|
|
@@ -36,25 +36,27 @@ import (
|
|
|
type alethGenesisSpec struct {
|
|
|
SealEngine string `json:"sealEngine"`
|
|
|
Params struct {
|
|
|
- AccountStartNonce math2.HexOrDecimal64 `json:"accountStartNonce"`
|
|
|
- MaximumExtraDataSize hexutil.Uint64 `json:"maximumExtraDataSize"`
|
|
|
- HomesteadForkBlock hexutil.Uint64 `json:"homesteadForkBlock"`
|
|
|
- DaoHardforkBlock math2.HexOrDecimal64 `json:"daoHardforkBlock"`
|
|
|
- EIP150ForkBlock hexutil.Uint64 `json:"EIP150ForkBlock"`
|
|
|
- EIP158ForkBlock hexutil.Uint64 `json:"EIP158ForkBlock"`
|
|
|
- ByzantiumForkBlock hexutil.Uint64 `json:"byzantiumForkBlock"`
|
|
|
- ConstantinopleForkBlock hexutil.Uint64 `json:"constantinopleForkBlock"`
|
|
|
- MinGasLimit hexutil.Uint64 `json:"minGasLimit"`
|
|
|
- MaxGasLimit hexutil.Uint64 `json:"maxGasLimit"`
|
|
|
- TieBreakingGas bool `json:"tieBreakingGas"`
|
|
|
- GasLimitBoundDivisor math2.HexOrDecimal64 `json:"gasLimitBoundDivisor"`
|
|
|
- MinimumDifficulty *hexutil.Big `json:"minimumDifficulty"`
|
|
|
- DifficultyBoundDivisor *math2.HexOrDecimal256 `json:"difficultyBoundDivisor"`
|
|
|
- DurationLimit *math2.HexOrDecimal256 `json:"durationLimit"`
|
|
|
- BlockReward *hexutil.Big `json:"blockReward"`
|
|
|
- NetworkID hexutil.Uint64 `json:"networkID"`
|
|
|
- ChainID hexutil.Uint64 `json:"chainID"`
|
|
|
- AllowFutureBlocks bool `json:"allowFutureBlocks"`
|
|
|
+ AccountStartNonce math2.HexOrDecimal64 `json:"accountStartNonce"`
|
|
|
+ MaximumExtraDataSize hexutil.Uint64 `json:"maximumExtraDataSize"`
|
|
|
+ HomesteadForkBlock *hexutil.Big `json:"homesteadForkBlock,omitempty"`
|
|
|
+ DaoHardforkBlock math2.HexOrDecimal64 `json:"daoHardforkBlock"`
|
|
|
+ EIP150ForkBlock *hexutil.Big `json:"EIP150ForkBlock,omitempty"`
|
|
|
+ EIP158ForkBlock *hexutil.Big `json:"EIP158ForkBlock,omitempty"`
|
|
|
+ ByzantiumForkBlock *hexutil.Big `json:"byzantiumForkBlock,omitempty"`
|
|
|
+ ConstantinopleForkBlock *hexutil.Big `json:"constantinopleForkBlock,omitempty"`
|
|
|
+ ConstantinopleFixForkBlock *hexutil.Big `json:"constantinopleFixForkBlock,omitempty"`
|
|
|
+ IstanbulForkBlock *hexutil.Big `json:"istanbulForkBlock,omitempty"`
|
|
|
+ MinGasLimit hexutil.Uint64 `json:"minGasLimit"`
|
|
|
+ MaxGasLimit hexutil.Uint64 `json:"maxGasLimit"`
|
|
|
+ TieBreakingGas bool `json:"tieBreakingGas"`
|
|
|
+ GasLimitBoundDivisor math2.HexOrDecimal64 `json:"gasLimitBoundDivisor"`
|
|
|
+ MinimumDifficulty *hexutil.Big `json:"minimumDifficulty"`
|
|
|
+ DifficultyBoundDivisor *math2.HexOrDecimal256 `json:"difficultyBoundDivisor"`
|
|
|
+ DurationLimit *math2.HexOrDecimal256 `json:"durationLimit"`
|
|
|
+ BlockReward *hexutil.Big `json:"blockReward"`
|
|
|
+ NetworkID hexutil.Uint64 `json:"networkID"`
|
|
|
+ ChainID hexutil.Uint64 `json:"chainID"`
|
|
|
+ AllowFutureBlocks bool `json:"allowFutureBlocks"`
|
|
|
} `json:"params"`
|
|
|
|
|
|
Genesis struct {
|
|
|
@@ -74,7 +76,7 @@ type alethGenesisSpec struct {
|
|
|
// alethGenesisSpecAccount is the prefunded genesis account and/or precompiled
|
|
|
// contract definition.
|
|
|
type alethGenesisSpecAccount struct {
|
|
|
- Balance *math2.HexOrDecimal256 `json:"balance"`
|
|
|
+ Balance *math2.HexOrDecimal256 `json:"balance,omitempty"`
|
|
|
Nonce uint64 `json:"nonce,omitempty"`
|
|
|
Precompiled *alethGenesisSpecBuiltin `json:"precompiled,omitempty"`
|
|
|
}
|
|
|
@@ -82,7 +84,7 @@ type alethGenesisSpecAccount struct {
|
|
|
// alethGenesisSpecBuiltin is the precompiled contract definition.
|
|
|
type alethGenesisSpecBuiltin struct {
|
|
|
Name string `json:"name,omitempty"`
|
|
|
- StartingBlock hexutil.Uint64 `json:"startingBlock,omitempty"`
|
|
|
+ StartingBlock *hexutil.Big `json:"startingBlock,omitempty"`
|
|
|
Linear *alethGenesisSpecLinearPricing `json:"linear,omitempty"`
|
|
|
}
|
|
|
|
|
|
@@ -106,21 +108,33 @@ func newAlethGenesisSpec(network string, genesis *core.Genesis) (*alethGenesisSp
|
|
|
spec.Params.AccountStartNonce = 0
|
|
|
spec.Params.TieBreakingGas = false
|
|
|
spec.Params.AllowFutureBlocks = false
|
|
|
- spec.Params.DaoHardforkBlock = 0
|
|
|
|
|
|
- spec.Params.HomesteadForkBlock = (hexutil.Uint64)(genesis.Config.HomesteadBlock.Uint64())
|
|
|
- spec.Params.EIP150ForkBlock = (hexutil.Uint64)(genesis.Config.EIP150Block.Uint64())
|
|
|
- spec.Params.EIP158ForkBlock = (hexutil.Uint64)(genesis.Config.EIP158Block.Uint64())
|
|
|
+ // Dao hardfork block is a special one. The fork block is listed as 0 in the
|
|
|
+ // config but aleth will sync with ETC clients up until the actual dao hard
|
|
|
+ // fork block.
|
|
|
+ spec.Params.DaoHardforkBlock = 0
|
|
|
|
|
|
- // Byzantium
|
|
|
+ if num := genesis.Config.HomesteadBlock; num != nil {
|
|
|
+ spec.Params.HomesteadForkBlock = (*hexutil.Big)(num)
|
|
|
+ }
|
|
|
+ if num := genesis.Config.EIP150Block; num != nil {
|
|
|
+ spec.Params.EIP150ForkBlock = (*hexutil.Big)(num)
|
|
|
+ }
|
|
|
+ if num := genesis.Config.EIP158Block; num != nil {
|
|
|
+ spec.Params.EIP158ForkBlock = (*hexutil.Big)(num)
|
|
|
+ }
|
|
|
if num := genesis.Config.ByzantiumBlock; num != nil {
|
|
|
- spec.setByzantium(num)
|
|
|
+ spec.Params.ByzantiumForkBlock = (*hexutil.Big)(num)
|
|
|
}
|
|
|
- // Constantinople
|
|
|
if num := genesis.Config.ConstantinopleBlock; num != nil {
|
|
|
- spec.setConstantinople(num)
|
|
|
+ spec.Params.ConstantinopleForkBlock = (*hexutil.Big)(num)
|
|
|
+ }
|
|
|
+ if num := genesis.Config.PetersburgBlock; num != nil {
|
|
|
+ spec.Params.ConstantinopleFixForkBlock = (*hexutil.Big)(num)
|
|
|
+ }
|
|
|
+ if num := genesis.Config.IstanbulBlock; num != nil {
|
|
|
+ spec.Params.IstanbulForkBlock = (*hexutil.Big)(num)
|
|
|
}
|
|
|
-
|
|
|
spec.Params.NetworkID = (hexutil.Uint64)(genesis.Config.ChainID.Uint64())
|
|
|
spec.Params.ChainID = (hexutil.Uint64)(genesis.Config.ChainID.Uint64())
|
|
|
spec.Params.MaximumExtraDataSize = (hexutil.Uint64)(params.MaximumExtraDataSize)
|
|
|
@@ -157,15 +171,32 @@ func newAlethGenesisSpec(network string, genesis *core.Genesis) (*alethGenesisSp
|
|
|
Linear: &alethGenesisSpecLinearPricing{Base: 15, Word: 3}})
|
|
|
if genesis.Config.ByzantiumBlock != nil {
|
|
|
spec.setPrecompile(5, &alethGenesisSpecBuiltin{Name: "modexp",
|
|
|
- StartingBlock: (hexutil.Uint64)(genesis.Config.ByzantiumBlock.Uint64())})
|
|
|
+ StartingBlock: (*hexutil.Big)(genesis.Config.ByzantiumBlock)})
|
|
|
spec.setPrecompile(6, &alethGenesisSpecBuiltin{Name: "alt_bn128_G1_add",
|
|
|
- StartingBlock: (hexutil.Uint64)(genesis.Config.ByzantiumBlock.Uint64()),
|
|
|
+ StartingBlock: (*hexutil.Big)(genesis.Config.ByzantiumBlock),
|
|
|
Linear: &alethGenesisSpecLinearPricing{Base: 500}})
|
|
|
spec.setPrecompile(7, &alethGenesisSpecBuiltin{Name: "alt_bn128_G1_mul",
|
|
|
- StartingBlock: (hexutil.Uint64)(genesis.Config.ByzantiumBlock.Uint64()),
|
|
|
+ StartingBlock: (*hexutil.Big)(genesis.Config.ByzantiumBlock),
|
|
|
Linear: &alethGenesisSpecLinearPricing{Base: 40000}})
|
|
|
spec.setPrecompile(8, &alethGenesisSpecBuiltin{Name: "alt_bn128_pairing_product",
|
|
|
- StartingBlock: (hexutil.Uint64)(genesis.Config.ByzantiumBlock.Uint64())})
|
|
|
+ StartingBlock: (*hexutil.Big)(genesis.Config.ByzantiumBlock)})
|
|
|
+ }
|
|
|
+ if genesis.Config.IstanbulBlock != nil {
|
|
|
+ if genesis.Config.ByzantiumBlock == nil {
|
|
|
+ return nil, errors.New("invalid genesis, istanbul fork is enabled while byzantium is not")
|
|
|
+ }
|
|
|
+ spec.setPrecompile(6, &alethGenesisSpecBuiltin{
|
|
|
+ Name: "alt_bn128_G1_add",
|
|
|
+ StartingBlock: (*hexutil.Big)(genesis.Config.ByzantiumBlock),
|
|
|
+ }) // Aleth hardcoded the gas policy
|
|
|
+ spec.setPrecompile(7, &alethGenesisSpecBuiltin{
|
|
|
+ Name: "alt_bn128_G1_mul",
|
|
|
+ StartingBlock: (*hexutil.Big)(genesis.Config.ByzantiumBlock),
|
|
|
+ }) // Aleth hardcoded the gas policy
|
|
|
+ spec.setPrecompile(9, &alethGenesisSpecBuiltin{
|
|
|
+ Name: "blake2_compression",
|
|
|
+ StartingBlock: (*hexutil.Big)(genesis.Config.IstanbulBlock),
|
|
|
+ })
|
|
|
}
|
|
|
return spec, nil
|
|
|
}
|
|
|
@@ -196,14 +227,6 @@ func (spec *alethGenesisSpec) setAccount(address common.Address, account core.Ge
|
|
|
|
|
|
}
|
|
|
|
|
|
-func (spec *alethGenesisSpec) setByzantium(num *big.Int) {
|
|
|
- spec.Params.ByzantiumForkBlock = hexutil.Uint64(num.Uint64())
|
|
|
-}
|
|
|
-
|
|
|
-func (spec *alethGenesisSpec) setConstantinople(num *big.Int) {
|
|
|
- spec.Params.ConstantinopleForkBlock = hexutil.Uint64(num.Uint64())
|
|
|
-}
|
|
|
-
|
|
|
// parityChainSpec is the chain specification format used by Parity.
|
|
|
type parityChainSpec struct {
|
|
|
Name string `json:"name"`
|
|
|
@@ -223,29 +246,33 @@ type parityChainSpec struct {
|
|
|
} `json:"engine"`
|
|
|
|
|
|
Params struct {
|
|
|
- AccountStartNonce hexutil.Uint64 `json:"accountStartNonce"`
|
|
|
- MaximumExtraDataSize hexutil.Uint64 `json:"maximumExtraDataSize"`
|
|
|
- MinGasLimit hexutil.Uint64 `json:"minGasLimit"`
|
|
|
- GasLimitBoundDivisor math2.HexOrDecimal64 `json:"gasLimitBoundDivisor"`
|
|
|
- NetworkID hexutil.Uint64 `json:"networkID"`
|
|
|
- ChainID hexutil.Uint64 `json:"chainID"`
|
|
|
- MaxCodeSize hexutil.Uint64 `json:"maxCodeSize"`
|
|
|
- MaxCodeSizeTransition hexutil.Uint64 `json:"maxCodeSizeTransition"`
|
|
|
- EIP98Transition hexutil.Uint64 `json:"eip98Transition"`
|
|
|
- EIP150Transition hexutil.Uint64 `json:"eip150Transition"`
|
|
|
- EIP160Transition hexutil.Uint64 `json:"eip160Transition"`
|
|
|
- EIP161abcTransition hexutil.Uint64 `json:"eip161abcTransition"`
|
|
|
- EIP161dTransition hexutil.Uint64 `json:"eip161dTransition"`
|
|
|
- EIP155Transition hexutil.Uint64 `json:"eip155Transition"`
|
|
|
- EIP140Transition hexutil.Uint64 `json:"eip140Transition"`
|
|
|
- EIP211Transition hexutil.Uint64 `json:"eip211Transition"`
|
|
|
- EIP214Transition hexutil.Uint64 `json:"eip214Transition"`
|
|
|
- EIP658Transition hexutil.Uint64 `json:"eip658Transition"`
|
|
|
- EIP145Transition hexutil.Uint64 `json:"eip145Transition"`
|
|
|
- EIP1014Transition hexutil.Uint64 `json:"eip1014Transition"`
|
|
|
- EIP1052Transition hexutil.Uint64 `json:"eip1052Transition"`
|
|
|
- EIP1283Transition hexutil.Uint64 `json:"eip1283Transition"`
|
|
|
- EIP1283DisableTransition hexutil.Uint64 `json:"eip1283DisableTransition"`
|
|
|
+ AccountStartNonce hexutil.Uint64 `json:"accountStartNonce"`
|
|
|
+ MaximumExtraDataSize hexutil.Uint64 `json:"maximumExtraDataSize"`
|
|
|
+ MinGasLimit hexutil.Uint64 `json:"minGasLimit"`
|
|
|
+ GasLimitBoundDivisor math2.HexOrDecimal64 `json:"gasLimitBoundDivisor"`
|
|
|
+ NetworkID hexutil.Uint64 `json:"networkID"`
|
|
|
+ ChainID hexutil.Uint64 `json:"chainID"`
|
|
|
+ MaxCodeSize hexutil.Uint64 `json:"maxCodeSize"`
|
|
|
+ MaxCodeSizeTransition hexutil.Uint64 `json:"maxCodeSizeTransition"`
|
|
|
+ EIP98Transition hexutil.Uint64 `json:"eip98Transition"`
|
|
|
+ EIP150Transition hexutil.Uint64 `json:"eip150Transition"`
|
|
|
+ EIP160Transition hexutil.Uint64 `json:"eip160Transition"`
|
|
|
+ EIP161abcTransition hexutil.Uint64 `json:"eip161abcTransition"`
|
|
|
+ EIP161dTransition hexutil.Uint64 `json:"eip161dTransition"`
|
|
|
+ EIP155Transition hexutil.Uint64 `json:"eip155Transition"`
|
|
|
+ EIP140Transition hexutil.Uint64 `json:"eip140Transition"`
|
|
|
+ EIP211Transition hexutil.Uint64 `json:"eip211Transition"`
|
|
|
+ EIP214Transition hexutil.Uint64 `json:"eip214Transition"`
|
|
|
+ EIP658Transition hexutil.Uint64 `json:"eip658Transition"`
|
|
|
+ EIP145Transition hexutil.Uint64 `json:"eip145Transition"`
|
|
|
+ EIP1014Transition hexutil.Uint64 `json:"eip1014Transition"`
|
|
|
+ EIP1052Transition hexutil.Uint64 `json:"eip1052Transition"`
|
|
|
+ EIP1283Transition hexutil.Uint64 `json:"eip1283Transition"`
|
|
|
+ EIP1283DisableTransition hexutil.Uint64 `json:"eip1283DisableTransition"`
|
|
|
+ EIP1283ReenableTransition hexutil.Uint64 `json:"eip1283ReenableTransition"`
|
|
|
+ EIP1344Transition hexutil.Uint64 `json:"eip1344Transition"`
|
|
|
+ EIP1884Transition hexutil.Uint64 `json:"eip1884Transition"`
|
|
|
+ EIP2028Transition hexutil.Uint64 `json:"eip2028Transition"`
|
|
|
} `json:"params"`
|
|
|
|
|
|
Genesis struct {
|
|
|
@@ -278,17 +305,22 @@ type parityChainSpecAccount struct {
|
|
|
|
|
|
// parityChainSpecBuiltin is the precompiled contract definition.
|
|
|
type parityChainSpecBuiltin struct {
|
|
|
- Name string `json:"name,omitempty"`
|
|
|
- ActivateAt math2.HexOrDecimal64 `json:"activate_at,omitempty"`
|
|
|
- Pricing *parityChainSpecPricing `json:"pricing,omitempty"`
|
|
|
+ Name string `json:"name"` // Each builtin should has it own name
|
|
|
+ Pricing *parityChainSpecPricing `json:"pricing"` // Each builtin should has it own price strategy
|
|
|
+ ActivateAt *hexutil.Big `json:"activate_at,omitempty"` // ActivateAt can't be omitted if empty, default means no fork
|
|
|
+ EIP1108Transition *hexutil.Big `json:"eip1108_transition,omitempty"` // EIP1108Transition can't be omitted if empty, default means no fork
|
|
|
}
|
|
|
|
|
|
// parityChainSpecPricing represents the different pricing models that builtin
|
|
|
// contracts might advertise using.
|
|
|
type parityChainSpecPricing struct {
|
|
|
- Linear *parityChainSpecLinearPricing `json:"linear,omitempty"`
|
|
|
- ModExp *parityChainSpecModExpPricing `json:"modexp,omitempty"`
|
|
|
- AltBnPairing *parityChainSpecAltBnPairingPricing `json:"alt_bn128_pairing,omitempty"`
|
|
|
+ Linear *parityChainSpecLinearPricing `json:"linear,omitempty"`
|
|
|
+ ModExp *parityChainSpecModExpPricing `json:"modexp,omitempty"`
|
|
|
+ AltBnPairing *parityChainSpecAltBnPairingPricing `json:"alt_bn128_pairing,omitempty"`
|
|
|
+ AltBnConstOperation *parityChainSpecAltBnConstOperationPricing `json:"alt_bn128_const_operations,omitempty"`
|
|
|
+
|
|
|
+ // Blake2F is the price per round of Blake2 compression
|
|
|
+ Blake2F *parityChainSpecBlakePricing `json:"blake2_f,omitempty"`
|
|
|
}
|
|
|
|
|
|
type parityChainSpecLinearPricing struct {
|
|
|
@@ -300,9 +332,20 @@ type parityChainSpecModExpPricing struct {
|
|
|
Divisor uint64 `json:"divisor"`
|
|
|
}
|
|
|
|
|
|
+type parityChainSpecAltBnConstOperationPricing struct {
|
|
|
+ Price uint64 `json:"price"`
|
|
|
+ EIP1108TransitionPrice uint64 `json:"eip1108_transition_price,omitempty"` // Before Istanbul fork, this field is nil
|
|
|
+}
|
|
|
+
|
|
|
type parityChainSpecAltBnPairingPricing struct {
|
|
|
- Base uint64 `json:"base"`
|
|
|
- Pair uint64 `json:"pair"`
|
|
|
+ Base uint64 `json:"base"`
|
|
|
+ Pair uint64 `json:"pair"`
|
|
|
+ EIP1108TransitionBase uint64 `json:"eip1108_transition_base,omitempty"` // Before Istanbul fork, this field is nil
|
|
|
+ EIP1108TransitionPair uint64 `json:"eip1108_transition_pair,omitempty"` // Before Istanbul fork, this field is nil
|
|
|
+}
|
|
|
+
|
|
|
+type parityChainSpecBlakePricing struct {
|
|
|
+ GasPerRound uint64 `json:"gas_per_round"`
|
|
|
}
|
|
|
|
|
|
// newParityChainSpec converts a go-ethereum genesis block into a Parity specific
|
|
|
@@ -352,7 +395,10 @@ func newParityChainSpec(network string, genesis *core.Genesis, bootnodes []strin
|
|
|
if num := genesis.Config.PetersburgBlock; num != nil {
|
|
|
spec.setConstantinopleFix(num)
|
|
|
}
|
|
|
-
|
|
|
+ // Istanbul
|
|
|
+ if num := genesis.Config.IstanbulBlock; num != nil {
|
|
|
+ spec.setIstanbul(num)
|
|
|
+ }
|
|
|
spec.Params.MaximumExtraDataSize = (hexutil.Uint64)(params.MaximumExtraDataSize)
|
|
|
spec.Params.MinGasLimit = (hexutil.Uint64)(params.MinGasLimit)
|
|
|
spec.Params.GasLimitBoundDivisor = (math2.HexOrDecimal64)(params.GasLimitBoundDivisor)
|
|
|
@@ -398,18 +444,34 @@ func newParityChainSpec(network string, genesis *core.Genesis, bootnodes []strin
|
|
|
Name: "identity", Pricing: &parityChainSpecPricing{Linear: &parityChainSpecLinearPricing{Base: 15, Word: 3}},
|
|
|
})
|
|
|
if genesis.Config.ByzantiumBlock != nil {
|
|
|
- blnum := math2.HexOrDecimal64(genesis.Config.ByzantiumBlock.Uint64())
|
|
|
spec.setPrecompile(5, &parityChainSpecBuiltin{
|
|
|
- Name: "modexp", ActivateAt: blnum, Pricing: &parityChainSpecPricing{ModExp: &parityChainSpecModExpPricing{Divisor: 20}},
|
|
|
+ Name: "modexp", ActivateAt: (*hexutil.Big)(genesis.Config.ByzantiumBlock), Pricing: &parityChainSpecPricing{ModExp: &parityChainSpecModExpPricing{Divisor: 20}},
|
|
|
})
|
|
|
spec.setPrecompile(6, &parityChainSpecBuiltin{
|
|
|
- Name: "alt_bn128_add", ActivateAt: blnum, Pricing: &parityChainSpecPricing{Linear: &parityChainSpecLinearPricing{Base: 500}},
|
|
|
+ Name: "alt_bn128_add", ActivateAt: (*hexutil.Big)(genesis.Config.ByzantiumBlock), Pricing: &parityChainSpecPricing{AltBnConstOperation: &parityChainSpecAltBnConstOperationPricing{Price: 500}},
|
|
|
})
|
|
|
spec.setPrecompile(7, &parityChainSpecBuiltin{
|
|
|
- Name: "alt_bn128_mul", ActivateAt: blnum, Pricing: &parityChainSpecPricing{Linear: &parityChainSpecLinearPricing{Base: 40000}},
|
|
|
+ Name: "alt_bn128_mul", ActivateAt: (*hexutil.Big)(genesis.Config.ByzantiumBlock), Pricing: &parityChainSpecPricing{AltBnConstOperation: &parityChainSpecAltBnConstOperationPricing{Price: 40000}},
|
|
|
})
|
|
|
spec.setPrecompile(8, &parityChainSpecBuiltin{
|
|
|
- Name: "alt_bn128_pairing", ActivateAt: blnum, Pricing: &parityChainSpecPricing{AltBnPairing: &parityChainSpecAltBnPairingPricing{Base: 100000, Pair: 80000}},
|
|
|
+ Name: "alt_bn128_pairing", ActivateAt: (*hexutil.Big)(genesis.Config.ByzantiumBlock), Pricing: &parityChainSpecPricing{AltBnPairing: &parityChainSpecAltBnPairingPricing{Base: 100000, Pair: 80000}},
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if genesis.Config.IstanbulBlock != nil {
|
|
|
+ if genesis.Config.ByzantiumBlock == nil {
|
|
|
+ return nil, errors.New("invalid genesis, istanbul fork is enabled while byzantium is not")
|
|
|
+ }
|
|
|
+ spec.setPrecompile(6, &parityChainSpecBuiltin{
|
|
|
+ Name: "alt_bn128_add", ActivateAt: (*hexutil.Big)(genesis.Config.ByzantiumBlock), EIP1108Transition: (*hexutil.Big)(genesis.Config.IstanbulBlock), Pricing: &parityChainSpecPricing{AltBnConstOperation: &parityChainSpecAltBnConstOperationPricing{Price: 500, EIP1108TransitionPrice: 150}},
|
|
|
+ })
|
|
|
+ spec.setPrecompile(7, &parityChainSpecBuiltin{
|
|
|
+ Name: "alt_bn128_mul", ActivateAt: (*hexutil.Big)(genesis.Config.ByzantiumBlock), EIP1108Transition: (*hexutil.Big)(genesis.Config.IstanbulBlock), Pricing: &parityChainSpecPricing{AltBnConstOperation: &parityChainSpecAltBnConstOperationPricing{Price: 40000, EIP1108TransitionPrice: 6000}},
|
|
|
+ })
|
|
|
+ spec.setPrecompile(8, &parityChainSpecBuiltin{
|
|
|
+ Name: "alt_bn128_pairing", ActivateAt: (*hexutil.Big)(genesis.Config.ByzantiumBlock), EIP1108Transition: (*hexutil.Big)(genesis.Config.IstanbulBlock), Pricing: &parityChainSpecPricing{AltBnPairing: &parityChainSpecAltBnPairingPricing{Base: 100000, Pair: 80000, EIP1108TransitionBase: 45000, EIP1108TransitionPair: 34000}},
|
|
|
+ })
|
|
|
+ spec.setPrecompile(9, &parityChainSpecBuiltin{
|
|
|
+ Name: "blake2_f", ActivateAt: (*hexutil.Big)(genesis.Config.IstanbulBlock), Pricing: &parityChainSpecPricing{Blake2F: &parityChainSpecBlakePricing{GasPerRound: 1}},
|
|
|
})
|
|
|
}
|
|
|
return spec, nil
|
|
|
@@ -451,6 +513,15 @@ func (spec *parityChainSpec) setConstantinopleFix(num *big.Int) {
|
|
|
spec.Params.EIP1283DisableTransition = hexutil.Uint64(num.Uint64())
|
|
|
}
|
|
|
|
|
|
+func (spec *parityChainSpec) setIstanbul(num *big.Int) {
|
|
|
+ // spec.Params.EIP152Transition = hexutil.Uint64(num.Uint64())
|
|
|
+ // spec.Params.EIP1108Transition = hexutil.Uint64(num.Uint64())
|
|
|
+ spec.Params.EIP1344Transition = hexutil.Uint64(num.Uint64())
|
|
|
+ spec.Params.EIP1884Transition = hexutil.Uint64(num.Uint64())
|
|
|
+ spec.Params.EIP2028Transition = hexutil.Uint64(num.Uint64())
|
|
|
+ spec.Params.EIP1283ReenableTransition = hexutil.Uint64(num.Uint64())
|
|
|
+}
|
|
|
+
|
|
|
// pyEthereumGenesisSpec represents the genesis specification format used by the
|
|
|
// Python Ethereum implementation.
|
|
|
type pyEthereumGenesisSpec struct {
|