Commitment: rehash code only with asserts#14536
Merged
Merged
Conversation
antonis19
reviewed
Apr 11, 2025
| @@ -1027,23 +1027,22 @@ func (sdc *SharedDomainsCommitmentContext) Account(plainKey []byte) (u *commitme | |||
| u.Flags |= commitment.BalanceUpdate | |||
Contributor
There was a problem hiding this comment.
I don't know why we automatically consider this to be a balance update? What if the balance wasn't updated?
Member
Author
There was a problem hiding this comment.
how you gonna check? asking history is not worth the effort, easier to mark balance as updated anyways, so balance will not be ignored in the middle of something. Account() happens only for keys we really know need to load (no memoized hash | key was directly given through Updates list as being touched). Balance is used along with Nonce during hashing so only makes sense to load them both or neither.
antonis19
approved these changes
Apr 11, 2025
| if ch := acc.CodeHash.Bytes(); len(ch) > 0 { | ||
| u.Flags |= commitment.CodeUpdate | ||
| copy(u.CodeHash[:], ch) | ||
| copy(u.CodeHash[:], acc.CodeHash.Bytes()) |
Member
Author
There was a problem hiding this comment.
diff is below, so we do not fetch code and hash it if we see not empty code hash
AskAlexSharov
approved these changes
Apr 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
disable contract code reading and hashing when asserts are off and pick code hash from ecnoded account