Skip to content

Commit

Permalink
Merge pull request #449 from lochjin/main
Browse files Browse the repository at this point in the history
gaslimit fork for meerevm
  • Loading branch information
dindinw authored May 28, 2023
2 parents 1bfbd10 + 3f5f161 commit 6d1b8b3
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
24 changes: 24 additions & 0 deletions consensus/forks/gaslimitfork.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package forks

import (
mparams "github.com/Qitmeer/qng/meerevm/params"
)

const (
// New gas limit for evm block
GasLimitForkEVMHeight = 606567
)

func IsGasLimitForkHeight(number int64, chainID int64) bool {
if chainID != mparams.QngMainnetChainConfig.ChainID.Int64() {
return false
}
return number >= GasLimitForkEVMHeight
}

func NeedFixedGasLimit(number int64, chainID int64) bool {
if chainID != mparams.QngMainnetChainConfig.ChainID.Int64() {
return false
}
return !IsGasLimitForkHeight(number, chainID)
}
6 changes: 2 additions & 4 deletions meerevm/meer/meerchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ package meer
import (
"encoding/hex"
"fmt"
"github.com/Qitmeer/qng/consensus/forks"
"github.com/Qitmeer/qng/consensus/model"
"github.com/Qitmeer/qng/consensus/vm"
qtypes "github.com/Qitmeer/qng/core/types"
qcommon "github.com/Qitmeer/qng/meerevm/common"
"github.com/Qitmeer/qng/meerevm/eth"
mparams "github.com/Qitmeer/qng/meerevm/params"
"github.com/Qitmeer/qng/rpc/api"
qconsensus "github.com/Qitmeer/qng/vm/consensus"
"github.com/ethereum/go-ethereum/common"
Expand Down Expand Up @@ -80,11 +80,9 @@ func (b *MeerChain) buildBlock(parent *types.Header, qtxs []model.Tx, timestamp
}
gaslimit := core.CalcGasLimit(parentBlock.GasLimit(), b.meerpool.config.GasCeil)

// --------Will be discard in the future --------------------
if config.ChainID.Int64() == mparams.QngMainnetChainConfig.ChainID.Int64() {
if forks.NeedFixedGasLimit(parent.Number.Int64(), config.ChainID.Int64()) {
gaslimit = 0x10000000000000
}
// ----------------------------------------------------------

header := makeHeader(&b.chain.Config().Eth, parentBlock, statedb, timestamp, gaslimit)

Expand Down
7 changes: 0 additions & 7 deletions meerevm/meer/meerpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"fmt"
"github.com/Qitmeer/qng/common/hash"
"github.com/Qitmeer/qng/core/blockchain/opreturn"
mparams "github.com/Qitmeer/qng/meerevm/params"
"github.com/ethereum/go-ethereum/core/txpool"
"github.com/ethereum/go-ethereum/miner"
"math/big"
Expand Down Expand Up @@ -377,12 +376,6 @@ func (m *MeerPool) updateTemplate(timestamp int64) {
}
gaslimit := core.CalcGasLimit(parent.GasLimit, m.config.GasCeil)

// --------Will be discard in the future --------------------
if m.chainConfig.ChainID.Int64() == mparams.QngMainnetChainConfig.ChainID.Int64() {
gaslimit = params.MaxGasLimit
}
// ----------------------------------------------------------

num := big.NewInt(0)
num.Set(parent.Number)
header := &types.Header{
Expand Down

0 comments on commit 6d1b8b3

Please sign in to comment.