mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 02:40:45 +00:00
clean up the configuration of the BAL execution mode based on the preset flag specified
This commit is contained in:
parent
24b6d44201
commit
af8d1ad024
6 changed files with 24 additions and 20 deletions
|
|
@ -20,6 +20,7 @@ import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/ethereum/go-ethereum/core/types/bal"
|
||||||
"os"
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
@ -243,12 +244,12 @@ func makeFullNode(ctx *cli.Context) *node.Node {
|
||||||
if ctx.IsSet(utils.BlockAccessListExecutionModeFlag.Name) {
|
if ctx.IsSet(utils.BlockAccessListExecutionModeFlag.Name) {
|
||||||
val := ctx.String(utils.BlockAccessListExecutionModeFlag.Name)
|
val := ctx.String(utils.BlockAccessListExecutionModeFlag.Name)
|
||||||
switch val {
|
switch val {
|
||||||
case utils.BalExecutionModeFull:
|
case utils.BalExecutionModeOptimized:
|
||||||
cfg.Eth.BALExecutionMode = 0
|
cfg.Eth.BALExecutionMode = bal.BALExecutionOptimized
|
||||||
case utils.BalExecutionModeNoBatchIO:
|
case utils.BalExecutionModeNoBatchIO:
|
||||||
cfg.Eth.BALExecutionMode = 1
|
cfg.Eth.BALExecutionMode = bal.BALExecutionNoBatchIO
|
||||||
case utils.BalExecutionModeSequential:
|
case utils.BalExecutionModeSequential:
|
||||||
cfg.Eth.BALExecutionMode = 2
|
cfg.Eth.BALExecutionMode = bal.BALExecutionSequential
|
||||||
default:
|
default:
|
||||||
utils.Fatalf("invalid option for --bal.executionmode: %s. acceptable values are full|nobatchio|sequential", val)
|
utils.Fatalf("invalid option for --bal.executionmode: %s. acceptable values are full|nobatchio|sequential", val)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1124,13 +1124,13 @@ block access list execution type. possible inputs are:
|
||||||
- sequential: no performance acceleration
|
- sequential: no performance acceleration
|
||||||
- full: parallel transaction execution, state root calculation, async warming of access list reads
|
- full: parallel transaction execution, state root calculation, async warming of access list reads
|
||||||
- nobatchio: same as 'full', but without async warming of access list reads`,
|
- nobatchio: same as 'full', but without async warming of access list reads`,
|
||||||
Value: BalExecutionModeFull,
|
Value: BalExecutionModeOptimized,
|
||||||
Category: flags.MiscCategory,
|
Category: flags.MiscCategory,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
BalExecutionModeFull = "full"
|
BalExecutionModeOptimized = "full"
|
||||||
BalExecutionModeNoBatchIO = "nobatchio"
|
BalExecutionModeNoBatchIO = "nobatchio"
|
||||||
BalExecutionModeSequential = "sequential"
|
BalExecutionModeSequential = "sequential"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -179,12 +179,6 @@ const (
|
||||||
BlockChainVersion uint64 = 9
|
BlockChainVersion uint64 = 9
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
BALExecutionModeFull = 0
|
|
||||||
BALExecutionModeNoBatchIO = iota
|
|
||||||
BALExecutionModeSequential = iota
|
|
||||||
)
|
|
||||||
|
|
||||||
// BlockChainConfig contains the configuration of the BlockChain object.
|
// BlockChainConfig contains the configuration of the BlockChain object.
|
||||||
type BlockChainConfig struct {
|
type BlockChainConfig struct {
|
||||||
// Trie database related options
|
// Trie database related options
|
||||||
|
|
@ -246,8 +240,7 @@ type BlockChainConfig struct {
|
||||||
StatelessSelfValidation bool // Generate execution witnesses and self-check against them (testing purpose)
|
StatelessSelfValidation bool // Generate execution witnesses and self-check against them (testing purpose)
|
||||||
EnableWitnessStats bool // Whether trie access statistics collection is enabled
|
EnableWitnessStats bool // Whether trie access statistics collection is enabled
|
||||||
|
|
||||||
// TODO clean this config up to use defined constants...
|
BALExecutionMode bal.BALExecutionMode
|
||||||
BALExecutionMode int
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DefaultConfig returns the default config.
|
// DefaultConfig returns the default config.
|
||||||
|
|
@ -609,7 +602,7 @@ func (bc *BlockChain) processBlockWithAccessList(parentRoot common.Hash, block *
|
||||||
statedb *state.StateDB
|
statedb *state.StateDB
|
||||||
)
|
)
|
||||||
|
|
||||||
useAsyncReads := bc.cfg.BALExecutionMode != BALExecutionModeNoBatchIO
|
useAsyncReads := bc.cfg.BALExecutionMode != bal.BALExecutionNoBatchIO
|
||||||
al := block.AccessList() // TODO: make the return of this method not be a pointer
|
al := block.AccessList() // TODO: make the return of this method not be a pointer
|
||||||
accessListReader := bal.NewAccessListReader(*al)
|
accessListReader := bal.NewAccessListReader(*al)
|
||||||
prefetchReader, err := bc.statedb.ReaderEIP7928(parentRoot, accessListReader.StorageKeys(useAsyncReads), runtime.NumCPU())
|
prefetchReader, err := bc.statedb.ReaderEIP7928(parentRoot, accessListReader.StorageKeys(useAsyncReads), runtime.NumCPU())
|
||||||
|
|
@ -2146,7 +2139,7 @@ func (bc *BlockChain) insertChain(ctx context.Context, chain types.Blocks, setHe
|
||||||
return nil, it.index, err
|
return nil, it.index, err
|
||||||
}
|
}
|
||||||
blockHasAccessList := block.AccessList() != nil
|
blockHasAccessList := block.AccessList() != nil
|
||||||
if blockHasAccessList && bc.cfg.BALExecutionMode != BALExecutionModeSequential {
|
if blockHasAccessList && bc.cfg.BALExecutionMode != bal.BALExecutionSequential {
|
||||||
res.stats.reportBALMetrics()
|
res.stats.reportBALMetrics()
|
||||||
} else {
|
} else {
|
||||||
res.stats.reportMetrics()
|
res.stats.reportMetrics()
|
||||||
|
|
@ -2265,7 +2258,7 @@ func (bc *BlockChain) ProcessBlock(ctx context.Context, parentRoot common.Hash,
|
||||||
blockHasAccessList := block.AccessList() != nil
|
blockHasAccessList := block.AccessList() != nil
|
||||||
|
|
||||||
// optimized execution path for blocks which contain BALs
|
// optimized execution path for blocks which contain BALs
|
||||||
if blockHasAccessList && bc.cfg.BALExecutionMode != BALExecutionModeSequential {
|
if blockHasAccessList && bc.cfg.BALExecutionMode != bal.BALExecutionSequential {
|
||||||
return bc.processBlockWithAccessList(parentRoot, block, config.WriteHead)
|
return bc.processBlockWithAccessList(parentRoot, block, config.WriteHead)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -531,3 +531,11 @@ func (a *AccountMutations) Eq(other *AccountMutations) bool {
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type BALExecutionMode int
|
||||||
|
|
||||||
|
const (
|
||||||
|
BALExecutionOptimized BALExecutionMode = iota
|
||||||
|
BALExecutionNoBatchIO
|
||||||
|
BALExecutionSequential
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ package ethconfig
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"github.com/ethereum/go-ethereum/core/types/bal"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
|
|
@ -210,7 +211,7 @@ type Config struct {
|
||||||
// RangeLimit restricts the maximum range (end - start) for range queries.
|
// RangeLimit restricts the maximum range (end - start) for range queries.
|
||||||
RangeLimit uint64 `toml:",omitempty"`
|
RangeLimit uint64 `toml:",omitempty"`
|
||||||
|
|
||||||
BALExecutionMode int
|
BALExecutionMode bal.BALExecutionMode
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateConsensusEngine creates a consensus engine for the given chain config.
|
// CreateConsensusEngine creates a consensus engine for the given chain config.
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
package ethconfig
|
package ethconfig
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/ethereum/go-ethereum/core/types/bal"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
|
|
@ -68,7 +69,7 @@ func (c Config) MarshalTOML() (interface{}, error) {
|
||||||
TxSyncDefaultTimeout time.Duration `toml:",omitempty"`
|
TxSyncDefaultTimeout time.Duration `toml:",omitempty"`
|
||||||
TxSyncMaxTimeout time.Duration `toml:",omitempty"`
|
TxSyncMaxTimeout time.Duration `toml:",omitempty"`
|
||||||
RangeLimit uint64 `toml:",omitempty"`
|
RangeLimit uint64 `toml:",omitempty"`
|
||||||
BALExecutionMode int
|
BALExecutionMode bal.BALExecutionMode
|
||||||
}
|
}
|
||||||
var enc Config
|
var enc Config
|
||||||
enc.Genesis = c.Genesis
|
enc.Genesis = c.Genesis
|
||||||
|
|
@ -340,7 +341,7 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
|
||||||
c.RangeLimit = *dec.RangeLimit
|
c.RangeLimit = *dec.RangeLimit
|
||||||
}
|
}
|
||||||
if dec.BALExecutionMode != nil {
|
if dec.BALExecutionMode != nil {
|
||||||
c.BALExecutionMode = *dec.BALExecutionMode
|
c.BALExecutionMode = bal.BALExecutionMode(*dec.BALExecutionMode)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue