mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
accesswitness: touch for origin and to (#348)
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
This commit is contained in:
parent
b7bd9e33ad
commit
eb31ae3f9e
1 changed files with 16 additions and 16 deletions
|
|
@ -139,34 +139,34 @@ func (aw *AccessWitness) TouchAndChargeContractCreateCompleted(addr []byte) uint
|
||||||
}
|
}
|
||||||
|
|
||||||
func (aw *AccessWitness) TouchTxOriginAndComputeGas(originAddr []byte) uint64 {
|
func (aw *AccessWitness) TouchTxOriginAndComputeGas(originAddr []byte) uint64 {
|
||||||
// var gas uint64
|
aw.TouchAddressOnReadAndComputeGas(originAddr, zeroTreeIndex, utils.VersionLeafKey)
|
||||||
// gas += aw.TouchAddressOnReadAndComputeGas(originAddr, zeroTreeIndex, utils.VersionLeafKey)
|
aw.TouchAddressOnReadAndComputeGas(originAddr, zeroTreeIndex, utils.CodeSizeLeafKey)
|
||||||
// gas += aw.TouchAddressOnReadAndComputeGas(originAddr, zeroTreeIndex, utils.CodeSizeLeafKey)
|
aw.TouchAddressOnReadAndComputeGas(originAddr, zeroTreeIndex, utils.CodeKeccakLeafKey)
|
||||||
// gas += aw.TouchAddressOnReadAndComputeGas(originAddr, zeroTreeIndex, utils.CodeKeccakLeafKey)
|
aw.TouchAddressOnWriteAndComputeGas(originAddr, zeroTreeIndex, utils.NonceLeafKey)
|
||||||
// gas += aw.TouchAddressOnWriteAndComputeGas(originAddr, zeroTreeIndex, utils.NonceLeafKey)
|
aw.TouchAddressOnWriteAndComputeGas(originAddr, zeroTreeIndex, utils.BalanceLeafKey)
|
||||||
// gas += aw.TouchAddressOnWriteAndComputeGas(originAddr, zeroTreeIndex, utils.BalanceLeafKey)
|
|
||||||
|
|
||||||
// Kaustinen note: we're currently experimenting with stop chargin gas for the origin address
|
// Kaustinen note: we're currently experimenting with stop chargin gas for the origin address
|
||||||
// so simple transfer still take 21000 gas. This is to potentially avoid breaking existing tooling.
|
// so simple transfer still take 21000 gas. This is to potentially avoid breaking existing tooling.
|
||||||
// This is the reason why we return 0 instead of `gas`.
|
// This is the reason why we return 0 instead of `gas`.
|
||||||
|
// Note that we still have to touch the addresses to make sure the witness is correct.
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (aw *AccessWitness) TouchTxExistingAndComputeGas(targetAddr []byte, sendsValue bool) uint64 {
|
func (aw *AccessWitness) TouchTxExistingAndComputeGas(targetAddr []byte, sendsValue bool) uint64 {
|
||||||
// var gas uint64
|
aw.TouchAddressOnReadAndComputeGas(targetAddr, zeroTreeIndex, utils.VersionLeafKey)
|
||||||
// gas += aw.TouchAddressOnReadAndComputeGas(targetAddr, zeroTreeIndex, utils.VersionLeafKey)
|
aw.TouchAddressOnReadAndComputeGas(targetAddr, zeroTreeIndex, utils.CodeSizeLeafKey)
|
||||||
// gas += aw.TouchAddressOnReadAndComputeGas(targetAddr, zeroTreeIndex, utils.CodeSizeLeafKey)
|
aw.TouchAddressOnReadAndComputeGas(targetAddr, zeroTreeIndex, utils.CodeKeccakLeafKey)
|
||||||
// gas += aw.TouchAddressOnReadAndComputeGas(targetAddr, zeroTreeIndex, utils.CodeKeccakLeafKey)
|
aw.TouchAddressOnReadAndComputeGas(targetAddr, zeroTreeIndex, utils.NonceLeafKey)
|
||||||
// gas += aw.TouchAddressOnReadAndComputeGas(targetAddr, zeroTreeIndex, utils.NonceLeafKey)
|
if sendsValue {
|
||||||
// if sendsValue {
|
aw.TouchAddressOnWriteAndComputeGas(targetAddr, zeroTreeIndex, utils.BalanceLeafKey)
|
||||||
// gas += aw.TouchAddressOnWriteAndComputeGas(targetAddr, zeroTreeIndex, utils.BalanceLeafKey)
|
} else {
|
||||||
// } else {
|
aw.TouchAddressOnReadAndComputeGas(targetAddr, zeroTreeIndex, utils.BalanceLeafKey)
|
||||||
// gas += aw.TouchAddressOnReadAndComputeGas(targetAddr, zeroTreeIndex, utils.BalanceLeafKey)
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
// Kaustinen note: we're currently experimenting with stop chargin gas for the origin address
|
// Kaustinen note: we're currently experimenting with stop chargin gas for the origin address
|
||||||
// so simple transfer still take 21000 gas. This is to potentially avoid breaking existing tooling.
|
// so simple transfer still take 21000 gas. This is to potentially avoid breaking existing tooling.
|
||||||
// This is the reason why we return 0 instead of `gas`.
|
// This is the reason why we return 0 instead of `gas`.
|
||||||
|
// Note that we still have to touch the addresses to make sure the witness is correct.
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue