dapphub / dapptools

Dapp, Seth, Hevm, and more
https://dapp.tools
2.09k stars 325 forks source link

looks like seth call create an invalid rpc call #329

Closed datgrog closed 4 years ago

datgrog commented 4 years ago

Hello!

Sorry to disturb you as it might be nothing.. I'm following this guide MakerDAO create Kovan DAI and seth call give an unexpected result.

dapp --version dapp 0.26.0 solc, the solidity compiler commandline interface Version: 0.5.15+commit.6a57276f.Darwin.clang hevm 0.36 seth 0.8.2

calling seth call $REP 'balanceOf(address)' $ETH_FROM gives

seth-rpc: {"id":1,"jsonrpc":"2.0","method":"eth_call","params":[{"data":"0xInvalid data","from":"0x5aBd8f42dA79fe93f2B0DB6cB0167fd0e932c788","to":"0xC7aa227823789E363f29679F23f7e8F6d9904a9B"},"latest"]}
seth-rpc: error:   code       -32602
seth-rpc: error:   message    Invalid params: Invalid hex: Invalid character 'I' at position 0.

but seth send $FAUCET 'gulp(address)' $REP works as it should. Did I miss something ? The call I'm trying to fire thought is seth --from-wei $(seth --to-dec $(seth call $REP 'balanceOf(address)' $ETH_FROM)) eth

gbalabasquer commented 4 years ago

Do you have the address to check balance in the $ETH_FROM variable?

datgrog commented 4 years ago

here is my .sethrc

# Use Infura's node for all RPC calls
export SETH_CHAIN=kovan

# Set an address as the default sender
export ETH_FROM=0x5aBd8f42dA79fe93f2B0DB6cB0167fd0e932c788

# Look for my key files in a custom directory
export ETH_KEYSTORE=/Users/onche/Projects/MakerDAO
export ETH_PASSWORD=/Users/onche/Projects/MakerDAO/pwd_kovan_mcd

export MCD_CHAIN=kovan

So in my context the env var $ETH_FROM is only set in this file, not in my shell session. Given that seth cmd works for seth send $FAUCET 'gulp(address)' $REP as it successfully craft and sign a transaction by reading both ETH_KEYSTORE, ETH_PASSWORD, I don't see why the ETH_FROM is not handle properly as well

datgrog commented 4 years ago

Just to clarify, doing explicitly export ETH_FROM=0x5aBd8f42dA79fe93f2B0DB6cB0167fd0e932c788 before seth --from-wei $(seth --to-dec $(seth call $REP 'balanceOf(address)' $ETH_FROM)) eth works but the command seth call itself looks like it does not grasp $ETHFROM from .sethrc_ as seth send did.

gbalabasquer commented 4 years ago

Actually it does, look at the tx details:

seth-rpc: {"id":1,"jsonrpc":"2.0","method":"eth_call","params":[{"data":"0xInvalid data","from":"0x5aBd8f42dA79fe93f2B0DB6cB0167fd0e932c788","to":"0xC7aa227823789E363f29679F23f7e8F6d9904a9B"},"latest"]}
seth-rpc: error:   code       -32602
seth-rpc: error:   message    Invalid params: Invalid hex: Invalid character 'I' at position 0.

The from is filled in with the correct address. The problem is in the data field because your shell doesn't have a variable "$ETH_FROM" exported (which could be called anything) breaking the whole calldata value.

datgrog commented 4 years ago

Sorry for the silly mistake, thanks!

gbalabasquer commented 4 years ago

No problem!