Closed max-chechel-vc closed 1 year ago
There's no way to tell why mirror node rejects request with 400 status because these errors are not being logged by the mirror node. I think it's something that also needs to be fixed.
Hello @max-chechel-vc
Thank you for reporting an issue.
I've reviewed the referenced tutorial and was able to successfully deploy it using remix
and metmask using public hashio testnet relay.
I was also able to successfully load the contract and interact with it, get the message and set a new message and then get the new message.
I also loaded your contract address 0x8cf56172314f08f7d69f0ee527b5e0d1ce06dd59
and was able to get the message, but not to set the message since I was not the owner, however the setMessage
method is not reverting, since as you can see, if you are not the owner it does only a return and does not reverts.
function set_message(string memory message_) public {
// only allow the owner to update the message
if (msg.sender != owner) return;
message = message_;
}
Finally a proceeded to use the data provided on the logs so I could try that call directly against our hashio hosted testnet relay. and it works (with your deployed contract)
curl --location 'https://testnet.hashio.io/api' \
--header 'Content-Type: application/json' \
--data '{
"id": 8151930679402,
"jsonrpc": "2.0",
"method": "eth_call",
"params": [
{
"from": "0x775d10635b7d6c328b022cb3193bc7cddba91dd9",
"data": "0x32af2edb",
"to": "0x8cf56172314f08F7d69f0eE527B5E0d1ce06Dd59"
},
"latest"
]
}'
Based on those tests I can see that:
Hello World
get_message
method.set_message
method is working as expected when using remix
and metamask
call data "undefined"
when calling eth_call
method. that is provoking the REVERT.Without Data (REVERTS)
curl --location 'https://testnet.hashio.io/api' \
--header 'Content-Type: application/json' \
--data '{
"id": 8151930679402,
"jsonrpc": "2.0",
"method": "eth_call",
"params": [
{
"from": "0x775d10635b7d6c328b022cb3193bc7cddba91dd9",
"to": "0x8cf56172314f08F7d69f0eE527B5E0d1ce06Dd59"
},
"latest"
]
}'
Hypothesis:
data
field, I am not familiar with Go-Ethereum Client, but would like you to double-check the way you are setting the fields in order to get the message.Let me know if we are good to close this ticket
Let me check what's the actual request body go-ethereum client sends to the JSON RPC relay.
Here is the body that go-ethereum client sends:
{
"jsonrpc": "2.0",
"id": 8,
"method": "eth_call",
"params": [
{
"from": "0x775d10635b7d6c328b022cb3193bc7cddba91dd9",
"input": "0x32af2edb",
"to": "0xaf220db900993d945aac371417d215783bfaf7d9"
},
"0x2b85ea"
]
}
I also tried to use pending
and latest
instead of the block number 0x2b85ea
and also tried to remove the input
field from request - same results.
Also it's not my client that makes this request it's the JSON RPC relay that makes request to the Hedera RPC mirror node. And the mirror node responds with 400 Bad Request error which results in CONTRACT_REVERT_EXECUTED error from the JSON RPC relay
So I think the undefined
comes from the JSON RPC relay when the contract method doesn't have any parameters and this undefined
comes from the JS code of the relay (no surprizes here).
Here is the body that go-ethereum client sends:
{ "jsonrpc": "2.0", "id": 8, "method": "eth_call", "params": [ { "from": "0x775d10635b7d6c328b022cb3193bc7cddba91dd9", "input": "0x32af2edb", "to": "0xaf220db900993d945aac371417d215783bfaf7d9" }, "0x2b85ea" ] }
I also tried to use
pending
andlatest
instead of the block number0x2b85ea
and also tried to remove theinput
field from request - same results.
I've ran that same query against our hosted version of the relay hashio testnet
and I don't get any 400
CONTRACT_REVERT (only changed to "latest" but it works also with the provided blockNumber.
curl --location 'https://testnet.hashio.io/api' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"id": 8,
"method": "eth_call",
"params": [
{
"from": "0x775d10635b7d6c328b022cb3193bc7cddba91dd9",
"input": "0x32af2edb",
"to": "0xaf220db900993d945aac371417d215783bfaf7d9"
},
"latest"
]
}'
@hexdigest, maybe is something with your Relay
Configuration, i see you are using your own instance.
could you share your .env
properties without the secrets?
@hexdigest, maybe is something with your
Relay
Configuration, i see you are using your own instance.could you share your
.env
properties without the secrets? Here is our .env:
HEDERA_NETWORK=TESTNET
CHAIN_ID=0x128
MIRROR_NODE_URL=http://rest:5551/
ETH_CALL_DEFAULT_TO_CONSENSUS_NODE=false
DEV_MODE=false
ETH_CALL_MAX_REQUEST_PER_SDK_INSTANCE=20
ETH_GET_TRANSACTION_COUNT_CACHE_TTL=200
ETH_POPULATE_SYNTHETIC_CONTRACT_RESULTS=true
INPUT_SIZE_LIMIT=1
MIRROR_NODE_HTTP_KEEP_ALIVE=true
MIRROR_NODE_HTTP_MAX_SOCKETS=200
MIRROR_NODE_HTTP_MAX_TOTAL_SOCKETS=200
MIRROR_NODE_RETRIES=1
MIRROR_NODE_RETRY_DELAY=3000
REQUEST_ID_IS_OPTIONAL=true
SDK_REQUEST_TIMEOUT=20000
SUBSCRIPTIONS_ENABLED=true
HBAR_RATE_LIMIT_TINYBAR=2200000000
Also can you please share what version of RPC relay and Mirror nodes you run? Maybe we use an outdated versions and this problem is no longer exists in the recent ones.
Thanks, I don't see any potential issues with your env
config.
Sharing used versions:
Relay version: 0.32.0 https://github.com/hashgraph/hedera-json-rpc-relay/releases/tag/v0.32.0
Mirror Node version: 0.89.0 https://github.com/hashgraph/hedera-mirror-node/releases/tag/v0.89.0
@max-chechel-vc just asking if we are good to close this ticket?
@max-chechel-vc just asking if we are good to close this ticket?
Have you guys fixed anything? Should we update our mirrors/relays?
Yes, the issue you described here is not happening on newer versions of the relay/mirror node.
Yes, the issue you described here is not happening on newer versions of the relay/mirror node.
I can confirm that the request above works with the latest versions of relay and mirror.
@hexdigest thanks. In follow up you can always check https://status.swirldslabs.com/ and https://status.hedera.com/ to see what versions of the relay and mirror node are deployed in public environments. Mainnet also usually lines up with the latest GA version in the repos https://github.com/hashgraph/hedera-json-rpc-relay/releases and https://github.com/hashgraph/hedera-mirror-node/releases.
Appreciate the ticket, please feel free to open a ticket if you encounter any more issues or start discussion if you have questions we can help address in the future.
Description
I took an example of the SC from here https://docs.hedera.com/hedera/tutorials/smart-contracts/deploy-your-first-smart-contract
solc
and generated a Go package to interact with the contract usingabigen
set_message
method of the SC using the generated codeget_message
method of the SC and got the following error:execution reverted: CONTRACT_REVERT_EXECUTED
Expected result:
No error, generated code returns a message saved on (3)
Steps to reproduce
solc --abi --bin HelloHedera.sol -o ./contracts/
abigen --bin=./contracts/HelloHedera.bin --abi=./contracts/HelloHedera.abi --pkg=contracts --out=./contracts/hello_hedera.go
Additional context
JSON RPC log related to the request:
Error from the go-ethereum client:
I'm able to successfully run all steps using native Hedera Go SDK but it's not the case with common go-ethereum client (and maybe others too).
Hedera network
testnet
Version
go-ethereum v1.13.2
Operating system
Linux