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

zkevm_getBatchByNumber is returning None for batches with no transactions #1560

Open
0xAdriaTorralba opened this issue Dec 16, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@0xAdriaTorralba
Copy link

0xAdriaTorralba commented Dec 16, 2024

I have synced the Polygon zkEVM network using this repo, and when I try to obtain the batch information using the zkevm_getBatchByNumber endpoint, it returns None for the batches that have no transactions. Find the output example below (batch_index response)

1 {'jsonrpc': '2.0', 'id': 42, 'result': None}
5 {'jsonrpc': '2.0', 'id': 42, 'result': None}
7 {'jsonrpc': '2.0', 'id': 42, 'result': None}
17 {'jsonrpc': '2.0', 'id': 42, 'result': None}
26 {'jsonrpc': '2.0', 'id': 42, 'result': None}
27 {'jsonrpc': '2.0', 'id': 42, 'result': None}
30 {'jsonrpc': '2.0', 'id': 42, 'result': None}
32 {'jsonrpc': '2.0', 'id': 42, 'result': None}
34 {'jsonrpc': '2.0', 'id': 42, 'result': None}
39 {'jsonrpc': '2.0', 'id': 42, 'result': None}
41 {'jsonrpc': '2.0', 'id': 42, 'result': None}
45 {'jsonrpc': '2.0', 'id': 42, 'result': None}
46 {'jsonrpc': '2.0', 'id': 42, 'result': None}
59 {'jsonrpc': '2.0', 'id': 42, 'result': None}
70 {'jsonrpc': '2.0', 'id': 42, 'result': None}

According to Polygonscan zkEVM explorer, these are 1-to-1 match with those batches that have no transactions within.

I'm getting this information running the following in Python.

    def getBatchByNumber(self, number, printJson=False):
        parameters = {
            "jsonrpc": "2.0",
            "method": "zkevm_getBatchByNumber", 
            "params": [number],
            "id": 42
        }
        if printJson: return self.rpc.post(self.headers, parameters).json()
        return self.rpc.post(self.headers, parameters).text

Is this a known bug, or am I doing something wrong here?

EDIT: I have this running on latest version using docker. I don't know if this points to v2.0.x or v2.60.0.

@0xAdriaTorralba
Copy link
Author

After forcing the node to run v2.60.0 and using the --db.size.limit 8TB workaround, I get this error when I try to obtain the information of batch 1

Enter batch number: 1
[
    {
        "jsonrpc": "2.0",
        "id": 42,
        "error": {
            "code": -32000,
            "message": "method handler crashed"
        }
    }
]

and on the node: cdk-erigon-zkevm | [EROR] [12-16|12:36:32.728] RPC method zkevm_getBatchByNumber crashed: runtime error: index out of range [0] with length 0

@obynonwane
Copy link

Hi @0xAdriaTorralba, have noted the issue. It indeed do crash. Will report that to the team

@Sharonbc01 Sharonbc01 added the bug Something isn't working label Dec 17, 2024
@Sharonbc01 Sharonbc01 assigned Sharonbc01 and tclemos and unassigned Sharonbc01 Dec 17, 2024
@0xAdriaTorralba
Copy link
Author

Okay, thank you @obynonwane, I also noticed that the AccInputHash is not retreiving correctly calling the same endpoint.
It returns

failed to get acc input hash for batch 406227: failed to get transaction data for tx 0x4a26e1f4630b02248ce905a0c00bcae093b4360309e0e3f2cdece2489c458f49: no result in JSON-RPC response

@obynonwane
Copy link

Okay, thank you @obynonwane, I also noticed that the AccInputHash is not retreiving correctly calling the same endpoint. It returns

failed to get acc input hash for batch 406227: failed to get transaction data for tx 0x4a26e1f4630b02248ce905a0c00bcae093b4360309e0e3f2cdece2489c458f49: no result in JSON-RPC response

It is a known issue, It should be included in the next milestone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants