diff options
author | Péter Szilágyi <peterke@gmail.com> | 2018-09-18 21:24:35 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-09-18 21:29:51 +0800 |
commit | 5d921fa3a0cea9d87e7fd391c0ddd3115d00d0c4 (patch) | |
tree | a2898e4b4d3f8b17d32f86c6964f60f177fa7c5b /params | |
parent | caa2c23a38141911a570ba098a940b4fdbf0aa88 (diff) | |
download | go-tangerine-5d921fa3a0cea9d87e7fd391c0ddd3115d00d0c4.tar go-tangerine-5d921fa3a0cea9d87e7fd391c0ddd3115d00d0c4.tar.gz go-tangerine-5d921fa3a0cea9d87e7fd391c0ddd3115d00d0c4.tar.bz2 go-tangerine-5d921fa3a0cea9d87e7fd391c0ddd3115d00d0c4.tar.lz go-tangerine-5d921fa3a0cea9d87e7fd391c0ddd3115d00d0c4.tar.xz go-tangerine-5d921fa3a0cea9d87e7fd391c0ddd3115d00d0c4.tar.zst go-tangerine-5d921fa3a0cea9d87e7fd391c0ddd3115d00d0c4.zip |
core, params: polish net gas metering PR a bit
Diffstat (limited to 'params')
-rw-r--r-- | params/config.go | 12 | ||||
-rw-r--r-- | params/protocol_params.go | 23 |
2 files changed, 27 insertions, 8 deletions
diff --git a/params/config.go b/params/config.go index 629720550..1c3e25eb7 100644 --- a/params/config.go +++ b/params/config.go @@ -335,7 +335,7 @@ func (err *ConfigCompatError) Error() string { type Rules struct { ChainID *big.Int IsHomestead, IsEIP150, IsEIP155, IsEIP158 bool - IsByzantium bool + IsByzantium, IsConstantinople bool } // Rules ensures c's ChainID is not nil. @@ -344,5 +344,13 @@ func (c *ChainConfig) Rules(num *big.Int) Rules { if chainID == nil { chainID = new(big.Int) } - return Rules{ChainID: new(big.Int).Set(chainID), IsHomestead: c.IsHomestead(num), IsEIP150: c.IsEIP150(num), IsEIP155: c.IsEIP155(num), IsEIP158: c.IsEIP158(num), IsByzantium: c.IsByzantium(num)} + return Rules{ + ChainID: new(big.Int).Set(chainID), + IsHomestead: c.IsHomestead(num), + IsEIP150: c.IsEIP150(num), + IsEIP155: c.IsEIP155(num), + IsEIP158: c.IsEIP158(num), + IsByzantium: c.IsByzantium(num), + IsConstantinople: c.IsConstantinople(num), + } } diff --git a/params/protocol_params.go b/params/protocol_params.go index 4b53b3320..c8b6609af 100644 --- a/params/protocol_params.go +++ b/params/protocol_params.go @@ -32,15 +32,26 @@ const ( TxGasContractCreation uint64 = 53000 // Per transaction that creates a contract. NOTE: Not payable on data of calls between transactions. TxDataZeroGas uint64 = 4 // Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions. QuadCoeffDiv uint64 = 512 // Divisor for the quadratic particle of the memory cost equation. - SstoreSetGas uint64 = 20000 // Once per SLOAD operation. LogDataGas uint64 = 8 // Per byte in a LOG* operation's data. CallStipend uint64 = 2300 // Free gas given at beginning of call. - Sha3Gas uint64 = 30 // Once per SHA3 operation. - Sha3WordGas uint64 = 6 // Once per word of the SHA3 operation's data. - SstoreResetGas uint64 = 5000 // Once per SSTORE operation if the zeroness changes from zero. - SstoreClearGas uint64 = 5000 // Once per SSTORE operation if the zeroness doesn't change. - SstoreRefundGas uint64 = 15000 // Once per SSTORE operation if the zeroness changes to zero. + Sha3Gas uint64 = 30 // Once per SHA3 operation. + Sha3WordGas uint64 = 6 // Once per word of the SHA3 operation's data. + + SstoreSetGas uint64 = 20000 // Once per SLOAD operation. + SstoreResetGas uint64 = 5000 // Once per SSTORE operation if the zeroness changes from zero. + SstoreClearGas uint64 = 5000 // Once per SSTORE operation if the zeroness doesn't change. + SstoreRefundGas uint64 = 15000 // Once per SSTORE operation if the zeroness changes to zero. + + NetSstoreNoopGas uint64 = 200 // Once per SSTORE operation if the value doesn't change. + NetSstoreInitGas uint64 = 20000 // Once per SSTORE operation from clean zero. + NetSstoreCleanGas uint64 = 5000 // Once per SSTORE operation from clean non-zero. + NetSstoreDirtyGas uint64 = 200 // Once per SSTORE operation from dirty. + + NetSstoreClearRefund uint64 = 15000 // Once per SSTORE operation for clearing an originally existing storage slot + NetSstoreResetRefund uint64 = 4800 // Once per SSTORE operation for resetting to the original non-zero value + NetSstoreResetClearRefund uint64 = 19800 // Once per SSTORE operation for resetting to the original zero value + JumpdestGas uint64 = 1 // Refunded gas, once per SSTORE operation if the zeroness changes to zero. EpochDuration uint64 = 30000 // Duration between proof-of-work epochs. CallGas uint64 = 40 // Once per CALL operation & message call transaction. |