skalenetwork / skaled

Running more than 20 production blockchains, SKALED is Ethereum-compatible, high performance C++ Proof-of-Stake client, tools and libraries. Uses SKALE consensus as a blockchain consensus core. Includes dynamic Oracle. Implements file storage and retrieval as an EVM extension.
https://skale.network
GNU General Public License v3.0
84 stars 39 forks source link

eth_call doesn't work with specific block number on historic node #1916

Open oleksandrSydorenkoJ opened 3 months ago

oleksandrSydorenkoJ commented 3 months ago

Note Actual for debug_traceCall and regular eth_call

Preconditions Active schain medium type Historic node Contract deployed on chain with Shangai fork

// SPDX-License-Identifier: GPL-3.0

pragma solidity >=0.8.20;

contract Push0Test {
    function f() public pure returns (uint256){
        return 1;
    }

    function a() public pure returns (string memory){
        return "success";
    }
}

Versions skalenetwork/schain:3.19.0-beta.1-historic

Steps to reproduce

  1. Send eth_call directly to the archival node to the "latest" block both functions f and a
    curl http://136.244.105.249:10195    -X POST   -H "Content-Type: application/json"   --data '{"id":10037,"jsonrpc":"2.0","method":"eth_call","params":[{"data":"0x0dbe671f","from":"0x71cBE3fedE33905d4D1Bf2Bd51f9d4A62375e659","to":"0xAad5EBf247f610B8Ab180Afcc16b5f18E32A910e","value":"0x0"},"latest"]}'
  2. Send eth_call directly to the archival node to the latest block Number in numeric exparsion
    curl http://136.244.105.249:10195    -X POST   -H "Content-Type: application/json"   --data '{"id":10037,"jsonrpc":"2.0","method":"eth_call","params":[{"data":"0x0dbe671f","from":"0x71cBE3fedE33905d4D1Bf2Bd51f9d4A62375e659","to":"0xAad5EBf247f610B8Ab180Afcc16b5f18E32A910e","value":"0x0"},"0x2fedb"]}'

Expected state Skaled on the archival node should return the same value for the "latest" tag and the newest block number as a tag.

Actual state Skaled on the archival node return empty value for the historic blocks.

Logs "latest"

 curl http://136.244.105.249:10195    -X POST   -H "Content-Type: application/json"   --data '{"id":10037,"jsonrpc":"2.0","method":"eth_call","params":[{"data":"0x0dbe671f","from":"0x71cBE3fedE33905d4D1Bf2Bd51f9d4A62375e659","to":"0xAad5EBf247f610B8Ab180Afcc16b5f18E32A910e","value":"0x0"},"latest"]}'
{"id":10037,"jsonrpc":"2.0","result":"0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000077375636365737300000000000000000000000000000000000000000000000000"}

"0x3020e" block

 curl http://136.244.105.249:10195    -X POST   -H "Content-Type: application/json"   --data '{"method":"eth_blockNumber","params":[],"id":1,"jsonrpc":"2.0"}'
{"id":1,"jsonrpc":"2.0","result":"0x3020e"}

curl http://136.244.105.249:10195    -X POST   -H "Content-Type: application/json"   --data '{"id":10037,"jsonrpc":"2.0","method":"eth_call","params":[{"data":"0x0dbe671f","from":"0x71cBE3fedE33905d4D1Bf2Bd51f9d4A62375e659","to":"0xAad5EBf247f610B8Ab180Afcc16b5f18E32A910e","value":"0x0"},"0x3020e"]}'
{"id":10037,"jsonrpc":"2.0","result":"0x"}

debug_traceCall

 curl http://136.244.105.249:10195   -X POST   -H "Content-Type: application/json"   --data '{"id":10037,"jsonrpc":"2.0","method":"debug_traceCall","params":[{"data":"0x26121ff0","from":"0x71cBE3fedE33905d4D1Bf2Bd51f9d4A62375e659","to":"0xAad5EBf247f610B8Ab180Afcc16b5f18E32A910e","value":"0x0"},"latest", {"tracer":"callTracer"}]}'

{"id":10037,"jsonrpc":"2.0","result":{"error":"undefined instruction","from":"0x71cbe3fede33905d4d1bf2bd51f9d4a62375e659","gas":"0xfffffff","gasUsed":"0xfffffff","input":"0x26121ff0","to":"0xaad5ebf247f610b8ab180afcc16b5f18e32a910e","type":"CALL","value":"0x0"}}
oleksandrSydorenkoJ commented 3 months ago

related to https://github.com/skalenetwork/skaled/issues/1851

dimalit commented 3 months ago

cause: https://github.com/skalenetwork/skaled/issues/1917