diff --git a/core/state_transition.go b/core/state_transition.go index ea15de7b1c54..b74a2766d19e 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -198,7 +198,7 @@ func (st *StateTransition) to() common.Address { func (st *StateTransition) buyGas() error { // fee delegation if st.msg.FeePayer() != nil { - if !st.evm.ChainConfig().IsFeeDelegation(st.evm.Context.BlockNumber) { + if !st.evm.ChainConfig().IsApplepie(st.evm.Context.BlockNumber) { return fmt.Errorf("%w: fee delegation type not supported", ErrTxTypeNotSupported) } FDmgval := new(big.Int).SetUint64(st.msg.Gas()) diff --git a/core/tx_pool.go b/core/tx_pool.go index 93fb9c0db4f2..e4b1ed565e6f 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -1396,7 +1396,7 @@ func (pool *TxPool) reset(oldHead, newHead *types.Header) { pool.eip2718 = pool.chainconfig.IsBerlin(next) pool.eip1559 = pool.chainconfig.IsLondon(next) // fee delegation - pool.feedelegation = pool.chainconfig.IsFeeDelegation(next) + pool.feedelegation = pool.chainconfig.IsApplepie(next) } // promoteExecutables moves transactions that have become processable from the diff --git a/light/txpool.go b/light/txpool.go index f890c534abd0..c34998252fb5 100644 --- a/light/txpool.go +++ b/light/txpool.go @@ -321,7 +321,7 @@ func (pool *TxPool) setNewHead(head *types.Header) { pool.istanbul = pool.config.IsIstanbul(next) pool.eip2718 = pool.config.IsBerlin(next) // fee delegation - pool.feedelegation = pool.config.IsFeeDelegation(next) + pool.feedelegation = pool.config.IsApplepie(next) } // Stop stops the light transaction pool diff --git a/params/config.go b/params/config.go index c5458df0b002..8f09208ffffd 100644 --- a/params/config.go +++ b/params/config.go @@ -178,6 +178,7 @@ var ( BerlinBlock: big.NewInt(0), LondonBlock: big.NewInt(0), PangyoBlock: big.NewInt(10_000_000), + ApplepieBlock: big.NewInt(26_240_268), Ethash: new(EthashConfig), } @@ -301,16 +302,16 @@ var ( // // 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), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, 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), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, 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), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, nil, 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), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, nil, 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), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, 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), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, nil, nil, new(EthashConfig), nil} TestRules = TestChainConfig.Rules(new(big.Int), false) ) @@ -392,6 +393,7 @@ type ChainConfig struct { ArrowGlacierBlock *big.Int `json:"arrowGlacierBlock,omitempty"` // Eip-4345 (bomb delay) switch block (nil = no fork, 0 = already activated) MergeForkBlock *big.Int `json:"mergeForkBlock,omitempty"` // EIP-3675 (TheMerge) switch block (nil = no fork, 0 = already in merge proceedings) PangyoBlock *big.Int `json:"pangyoBlock,omitempty"` // Pangyo switch block (nil = no fork, 0 = already on pangyo) + ApplepieBlock *big.Int `json:"applepieBlock,omitempty"` // Applepie switch block (nil = no fork, 0 = already on applepie) // TerminalTotalDifficulty is the amount of total difficulty reached by // the network that triggers the consensus upgrade. @@ -432,7 +434,7 @@ func (c *ChainConfig) String() string { default: engine = "unknown" } - return fmt.Sprintf("{ChainID: %v Homestead: %v DAO: %v DAOSupport: %v EIP150: %v EIP155: %v EIP158: %v Byzantium: %v Constantinople: %v Petersburg: %v Istanbul: %v, Muir Glacier: %v, Berlin: %v, London: %v, Arrow Glacier: %v, MergeFork: %v, Terminal TD: %v, Engine: %v}", + return fmt.Sprintf("{ChainID: %v Homestead: %v DAO: %v DAOSupport: %v EIP150: %v EIP155: %v EIP158: %v Byzantium: %v Constantinople: %v Petersburg: %v Istanbul: %v, Muir Glacier: %v, Berlin: %v, London: %v, Arrow Glacier: %v, MergeFork: %v, PangyoFork: %v, ApplepieFork: %v, Terminal TD: %v, Engine: %v}", c.ChainID, c.HomesteadBlock, c.DAOForkBlock, @@ -449,6 +451,8 @@ func (c *ChainConfig) String() string { c.LondonBlock, c.ArrowGlacierBlock, c.MergeForkBlock, + c.PangyoBlock, + c.ApplepieBlock, c.TerminalTotalDifficulty, engine, ) @@ -522,13 +526,9 @@ func (c *ChainConfig) IsPangyo(num *big.Int) bool { } // fee delegation -// IsFeeDelegation returns whether num is either equal to the fee delegation fork block or greater. -func (c *ChainConfig) IsFeeDelegation(num *big.Int) bool { - // TBD - // Test code - //FeeDelegateBlock := big.NewInt(277000) - //return isForked(FeeDelegateBlock, num) - return false +// IsApplepie returns whether num is either equal to the Applepie fork block or greater. +func (c *ChainConfig) IsApplepie(num *big.Int) bool { + return isForked(c.ApplepieBlock, num) } // IsArrowGlacier returns whether num is either equal to the Arrow Glacier (EIP-4345) fork block or greater. @@ -735,7 +735,7 @@ type Rules struct { IsByzantium, IsConstantinople, IsPetersburg, IsIstanbul bool IsBerlin, IsLondon bool IsMerge bool - IsPangyo bool + IsPangyo, IsApplepie bool } // Rules ensures c's ChainID is not nil. @@ -758,5 +758,6 @@ func (c *ChainConfig) Rules(num *big.Int, isMerge bool) Rules { IsLondon: c.IsLondon(num), IsMerge: isMerge, IsPangyo: c.IsPangyo(num), + IsApplepie: c.IsApplepie(num), } } diff --git a/wemix/scripts/genesis-template.json b/wemix/scripts/genesis-template.json index f4fb7e159f2c..44a2860fbf5e 100644 --- a/wemix/scripts/genesis-template.json +++ b/wemix/scripts/genesis-template.json @@ -27,6 +27,7 @@ "istanbulBlock": 0, "londonBlock": 0, "muirGlacierBlock": 0, - "pangyoBlock": 0 + "pangyoBlock": 0, + "applepieBlock": 0 } }