Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no return value for eth_call #130

Closed
gluneau opened this issue Nov 18, 2021 · 9 comments
Closed

no return value for eth_call #130

gluneau opened this issue Nov 18, 2021 · 9 comments

Comments

@gluneau
Copy link
Contributor

gluneau commented Nov 18, 2021

From the command line:

➜  hardhat npx hardhat console --network development
Welcome to Node.js v14.18.1.
Type ".help" for more information.
> const Greeter = await ethers.getContractFactory("Greeter");
undefined
> const greeter = await Greeter.attach('0x851def71f0e6a903375c1e536bd9ff1684bad802')
undefined
> await greeter.greet()
Uncaught:
Error: call revert exception (method="greet()", errorArgs=null, errorName=null, errorSignature=null, reason=null, code=CALL_EXCEPTION, version=abi/5.5.0)
    at step (/home/acala/hardhat/node_modules/@ethersproject/contracts/lib/index.js:48:23)
    at Contract.<anonymous> (/home/acala/hardhat/node_modules/@ethersproject/contracts/src.ts/index.ts:392:44)
    at Interface.decodeFunctionResult (/home/acala/hardhat/node_modules/@ethersproject/abi/src.ts/interface.ts:425:23)
    at Logger.throwError (/home/acala/hardhat/node_modules/@ethersproject/logger/src.ts/index.ts:237:20)
    at Logger.makeError (/home/acala/hardhat/node_modules/@ethersproject/logger/src.ts/index.ts:225:28) {
  reason: null,
  code: 'CALL_EXCEPTION',
  method: 'greet()',
  errorArgs: null,
  errorName: null,
  errorSignature: null,
  address: '0x851def71f0e6a903375c1e536bd9ff1684bad802',
  args: [],
  transaction: {
    data: '0xcfae3217',
    to: '0x851dEf71f0e6A903375C1e536Bd9ff1684BAD802',
    from: '0x75E480dB528101a381Ce68544611C169Ad7EB342'
  }
}

Results from RPC:

[1637274024790] DEBUG (2628826 on XPS-15-7590): incoming request
    jsonrpc: "2.0"
    method: "eth_call"
    params: [
      {
        "from": "0x75e480db528101a381ce68544611c169ad7eb342",
        "to": "0x851def71f0e6a903375c1e536bd9ff1684bad802",
        "data": "0xcfae3217"
      },
      "latest"
    ]
    id: 5
[1637274024796] DEBUG (2628826 on XPS-15-7590): request completed
    id: 5
    jsonrpc: "2.0"
    result: "0x"
@ntduan
Copy link
Collaborator

ntduan commented Nov 18, 2021

can you try this ?

curl --location --request POST 'http://127.0.0.1:9933' \
--header 'Content-Type: application/json' \
--data-raw '{
    "id": 19,
    "jsonrpc": "2.0",
    "method": "evm_call",
    "params": [
        {
            "from": "0x75e480db528101a381ce68544611c169ad7eb342",
            "to": "0x851def71f0e6a903375c1e536bd9ff1684bad802",
            "gasLimit": null,
            "storageLimit": null,
            "value": null,
            "data": "0xcfae3217"
        }
    ]
}'

@gluneau
Copy link
Contributor Author

gluneau commented Nov 19, 2021

9933 is not a port that is open. I'm running the docker with the rpc.

PORT     STATE SERVICE
631/tcp  open  ipp
3000/tcp open  ppp
3001/tcp open  nessus
5432/tcp open  postgresql
9944/tcp open  unknown

@ntduan
Copy link
Collaborator

ntduan commented Nov 19, 2021

9933 is not a port that is open. I'm running the docker with the rpc.

PORT     STATE SERVICE
631/tcp  open  ipp
3000/tcp open  ppp
3001/tcp open  nessus
5432/tcp open  postgresql
9944/tcp open  unknown

http://livepersoninc.github.io/ws-test-page/

image

you can test it with websocket here.

@gluneau
Copy link
Contributor Author

gluneau commented Nov 19, 2021

Like so:

image

@ntduan
Copy link
Collaborator

ntduan commented Nov 19, 2021

Like so:

image

So this may not be a bug with bodhi.js. @xlc @zjb0807

@ntduan
Copy link
Collaborator

ntduan commented Nov 19, 2021

Maybe your contract didn't deploy successfully?

@zjb0807
Copy link
Member

zjb0807 commented Nov 19, 2021

How can I reproduce the error?

@zjb0807
Copy link
Member

zjb0807 commented Nov 19, 2021

If you start node with -levm=debug, you can show me the logs.

@gluneau
Copy link
Contributor Author

gluneau commented Nov 19, 2021

I found the error, I was not using the smart contract address to interact, I was using the returned transaction hash.

➜  hardhat npx hardhat console --network development
Welcome to Node.js v14.18.1.
Type ".help" for more information.
> 
> const Greeter = await ethers.getContractFactory("Greeter");
undefined
> const greeter = await Greeter.attach('0x3d3593927228553b349767aba68d4fb1514678cb');
undefined
> await greeter.greet()
'Hello, Hardhat!'
>

And this is the successful response from the RPC:

[1637286036230] DEBUG (2628826 on XPS-15-7590): incoming request
    jsonrpc: "2.0"
    method: "eth_call"
    params: [
      {
        "from": "0x75e480db528101a381ce68544611c169ad7eb342",
        "to": "0x3d3593927228553b349767aba68d4fb1514678cb",
        "data": "0xcfae3217"
      },
      "latest"
    ]
    id: 5
[1637286036234] DEBUG (2628826 on XPS-15-7590): request completed
    id: 5
    jsonrpc: "2.0"
    result: "0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000f48656c6c6f2c2048617264686174210000000000000000000000000000000000"

@gluneau gluneau closed this as completed Nov 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants