aboutsummaryrefslogtreecommitdiffstats
path: root/params
diff options
context:
space:
mode:
Diffstat (limited to 'params')
-rw-r--r--params/config.go66
-rw-r--r--params/protocol_params.go23
-rw-r--r--params/version.go2
3 files changed, 79 insertions, 12 deletions
diff --git a/params/config.go b/params/config.go
index 629720550..a9e631cde 100644
--- a/params/config.go
+++ b/params/config.go
@@ -46,6 +46,15 @@ var (
Ethash: new(EthashConfig),
}
+ // MainnetTrustedCheckpoint contains the light client trusted checkpoint for the main network.
+ MainnetTrustedCheckpoint = &TrustedCheckpoint{
+ Name: "mainnet",
+ SectionIndex: 193,
+ SectionHead: common.HexToHash("0xc2d574295ecedc4d58530ae24c31a5a98be7d2b3327fba0dd0f4ed3913828a55"),
+ CHTRoot: common.HexToHash("0x5d1027dfae688c77376e842679ceada87fd94738feb9b32ef165473bfbbb317b"),
+ BloomRoot: common.HexToHash("0xd38be1a06aabd568e10957fee4fcc523bc64996bcf31bae3f55f86e0a583919f"),
+ }
+
// TestnetChainConfig contains the chain parameters to run a node on the Ropsten test network.
TestnetChainConfig = &ChainConfig{
ChainID: big.NewInt(3),
@@ -61,6 +70,15 @@ var (
Ethash: new(EthashConfig),
}
+ // TestnetTrustedCheckpoint contains the light client trusted checkpoint for the Ropsten test network.
+ TestnetTrustedCheckpoint = &TrustedCheckpoint{
+ Name: "testnet",
+ SectionIndex: 123,
+ SectionHead: common.HexToHash("0xa372a53decb68ce453da12bea1c8ee7b568b276aa2aab94d9060aa7c81fc3dee"),
+ CHTRoot: common.HexToHash("0x6b02e7fada79cd2a80d4b3623df9c44384d6647fc127462e1c188ccd09ece87b"),
+ BloomRoot: common.HexToHash("0xf2d27490914968279d6377d42868928632573e823b5d1d4a944cba6009e16259"),
+ }
+
// RinkebyChainConfig contains the chain parameters to run a node on the Rinkeby test network.
RinkebyChainConfig = &ChainConfig{
ChainID: big.NewInt(4),
@@ -79,24 +97,45 @@ var (
},
}
+ // RinkebyTrustedCheckpoint contains the light client trusted checkpoint for the Rinkeby test network.
+ RinkebyTrustedCheckpoint = &TrustedCheckpoint{
+ Name: "rinkeby",
+ SectionIndex: 91,
+ SectionHead: common.HexToHash("0x435b7b2d8a7922f3b9a522f2fb02730e95e0e1782f0f5443894d5415bba37154"),
+ CHTRoot: common.HexToHash("0x0664bf7ecccfb6775c4eca6f0f264fb5282a22754a2135a1ac4bff2ef02898dd"),
+ BloomRoot: common.HexToHash("0x2a64df2400c3a2cb6400639bb6ed29389abdb4d93e2e525aa7c21f38767cd96f"),
+ }
+
// AllEthashProtocolChanges contains every protocol change (EIPs) introduced
// and accepted by the Ethereum core developers into the Ethash consensus.
//
// This configuration is intentionally not using keyed fields to force anyone
// adding flags to the config to also have to set these fields.
- AllEthashProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, new(EthashConfig), nil}
+ AllEthashProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, new(EthashConfig), nil}
// AllCliqueProtocolChanges contains every protocol change (EIPs) introduced
// and accepted by the Ethereum core developers into the Clique consensus.
//
// This configuration is intentionally not using keyed fields to force anyone
// adding flags to the config to also have to set these fields.
- AllCliqueProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, &CliqueConfig{Period: 0, Epoch: 30000}}
+ AllCliqueProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, nil, &CliqueConfig{Period: 0, Epoch: 30000}}
- TestChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, new(EthashConfig), nil}
+ TestChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, new(EthashConfig), nil}
TestRules = TestChainConfig.Rules(new(big.Int))
)
+// TrustedCheckpoint represents a set of post-processed trie roots (CHT and
+// BloomTrie) associated with the appropriate section index and head hash. It is
+// used to start light syncing from this checkpoint and avoid downloading the
+// entire header chain while still being able to securely access old headers/logs.
+type TrustedCheckpoint struct {
+ Name string `json:"-"`
+ SectionIndex uint64 `json:"sectionIndex"`
+ SectionHead common.Hash `json:"sectionHead"`
+ CHTRoot common.Hash `json:"chtRoot"`
+ BloomRoot common.Hash `json:"bloomRoot"`
+}
+
// ChainConfig is the core config which determines the blockchain settings.
//
// ChainConfig is stored in the database on a per block basis. This means
@@ -119,6 +158,7 @@ type ChainConfig struct {
ByzantiumBlock *big.Int `json:"byzantiumBlock,omitempty"` // Byzantium switch block (nil = no fork, 0 = already on byzantium)
ConstantinopleBlock *big.Int `json:"constantinopleBlock,omitempty"` // Constantinople switch block (nil = no fork, 0 = already activated)
+ EWASMBlock *big.Int `json:"ewasmBlock,omitempty"` // EWASM switch block (nil = no fork, 0 = already activated)
// Various consensus engines
Ethash *EthashConfig `json:"ethash,omitempty"`
@@ -204,6 +244,11 @@ func (c *ChainConfig) IsConstantinople(num *big.Int) bool {
return isForked(c.ConstantinopleBlock, num)
}
+// IsEWASM returns whether num represents a block number after the EWASM fork
+func (c *ChainConfig) IsEWASM(num *big.Int) bool {
+ return isForked(c.EWASMBlock, num)
+}
+
// GasTable returns the gas table corresponding to the current phase (homestead or homestead reprice).
//
// The returned GasTable's fields shouldn't, under any circumstances, be changed.
@@ -269,6 +314,9 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, head *big.Int) *Confi
if isForkIncompatible(c.ConstantinopleBlock, newcfg.ConstantinopleBlock, head) {
return newCompatError("Constantinople fork block", c.ConstantinopleBlock, newcfg.ConstantinopleBlock)
}
+ if isForkIncompatible(c.EWASMBlock, newcfg.EWASMBlock, head) {
+ return newCompatError("ewasm fork block", c.EWASMBlock, newcfg.EWASMBlock)
+ }
return nil
}
@@ -335,7 +383,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 +392,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.
diff --git a/params/version.go b/params/version.go
index a178af8f5..e87d7dc35 100644
--- a/params/version.go
+++ b/params/version.go
@@ -23,7 +23,7 @@ import (
const (
VersionMajor = 1 // Major version component of the current release
VersionMinor = 8 // Minor version component of the current release
- VersionPatch = 16 // Patch version component of the current release
+ VersionPatch = 17 // Patch version component of the current release
VersionMeta = "unstable" // Version metadata to append to the version string
)