crypto-org-chain / cronos

Cronos is the first Ethereum-compatible blockchain network built on Cosmos SDK technology. Cronos aims to massively scale the DeFi, GameFi, and overall Web3 user community by providing builders with the ability to instantly port apps and crypto assets from other chains while benefiting from low transaction fees, high throughput, and fast finality.
Other
296 stars 238 forks source link

debug_traceCall always returns half of gas limit as gasUsed #1534

Closed susuper closed 3 months ago

susuper commented 3 months ago

Hello.

curl  http://127.0.0.1:8545 \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"debug_traceCall","params":[{"from":null,"to":"0x6b175474e89094c44da98b954eedeac495271d0f","data":"0x70a082310000000000000000000000006E0d01A76C3Cf4288372a29124A26D4353EE51BE", "gasPrice": "0x574FBDE6000", "gas": "0x30D40"}, "latest", {"tracer": "callTracer", "tracerConfig": {"onlyTopCall": true}}],"id":1,"jsonrpc":"2.0"}'

{"jsonrpc":"2.0","id":1,"result":{"from":"0x0000000000000000000000000000000000000000","gas":"0x30d40","gasUsed":"0x186a0","input":"0x70a082310000000000000000000000006e0d01a76c3cf4288372a29124a26d4353ee51be","to":"0x6b175474e89094c44da98b954eedeac495271d0f","type":"CALL","value":"0x0"}}

gasUsed value is always half of gas limit and not a real gas usage.

Cronos v1.3.0.

mmsqe commented 3 months ago

Hi @susuper, might related to min_gas_multiplier is set to 0.5, can you try with smaller gas param?

susuper commented 3 months ago

@mmsqe I've tried lower gas limits and in case the limit is close to real gas consumption the "gasUsed" returns correct value. But I guess it is not convenient and one unable to know in advance which value of gas limit to put in the request to get correct "gasUsed" value. eth_estimateGas returns correct gasUsed values, but it is much slower (10-50 times) than debug_traceCall unfortunately.