Skip to content

Commit

Permalink
rename upgrade name
Browse files Browse the repository at this point in the history
  • Loading branch information
abelliumnt authored and pandainzoo committed May 22, 2024
1 parent 1195f7a commit a16aca1
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion core/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,8 @@ func SetupGenesisBlockWithOverride(db ethdb.Database, triedb *trie.Database, gen
if mantleUpgradeChainConfig != nil {
config.BaseFeeTime = mantleUpgradeChainConfig.BaseFeeTime
config.BVMETHMintUpgradeTime = mantleUpgradeChainConfig.BVMETHMintUpgradeTime
config.MetaTxV1UpgradeTime = mantleUpgradeChainConfig.MetaTxV1UpgradeTime
config.MetaTxV2UpgradeTime = mantleUpgradeChainConfig.MetaTxV2UpgradeTime
config.MetaTxV3UpgradeTime = mantleUpgradeChainConfig.MetaTxV3UpgradeTime
}

if overrides != nil && overrides.OverrideShanghai != nil {
Expand Down
14 changes: 7 additions & 7 deletions core/mantle_upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,29 @@ var (
ChainID: params.MantleMainnetChainId,
BaseFeeTime: u64Ptr(0),
BVMETHMintUpgradeTime: u64Ptr(0),
MetaTxV1UpgradeTime: u64Ptr(0),
MetaTxV2UpgradeTime: u64Ptr(0), //TODO set upgrade timestamp
MetaTxV2UpgradeTime: u64Ptr(0),
MetaTxV3UpgradeTime: u64Ptr(0), //TODO set upgrade timestamp
}

MantleSepoliaUpgradeConfig = MantleUpgradeChainConfig{
ChainID: params.MantleSepoliaChainId,
BaseFeeTime: u64Ptr(1_704_891_600),
BVMETHMintUpgradeTime: nil, //TODO set upgrade timestamp
MetaTxV1UpgradeTime: nil, //TODO set upgrade timestamp
MetaTxV2UpgradeTime: nil, //TODO set upgrade timestamp
MetaTxV3UpgradeTime: nil, //TODO set upgrade timestamp
}
MantleLocalUpgradeConfig = MantleUpgradeChainConfig{
ChainID: params.MantleLocalChainId,
BaseFeeTime: u64Ptr(0),
BVMETHMintUpgradeTime: u64Ptr(0),
MetaTxV1UpgradeTime: u64Ptr(0),
MetaTxV2UpgradeTime: u64Ptr(0),
MetaTxV3UpgradeTime: u64Ptr(0),
}
MantleDefaultUpgradeConfig = MantleUpgradeChainConfig{
BaseFeeTime: u64Ptr(0),
BVMETHMintUpgradeTime: u64Ptr(0),
MetaTxV1UpgradeTime: u64Ptr(0),
MetaTxV2UpgradeTime: u64Ptr(0),
MetaTxV3UpgradeTime: u64Ptr(0),
}
)

Expand All @@ -42,8 +42,8 @@ type MantleUpgradeChainConfig struct {

BaseFeeTime *uint64 `json:"baseFeeTime"` // Mantle BaseFee switch time (nil = no fork, 0 = already on mantle baseFee)
BVMETHMintUpgradeTime *uint64 `json:"bvmETHMintUpgradeTime"` // BVM_ETH mint upgrade switch time (nil = no fork, 0 = already on)
MetaTxV1UpgradeTime *uint64 `json:"metaTxV1UpgradeTime"` // MetaTxV1UpgradeBlock identifies the current block height is using metaTx with MetaTxSignDataV2
MetaTxV2UpgradeTime *uint64 `json:"metaTxV2UpgradeTime"` // MetaTxV2UpgradeBlock identifies the current block height is using metaTx with MetaTxSignDataV3
MetaTxV2UpgradeTime *uint64 `json:"metaTxV2UpgradeTime"` // MetaTxV1UpgradeBlock identifies the current block height is using metaTx with MetaTxSignDataV2
MetaTxV3UpgradeTime *uint64 `json:"metaTxV3UpgradeTime"` // MetaTxV3UpgradeBlock identifies the current block height is ensuring sponsor and sender are not the same
}

func GetUpgradeConfigForMantle(chainID *big.Int) *MantleUpgradeChainConfig {
Expand Down
9 changes: 6 additions & 3 deletions core/txpool/txpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,8 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error {
}

metaTxParams, err := types.DecodeAndVerifyMetaTxParams(tx,
pool.chainconfig.IsMetaTxV2(pool.chain.CurrentBlock().Time), pool.chainconfig.IsMetaTxV3(pool.chain.CurrentBlock().Time))
pool.chainconfig.IsMetaTxV2(pool.chain.CurrentBlock().Time),
pool.chainconfig.IsMetaTxV3(pool.chain.CurrentBlock().Time))
if err != nil {
return err
}
Expand Down Expand Up @@ -739,7 +740,8 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error {
replCost = replCost.Add(cost, replL1Cost)
}
replMetaTxParams, err := types.DecodeAndVerifyMetaTxParams(repl,
pool.chainconfig.IsMetaTxV2(pool.chain.CurrentBlock().Time), pool.chainconfig.IsMetaTxV3(pool.chain.CurrentBlock().Time))
pool.chainconfig.IsMetaTxV2(pool.chain.CurrentBlock().Time),
pool.chainconfig.IsMetaTxV3(pool.chain.CurrentBlock().Time))
if err != nil {
return err
}
Expand Down Expand Up @@ -1528,7 +1530,8 @@ func (pool *TxPool) validateMetaTxList(list *list) ([]*types.Transaction, *big.I
sponsorCostSumPerSponsor := make(map[common.Address]*big.Int)
for _, tx := range list.txs.Flatten() {
metaTxParams, err := types.DecodeAndVerifyMetaTxParams(tx,
pool.chainconfig.IsMetaTxV2(pool.chain.CurrentBlock().Time), pool.chainconfig.IsMetaTxV3(pool.chain.CurrentBlock().Time))
pool.chainconfig.IsMetaTxV2(pool.chain.CurrentBlock().Time),
pool.chainconfig.IsMetaTxV3(pool.chain.CurrentBlock().Time))
if err != nil {
invalidMetaTxs = append(invalidMetaTxs, tx)
continue
Expand Down
3 changes: 2 additions & 1 deletion light/txpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,8 @@ func (pool *TxPool) validateTx(ctx context.Context, tx *types.Transaction) error
return txpool.ErrNegativeValue
}

metaTxParams, err := types.DecodeAndVerifyMetaTxParams(tx, pool.config.IsMetaTxV2(header.Time), pool.config.IsMetaTxV3(header.Time))
metaTxParams, err := types.DecodeAndVerifyMetaTxParams(tx,
pool.config.IsMetaTxV2(header.Time), pool.config.IsMetaTxV3(header.Time))
if err != nil {
return err
}
Expand Down
8 changes: 4 additions & 4 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,8 @@ type ChainConfig struct {
BVMETHMintUpgradeTime *uint64 `json:"bvmETHMintUpgradeTime,omitempty"` // BVM_ETH mint upgrade switch time (nil = no fork, 0 = already on)

// MetaTx upgrade config
MetaTxV1UpgradeTime *uint64 `json:"metaTxV1UpgradeTime,omitempty"` // MetaTxUpgradeTime switch time ( nil = no fork, 0 = already forked)
MetaTxV2UpgradeTime *uint64 `json:"metaTxV2UpgradeTime,omitempty"` // MetaTxUpgradeTime switch time ( nil = no fork, 0 = already forked)
MetaTxV2UpgradeTime *uint64 `json:"metaTxV2UpgradeTime,omitempty"` // MetaTxV2UpgradeTime switch time ( nil = no fork, 0 = already forked)
MetaTxV3UpgradeTime *uint64 `json:"metaTxV3UpgradeTime,omitempty"` // MetaTxV3UpgradeTime switch time ( nil = no fork, 0 = already forked)

// Fork scheduling was switched from blocks to timestamps here

Expand Down Expand Up @@ -689,12 +689,12 @@ func (c *ChainConfig) IsMantleBVMETHMintUpgrade(time uint64) bool {

// IsMetaTxV2 returns whether time is either equal to the MetaTx fork time or greater.
func (c *ChainConfig) IsMetaTxV2(time uint64) bool {
return isTimestampForked(c.MetaTxV1UpgradeTime, time)
return isTimestampForked(c.MetaTxV2UpgradeTime, time)
}

// IsMetaTxV3 returns whether time is either equal to the MetaTx fork time or greater.
func (c *ChainConfig) IsMetaTxV3(time uint64) bool {
return isTimestampForked(c.MetaTxV2UpgradeTime, time)
return isTimestampForked(c.MetaTxV3UpgradeTime, time)
}

// IsArrowGlacier returns whether num is either equal to the Arrow Glacier (EIP-4345) fork block or greater.
Expand Down

0 comments on commit a16aca1

Please sign in to comment.