diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index b9398e0fd..53b8587d7 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -979,7 +979,13 @@ var ( // if none (or the empty string) is specified. If the node is starting a testnet, // then a subdirectory of the specified datadir will be used. func MakeDataDir(ctx *cli.Context) string { - if path := ctx.String(DataDirFlag.Name); path != "" { + if path := ctx.String(DataDirFlag.Name); path == "" { + // begin PluGeth injection + if pluginPath := pluginDefaultDataDir(path); pluginPath != "" { + log.Error("Inside datdir injection number one") + return pluginPath + } + // end PluGeth injection if ctx.Bool(GoerliFlag.Name) { return filepath.Join(path, "goerli") } @@ -1038,7 +1044,12 @@ func setNodeUserIdent(ctx *cli.Context, cfg *node.Config) { // 4. default to mainnet nodes func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) { urls := params.MainnetBootnodes - if ctx.IsSet(BootnodesFlag.Name) { + // begin PluGeth injection + if pluginUrls := pluginSetBootstrapNodes(); pluginUrls != nil { + urls = pluginUrls + } + // end PluGeth injection + if ctx.IsSet(BootnodesFlag.Name) { urls = SplitAndTrim(ctx.String(BootnodesFlag.Name)) } else { if cfg.BootstrapNodes != nil { @@ -1490,7 +1501,13 @@ func setSmartCard(ctx *cli.Context, cfg *node.Config) { } func SetDataDir(ctx *cli.Context, cfg *node.Config) { + // begin PluGeth injection + pluginPath := pluginDefaultDataDir(node.DefaultDataDir()) switch { + case pluginPath != "" && ctx.String(DataDirFlag.Name) == node.DefaultDataDir(): + log.Error("Inside datdir injection number two") + cfg.DataDir = pluginPath + // end PluGeth injection case ctx.IsSet(DataDirFlag.Name): cfg.DataDir = ctx.String(DataDirFlag.Name) case ctx.Bool(DeveloperFlag.Name): @@ -1669,6 +1686,20 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) { setRequiredBlocks(ctx, cfg) setLes(ctx, cfg) + // beginPluGethInjection + if pluginNetworkId := pluginNetworkId(); pluginNetworkId != nil { + cfg.NetworkId = *pluginNetworkId + } + if cfg.EthDiscoveryURLs == nil { + var lightMode bool + if cfg.SyncMode == downloader.LightSync { + lightMode = true + } + cfg.EthDiscoveryURLs = pluginETHDiscoveryURLs(lightMode) + cfg.SnapDiscoveryURLs = pluginSnapDiscoveryURLs() + } + //end PluGeth injection + // Cap the cache allowance and tune the garbage collector mem, err := gopsutil.VirtualMemory() if err == nil { @@ -1889,6 +1920,16 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) { SetDNSDiscoveryDefaults(cfg, params.MainnetGenesisHash) } } + + //begin plugeth injection + if genesis := pluginGenesisBlock(); genesis != nil { + chaindb := MakeChainDatabase(ctx, stack, false) + cfg.Genesis = genesis + rawdb.WriteChainConfig(chaindb, genesis.ToBlock().Hash(), genesis.Config) + chaindb.Close() + } + //end plugeth injection + // Set any dangling config values if ctx.String(CryptoKZGFlag.Name) != "gokzg" && ctx.String(CryptoKZGFlag.Name) != "ckzg" { Fatalf("--%s flag must be 'gokzg' or 'ckzg'", CryptoKZGFlag.Name) @@ -2141,6 +2182,11 @@ func MakeGenesis(ctx *cli.Context) *core.Genesis { case ctx.Bool(DeveloperFlag.Name): Fatalf("Developer chains are ephemeral") } + //begin plugeth injection + if genesis == nil { + genesis = pluginGenesisBlock() + } + //end plugeth injection return genesis } diff --git a/cmd/utils/plugin_hooks.go b/cmd/utils/plugin_hooks.go new file mode 100644 index 000000000..df28ad8f1 --- /dev/null +++ b/cmd/utils/plugin_hooks.go @@ -0,0 +1,139 @@ +package utils + +import ( + "encoding/json" + "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/plugins" +) + +func DefaultDataDir(pl *plugins.PluginLoader, path string) string { + dataDirPath := "" + fnList := pl.Lookup("SetDefaultDataDir", func(item interface{}) bool { + _, ok := item.(func(string) string) + return ok + }) + for _, fni := range fnList { + if fn, ok := fni.(func(string) string); ok { + dataDirPath = fn(path) + } + } + return dataDirPath +} + +func pluginDefaultDataDir(path string) string { + if plugins.DefaultPluginLoader == nil { + log.Warn("Attempting DefaultDataDir, but default PluginLoader has not been initialized") + return "" + } + return DefaultDataDir(plugins.DefaultPluginLoader, path) +} + +func PluginSetBootStrapNodes(pl *plugins.PluginLoader) []string { + var urls []string + fnList := pl.Lookup("SetBootstrapNodes", func(item interface{}) bool { + _, ok := item.(func() []string) + return ok + }) + for _, fni := range fnList { + if fn, ok := fni.(func() []string); ok { + urls = fn() + } + } + return urls +} + +func pluginSetBootstrapNodes() []string { + if plugins.DefaultPluginLoader == nil { + log.Warn("Attempting pluginSetBootStrapNodes, but default PluginLoader has not been initialized") + return nil + } + return PluginSetBootStrapNodes(plugins.DefaultPluginLoader) +} + +func PluginNetworkId(pl *plugins.PluginLoader) *uint64 { + var networkId *uint64 + fnList := pl.Lookup("SetNetworkId", func(item interface{}) bool { + _, ok := item.(func() *uint64) + return ok + }) + for _, fni := range fnList { + if fn, ok := fni.(func() *uint64); ok { + networkId = fn() + } + } + return networkId +} + +func pluginNetworkId() *uint64 { + if plugins.DefaultPluginLoader == nil { + log.Warn("Attempting pluginNetworkID, but default PluginLoader has not been initialized") + return nil + } + return PluginNetworkId(plugins.DefaultPluginLoader) +} + +func PluginETHDiscoveryURLs(pl *plugins.PluginLoader, mode bool) []string { + var ethDiscoveryURLs []string + fnList := pl.Lookup("SetETHDiscoveryURLs", func(item interface{}) bool { + _, ok := item.(func(bool) []string) + return ok + }) + for _, fni := range fnList { + if fn, ok := fni.(func(bool) []string); ok { + ethDiscoveryURLs = fn(mode) + } + } + return ethDiscoveryURLs +} + +func pluginETHDiscoveryURLs(mode bool) []string { + if plugins.DefaultPluginLoader == nil { + log.Warn("Attempting pluginETHDiscoveryURLs, but default PluginLoader has not been initialized") + return nil + } + return PluginETHDiscoveryURLs(plugins.DefaultPluginLoader, mode) +} + +func PluginSnapDiscoveryURLs(pl *plugins.PluginLoader) []string { + var snapDiscoveryURLs []string + fnList := pl.Lookup("SetSnapDiscoveryURLs", func(item interface{}) bool { + _, ok := item.(func() []string) + return ok + }) + for _, fni := range fnList { + if fn, ok := fni.(func() []string); ok { + snapDiscoveryURLs = fn() + } + } + return snapDiscoveryURLs +} + +func pluginSnapDiscoveryURLs() []string { + if plugins.DefaultPluginLoader == nil { + log.Warn("Attempting PluginSnapDiscoveryURLs, but default PluginLoader has not been initialized") + return nil + } + return PluginSnapDiscoveryURLs(plugins.DefaultPluginLoader) +} + +func PluginGenesisBlock(pl *plugins.PluginLoader) *core.Genesis { + genesisJSON, ok := plugins.LookupOne[func() []byte](pl, "GenesisBlock") + if !ok { + return nil + } + var genesis core.Genesis + if err := json.Unmarshal(genesisJSON(), &genesis); err != nil { + log.Warn("Error unmarshalling genesis", "err", err) + return nil + } + return &genesis +} + +func pluginGenesisBlock() *core.Genesis { + if plugins.DefaultPluginLoader == nil { + log.Warn("Attempting PluginGenesisBlock, but default PluginLoader has not been initialized") + return nil + } + return PluginGenesisBlock(plugins.DefaultPluginLoader) +} diff --git a/consensus/misc/eip1559/eip1559.go b/consensus/misc/eip1559/eip1559.go index 84b82c4c4..9b581fef4 100644 --- a/consensus/misc/eip1559/eip1559.go +++ b/consensus/misc/eip1559/eip1559.go @@ -34,7 +34,9 @@ import ( func VerifyEIP1559Header(config *params.ChainConfig, parent, header *types.Header) error { // Verify that the gas limit remains within allowed bounds parentGasLimit := parent.GasLimit - if !config.IsLondon(parent.Number) { + // begin PluGeth injection + if !config.Is1559(parent.Number) { + // end PluGeth injection parentGasLimit = parent.GasLimit * config.ElasticityMultiplier() } if err := misc.VerifyGaslimit(parentGasLimit, header.GasLimit); err != nil { @@ -56,7 +58,9 @@ func VerifyEIP1559Header(config *params.ChainConfig, parent, header *types.Heade // CalcBaseFee calculates the basefee of the header. 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) { + // begin PluGeth injection + if !config.Is1559(parent.Number) { + // end PluGeth injection return new(big.Int).SetUint64(params.InitialBaseFee) } diff --git a/core/forkid/forkid.go b/core/forkid/forkid.go index 76825d3be..1bf81f8dd 100644 --- a/core/forkid/forkid.go +++ b/core/forkid/forkid.go @@ -240,6 +240,7 @@ func checksumToBytes(hash uint32) [4]byte { // gatherForks gathers all the known forks and creates two sorted lists out of // them, one for the block number based forks and the second for the timestamps. func gatherForks(config *params.ChainConfig, genesis uint64) ([]uint64, []uint64) { + // Gather all the fork block numbers via reflection kind := reflect.TypeOf(params.ChainConfig{}) conf := reflect.ValueOf(config).Elem() @@ -293,5 +294,10 @@ func gatherForks(config *params.ChainConfig, genesis uint64) ([]uint64, []uint64 for len(forksByTime) > 0 && forksByTime[0] <= genesis { forksByTime = forksByTime[1:] } + // begin PluGeth injection + if byBlock, byTime, ok := pluginForkIDs(forksByBlock, forksByTime); ok { + return byBlock, byTime + } + // end PluGeth injection return forksByBlock, forksByTime } diff --git a/core/forkid/plugin_hooks.go b/core/forkid/plugin_hooks.go new file mode 100644 index 000000000..a95ee0911 --- /dev/null +++ b/core/forkid/plugin_hooks.go @@ -0,0 +1,25 @@ +package forkid + +import ( + "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/plugins" +) + +func PluginForkIDs(pl *plugins.PluginLoader, byBlock, byTime []uint64) ([]uint64, []uint64, bool) { + f, ok := plugins.LookupOne[func([]uint64, []uint64) ([]uint64, []uint64)](pl, "ForkIDs") + if !ok { + return nil, nil, false + } + pluginByBlock, pluginByTime := f(byBlock, byTime) + + return pluginByBlock, pluginByTime, ok + +} + +func pluginForkIDs(byBlock, byTime []uint64) ([]uint64, []uint64, bool) { + if plugins.DefaultPluginLoader == nil { + log.Warn("Attempting PluginForkIDs, but default PluginLoader has not been initialized") + return nil, nil, false + } + return PluginForkIDs(plugins.DefaultPluginLoader, byBlock, byTime) +} diff --git a/core/state_transition.go b/core/state_transition.go index 1576b4e82..af6f12902 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -289,7 +289,9 @@ func (st *StateTransition) preCheck() error { } // Make sure that transaction gasFeeCap is greater than the baseFee (post london) - if st.evm.ChainConfig().IsLondon(st.evm.Context.BlockNumber) { + // begin PluGeth injection + if st.evm.ChainConfig().Is1559(st.evm.Context.BlockNumber) { + // end PluGeth injection // Skip the checks if gas fields are zero and baseFee was explicitly disabled (eth_call) if !st.evm.Config.NoBaseFee || msg.GasFeeCap.BitLen() > 0 || msg.GasTipCap.BitLen() > 0 { if l := msg.GasFeeCap.BitLen(); l > 256 { @@ -432,7 +434,11 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) { } effectiveTip := msg.GasPrice if rules.IsLondon { - effectiveTip = cmath.BigMin(msg.GasTipCap, new(big.Int).Sub(msg.GasFeeCap, st.evm.Context.BaseFee)) + // begin PluGeth injection + if st.evm.ChainConfig().Is1559(st.evm.Context.BlockNumber) { + // end PluGeth injection + effectiveTip = cmath.BigMin(msg.GasTipCap, new(big.Int).Sub(msg.GasFeeCap, st.evm.Context.BaseFee)) + } } if st.evm.Config.NoBaseFee && msg.GasFeeCap.Sign() == 0 && msg.GasTipCap.Sign() == 0 { diff --git a/core/vm/interpreter.go b/core/vm/interpreter.go index 28da2e80e..56e0d0476 100644 --- a/core/vm/interpreter.go +++ b/core/vm/interpreter.go @@ -72,7 +72,9 @@ func NewEVMInterpreter(evm *EVM) *EVMInterpreter { table = &constantinopleInstructionSet case evm.chainRules.IsByzantium: table = &byzantiumInstructionSet - case evm.chainRules.IsEIP158: + // begin PluGeth injection + case evm.chainRules.IsEIP160: + // end PluGeth injection table = &spuriousDragonInstructionSet case evm.chainRules.IsEIP150: table = &tangerineWhistleInstructionSet @@ -95,6 +97,11 @@ func NewEVMInterpreter(evm *EVM) *EVMInterpreter { } } evm.Config.ExtraEips = extraEips + // begin PluGeth injection + if pluginTable := pluginOpCodeSelect(table); pluginTable != nil { + table = pluginTable + } + // end PluGeth injection return &EVMInterpreter{evm: evm, table: table} } diff --git a/core/vm/jump_table_export.go b/core/vm/jump_table_export.go index b74109da0..b7d22e6fc 100644 --- a/core/vm/jump_table_export.go +++ b/core/vm/jump_table_export.go @@ -46,7 +46,9 @@ func LookupInstructionSet(rules params.Rules) (JumpTable, error) { return newConstantinopleInstructionSet(), nil case rules.IsByzantium: return newByzantiumInstructionSet(), nil - case rules.IsEIP158: + // Begin plugeth injection + case rules.IsEIP160: + // End plugeth injection return newSpuriousDragonInstructionSet(), nil case rules.IsEIP150: return newTangerineWhistleInstructionSet(), nil diff --git a/core/vm/plugin_hooks.go b/core/vm/plugin_hooks.go index 728e3c75f..d00a6aa3b 100644 --- a/core/vm/plugin_hooks.go +++ b/core/vm/plugin_hooks.go @@ -1,5 +1,39 @@ package vm +import ( + "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/plugins" +) + func (st *Stack) Len() int { return len(st.data) } + +func PluginOpCodeSelect(pl *plugins.PluginLoader, jt *JumpTable) *JumpTable { + var opCodes []int + fnList := pl.Lookup("OpCodeSelect", func(item interface{}) bool { + _, ok := item.(func() []int) + return ok + }) + for _, fni := range fnList { + if fn, ok := fni.(func() []int); ok { + opCodes = append(opCodes, fn()...) + } + } + if len(opCodes) > 0 { + jt = copyJumpTable(jt) + } + for _, idx := range opCodes { + (*jt)[idx] = &operation{execute: opUndefined, maxStack: maxStack(0, 0)} + } + return jt +} + +func pluginOpCodeSelect(jt *JumpTable) *JumpTable { + if plugins.DefaultPluginLoader == nil { + log.Warn("Attempting PluginOpCodeSelect, but default PluginLoader has not been initialized") + return nil + } + return PluginOpCodeSelect(plugins.DefaultPluginLoader, jt) +} + diff --git a/go.mod b/go.mod index 177364ff0..fcff21e6b 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/consensys/gnark-crypto v0.10.0 github.com/crate-crypto/go-kzg-4844 v0.3.0 github.com/davecgh/go-spew v1.1.1 - github.com/deckarep/golang-set/v2 v2.1.0 + github.com/deckarep/golang-set/v2 v2.3.1 github.com/docker/docker v24.0.5+incompatible github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127 github.com/ethereum/c-kzg-4844 v0.3.1 @@ -53,7 +53,7 @@ require ( github.com/mattn/go-isatty v0.0.16 github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416 github.com/olekukonko/tablewriter v0.0.5 - github.com/openrelayxyz/plugeth-utils v1.3.0 + github.com/openrelayxyz/plugeth-utils v1.4.0 github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7 github.com/protolambda/bls12-381-util v0.0.0-20220416220906-d8552aa452c7 github.com/rs/cors v1.7.0 diff --git a/go.sum b/go.sum index 562bfcf79..81767b0c3 100644 --- a/go.sum +++ b/go.sum @@ -144,8 +144,8 @@ github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/deckarep/golang-set/v2 v2.1.0 h1:g47V4Or+DUdzbs8FxCCmgb6VYd+ptPAngjM6dtGktsI= -github.com/deckarep/golang-set/v2 v2.1.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= +github.com/deckarep/golang-set/v2 v2.3.1 h1:vjmkvJt/IV27WXPyYQpAh4bRyWJc5Y435D17XQ9QU5A= +github.com/deckarep/golang-set/v2 v2.3.1/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc= @@ -460,8 +460,6 @@ github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9k github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/openrelayxyz/plugeth-utils v1.3.0 h1:0goW7zzasytejXJJcWCJiIRXl3X8o/oFtK8zKF//rlE= -github.com/openrelayxyz/plugeth-utils v1.3.0/go.mod h1:p5Jc8deG2yxXI8DzmrH3kHNEwlQqcOQS0pmGulsqg+M= github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= diff --git a/params/config.go b/params/config.go index 88ff772a1..6db4702ce 100644 --- a/params/config.go +++ b/params/config.go @@ -852,6 +852,10 @@ type Rules struct { IsBerlin, IsLondon bool IsMerge, IsShanghai, IsCancun, IsPrague bool IsVerkle bool + + // begin plugeth injection + IsEIP160 bool + // end plugeth injection } // Rules ensures c's ChainID is not nil. @@ -877,5 +881,10 @@ func (c *ChainConfig) Rules(num *big.Int, isMerge bool, timestamp uint64) Rules IsCancun: c.IsCancun(num, timestamp), IsPrague: c.IsPrague(num, timestamp), IsVerkle: c.IsVerkle(num, timestamp), + + + // Begin plugeth injection + IsEIP160: c.IsEIP160(num), + // End plugeth injection } } diff --git a/params/plugin_hooks.go b/params/plugin_hooks.go new file mode 100644 index 000000000..23e7cbbe9 --- /dev/null +++ b/params/plugin_hooks.go @@ -0,0 +1,41 @@ +package params + +import ( + "math/big" + + "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/plugins" +) + +// Is1559 returns whether num is either equal to the London fork block or greater, if the chain supports EIP1559 +func (c *ChainConfig) Is1559(num *big.Int) bool { + if plugins.DefaultPluginLoader == nil { + log.Warn("Attempting is1559, but default PluginLoader has not been initialized") + return c.IsLondon(num) + } + if active, ok := PluginEIPCheck(plugins.DefaultPluginLoader, "Is1559", num); ok { + return active + } + return c.IsLondon(num) +} + + +func PluginEIPCheck(pl *plugins.PluginLoader, eipHookName string, num *big.Int) (bool, bool) { + fn, ok := plugins.LookupOne[func(*big.Int) bool](pl, eipHookName) + if !ok { + return false, false + } + return fn(num), ok +} +// IsEIP160 returns whether num is either equal to the EIP160 block or greater. +// This defaults to same as 158, but some chains do it at a different block +func (c *ChainConfig) IsEIP160(num *big.Int) bool { + if plugins.DefaultPluginLoader == nil { + log.Warn("Attempting is160, but default PluginLoader has not been initialized") + return c.IsEIP158(num) + } + if active, ok := PluginEIPCheck(plugins.DefaultPluginLoader, "Is160", num); ok { + return active + } + return c.IsEIP158(num) +} diff --git a/plugins/plugin_loader.go b/plugins/plugin_loader.go index dfb4af030..ccd120f06 100644 --- a/plugins/plugin_loader.go +++ b/plugins/plugin_loader.go @@ -157,6 +157,26 @@ func (pl *PluginLoader) ParseFlags(args []string) bool { return len(pl.Flags) > 0 } +func LookupOne[T any](pl *PluginLoader, name string) (T, bool) { + var zero T + if pl == nil { + if DefaultPluginLoader == nil { + log.Warn("Attempting to LookupOne, but default PluginLoader has not been initialized") + return zero, false + } + pl = DefaultPluginLoader + } + items := pl.Lookup(name, func(v interface{}) bool { + _, ok := v.(T) + return ok + }) + if len(items) == 0 { + return zero, false + } + return items[0].(T), true +} + + func ParseFlags(args []string) bool { if DefaultPluginLoader == nil { log.Warn("Attempting to parse flags, but default PluginLoader has not been initialized") diff --git a/plugins/test-plugin/engine.go b/plugins/test-plugin/engine.go index 8a4fe4086..76097ba6f 100644 --- a/plugins/test-plugin/engine.go +++ b/plugins/test-plugin/engine.go @@ -108,4 +108,5 @@ func (e *engine) Close() error { func CreateEngine(chainConfig *params.ChainConfig, db restricted.Database) consensus.Engine { return &engine{} -} \ No newline at end of file +} + diff --git a/plugins/test-plugin/genesis.go b/plugins/test-plugin/genesis.go new file mode 100644 index 000000000..e53eb4274 --- /dev/null +++ b/plugins/test-plugin/genesis.go @@ -0,0 +1,815 @@ +package main + +func GenesisBlock() []byte { + return []byte(`{ + "config": { + "chainId": 6448, + "homesteadBlock": 0, + "eip150Block": 0, + "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "eip155Block": 0, + "eip158Block": 0, + "byzantiumBlock": 0, + "constantinopleBlock": 0, + "petersburgBlock": 0, + "istanbulBlock": 0, + "berlinBlock" : 0, + "londonBlock": 0, + "mergeNetsplitBlock": 0, + "shanghaiTime": 0, + "clique": { + "period": 5, + "epoch": 30000 + } + }, + "nonce": "0x0", + "timestamp": "0x603e6caa", + "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000f2c207111cb6ef761e439e56b25c7c99ac026a010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "gasLimit": "0x47b760", + "difficulty": "0x1", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "coinbase": "0x0000000000000000000000000000000000000000", + "alloc": { + "0000000000000000000000000000000000000000": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000001": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000002": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000003": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000004": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000005": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000006": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000007": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000008": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000009": { + "balance": "0x1" + }, + "000000000000000000000000000000000000000a": { + "balance": "0x1" + }, + "000000000000000000000000000000000000000b": { + "balance": "0x1" + }, + "000000000000000000000000000000000000000c": { + "balance": "0x1" + }, + "000000000000000000000000000000000000000d": { + "balance": "0x1" + }, + "000000000000000000000000000000000000000e": { + "balance": "0x1" + }, + "000000000000000000000000000000000000000f": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000010": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000011": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000012": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000013": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000014": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000015": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000016": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000017": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000018": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000019": { + "balance": "0x1" + }, + "000000000000000000000000000000000000001a": { + "balance": "0x1" + }, + "000000000000000000000000000000000000001b": { + "balance": "0x1" + }, + "000000000000000000000000000000000000001c": { + "balance": "0x1" + }, + "000000000000000000000000000000000000001d": { + "balance": "0x1" + }, + "000000000000000000000000000000000000001e": { + "balance": "0x1" + }, + "000000000000000000000000000000000000001f": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000020": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000021": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000022": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000023": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000024": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000025": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000026": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000027": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000028": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000029": { + "balance": "0x1" + }, + "000000000000000000000000000000000000002a": { + "balance": "0x1" + }, + "000000000000000000000000000000000000002b": { + "balance": "0x1" + }, + "000000000000000000000000000000000000002c": { + "balance": "0x1" + }, + "000000000000000000000000000000000000002d": { + "balance": "0x1" + }, + "000000000000000000000000000000000000002e": { + "balance": "0x1" + }, + "000000000000000000000000000000000000002f": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000030": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000031": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000032": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000033": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000034": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000035": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000036": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000037": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000038": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000039": { + "balance": "0x1" + }, + "000000000000000000000000000000000000003a": { + "balance": "0x1" + }, + "000000000000000000000000000000000000003b": { + "balance": "0x1" + }, + "000000000000000000000000000000000000003c": { + "balance": "0x1" + }, + "000000000000000000000000000000000000003d": { + "balance": "0x1" + }, + "000000000000000000000000000000000000003e": { + "balance": "0x1" + }, + "000000000000000000000000000000000000003f": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000040": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000041": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000042": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000043": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000044": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000045": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000046": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000047": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000048": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000049": { + "balance": "0x1" + }, + "000000000000000000000000000000000000004a": { + "balance": "0x1" + }, + "000000000000000000000000000000000000004b": { + "balance": "0x1" + }, + "000000000000000000000000000000000000004c": { + "balance": "0x1" + }, + "000000000000000000000000000000000000004d": { + "balance": "0x1" + }, + "000000000000000000000000000000000000004e": { + "balance": "0x1" + }, + "000000000000000000000000000000000000004f": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000050": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000051": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000052": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000053": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000054": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000055": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000056": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000057": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000058": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000059": { + "balance": "0x1" + }, + "000000000000000000000000000000000000005a": { + "balance": "0x1" + }, + "000000000000000000000000000000000000005b": { + "balance": "0x1" + }, + "000000000000000000000000000000000000005c": { + "balance": "0x1" + }, + "000000000000000000000000000000000000005d": { + "balance": "0x1" + }, + "000000000000000000000000000000000000005e": { + "balance": "0x1" + }, + "000000000000000000000000000000000000005f": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000060": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000061": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000062": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000063": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000064": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000065": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000066": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000067": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000068": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000069": { + "balance": "0x1" + }, + "000000000000000000000000000000000000006a": { + "balance": "0x1" + }, + "000000000000000000000000000000000000006b": { + "balance": "0x1" + }, + "000000000000000000000000000000000000006c": { + "balance": "0x1" + }, + "000000000000000000000000000000000000006d": { + "balance": "0x1" + }, + "000000000000000000000000000000000000006e": { + "balance": "0x1" + }, + "000000000000000000000000000000000000006f": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000070": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000071": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000072": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000073": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000074": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000075": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000076": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000077": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000078": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000079": { + "balance": "0x1" + }, + "000000000000000000000000000000000000007a": { + "balance": "0x1" + }, + "000000000000000000000000000000000000007b": { + "balance": "0x1" + }, + "000000000000000000000000000000000000007c": { + "balance": "0x1" + }, + "000000000000000000000000000000000000007d": { + "balance": "0x1" + }, + "000000000000000000000000000000000000007e": { + "balance": "0x1" + }, + "000000000000000000000000000000000000007f": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000080": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000081": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000082": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000083": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000084": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000085": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000086": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000087": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000088": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000089": { + "balance": "0x1" + }, + "000000000000000000000000000000000000008a": { + "balance": "0x1" + }, + "000000000000000000000000000000000000008b": { + "balance": "0x1" + }, + "000000000000000000000000000000000000008c": { + "balance": "0x1" + }, + "000000000000000000000000000000000000008d": { + "balance": "0x1" + }, + "000000000000000000000000000000000000008e": { + "balance": "0x1" + }, + "000000000000000000000000000000000000008f": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000090": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000091": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000092": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000093": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000094": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000095": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000096": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000097": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000098": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000099": { + "balance": "0x1" + }, + "000000000000000000000000000000000000009a": { + "balance": "0x1" + }, + "000000000000000000000000000000000000009b": { + "balance": "0x1" + }, + "000000000000000000000000000000000000009c": { + "balance": "0x1" + }, + "000000000000000000000000000000000000009d": { + "balance": "0x1" + }, + "000000000000000000000000000000000000009e": { + "balance": "0x1" + }, + "000000000000000000000000000000000000009f": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000a0": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000a1": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000a2": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000a3": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000a4": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000a5": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000a6": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000a7": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000a8": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000a9": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000aa": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000ab": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000ac": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000ad": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000ae": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000af": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000b0": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000b1": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000b2": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000b3": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000b4": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000b5": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000b6": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000b7": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000b8": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000b9": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000ba": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000bb": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000bc": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000bd": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000be": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000bf": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000c0": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000c1": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000c2": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000c3": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000c4": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000c5": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000c6": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000c7": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000c8": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000c9": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000ca": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000cb": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000cc": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000cd": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000ce": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000cf": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000d0": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000d1": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000d2": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000d3": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000d4": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000d5": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000d6": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000d7": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000d8": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000d9": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000da": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000db": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000dc": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000dd": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000de": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000df": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000e0": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000e1": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000e2": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000e3": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000e4": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000e5": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000e6": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000e7": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000e8": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000e9": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000ea": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000eb": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000ec": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000ed": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000ee": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000ef": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000f0": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000f1": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000f2": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000f3": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000f4": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000f5": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000f6": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000f7": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000f8": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000f9": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000fa": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000fb": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000fc": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000fd": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000fe": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000ff": { + "balance": "0x1" + }, + "2cb2e3bdb066a83a7f1191eef1697da51793f631": { + "balance": "0x200000000000000000000000000000000000000000000000000000000000000" + }, + "4204477bf7fce868e761caaba991ffc607717dbf": { + "balance": "0x200000000000000000000000000000000000000000000000000000000000000" + }, + "f2c207111cb6ef761e439e56b25c7c99ac026a01": { + "balance": "0x200000000000000000000000000000000000000000000000000000000000000" + } + }, + "number": "0x0", + "gasUsed": "0x0", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000" + }`) +} \ No newline at end of file diff --git a/plugins/test-plugin/hooks.go b/plugins/test-plugin/hooks.go index 7667c616d..b1a11e44a 100644 --- a/plugins/test-plugin/hooks.go +++ b/plugins/test-plugin/hooks.go @@ -41,6 +41,48 @@ func GetAPIs(stack core.Node, backend core.Backend) []core.API { // this injection is covered by another test in this package. See documentation for details. // } +// cmd/utils/ + +func SetDefaultDataDir(arg string) string { + m := map[string]struct{}{ + "SetDefaultDataDir":struct{}{}, + } + hookChan <- m + return "test" +} + +func SetBootstrapNodes() []string { + m := map[string]struct{}{ + "SetBootstrapNodes":struct{}{}, + } + hookChan <- m + return nil +} + +func SetNetworkId() *uint64 { + m := map[string]struct{}{ + "SetNetworkId":struct{}{}, + } + hookChan <- m + return nil +} + +func SetETHDiscoveryURLs(arg bool) []string { + m := map[string]struct{}{ + "SetETHDiscoveryURLs":struct{}{}, + } + hookChan <- m + return nil +} + +func SetSnapDiscoveryURLs() []string { + m := map[string]struct{}{ + "SetSnapDiscoveryURLs":struct{}{}, + } + hookChan <- m + return nil +} + // core/ @@ -99,6 +141,23 @@ func SetTrieFlushIntervalClone(duration time.Duration) time.Duration { return duration } +// core/forkid/ + +var onceZero sync.Once + +func ForkIDs(byBlock, byTime []uint64) ([]uint64, []uint64) { + go func() { + onceZero.Do(func() { + m := map[string]struct{}{ + "ForkIDs":struct{}{}, + } + hookChan <- m + }) + }() + + return byBlock, byTime +} + // core/rawdb/ func ModifyAncients(index uint64, freezerUpdate map[string]struct{}) { @@ -112,13 +171,22 @@ func AppendAncient(number uint64, hash, header, body, receipts, td []byte) { // core/state/ func StateUpdate(blockRoot core.Hash, parentRoot core.Hash, coreDestructs map[core.Hash]struct{}, coreAccounts map[core.Hash][]byte, coreStorage map[core.Hash]map[core.Hash][]byte, coreCode map[core.Hash][]byte) { - // log.Warn("StatueUpdate", "blockRoot", blockRoot, "parentRoot", parentRoot, "coreDestructs", coreDestructs, "coreAccounts", coreAccounts, "coreStorage", coreStorage, "coreCode", coreCode) m := map[string]struct{}{ "StateUpdate":struct{}{}, } hookChan <- m } +// core/vm/ + +func OpCodeSelect() []int { + m := map[string]struct{}{ + "OpCodeSelect":struct{}{}, + } + hookChan <- m + return nil +} + // rpc/ @@ -129,11 +197,11 @@ func GetRPCCalls(method string, id string, params string) { hookChan <- m } -var once sync.Once +var onceOne sync.Once func RPCSubscriptionTest() { go func() { - once.Do(func() { + onceOne.Do(func() { m := map[string]struct{}{ "RPCSubscriptionTest":struct{}{}, } @@ -152,6 +220,24 @@ func RPCSubscriptionTest() { // this injection is covered by another test in this package. See documentation for details. // } +// params/ + +func Is1559(*big.Int) bool { // while this hook resides in params the injections are in consensus/misc/ (2), and core/ (2) + m := map[string]struct{}{ + "Is1559":struct{}{}, + } + hookChan <- m + return true +} + +func Is160(num *big.Int) bool { + m := map[string]struct{}{ + "PluginEIPCheck":struct{}{}, + } + hookChan <- m + return true +} + var plugins map[string]struct{} = map[string]struct{}{ "OnShutdown": struct{}{}, "SetTrieFlushIntervalClone":struct{}{}, @@ -176,12 +262,21 @@ var plugins map[string]struct{} = map[string]struct{}{ "LivePostProcessBlock": struct{}{}, "LiveCaptureStart": struct{}{}, "LiveCaptureState": struct{}{}, + "LiveCaptureEnd": struct{}{}, + "PreTrieCommit": struct{}{}, + "PostTrieCommit": struct{}{}, // "LiveCaptureFault": struct{}{}, // "LiveCaptureEnter": struct{}{}, // "LiveCaptureExit": struct{}{}, // "LiveTracerResult": struct{}{}, - "LiveCaptureEnd": struct{}{}, - "PreTrieCommit": struct{}{}, - "PostTrieCommit": struct{}{}, + "SetDefaultDataDir":struct{}{}, + "SetBootstrapNodes":struct{}{}, + "SetNetworkId":struct{}{}, + "SetETHDiscoveryURLs": struct{}{}, + "SetSnapDiscoveryURLs": struct{}{}, + "ForkIDs": struct{}{}, + "OpCodeSelect":struct{}{}, + "Is1559":struct{}{}, + "PluginEIPCheck":struct{}{}, } diff --git a/plugins/test-plugin/main.go b/plugins/test-plugin/main.go index 97c03e7bf..75cba1eee 100644 --- a/plugins/test-plugin/main.go +++ b/plugins/test-plugin/main.go @@ -101,6 +101,12 @@ func BlockChain() { delete(plugins, "LiveCaptureStart") case f("LiveCaptureState"): delete(plugins, "LiveCaptureState") + case f("LiveCaptureEnd"): + delete(plugins, "LiveCaptureEnd") + case f("PreTrieCommit"): + delete(plugins, "PreTrieCommit") + case f("PostTrieCommit"): + delete(plugins, "PostTrieCommit") // These methods are not covered by tests at this time // case f("LiveCaptureFault"): // delete(plugins, "LiveCaptureFault") @@ -110,12 +116,24 @@ func BlockChain() { // delete(plugins, "LiveCaptureExit") // case f("LiveTracerResult"): // delete(plugins, "LiveTracerResult") - case f("LiveCaptureEnd"): - delete(plugins, "LiveCaptureEnd") - case f("PreTrieCommit"): - delete(plugins, "PreTrieCommit") - case f("PostTrieCommit"): - delete(plugins, "PostTrieCommit") + case f("SetDefaultDataDir"): + delete(plugins, "SetDefaultDataDir") + case f("SetBootstrapNodes"): + delete(plugins, "SetBootstrapNodes") + case f("SetNetworkId"): + delete(plugins, "SetNetworkId") + case f("SetETHDiscoveryURLs"): + delete(plugins, "SetETHDiscoveryURLs") + case f("SetSnapDiscoveryURLs"): + delete(plugins, "SetSnapDiscoveryURLs") + case f("ForkIDs"): + delete(plugins, "ForkIDs") + case f("OpCodeSelect"): + delete(plugins, "OpCodeSelect") + case f("Is1559"): + delete(plugins, "Is1559") + case f("PluginEIPCheck"): + delete(plugins, "PluginEIPCheck") } } } diff --git a/plugins/test-plugin/test/config01.toml b/plugins/test-plugin/test/config01.toml index 166c37c3f..31417687c 100644 --- a/plugins/test-plugin/test/config01.toml +++ b/plugins/test-plugin/test/config01.toml @@ -1,8 +1,6 @@ [Eth] NetworkId = 6448 SyncMode = "snap" -EthDiscoveryURLs = [] -SnapDiscoveryURLs = [] NoPruning = false NoPrefetch = false TxLookupLimit = 2350000 diff --git a/plugins/test-plugin/test/genesis.json b/plugins/test-plugin/test/genesis.json index ff201c35e..1ac94e795 100644 --- a/plugins/test-plugin/test/genesis.json +++ b/plugins/test-plugin/test/genesis.json @@ -15,797 +15,797 @@ "mergeNetsplitBlock": 0, "shanghaiTime": 0, "clique": { - "period": 5, - "epoch": 30000 + "period": 5, + "epoch": 30000 } }, "nonce": "0x0", "timestamp": "0x603e6caa", "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000f2c207111cb6ef761e439e56b25c7c99ac026a010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "gasLimit": "0x47b760", + "gasLimit": "0x1c9c380", "difficulty": "0x1", "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "coinbase": "0x0000000000000000000000000000000000000000", "alloc": { "0000000000000000000000000000000000000000": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000001": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000002": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000003": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000004": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000005": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000006": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000007": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000008": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000009": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000000a": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000000b": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000000c": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000000d": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000000e": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000000f": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000010": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000011": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000012": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000013": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000014": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000015": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000016": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000017": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000018": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000019": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000001a": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000001b": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000001c": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000001d": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000001e": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000001f": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000020": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000021": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000022": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000023": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000024": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000025": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000026": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000027": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000028": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000029": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000002a": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000002b": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000002c": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000002d": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000002e": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000002f": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000030": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000031": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000032": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000033": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000034": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000035": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000036": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000037": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000038": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000039": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000003a": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000003b": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000003c": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000003d": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000003e": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000003f": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000040": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000041": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000042": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000043": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000044": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000045": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000046": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000047": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000048": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000049": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000004a": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000004b": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000004c": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000004d": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000004e": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000004f": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000050": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000051": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000052": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000053": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000054": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000055": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000056": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000057": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000058": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000059": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000005a": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000005b": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000005c": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000005d": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000005e": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000005f": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000060": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000061": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000062": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000063": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000064": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000065": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000066": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000067": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000068": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000069": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000006a": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000006b": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000006c": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000006d": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000006e": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000006f": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000070": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000071": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000072": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000073": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000074": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000075": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000076": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000077": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000078": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000079": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000007a": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000007b": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000007c": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000007d": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000007e": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000007f": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000080": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000081": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000082": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000083": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000084": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000085": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000086": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000087": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000088": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000089": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000008a": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000008b": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000008c": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000008d": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000008e": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000008f": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000090": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000091": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000092": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000093": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000094": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000095": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000096": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000097": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000098": { - "balance": "0x1" + "balance": "0x1" }, "0000000000000000000000000000000000000099": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000009a": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000009b": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000009c": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000009d": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000009e": { - "balance": "0x1" + "balance": "0x1" }, "000000000000000000000000000000000000009f": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000a0": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000a1": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000a2": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000a3": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000a4": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000a5": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000a6": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000a7": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000a8": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000a9": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000aa": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000ab": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000ac": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000ad": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000ae": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000af": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000b0": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000b1": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000b2": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000b3": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000b4": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000b5": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000b6": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000b7": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000b8": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000b9": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000ba": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000bb": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000bc": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000bd": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000be": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000bf": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000c0": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000c1": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000c2": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000c3": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000c4": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000c5": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000c6": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000c7": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000c8": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000c9": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000ca": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000cb": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000cc": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000cd": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000ce": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000cf": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000d0": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000d1": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000d2": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000d3": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000d4": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000d5": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000d6": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000d7": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000d8": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000d9": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000da": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000db": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000dc": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000dd": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000de": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000df": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000e0": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000e1": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000e2": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000e3": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000e4": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000e5": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000e6": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000e7": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000e8": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000e9": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000ea": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000eb": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000ec": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000ed": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000ee": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000ef": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000f0": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000f1": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000f2": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000f3": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000f4": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000f5": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000f6": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000f7": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000f8": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000f9": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000fa": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000fb": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000fc": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000fd": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000fe": { - "balance": "0x1" + "balance": "0x1" }, "00000000000000000000000000000000000000ff": { - "balance": "0x1" + "balance": "0x1" }, "2cb2e3bdb066a83a7f1191eef1697da51793f631": { - "balance": "0x200000000000000000000000000000000000000000000000000000000000000" + "balance": "0x200000000000000000000000000000000000000000000000000000000000000" }, "4204477bf7fce868e761caaba991ffc607717dbf": { - "balance": "0x200000000000000000000000000000000000000000000000000000000000000" + "balance": "0x200000000000000000000000000000000000000000000000000000000000000" }, "f2c207111cb6ef761e439e56b25c7c99ac026a01": { - "balance": "0x200000000000000000000000000000000000000000000000000000000000000" + "balance": "0x200000000000000000000000000000000000000000000000000000000000000" } }, "number": "0x0", "gasUsed": "0x0", "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000" -} \ No newline at end of file + } \ No newline at end of file diff --git a/plugins/test-plugin/test/run-test.sh b/plugins/test-plugin/test/run-test.sh index c7b7cd77a..861c6f62f 100755 --- a/plugins/test-plugin/test/run-test.sh +++ b/plugins/test-plugin/test/run-test.sh @@ -9,9 +9,9 @@ mkdir -p test00 test01 test02 00/keystore 01/keystore 02/keystore 00/geth 01/geth 02/geth 00/plugins 01/plugins 02/plugins -cp ../engine.go test00/ -cp ../engine.go ../main.go ../hooks.go ../tracer.go ../live_tracer.go test01/ -cp ../engine.go ../shutdown.go test02/ +cp ../engine.go ../genesis.go test00/ +cp ../engine.go ../genesis.go ../main.go ../hooks.go ../tracer.go ../live_tracer.go test01/ +cp ../engine.go ../genesis.go ../shutdown.go test02/ cd test00/ go build -buildmode=plugin -o ../00/plugins cd ../ @@ -32,9 +32,9 @@ cp nodekey02 02/geth/nodekey echo -n "supersecretpassword" > passwordfile -$GETH init --datadir=./00 genesis.json -$GETH init --datadir=./01 genesis.json -$GETH init --datadir=./02 genesis.json +# $GETH init --datadir=./00 genesis.json +# $GETH init --datadir=./01 genesis.json +# $GETH init --datadir=./02 genesis.json # miner node $GETH --cache.preimages --config config00.toml --authrpc.port 8552 --port 64480 --verbosity=0 --nodiscover --networkid=6448 --datadir=./00/ --mine --miner.etherbase f2c207111cb6ef761e439e56b25c7c99ac026a01 --unlock f2c207111cb6ef761e439e56b25c7c99ac026a01 --http --http.api eth,debug,net --http.port 9545 --password passwordfile --allow-insecure-unlock & diff --git a/plugins/wrappers/backendwrapper/backendwrapper.go b/plugins/wrappers/backendwrapper/backendwrapper.go index 311402186..a2f681ed9 100644 --- a/plugins/wrappers/backendwrapper/backendwrapper.go +++ b/plugins/wrappers/backendwrapper/backendwrapper.go @@ -482,9 +482,9 @@ func CloneChainConfig(cf *gparams.ChainConfig) *params.ChainConfig { if lv.Kind() != reflect.Invalid { // If core.ChainConfig doesn't have this field, skip it. if v.Type() == lv.Type() && lv.CanSet() { - lv.Set(v) + v.Set(lv) } else { - convertAndSet(lv, v) + convertAndSet(v, lv) } } } diff --git a/plugins/wrappers/wrappers.go b/plugins/wrappers/wrappers.go index e49dfb1ea..98bfd93d0 100644 --- a/plugins/wrappers/wrappers.go +++ b/plugins/wrappers/wrappers.go @@ -199,7 +199,10 @@ func (w *WrappedStateDB) SlotInAccessList(addr core.Address, slot core.Hash) (ad func (w *WrappedStateDB) IntermediateRoot(deleteEmptyObjects bool) core.Hash { return core.Hash(w.s.IntermediateRoot(deleteEmptyObjects)) } - + +func (w *WrappedStateDB) AddBalance(addr core.Address, amount *big.Int) { + w.s.AddBalance(common.Address(addr), amount) +} type Node struct { n *node.Node