Skip to content

Commit

Permalink
update the constants for conssensus
Browse files Browse the repository at this point in the history
  • Loading branch information
mapdev33 committed Jan 24, 2024
1 parent 14bfb03 commit 5542471
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
11 changes: 6 additions & 5 deletions consensus/misc/dao.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

"github.com/mapprotocol/atlas/core/state"
"github.com/mapprotocol/atlas/core/types"
"github.com/ethereum/go-ethereum/params"
"github.com/mapprotocol/atlas/params"
)

var (
Expand All @@ -40,10 +40,11 @@ var (
// ensure it conforms to DAO hard-fork rules.
//
// DAO hard-fork extension to the header validity:
// a) if the node is no-fork, do not accept blocks in the [fork, fork+10) range
// with the fork specific extra-data set
// b) if the node is pro-fork, require blocks in the specific range to have the
// unique extra-data set.
//
// a) if the node is no-fork, do not accept blocks in the [fork, fork+10) range
// with the fork specific extra-data set
// b) if the node is pro-fork, require blocks in the specific range to have the
// unique extra-data set.
func VerifyDAOHeaderExtraData(config *params.ChainConfig, header *types.Header) error {
// Short circuit validation if the node doesn't care about the DAO fork
if config.DAOForkBlock == nil {
Expand Down
9 changes: 4 additions & 5 deletions consensus/misc/eip1559.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/math"
ethparams "github.com/ethereum/go-ethereum/params"

"github.com/mapprotocol/atlas/core/types"
"github.com/mapprotocol/atlas/params"
Expand All @@ -35,7 +34,7 @@ func VerifyEip1559Header(config *params.ChainConfig, parent, header *types.Heade
// Verify that the gas limit remains within allowed bounds
parentGasLimit := parent.GasLimit
if !config.IsLondon(parent.Number) {
parentGasLimit = parent.GasLimit * ethparams.ElasticityMultiplier
parentGasLimit = parent.GasLimit * params.ElasticityMultiplier
}
if err := VerifyGaslimit(parentGasLimit, header.GasLimit); err != nil {
return err
Expand All @@ -57,12 +56,12 @@ func VerifyEip1559Header(config *params.ChainConfig, parent, header *types.Heade
func CalcBaseFee(config *params.ChainConfig, parent *types.Header) *big.Int {
// If the current block is the first EIP-1559 block, return the InitialBaseFee.
if !config.IsLondon(parent.Number) {
return new(big.Int).SetUint64(ethparams.InitialBaseFee)
return new(big.Int).SetUint64(params.InitialBaseFee)
}
var (
parentGasTarget = parent.GasLimit / ethparams.ElasticityMultiplier
parentGasTarget = parent.GasLimit / params.ElasticityMultiplier
parentGasTargetBig = new(big.Int).SetUint64(parentGasTarget)
baseFeeChangeDenominator = new(big.Int).SetUint64(ethparams.BaseFeeChangeDenominator)
baseFeeChangeDenominator = new(big.Int).SetUint64(params.BaseFeeChangeDenominator)
newBaseFee = big.NewInt(0)
)
// If the parent gasUsed is the same as the target, the baseFee remains unchanged.
Expand Down
2 changes: 1 addition & 1 deletion consensus/misc/forks.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (

"github.com/ethereum/go-ethereum/common"
"github.com/mapprotocol/atlas/core/types"
"github.com/ethereum/go-ethereum/params"
"github.com/mapprotocol/atlas/params"
)

// VerifyForkHashes verifies that blocks conforming to network hard-forks do have
Expand Down
2 changes: 1 addition & 1 deletion consensus/misc/gaslimit.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"errors"
"fmt"

"github.com/ethereum/go-ethereum/params"
"github.com/mapprotocol/atlas/params"
)

// VerifyGaslimit verifies the header gas limit according increase/decrease
Expand Down
12 changes: 6 additions & 6 deletions core/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ package core

import (
"crypto/ecdsa"
"github.com/mapprotocol/atlas/consensus/consensustest"
"github.com/mapprotocol/atlas/core/chain"
params2 "github.com/mapprotocol/atlas/params"
"io/ioutil"
"math/big"
"os"
"testing"

"github.com/mapprotocol/atlas/consensus/consensustest"
"github.com/mapprotocol/atlas/core/chain"
"github.com/mapprotocol/atlas/params"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/math"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/params"
"github.com/mapprotocol/atlas/core/rawdb"
"github.com/mapprotocol/atlas/core/types"
"github.com/mapprotocol/atlas/core/vm"
Expand Down Expand Up @@ -169,7 +169,7 @@ func benchInsertChain(b *testing.B, disk bool, gen func(int, *chain.BlockGen)) {
// Generate a chain of b.N blocks using the supplied block
// generator function.
gspec := chain.Genesis{
Config: params2.TestChainConfig,
Config: params.TestChainConfig,
Alloc: chain.GenesisAlloc{benchRootAddr: {Balance: benchRootFunds}},
}
genesis := gspec.MustCommit(db)
Expand Down Expand Up @@ -287,7 +287,7 @@ func benchReadChain(b *testing.B, full bool, count uint64) {
if err != nil {
b.Fatalf("error opening database at %v: %v", dir, err)
}
chain, err := chain.NewBlockChain(db, nil, params2.TestChainConfig, consensustest.NewFaker(), vm.Config{}, nil, nil)
chain, err := chain.NewBlockChain(db, nil, params.TestChainConfig, consensustest.NewFaker(), vm.Config{}, nil, nil)
if err != nil {
b.Fatalf("error creating chain: %v", err)
}
Expand Down

0 comments on commit 5542471

Please sign in to comment.