-
Notifications
You must be signed in to change notification settings - Fork 844
Update geth-utils
and bus-mapping
to build more witness
#292
Update geth-utils
and bus-mapping
to build more witness
#292
Conversation
db2ab33
to
253e337
Compare
// TODO: Embed error from result into TracingError if possible | ||
true => Err(Error::TracingError), | ||
match result.is_empty() || result.starts_with("Failed") { | ||
true => Err(Error::TracingError(result)), |
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 resolves some of the tasks defined here #165
253e337
to
7c3d514
Compare
7c3d514
to
316fc50
Compare
This PR also resolves #174 |
0c16aa0
to
07c3e31
Compare
07c3e31
to
aa9f4f0
Compare
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've left some comments and notes. I plan to review the circuit input builder changes in more detail after this first review.
@@ -59,12 +59,22 @@ impl Account { | |||
code_hash: *CODE_HASH_ZERO, | |||
} | |||
} | |||
|
|||
/// Return if account is empty or not. | |||
pub fn is_empty(&self) -> bool { |
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.
How/Where will this method be used?
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.
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.
Thanks! No need to remove it, I just wanted to understand where it was needed because I was thinking of a possible edge case but it may not apply here. The edge case I was thinking about is that an Account has a Storage which we model as a HashMap. But keys can be deleted in EVM by setting the value to 0, but our HashMap will not be empty in that case. Maybe this edge case never occurs, because to write to the Storage you would need a code hash != empty.
Nevertheless let me confirm this: is_empty
should return true when either the account never existed, or it has been destroyed, and no other case right?
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 see, to put something in storage of an account, its nonce
must be non-zero (being created or already created), so I guess this edge case would not happen (actually contract could be have some storage without code, we can do this by store something and return nothing when creation).
is_empty
should return true when either the account never existed, or it has been destroyed, and no other case right?
Not really. You just reminds me, for destroyed one, it depends on if we have finalized or not (tx ends or not), because before finalizing, destroyed account is not empty. We might need to add a tag to record if this account is destroyed or not, and finalize to actual remove it after each tx ends.
0b44a56
to
1406ff6
Compare
Overall the PR looks good to me! Quite a lot of changes! |
20ed665
to
8639ab2
Compare
This PR is once part of #278, and aims to fulfill all required witness when parsing.
It first update
geth-utils
to better match howgeth
trace API works, and parse all fields of call for further usage.The most tricky field of call is
rw_counter_end_of_reversion
, which takes 2 rounds of iteration on the traces to infer. Briefly speaking, the first round is for inspecting if a call ends up success (e.g.STOP
orRETURN
) or failure (REVERT
or all kind of Exceptions), the second round is for recording the correct amount of read/write, with proper reversions if needed, then knowing the correctrw_counter_end_of_reversion
. For more details on state write reversion, please refer to this note with illustration.Also due to the interpreter changes of
geth
, error parsing ofInvalidOpcode
andWriteProtection
are handled byget_step_err
instead of directly from error string (see ethereum/go-ethereum#24031 and ethereum/go-ethereum#23970)Resolves #174
Resolves #188
Resolves #225
Resolves #250
Resolves #289