mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-28 07:36:44 +00:00
feat(consensus): introduce AnchorV3GasLimit (#378)
* feat(consensus): introduce `AnchorV3GasLimit` * feat(consensus): introduce `AnchorV3GasLimit`
This commit is contained in:
parent
7bf5c0d259
commit
a0b97be30c
3 changed files with 26 additions and 3 deletions
|
|
@ -39,7 +39,8 @@ var (
|
|||
AnchorV3Selector = crypto.Keccak256(
|
||||
[]byte("anchorV3(uint64,bytes32,bytes32,uint32,(uint8,uint8,uint32,uint64,uint32),bytes32[])"),
|
||||
)[:4]
|
||||
AnchorGasLimit = uint64(250_000)
|
||||
AnchorGasLimit = uint64(250_000)
|
||||
AnchorV3GasLimit = uint64(1_000_000)
|
||||
)
|
||||
|
||||
// Taiko is a consensus engine used by L2 rollup.
|
||||
|
|
@ -313,8 +314,14 @@ func (t *Taiko) ValidateAnchorTx(tx *types.Transaction, header *types.Header) (b
|
|||
return false, nil
|
||||
}
|
||||
|
||||
if tx.Gas() != AnchorGasLimit {
|
||||
return false, nil
|
||||
if t.chainConfig.IsPacaya(header.Number) {
|
||||
if tx.Gas() != AnchorV3GasLimit {
|
||||
return false, nil
|
||||
}
|
||||
} else {
|
||||
if tx.Gas() != AnchorGasLimit {
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
|
||||
if tx.GasFeeCap().Cmp(header.BaseFee) != 0 {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,11 @@ var (
|
|||
PreconfDevnetOntakeBlock = common.Big0
|
||||
HeklaOntakeBlock = new(big.Int).SetUint64(840_512)
|
||||
MainnetOntakeBlock = new(big.Int).SetUint64(538_304)
|
||||
|
||||
InternalDevnetPacayaBlock = new(big.Int).SetUint64(10)
|
||||
PreconfDevnetPacayaBlock = common.Big0
|
||||
HeklaPacayaBlock = new(big.Int).SetUint64(999_999_999_999)
|
||||
MainnetPacayaBlock = new(big.Int).SetUint64(999_999_999_999)
|
||||
)
|
||||
|
||||
// TaikoGenesisBlock returns the Taiko network genesis block configs.
|
||||
|
|
@ -25,10 +30,12 @@ func TaikoGenesisBlock(networkID uint64) *Genesis {
|
|||
case params.TaikoMainnetNetworkID.Uint64():
|
||||
chainConfig.ChainID = params.TaikoMainnetNetworkID
|
||||
chainConfig.OntakeBlock = MainnetOntakeBlock
|
||||
chainConfig.PacayaBlock = MainnetPacayaBlock
|
||||
allocJSON = taikoGenesis.MainnetGenesisAllocJSON
|
||||
case params.TaikoInternalL2ANetworkID.Uint64():
|
||||
chainConfig.ChainID = params.TaikoInternalL2ANetworkID
|
||||
chainConfig.OntakeBlock = InternalDevnetOntakeBlock
|
||||
chainConfig.PacayaBlock = InternalDevnetPacayaBlock
|
||||
allocJSON = taikoGenesis.InternalL2AGenesisAllocJSON
|
||||
case params.TaikoInternalL2BNetworkID.Uint64():
|
||||
chainConfig.ChainID = params.TaikoInternalL2BNetworkID
|
||||
|
|
@ -54,14 +61,17 @@ func TaikoGenesisBlock(networkID uint64) *Genesis {
|
|||
case params.HeklaNetworkID.Uint64():
|
||||
chainConfig.ChainID = params.HeklaNetworkID
|
||||
chainConfig.OntakeBlock = HeklaOntakeBlock
|
||||
chainConfig.PacayaBlock = HeklaPacayaBlock
|
||||
allocJSON = taikoGenesis.HeklaGenesisAllocJSON
|
||||
case params.PreconfDevnetNetworkID.Uint64():
|
||||
chainConfig.ChainID = params.PreconfDevnetNetworkID
|
||||
chainConfig.OntakeBlock = PreconfDevnetOntakeBlock
|
||||
chainConfig.PacayaBlock = PreconfDevnetPacayaBlock
|
||||
allocJSON = taikoGenesis.PreconfDevnetGenesisAllocJSON
|
||||
default:
|
||||
chainConfig.ChainID = params.TaikoInternalL2ANetworkID
|
||||
chainConfig.OntakeBlock = InternalDevnetOntakeBlock
|
||||
chainConfig.PacayaBlock = InternalDevnetPacayaBlock
|
||||
allocJSON = taikoGenesis.InternalL2AGenesisAllocJSON
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -359,6 +359,7 @@ type ChainConfig struct {
|
|||
// CHANGE(taiko): Taiko network flag.
|
||||
Taiko bool `json:"taiko"`
|
||||
OntakeBlock *big.Int `json:"ontakeBlock,omitempty"` // Ontake switch block (nil = no fork, 0 = already activated)
|
||||
PacayaBlock *big.Int `json:"pacayaBlock,omitempty"` // Ontake switch block (nil = no fork, 0 = already activated)
|
||||
}
|
||||
|
||||
// EthashConfig is the consensus engine configs for proof-of-work based sealing.
|
||||
|
|
@ -580,6 +581,11 @@ func (c *ChainConfig) IsOntake(num *big.Int) bool {
|
|||
return isBlockForked(c.OntakeBlock, num)
|
||||
}
|
||||
|
||||
// CHANGE(taiko): IsPacaya returns whether num is either equal to the pacaya fork block or greater.
|
||||
func (c *ChainConfig) IsPacaya(num *big.Int) bool {
|
||||
return isBlockForked(c.PacayaBlock, num)
|
||||
}
|
||||
|
||||
// IsEIP4762 returns whether eip 4762 has been activated at given block.
|
||||
func (c *ChainConfig) IsEIP4762(num *big.Int, time uint64) bool {
|
||||
return c.IsVerkle(num, time)
|
||||
|
|
|
|||
Loading…
Reference in a new issue