Git Product home page Git Product logo

aleo-rust's Issues

[Bug] AleoApiClient does not parse json from node

๐Ÿ› 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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.