zkevm-circuits icon indicating copy to clipboard operation
zkevm-circuits copied to clipboard

get_proof unwrap panic due to uninitialized sstore position.

Open smtmfft opened this issue 2 years ago • 0 comments

The painc message looks like below:

panicked at 'called Result::unwrap() on an Err value: JSONRpcError(JsonRpcClientError(SerdeJson { err: Error("invalid type: null, expected a sequence", line: 1, column: 5410), text: "{"address":"0xc11....9e4","accountProof":["0xf902...........a503ebb","nonce":"0x1","storageHash":"0x5601...b421","storageProof":[{"key":"0x0","value":"0x0","proof":null}]}" }))'

The reason is because it requests a non existed key storage, if this is the first write on chain, there is no proof in its parent block.

Here, that first writing is collected. https://github.com/privacy-scaling-explorations/zkevm-circuits/blob/63beeee927db627dbdbed91c7c5b8b2d3c014b85/bus-mapping/src/circuit_input_builder/access.rs#L150-L154 then this unwrap fails: https://github.com/privacy-scaling-explorations/zkevm-circuits/blob/63beeee927db627dbdbed91c7c5b8b2d3c014b85/bus-mapping/src/circuit_input_builder.rs#L686-L695 because the proof returned is "null". Should we remove the first write proof collection? or make the EIP1186ProofResponse's storage proof vector an option?

BTW: I met this in Taiko's circuit test whose codebase is slightly different from here. Please let me know if there is a fix.

smtmfft avatar Oct 26 '23 03:10 smtmfft