Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

[Bug] AleoApiClient does not parse json from node #35

Open
lucas-u410 opened this issue Oct 23, 2023 · 0 comments
Open

[Bug] AleoApiClient does not parse json from node #35

lucas-u410 opened this issue Oct 23, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@lucas-u410
Copy link

🐛 Bug Report

As of a few weeks ago, I was able to successfully find unspent records and execute private transfers on testnet. However now something seems wrong the AleoApiClient. When trying to find unspent records, I get this error:

Error: Failed to parse blocks 5050 (inclusive) to 5099 (exclusive): Failed to read JSON: Failed to parse string. Parsing Error: VerboseError { errors: [("sr1yvt089c2zf09hhuzrxaty20ymjyz3sz6x2rkje9c7a86kn9tevxsm4gpd5", Nom(OneOf)), ("sr1yvt089c2zf09hhuzrxaty20ymjyz3sz6x2rkje9c7a86kn9tevxsm4gpd5", Nom(Many1))] } at line 1034 column 3

That error comes from AleoApiClient.get_blocks. When I drill down the call stack, I can get the url it's hitting, and when I hit that in postman, it's valid json. It also fails for a similar reason when just getting a single block with get_block. According to the line/col numbers, it seems to fail at the last character of the response, despite being valid json.

I notice there's a reference to nom in the errors, which is a dep of some of the snarkvm packages.

aleo_rust hasn't been updated in months, and is using the old, version 14 of snarkvm, while the most recent version is 16, perhaps that's related? Although I don't know why my code was working before.

Steps to Reproduce

Code snippet to reproduce

use aleo_rust::AleoAPIClient;
use snarkvm_console::network::Testnet3;

let api_client = AleoAPIClient::<Testnet3>::new("https://apiv2.aleo.network", "testnet3").unwrap()
let block = api_client.get_block(5538).unwrap();

Stack trace & error message

Error: Failed to parse blocks 5050 (inclusive) to 5099 (exclusive): Failed to read JSON: Failed to parse string. Parsing Error: VerboseError { errors: [("sr1yvt089c2zf09hhuzrxaty20ymjyz3sz6x2rkje9c7a86kn9tevxsm4gpd5", Nom(OneOf)), ("sr1yvt089c2zf09hhuzrxaty20ymjyz3sz6x2rkje9c7a86kn9tevxsm4gpd5", Nom(Many1))] } at line 1034 column 3

Expected Behavior

It was supposed to get the block instead of erroring out.

Your Environment

  • `aleo-rust = "0.5.5"`
  • `rustc 1.73.0 (cc66ad468 2023-10-03)`
  • macOS Ventura 13.6
@lucas-u410 lucas-u410 added the bug Something isn't working label Oct 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant