Giter Club home page Giter Club logo

Comments (7)

tomusdrw avatar tomusdrw commented on August 17, 2024

Is the contract deployed correctly under incentive_layer_address? Can you run the node with RPC tracing to see what exactly is returned by the server?
You can also set up env_logger in your program and run with RUST_LOG="web3=trace" to see more details about incoming responses.

from rust-web3.

hswick avatar hswick commented on August 17, 2024

I'm deploying the contract with truffle and then writing the address to a json file. Seems to be working correctly when using interacting with web3js. Am I doing anything incorrectly in this line?

  let incentive_layer_contract = Contract::from_json(web3.eth(), incentive_layer_address, il.as_bytes()).unwrap();

Here is the output from the log:

RUST_LOG="web3=trace" cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
     Running `target/debug/incentive-layer-client`
DEBUG 2018-03-11T16:20:02Z: web3::transports::http: [0] Sending: {"jsonrpc":"2.0","method":"eth_accounts","params":[],"id":0} to http://localhost:8545/
TRACE 2018-03-11T16:20:02Z: web3::transports::shared: [0] Request pending.
TRACE 2018-03-11T16:20:02Z: web3::transports::shared: [0] Checking response.
TRACE 2018-03-11T16:20:02Z: web3::transports::shared: [0] Checking response.
TRACE 2018-03-11T16:20:02Z: web3::transports::shared: [0] Extracting result.
DEBUG 2018-03-11T16:20:02Z: web3::transports::http: [1] Sending: {"jsonrpc":"2.0","method":"eth_getBalance","params":["0x00a329c0648769a73afac7f9381e08fb43dbea72","latest"],"id":1} to http://localhost:8545/
TRACE 2018-03-11T16:20:02Z: web3::transports::shared: [1] Request pending.
TRACE 2018-03-11T16:20:02Z: web3::transports::shared: [1] Checking response.
TRACE 2018-03-11T16:20:02Z: web3::transports::shared: [1] Checking response.
TRACE 2018-03-11T16:20:02Z: web3::transports::shared: [1] Extracting result.
DEBUG 2018-03-11T16:20:02Z: web3::transports::http: [2] Sending: {"jsonrpc":"2.0","method":"eth_sendTransaction","params":[{"data":"0x40732c89","from":"0x00a329c0648769a73afac7f9381e08fb43dbea72","to":"0x2230783864326633663239386664326632333861","value":"0x3e8"}],"id":2} to http://localhost:8545/
 WARN 2018-03-11T16:20:02Z: web3::transports::http: Error resuming asynchronous request: Ok([123, 34, 106, 115, 111, 110, 114, 112, 99, 34, 58, 34, 50, 46, 48, 34, 44, 34, 114, 101, 115, 117, 108, 116, 34, 58, 34, 48, 120, 56, 53, 97, 98, 54, 54, 98, 57, 97, 100, 52, 57, 49, 102, 49, 98, 54, 53, 53, 52, 98, 102, 51, 54, 97, 57, 57, 97, 98, 52, 54, 101, 97, 98, 99, 52, 98, 48, 48, 100, 101, 55, 100, 51, 56, 56, 101, 56, 52, 102, 55, 55, 54, 48, 50, 98, 102, 51, 57, 50, 49, 50, 51, 51, 34, 44, 34, 105, 100, 34, 58, 50, 125, 10])
DEBUG 2018-03-11T16:20:04Z: web3::transports::http: [3] Sending: {"jsonrpc":"2.0","method":"eth_call","params":[{"data":"0xe1254fba00000000000000000000000000a329c0648769a73afac7f9381e08fb43dbea72","to":"0x2230783864326633663239386664326632333861"},"latest"],"id":3} to http://localhost:8545/
TRACE 2018-03-11T16:20:04Z: web3::transports::shared: [3] Request pending.
TRACE 2018-03-11T16:20:04Z: web3::transports::shared: [3] Checking response.
TRACE 2018-03-11T16:20:04Z: web3::transports::shared: [3] Checking response.
TRACE 2018-03-11T16:20:04Z: web3::transports::shared: [3] Extracting result.
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error(Abi(Msg("Cannot decode uint256")), State { next_error: Some(Error(InvalidData, State { next_error: None, backtrace: None })), backtrace: None })', /checkout/src/libcore/result.rs:916:5

I wasn't able to look at the output because it breaks on the decoding part.

from rust-web3.

tomusdrw avatar tomusdrw commented on August 17, 2024

Logs are not that helpful, they don't contain raw responses from the client. Could you run the client with response logging?

from rust-web3.

hswick avatar hswick commented on August 17, 2024

Ran parity with --logging=rpc=trace flag

Got this output:

2018-03-12 11:33:56   TRACE rpc  Request: {"jsonrpc":"2.0","method":"eth_call","params":[{"data":"0xe1254fba00000000000000000000000000a329c0648769a73afac7f9381e08fb43dbea72","to":"0x2230786463623339333431663666623836316633"},"latest"],"id":3}.
2018-03-12 11:33:56   DEBUG rpc  Response: Some("{\"jsonrpc\":\"2.0\",\"result\":\"0x\",\"id\":3}")

The response result is definitely not correct

from rust-web3.

tomusdrw avatar tomusdrw commented on August 17, 2024

Perhaps the contract is not yet deployed? Can you check eth_getCode("0x2230786463623339333431663666623836316633")?

from rust-web3.

hswick avatar hswick commented on August 17, 2024

Yes the code is there after checking.

I haven't had this issue before, but one thing I am doing differently is using the truffle artifacts. It is possible that the format for the abi is not the same as what is expected by this library, however this would surprise me since abi is a standard format.

Another difference is that I am not deploying the contract with rust-web3 but rather with truffle.

I'm running parity and then deploying the contracts with truffle migrate --reset, the deployment script writes the address to the addresses.json file which I am using for the client code.

Here is the entire repo/branch for reference: https://github.com/TrueBitFoundation/incentive-layer/tree/rust_client

from rust-web3.

tomusdrw avatar tomusdrw commented on August 17, 2024

There has been many changes in recent versions of ethereum-types that might affect Ser/De of the structs. Please reopen if the issue persists.

from rust-web3.

Related Issues (20)

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.