forked from ethereum/go-ethereum
-
Notifications
You must be signed in to change notification settings - Fork 13
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
implement post-nyota verkle costs #454
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
46ee384
implement post-nyota verkle costs
gballet baaccb6
fix tests and a few bugs
gballet 92999f7
make linter happy
gballet 6626e04
attempt at fixing replay + shadowfork
gballet 063552e
nyota fixes (#469)
jsign 1c13629
fixes from replaying nyota costs (#472)
gballet f626498
fix most tests
gballet c4691c1
ci: fix buggy target spec tests (temporary)
jsign 9b090a3
fix last failing test
gballet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,41 +91,36 @@ func (aw *AccessWitness) Copy() *AccessWitness { | |
|
||
func (aw *AccessWitness) TouchFullAccount(addr []byte, isWrite bool) uint64 { | ||
var gas uint64 | ||
for i := utils.VersionLeafKey; i <= utils.CodeSizeLeafKey; i++ { | ||
for i := utils.BasicDataLeafKey; i <= utils.CodeHashLeafKey; i++ { | ||
gas += aw.touchAddressAndChargeGas(addr, zeroTreeIndex, byte(i), isWrite) | ||
} | ||
return gas | ||
} | ||
|
||
func (aw *AccessWitness) TouchAndChargeMessageCall(addr []byte) uint64 { | ||
var gas uint64 | ||
gas += aw.touchAddressAndChargeGas(addr, zeroTreeIndex, utils.VersionLeafKey, false) | ||
gas += aw.touchAddressAndChargeGas(addr, zeroTreeIndex, utils.CodeSizeLeafKey, false) | ||
gas += aw.touchAddressAndChargeGas(addr, zeroTreeIndex, utils.BasicDataLeafKey, false) | ||
return gas | ||
} | ||
|
||
func (aw *AccessWitness) TouchAndChargeValueTransfer(callerAddr, targetAddr []byte) uint64 { | ||
var gas uint64 | ||
gas += aw.touchAddressAndChargeGas(callerAddr, zeroTreeIndex, utils.BalanceLeafKey, true) | ||
gas += aw.touchAddressAndChargeGas(targetAddr, zeroTreeIndex, utils.BalanceLeafKey, true) | ||
gas += aw.touchAddressAndChargeGas(callerAddr, zeroTreeIndex, utils.BasicDataLeafKey, true) | ||
gas += aw.touchAddressAndChargeGas(targetAddr, zeroTreeIndex, utils.BasicDataLeafKey, true) | ||
return gas | ||
} | ||
|
||
// TouchAndChargeContractCreateInit charges access costs to initiate | ||
// a contract creation | ||
func (aw *AccessWitness) TouchAndChargeContractCreateInit(addr []byte, createSendsValue bool) uint64 { | ||
var gas uint64 | ||
gas += aw.touchAddressAndChargeGas(addr, zeroTreeIndex, utils.VersionLeafKey, true) | ||
gas += aw.touchAddressAndChargeGas(addr, zeroTreeIndex, utils.NonceLeafKey, true) | ||
if createSendsValue { | ||
gas += aw.touchAddressAndChargeGas(addr, zeroTreeIndex, utils.BalanceLeafKey, true) | ||
} | ||
gas += aw.touchAddressAndChargeGas(addr, zeroTreeIndex, utils.BasicDataLeafKey, true) | ||
return gas | ||
} | ||
|
||
func (aw *AccessWitness) TouchTxOriginAndComputeGas(originAddr []byte) uint64 { | ||
for i := utils.VersionLeafKey; i <= utils.CodeSizeLeafKey; i++ { | ||
aw.touchAddressAndChargeGas(originAddr, zeroTreeIndex, byte(i), i == utils.BalanceLeafKey || i == utils.NonceLeafKey) | ||
for i := utils.BasicDataLeafKey; i <= utils.CodeHashLeafKey; i++ { | ||
aw.touchAddressAndChargeGas(originAddr, zeroTreeIndex, byte(i), i == utils.BasicDataLeafKey) | ||
} | ||
|
||
// Kaustinen note: we're currently experimenting with stop chargin gas for the origin address | ||
|
@@ -136,14 +131,10 @@ func (aw *AccessWitness) TouchTxOriginAndComputeGas(originAddr []byte) uint64 { | |
} | ||
|
||
func (aw *AccessWitness) TouchTxExistingAndComputeGas(targetAddr []byte, sendsValue bool) uint64 { | ||
aw.touchAddressAndChargeGas(targetAddr, zeroTreeIndex, utils.VersionLeafKey, false) | ||
aw.touchAddressAndChargeGas(targetAddr, zeroTreeIndex, utils.CodeSizeLeafKey, false) | ||
aw.touchAddressAndChargeGas(targetAddr, zeroTreeIndex, utils.BasicDataLeafKey, false) | ||
aw.touchAddressAndChargeGas(targetAddr, zeroTreeIndex, utils.CodeHashLeafKey, false) | ||
aw.touchAddressAndChargeGas(targetAddr, zeroTreeIndex, utils.NonceLeafKey, false) | ||
if sendsValue { | ||
aw.touchAddressAndChargeGas(targetAddr, zeroTreeIndex, utils.BalanceLeafKey, true) | ||
} else { | ||
aw.touchAddressAndChargeGas(targetAddr, zeroTreeIndex, utils.BalanceLeafKey, false) | ||
aw.touchAddressAndChargeGas(targetAddr, zeroTreeIndex, utils.BasicDataLeafKey, true) | ||
} | ||
Comment on lines
136
to
138
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code can be removed since we can pass |
||
|
||
// Kaustinen note: we're currently experimenting with stop chargin gas for the origin address | ||
|
@@ -276,20 +267,8 @@ func (aw *AccessWitness) TouchCodeChunksRangeAndChargeGas(contractAddr []byte, s | |
return statelessGasCharged | ||
} | ||
|
||
func (aw *AccessWitness) TouchVersion(addr []byte, isWrite bool) uint64 { | ||
return aw.touchAddressAndChargeGas(addr, zeroTreeIndex, utils.VersionLeafKey, isWrite) | ||
} | ||
|
||
func (aw *AccessWitness) TouchBalance(addr []byte, isWrite bool) uint64 { | ||
return aw.touchAddressAndChargeGas(addr, zeroTreeIndex, utils.BalanceLeafKey, isWrite) | ||
} | ||
|
||
func (aw *AccessWitness) TouchNonce(addr []byte, isWrite bool) uint64 { | ||
return aw.touchAddressAndChargeGas(addr, zeroTreeIndex, utils.NonceLeafKey, isWrite) | ||
} | ||
|
||
func (aw *AccessWitness) TouchCodeSize(addr []byte, isWrite bool) uint64 { | ||
return aw.touchAddressAndChargeGas(addr, zeroTreeIndex, utils.CodeSizeLeafKey, isWrite) | ||
func (aw *AccessWitness) TouchBasicData(addr []byte, isWrite bool) uint64 { | ||
return aw.touchAddressAndChargeGas(addr, zeroTreeIndex, utils.BasicDataLeafKey, isWrite) | ||
} | ||
|
||
func (aw *AccessWitness) TouchCodeHash(addr []byte, isWrite bool) uint64 { | ||
|
This file contains 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
This file contains 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
Oops, something went wrong.
Oops, something went wrong.
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.
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 can remove the parameter
createSendsValue
.