-
Notifications
You must be signed in to change notification settings - Fork 43
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
Problem: state overrides are not supported in eth_call #369
Conversation
Closes: #368 Solution: - add the feature
Signed-off-by: yihuang <huang@crypto.com>
for key, value := range *account.StateDiff { | ||
db.SetState(addr, key, value) | ||
} |
Check failure
Code scanning / gosec
the value in the range statement should be _ unless copying a map: want: for key := range m Error
for addr, account := range *diff { | ||
// Override account nonce. | ||
if account.Nonce != nil { | ||
db.SetNonce(addr, uint64(*account.Nonce)) | ||
} | ||
// Override account(contract) code. | ||
if account.Code != nil { | ||
db.SetCode(addr, *account.Code) | ||
} | ||
// Override account balance. | ||
if account.Balance != nil { | ||
db.SetBalance(addr, (*big.Int)(*account.Balance)) | ||
} | ||
if account.State != nil && account.StateDiff != nil { | ||
return fmt.Errorf("account %s has both 'state' and 'stateDiff'", addr.Hex()) | ||
} | ||
// Replace entire state if caller requires. | ||
if account.State != nil { | ||
db.SetStorage(addr, *account.State) | ||
} | ||
// Apply state diff into specified accounts. | ||
if account.StateDiff != nil { | ||
for key, value := range *account.StateDiff { | ||
db.SetState(addr, key, value) | ||
} | ||
} | ||
} |
Check failure
Code scanning / gosec
the value in the range statement should be _ unless copying a map: want: for key := range m Error
Signed-off-by: mmsqe <mavis@crypto.com>
Closes: #368
Solution:
Closes: #XXX
Description
For contributor use:
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerFor admin use:
WIP
,R4R
,docs
, etc)