0xPolygonHermez / cdk-erigon

Ethereum implementation on the efficiency frontier
GNU Lesser General Public License v3.0
34 stars 33 forks source link

[RPC] Method "zkevm_getBatchByNumber" not returning correct info #723

Closed Damantino closed 1 month ago

Damantino commented 3 months ago

System information

output of git branch

* (HEAD detached at v1.1.5.5)
  zkevm

Config File

datadir: /path/to/my/cdk-erigon/datadir
chain: hermez-mainnet
http: true
private.api.addr: localhost:9091
zkevm.l2-chain-id: 1101
zkevm.l2-sequencer-rpc-url: https://zkevm-rpc.com
zkevm.l2-datastreamer-url: stream.zkevm-rpc.com:6900
zkevm.l1-chain-id: 1
zkevm.l1-rpc-url: http://my-l1-node

zkevm.address-sequencer: "0x148Ee7dAF16574cD020aFa34CC658f8F3fbd2800"
zkevm.address-zkevm: "0x519E42c24163192Dca44CD3fBDCEBF6be9130987"
zkevm.address-admin: "0x242daE44F5d8fb54B198D03a94dA45B5a4413e21"
zkevm.address-rollup: "0x5132A183E9F3CB7C848b0AAC5Ae0c4f0491B7aB2"
zkevm.address-ger-manager: "0x580bda1e7A0CFAe92Fa7F6c20A3794F169CE3CFb"

zkevm.default-gas-price: 1
zkevm.max-gas-price: 0
zkevm.gas-price-factor: 0.0375

zkevm.l1-rollup-id: 1
zkevm.l1-block-range: 20000
zkevm.l1-query-delay: 6000
zkevm.l1-first-block: 16896700
zkevm.rpc-ratelimit: 250
zkevm.datastream-version: 2

externalcl: true
http.api: [eth, debug, net, trace, web3, erigon, zkevm]
http.addr: 0.0.0.0
http.vhosts: any
http.corsdomain: any
ws: true

Erigon Command (with flags/config):

./build/bin/cdk-erigon --config="/mnt/ethereum/cdk-erigon/hermezconfig-mainnet.yaml" --ws

Expected behaviour

When I curl to get batch info it gets delivered.

> curl --request POST      --url http://localhost:8550/    --header 'accept: application/json'      --header 'content-type: application/json'      --data '
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "zkevm_getBatchByNumber",
  "params": [
    "1984749"
  ]
}
'
< {"jsonrpc":"2.0","id":1,"result":"The batch info"}

Actual behaviour

We spotted 3 errors:

  1. When requesting a really old batch it just returns null
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": null
}
  1. When requesting a batch untill 1984748 it hangs and throws too many retries
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": too many retries
}
  1. When requesting batch info from 1984749 it doesn't return the whole batch info
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "accInputHash": "0xe47d63f69332a8d636e8725de70daad01225df62b0ba141ce6802d1b90775734",
        "batchL2Data": "0x0b0000000a00000000e93c84c4b201008255f094e10add2ad591a7ac3ca46788a06290de017b9fb48084632a9a5282044d808051289d2cfa97b2309af07fb46e1d40c95648dfa9b787f4f340ad868a4548eae7450c48d2d2dd62dd02a3aa380860cf2df6804cee3f868db53a6db955b1f7f0691cff",
        "blocks": [
            "0x926fee7d040140f2fe85234d7be1a1d650376780835e8434046b23f75816e7bc"
        ],
        "closed": true,
        "coinbase": "0x148ee7daf16574cd020afa34cc658f8f3fbd2800",
        "globalExitRoot": "0x5133e238347ff7be21b622212201942de236fb79f45bf62e31469ad1b069df9d",
        "localExitRoot": "0xc8d644975e1ccf919f590de4aeb7796f4c5697e5400a7a85d77cc5bc19ae9215",
        "mainnetExitRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "number": "0x1e48ed",
        "rollupExitRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "sendSequencesTxHash": null,
        "stateRoot": "0x24019b68d02e86bd9ffa2e46dbeef48218779c599278348836885c0656b414ee",
        "timestamp": "0x65cb409d",
        "transactions": [
            "0x6d483d9f33846d024e3406f1cd5735b2f8847ce009438dda4882ddcc69f9ba97"
        ],
        "verifyBatchTxHash": "0xaf00da08105ae91dfd71a65b7743eb07b50becf1b678c10588e8a22cfd965690"
    }
}

It is missing the sequenceHash.

Steps to reproduce the behaviour

  1. Launch node, wait until synchronises
  2. Launch petition
mandrigin commented 3 months ago

thanks! we are actively working on improving this method, one thing to try is to sync a fresh node on 1.1.5.6 and see if any of your issues went away.

Damantino commented 2 months ago

Hi @mandrigin , unfortunately after resyncing issues persist. Seems to be okay for batches after 1984749 (inclusive), but for 1984748 it is the same.

It returns this after a while:

> curl --request POST      --url http://localhost:8550/    --header 'accept: application/json'      --header 'content-type: application/json'      --data '
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "zkevm_getBatchByNumber",
  "params": [
    "1984748"
  ]
}
'
< {
    "jsonrpc": "2.0",
    "id": 1,
    "error": {
        "code": -32000,
        "message": "too many retries"
    }
}

And same for an old batch like 2.

mandrigin commented 1 month ago

should be fixed in 1.2.15.4