-
Notifications
You must be signed in to change notification settings - Fork 20.1k
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
core/{state,vm}: FILL_COSTS using StateExists #30390
base: master
Are you sure you want to change the base?
Conversation
ae.touchAddressAndChargeGas(originAddr, zeroTreeIndex, utils.BasicDataLeafKey, true, false) | ||
ae.touchAddressAndChargeGas(originAddr, zeroTreeIndex, utils.CodeHashLeafKey, false, 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.
We need to test what happens if we try to send a tx from an account that isn't in the state (i.e. someone generates a public key, and sends a tx from it before they even created the account in the state)
// the intrinsic tx gas if needed. If the destination is written to during | ||
// the contract execution, before the state db layer has saved it to disk, | ||
// the fill cost will already have been covered by the intrinsic gas. | ||
ae.touchAddressAndChargeGas(addr, zeroTreeIndex, utils.BasicDataLeafKey, sendsValue, true) |
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 sendsValue
here is potentially incorrect, because if we create an account while not sending funds, but it does create the account (which isn't possible now but might be the case in 7702). So I think we should change sendsValue
to true
.
return gas | ||
} | ||
|
||
// ContractCreateInitGas returns the access gas costs for the initialization of | ||
// a contract creation. | ||
func (ae *AccessEvents) ContractCreateInitGas(addr common.Address, createSendsValue bool) uint64 { | ||
var gas uint64 | ||
gas += ae.touchAddressAndChargeGas(addr, zeroTreeIndex, utils.BasicDataLeafKey, true) | ||
gas += ae.touchAddressAndChargeGas(addr, zeroTreeIndex, utils.BasicDataLeafKey, true, true) |
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 ok for now, but this isn't going to when we implement fill_cost: we need to find out if the contract exists as there might be a collision. There is some argument that needs to be debated here but if we can't use the collision check to determine that it's a fill, then we need to add a parameter here.
This is a reimplementation of the
FILL_COST
PR rebased on Gary'sStateExists
PR (rjl493456442@732cb64#diff-c3757dc9e9d868f63bc84a0cc67159c1d5c22cc5d8c9468757098f0492e0658c).