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

checkOutExternalGas() check used for the historic blocks and leads to the failed request #1856

Closed
oleksandrSydorenkoJ opened this issue Mar 26, 2024 · 2 comments · Fixed by #1867
Assignees
Labels
bug Something isn't working epic:archive-node

Comments

@oleksandrSydorenkoJ
Copy link

oleksandrSydorenkoJ commented Mar 26, 2024

Note:
debug_traceTransaction, debug_traceBlockByNumber and debug_traceBlockByHash methods return the error for the non-latest block number.
checkOutExternalGas() check inside these methods works only for the latest block number, but not for the specific
debug.traceBlockByNumber("latest", {'tracer':'callTracer'}) call returns the object and skaled caches it, so some of the transaction may be used with {'tracer':'callTracer'} but returns the error on another gethTracers.

Version:
skalenetwork/schain:3.18.1-develop.0-historic

Preconditions:
Active schain medium type
Archival node connected to schain
Address with whitelisted deployer role (schain owner is preferable)
Test token contract link

To Reproduce:

  1. Deploy the test token contract on the chain.
  2. Send several transactions in several blocks.
  3. Send debug_traceBlockByNumber("latest", {'tracer':'callTracer'}) and check one of the transaction from the latest block
  4. Send a debug_traceTransaction or debug_traceBlockByNumber call for the previous non-cached blocks or transactions.

Expected Behavior:
debug_traceTransaction, debug_traceBlockByNumber and debug_traceBlockByHash should not use checkOutExternalGas() for the historic blocks

Actual State:
The debug_traceTransaction call returns an debug_traceTransaction:206:Could not trace block:83894:Internal error: checkOutExternalGas() has invalid block number error for all transactions in the non-latest block.

Logs:
geth attach

> debug.traceTransaction('0x38aad90ad17e5db17aaf354333e591f312d7c32a394e76dc215731ec8f23026f', {"tracer": "callTracer"})
Error: debug_traceTransaction:206: Could not trace block:7273: Internal error: checkOutExternalGas() has invalid block number
    at web3.js:6367:9(39)
    at send (web3.js:5101:62(29))
    at <eval>:1:23(6)

JSON-RPC example:
debug_traceBlockByNumber ('latest')

 curl http://localhost:10131  -X POST -H "Content-Type: application/json" --data '{"method":"debug_traceBlockByNumber","params":["latest", {"tracer": "callTracer"}],"id":1,"jsonrpc":"2'
{"id":1,"jsonrpc":"2.0","result":[{"result":{"from":"0x427ab5520d5885b9f34db18beee6246523830267","gas":"0x2af40","gasUsed":"0x19062","input":"0x56b8c724000000000000000000000000505d1e7dd05faddd494e18145c82c43bd14c236100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008366393063613830343832303136623833303138366130393438386664356530313037383632396363313934633933336439363331623934342020202020202020202020202020386665313062316438306239306334343764393330313962303030303033306365653739333865396562613265393132313162373862333239653236320000000000000000000000000000000000000000000000000000000000","output":"0x0000000000000000000000000000000000000000000000000000000000000001","to":"0xe770700a413f841d7bbd85e59b61905fd6a6939c","type":"CALL","value":"0x0"},"txHash":"0xabea0a84a46286212426045ca317c015246890d51effd7e58ae76c8f487dc186"},...}

cached transaction from the latest block

curl http://localhost:10131 -X POST -H "Content-Type: application/json" --data '{"method":"debug_traceTransaction","params":["0xabea0a84a46286212426045ca317c015246890d51effd7e58ae76c8f487dc186", {"tracer": "callTracer"}], "id":1,"jsonrpc":"2.0"}'
{"id":1,"jsonrpc":"2.0","result":{"from":"0x427ab5520d5885b9f34db18beee6246523830267","gas":"0x2af40","gasUsed":"0x19062","input":"...","output":"0x0000000000000000000000000000000000000000000000000000000000000001","to":"0xe770700a413f841d7bbd85e59b61905fd6a6939c","type":"CALL","value":"0x0"}}

not cached transaction from the historic block

curl http://localhost:10131 -X POST -H "Content-Type: application/json" --data '{"method":"debug_traceTransaction","params":["0x36cc5e62f8ebcf4d007f7988bef2ef86d189407abd5fc946b25b099a4e14db01", {"tracer": "callTracer"}], "id":1,"jsonrpc":"2.0"}'
{"error":{"code":0,"data":null,"message":"debug_traceTransaction:206:Could not trace block:86484:Internal error: checkOutExternalGas() has invalid block number"},"id":1,"jsonrpc":"2.0"}
@oleksandrSydorenkoJ oleksandrSydorenkoJ added bug Something isn't working epic:archive-node labels Mar 26, 2024
@DmytroNazarenko DmytroNazarenko moved this from To Do to Ready For Pickup in SKALE Engineering 🚀 Mar 27, 2024
@oleksandrSydorenkoJ oleksandrSydorenkoJ changed the title 'debug_traceTransaction' call returns an error for reverted transaction. 'debug_traceTransaction' call returns an error for all transction in non-Latest block. Apr 2, 2024
@oleksandrSydorenkoJ oleksandrSydorenkoJ changed the title 'debug_traceTransaction' call returns an error for all transction in non-Latest block. checkOutExternalGas() check used for the historic blocks and leads to the failed request Apr 2, 2024
@kladkogex kladkogex linked a pull request Apr 10, 2024 that will close this issue
@github-project-automation github-project-automation bot moved this from Ready For Pickup to Ready For Release Candidate in SKALE Engineering 🚀 Apr 11, 2024
@oleksandrSydorenkoJ
Copy link
Author

Verified on Legacy network
Version: skalenetwork/schain:3.18.1-beta.0-historic
skale_schain_these-long-sadalsuud
Block number: 299544

 curl http://45.63.52.42:10195 -X POST -H "Content-Type: application/json" --data '{"method":"debug_traceBlockByNumber","params":["latest", {"tracer": "callTracer"}],"id":1,"jsonrpc":"2.0"}'
{"id":1,"jsonrpc":"2.0","result":[]}

$ curl http://45.63.52.42:10195 -X POST -H "Content-Type: application/json" --data '{"method":"debug_traceBlockByNumber","params":["299544", {"tracer": "callTracer"}],"id":1,"jsonrpc":"2.0"}'
{"id":1,"jsonrpc":"2.0","result":[{"result":{"from":"0x94c6e5746971d6aebeaa42cbbe2feca0f6b5b24f","gas":"0x186a0","gasUsed":"0xbee2","input":"0x40c10f1900000000000000000000000094c6e5746971d6aebeaa42cbbe2feca0f6b5b24f00000000000000000000000000000000000000000000000000038d7ea4c68000","to":"0x8722eb776a5d9a2ffd914648381fe2daf80c7add","type":"CALL","value":"0x0"},"txHash":"0x217115a9b4ccaf353ad0de6f5b59f90efe9b58781c979f27d83e0f53ec03339f"},{"result":{"from":"0x0aa6a44690ef52354e976990292cf9c5cd36ad59","gas":"0x186a0","gasUsed":"0xbee2","input":"0x40c10f190000000000000000000000000aa6a44690ef52354e976990292cf9c5cd36ad5900000000000000000000000000000000000000000000000000038d7ea4c68000","to":"0x8722eb776a5d9a2ffd914648381fe2daf80c7add","type":"CALL","value":"0x0"},"txHash":"0x3e1b42b1a89820dbb5c087ab1a1a148257175484ccb306234e4b95027fb20a0b"},{"result":{"from":"0x88fd5e01078629cc194c933d9631b9448fe10b1d","gas":"0x186a0","gasUsed":"0xbee2","input":"0x40c10f1900000000000000000000000088fd5e01078629cc194c933d9631b9448fe10b1d00000000000000000000000000000000000000000000000000038d7ea4c68000","to":"0x8722eb776a5d9a2ffd914648381fe2daf80c7add","type":"CALL","value":"0x0"},"txHash":"0xf00b68e5309b0531b136715c7fbf7431129c48353ff2f0ae333cd9e81f4acee8"},{"result":{"from":"0x3f5bdf5d4c274c82b8d17aa2810b00d2cf050f24","gas":"0x186a0","gasUsed":"0xbed6","input":"0x40c10f190000000000000000000000003f5bdf5d4c274c82b8d17aa2810b00d2cf050f2400000000000000000000000000000000000000000000000000038d7ea4c68000","to":"0x8722eb776a5d9a2ffd914648381fe2daf80c7add","type":"CALL","value":"0x0"},"txHash":"0x8bfc1c374fc56fbfeb2d5dd4771d225309a2a1a1c9522e54c3fa40117c1b5644"},{"result":{"from":"0xe3cc6ec63b5652d1594bc63bb293f4e80f76dbdd","gas":"0x186a0","gasUsed":"0xbee2","input":"0x40c10f19000000000000000000000000e3cc6ec63b5652d1594bc63bb293f4e80f76dbdd00000000000000000000000000000000000000000000000000038d7ea4c68000","to":"0x8722eb776a5d9a2ffd914648381fe2daf80c7add","type":"CALL","value":"0x0"},"txHash":"0x130d040bb55550bf5a388a454563bc8c99a8943f661556368cb20ecca47250c8"},{"result":{"from":"0x863f816036e3cbba90855196c9d1e339fcff1650","gas":"0x186a0","gasUsed":"0xbee2","input":"0x40c10f19000000000000000000000000863f816036e3cbba90855196c9d1e339fcff165000000000000000000000000000000000000000000000000000038d7ea4c68000","to":"0x8722eb776a5d9a2ffd914648381fe2daf80c7add","type":"CALL","value":"0x0"},"txHash":"0x4792d343cf9b9627036d44519800ed325d65d15614feff3e9055d6845b71d8e0"},{"result":{"from":"0x77a0bc73442d3d9cb993e8d9752f95babf0ccaa6","gas":"0x186a0","gasUsed":"0xbee2","input":"0x40c10f1900000000000000000000000077a0bc73442d3d9cb993e8d9752f95babf0ccaa600000000000000000000000000000000000000000000000000038d7ea4c68000","to":"0x8722eb776a5d9a2ffd914648381fe2daf80c7add","type":"CALL","value":"0x0"},"txHash":"0xfb0163826a3e53f71a10333b5e62abaa6eb96e89951b478271474e0ae9124feb"},{"result":{"from":"0xa68f946090c600eda6f139783077ee802afeb990","gas":"0x186a0","gasUsed":"0xbed6","input":"0x40c10f19000000000000000000000000a68f946090c600eda6f139783077ee802afeb99000000000000000000000000000000000000000000000000000038d7ea4c68000","to":"0x8722eb776a5d9a2ffd914648381fe2daf80c7add","type":"CALL","value":"0x0"},"txHash":"0xb8a763ebdb87819c45ba0d08236ddbebbbf03dc52b56b82fa83986eab705be0f"}]

@PolinaKiporenko
Copy link
Contributor

3.18.1-beta.0

@PolinaKiporenko PolinaKiporenko moved this from Ready For Release Candidate to Merged To Release Candidate in SKALE Engineering 🚀 May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working epic:archive-node
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants