kkrt-labs / kakarot-rpc

Kakarot ZK EVM Ethereum RPC adapter
MIT License
133 stars 88 forks source link

bug: call OOG #1138

Open greged93 opened 3 months ago

greged93 commented 3 months ago

Script used in order to call a contract here.

The call runs out of gas which causes a return value of 0 instead of 1. Check why the gas limit instead high enough for the call.

Contracts should already be deployed but can be redeployed using:


forge create --rpc-url https://sepolia-rpc.kakarot.org/ \
    --private-key PRIVATE_KEY \
    src/lib/libSCL_RIP7212.sol:SCL_RIP7212

forge create --rpc-url https://sepolia-rpc.kakarot.org/ \
--libraries src/lib/libSCL_RIP7212.sol:SCL_RIP7212:0x3A0fc0Fb97F61FA0da73C26D4D448a060cBB5DF2 \
    --private-key PRIVATE_KEY \
    script/Deploy7212.s.sol:SCL_RIP7212_wrapper
greged93 commented 3 months ago

Update on the issue: this was quite an intricate issue. In short:

curl   -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0", "method": "starknet_getTransactionReceipt","params":["0x70993c995411d5371125d3e14a577076f9edf51c6779f6c2d027362c72be955"], "id":1}' https://juno-kakarot-dev.karnot.xyz/
{"jsonrpc":"2.0","result":{"type":"INVOKE","transaction_hash":"0x70993c995411d5371125d3e14a577076f9edf51c6779f6c2d027362c72be955","actual_fee":{"amount":"0x119e77897d184","unit":"WEI"},"execution_status":"SUCCEEDED","finality_status":"ACCEPTED_ON_L1","block_hash":"0x716c6fa77fdf0c08a7b6ff87f830f66730e575ed5d98b59d124c1befa6b39d6","block_number":1626,"messages_sent":[],"events":[{"from_address":"0x54f7a1c7b3ca053bbd8393e649a7d8d77f0081f71b4e31fb8df9b647ec57176","keys":["0x5ad857f66a5b55f1301ff1ed7e098ac6d4433148f0b72ebc4a2945ab85ad53"],"data":["0x20","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x1","0x6ca9"]},{"from_address":"0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7","keys":["0x99cd8bde557814842a3121e8ddfd433a539b8c9f14bf31ebf108d12e6196e9"],"data":["0x54f7a1c7b3ca053bbd8393e649a7d8d77f0081f71b4e31fb8df9b647ec57176","0x46a89ae102987331d369645031b49c27738ed096f2789c24449966da4c6de6b","0x119e77897d184","0x0"]}],"execution_resources":{"steps":337082,"memory_holes":39251,"pedersen_builtin_applications":402,"range_check_builtin_applications":15961,"bitwise_builtin_applications":2}},"id":1}

with the return being ["0x20","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x0","0x1","0x6ca9"], decoding to result = 0x0, success = 0x1, gas_used = 0x6ac9.

The OOG issue is thus due to an incorrect estimation linked to the early return on the addmod issue.

greged93 commented 2 months ago

Blocked until Kakarot v0.8.2 is deployed (should happen on the 20th of June 2024)

greged93 commented 2 months ago

Update: ran again now that v0.8.3 has been deployed. Getting an out of resource error, need to check what is the actual call limit on the node. EDIT: it looks like the limit of the node is correct, so it just means that currently we cannot run a call to this contract.