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 has mismatched information for accInputHash and timestamp #1378

Closed
praetoriansentry opened this issue Oct 29, 2024 · 4 comments
Assignees
Labels
bug Something isn't working Gateway FM High Priority

Comments

@praetoriansentry
Copy link

We're cross referencing information from the RPC, Sequencer, Datastreamer, and L1 contracts for verified batches. It seems like we're often missing the accInputHash and potentially returning the wrong timestamp.

image

In the image above, we're pulling data from a few sources. The state roots seem to align which is good, but the accInputHash from L1 is 0x153491ff81c722447f273fd43342407e9e5c721418c640f2102bcb8d1a7d2e67 and the RPC & Sequencer are returning 0x0000000000000000000000000000000000000000000000000000000000000000.

Similarly, the timestamp returned by the RPC & Sequencer is 0x67214d80, but the timestamp returned by getRollupSequencedBatches

This is happening with hermeznetwork/cdk-erigon:v2.2.0-RC3

@V-Staykov
Copy link
Collaborator

We'll need some more info: example network and batch number would be great, so we can reproduce and debug this.

The accInputHash being zeroes should be fixed and working, if a valid contract addresses and l1 RPC url provided. It only returns zeroes if it is unable to get some data from l1 that is needed to calculate the accInputHash.

@V-Staykov V-Staykov self-assigned this Oct 30, 2024
@praetoriansentry
Copy link
Author

git clone [email protected]:0xPolygon/kurtosis-cdk.git
cd kurtosis-cdk
git checkout 210e0217771384c6177bc81cd260e1467f962bc3
kurtosis run --enclave cdk . '{"args":{"zkevm_contracts_image":"leovct/zkevm-contracts:v8.1.0-rc.1-fork.13","zkevm_prover_image":"hermeznetwork/zkevm-prover:v9.0.0-RC1-fork.13","cdk_erigon_node_image":"nulyjkdhthz/cdk-erigon:434376b78c60ff5cfdf1c6efebe813690f8d73d5"}}'

After letting the network get started up, give it a minute or two for some batches to get verified. You can check that the batches have climbed with this:

cast rpc --rpc-url "$(kurtosis port print cdk cdk-erigon-sequencer-001 rpc)" zkevm_verifiedBatchNumber

At this point we can do some checks for consistency. Assuming our last verified batch is 0x1c1

cast rpc --rpc-url "$(kurtosis port print cdk cdk-erigon-sequencer-001 rpc)" zkevm_getBatchByNumber 0x1c | jq '.' 
cast call --json --rpc-url "$(kurtosis port print cdk el-1-geth-lighthouse rpc)" 0x2F50ef6b8e8Ee4E579B17619A92dE3E2ffbD8AD2 'getRollupSequencedBatches(uint32,uint64)(bytes32,uint64,uint64)' 1 28 | jq '.'

image

I'm expecting that the accInputHash shouldn't be empty and that it would match the value from the L1 verification. Additionally, I thought the timestamp should match, but possibly not.

@zjg555543
Copy link

zjg555543 commented Nov 1, 2024

About accInputHash issue.
I added some logs with branch upstream/v2.60.0-beta1. It got an error while calling RPC zkevm_getBatchByNumber

failed to get acc input hash for batch 10: failed to decode calldata for tx 0x6afb234e994b2db7a15d25fea91d138bfe8fc7b09290867e909b5408188896c3: no decoder found for method signature: 165e8a8d

So, I think we must to adapt decoding methods for SequenceBatchesValidiumBanana,SequenceBatchesBanana,SequenceBatchesValidiumBanana
https://github.com/0xPolygonHermez/cdk-erigon/blob/v2.60.0-beta1/zk/syncer/utils.go#L105

@revitteth
Copy link
Collaborator

revitteth commented Nov 8, 2024

Fixed by #1419 and #1421

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

No branches or pull requests

6 participants