testinprod-io / op-erigon

Optimism implementation on the efficiency frontier
https://op-erigon.testinprod.io
GNU Lesser General Public License v3.0
87 stars 15 forks source link

optimism_outputAtBlock: failed to get contract proof at block #212

Open quickchase opened 1 month ago

quickchase commented 1 month ago

When querying op-node, attached to op-erigon, we get an error:

Query:

{"method": "optimism_outputAtBlock", "params": ["0x1153a46"], "id": 1, "jsonrpc": "2.0"}

Response:

{"jsonrpc":"2.0","id":1,"error":{"code":-32000,"message":"failed to get L2 output at block 0x1072048d5d3761e1649fa0e92a5cfa3a35ee9c737e047827b46871897b8d4420:18168390: failed to get contract proof at block 0x1072048d5d3761e1649fa0e92a5cfa3a35ee9c737e047827b46871897b8d4420: context deadline exceeded"}}

However, this works fine with an archive op-geth node.

Is there anything we can adjust or do to make this work with op-erigon?

Expected Response (taken from op-geth):

{"jsonrpc":"2.0","id":1,"result":{"version":"0x0000000000000000000000000000000000000000000000000000000000000000","outputRoot":"0xf0ca80df53f4c252ca2011a6b13b770484755c5b2cdbd65bc25c4e90cff2571a","blockRef":{"hash":"0x1072048d5d3761e1649fa0e92a5cfa3a35ee9c737e047827b46871897b8d4420","number":18168390,"parentHash":"0x5bb8b8e8c53446c52bed28f0702773e79f413c65874e5324dd361e8c1281e2e4","timestamp":1723126127,"l1origin":{"hash":"0x7b55ddc5c4a05e67c278ece9329756df65e1d30f6e9357ad2bf93c9c242126f1","number":20484351},"sequenceNumber":0},"withdrawalStorageRoot":"0x684fc8c86e48985d819b3a344a0f114c55154c426a1a9a99d0a4b132d3bc00d1","stateRoot":"0xc8f0d78b209c2693f62f54921790d30343fbbf208084d5e7b9f3a732db6472df","syncStatus":{"current_l1":{"hash":"0xb762e43809076c68d4f6469b5e455ddd14d0fbee5afa72466dcecc4dec27eaa2","number":20484853,"parentHash":"0xdeb2e8d42ab4afb61256d6d34c7a258fb1efb8cf6eb2331f69dddf6f53248810","timestamp":1723131983},"current_l1_finalized":{"hash":"0x21b8d9442be3780fc8bf36f71c38054e2b3bf805e444272e4ff92249b450ed7c","number":20484747,"parentHash":"0x5ceee82cce7cf8acac34b51bb7ebe150a258990e5024c33d9de966fb757a8103","timestamp":1723130711},"head_l1":{"hash":"0xb762e43809076c68d4f6469b5e455ddd14d0fbee5afa72466dcecc4dec27eaa2","number":20484853,"parentHash":"0xdeb2e8d42ab4afb61256d6d34c7a258fb1efb8cf6eb2331f69dddf6f53248810","timestamp":1723131983},"safe_l1":{"hash":"0x70fc03a5f3f77606a16519f8f65852b4fbbdb9f72ef8942bae6062335d1737f4","number":20484779,"parentHash":"0x7a91d74b5a4249b3967bc1d77933a746adc60a182422d5f51495db04b37e81e9","timestamp":1723131095},"finalized_l1":{"hash":"0x21b8d9442be3780fc8bf36f71c38054e2b3bf805e444272e4ff92249b450ed7c","number":20484747,"parentHash":"0x5ceee82cce7cf8acac34b51bb7ebe150a258990e5024c33d9de966fb757a8103","timestamp":1723130711},"unsafe_l2":{"hash":"0x9df60b88af0b3949c28298365086044c29e8ab3e442b60f3c257eb66808e90c5","number":18171322,"parentHash":"0x2b28534bceaf80dd774e0c2f5da50f6da5b077f7b1e5e999da24a3e52600b4b7","timestamp":1723131991,"l1origin":{"hash":"0x84b094af1bc34860405bc8bcc4e7e71e31ecb75658e8da676bcb63735e0d0c63","number":20484838},"sequenceNumber":3},"safe_l2":{"hash":"0x1ee3fbebdacf615de6bf9fc09d4842b6c94d8bdab7ce6a5139d4f7939b9c45da","number":18171255,"parentHash":"0x63be9330be674591ba16294674fa66c9da7e83a53988ae127ea375ff8f840fb8","timestamp":1723131857,"l1origin":{"hash":"0x218f03fa407f15fe654794152df6a559ba7e4f15244156973c6784f6a5fed19d","number":20484827},"sequenceNumber":2},"finalized_l2":{"hash":"0x3c4c4552a04ecdf6e76f57b4508d089d626d458056b27ae30f6a19c0920b181e","number":18170629,"parentHash":"0x9447310f420b76add2395b5c0a948b0605a3fb44adcf3bf3a53e02fc3dec7697","timestamp":1723130605,"l1origin":{"hash":"0x6d683b3ab435f4d491f94010b1723db899b388cfb71c8812dedba4d94d6fc59c","number":20484722},"sequenceNumber":10},"pending_safe_l2":{"hash":"0x1ee3fbebdacf615de6bf9fc09d4842b6c94d8bdab7ce6a5139d4f7939b9c45da","number":18171255,"parentHash":"0x63be9330be674591ba16294674fa66c9da7e83a53988ae127ea375ff8f840fb8","timestamp":1723131857,"l1origin":{"hash":"0x218f03fa407f15fe654794152df6a559ba7e4f15244156973c6784f6a5fed19d","number":20484827},"sequenceNumber":2}}}}
ImTei commented 1 month ago

@quickchase optimism_outputAtBlock uses eth_getProof RPC. But erigon's getProof has a limitation, and it takes time to get results for past blocks. https://github.com/testinprod-io/op-erigon/blob/op-erigon/cmd/utils/flags.go#L543-L551

// Careful! Because we must rewind the hash state // and re-compute the state trie, the further back in time the request, the more // computationally intensive the operation becomes. // The current default has been chosen arbitrarily as 'useful' without likely being overly computationally intense.

So it's not recommened to use optimism_outputAtBlock for a past block with op-erigon now.