-
Notifications
You must be signed in to change notification settings - Fork 38
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
fix: missing code read in state write #699
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think allow_missing_code
should be a parameter to middle
, not a property of Hash2Code
.
But I don't think we want it at all:
// TODO(Nashtare): https://github.com/0xPolygonZero/zk_evm/issues/...
// This is a bug in the zero tracer, which shouldn't be giving us this read at all.
// Workaround for now.
if let Some(code) = code.get(hash) {
batch_contract_code.insert(code)
}
Don't we want to at least disable this edge case for the native tracer? |
Missed this from our Slack discussion :D Makes sense, let's do, and document this our choice at the call site. pub struct FatalMissingCode(pub bool);
fn middle(..., fatal_missing_code: FatalMissingCode) {..} // TODO(Nashtare): https://github.com/0xPolygonZero/zk_evm/issues/...
// This is a bug in the zero tracer, which shouldn't be giving us this read at all.
// Workaround for now.
match (fatal_missing_code, code.get(hash)) {
(FatalMissingCode(true), None) => bail!("no code for hash {hash}"),
(_, Some(it)) => batch_contract_code.insert(code),
(_, None) => warn!(%hash, "no code for hash"),
} |
This reverts commit 3a750e9.
Co-authored-by: 0xaatif <aatifsyedyp+polygon@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
love it!
let fatal_missing_code = match trie_pre_images { | ||
BlockTraceTriePreImages::Separate(_) => FatalMissingCode(true), | ||
BlockTraceTriePreImages::Combined(_) => FatalMissingCode(false), | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is my first time realising that native = separate, and compact = jerigon
We're currently erroring when missing an entry in the
Hash2Code
map. The access being done uponstate_read
in a state write, I'm wondering whether we should always expect the client to provide necessary information, or if we should allow missing entries.In the current state of things, block 1034, txn 0 (
0xcfaf63b718a548069b856e8ff6b27ad69c3e8ca84ae2ab6ae67c545ecf0b642c
) is failing to parse at the decoder stage because we're missing contract bytecode associated to this txn trace:However, the prover does not need it and processes the txn payload fine with the change on this branch. I think Jerigon here knows we can
skip
the actual bytecode, and hence isn't passing it to thecompact
witness (@cffls to confirm). In which case we should notbail!
when failing to find the mapping bytecode.Opening as discussion because I'm not clear yet as to what the assumption should be / who's responsability it should be.
Passing the block payload here (note that it's failing to run further ahead)
b1034_dev.json
3.5/N @praetoriansentry