diff --git a/core/state_processor.go b/core/state_processor.go index b499f194e..cc2946f79 100644 --- a/core/state_processor.go +++ b/core/state_processor.go @@ -123,6 +123,10 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg } // Finalize the block, applying any consensus engine specific extras (e.g. block rewards) p.engine.Finalize(p.bc, header, statedb, block.Transactions(), block.Uncles(), withdrawals) + //begin PluGeth code injection + pluginPostProcessBlock(block) + blockTracer.PostProcessBlock(block) + // end PluGeth code injection return receipts, allLogs, *usedGas, nil } diff --git a/eth/ethconfig/config.go b/eth/ethconfig/config.go index eaf2cd033..074dc5436 100644 --- a/eth/ethconfig/config.go +++ b/eth/ethconfig/config.go @@ -33,6 +33,7 @@ import ( "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/miner" "github.com/ethereum/go-ethereum/params" + "github.com/ethereum/go-ethereum/log" ) // FullNodeGPO contains default gasprice oracle settings for full node. @@ -170,9 +171,9 @@ type Config struct { func CreateConsensusEngine(config *params.ChainConfig, db ethdb.Database) (consensus.Engine, error) { // If proof-of-authority is requested, set it up //begin PluGeth code injection - if engine := pluginGetEngine(stack, notify, noverify, db); engine != nil { - log.Debug("returning plugin consensus engine") - return engine + if engine := pluginGetEngine(); engine != nil { + log.Error("returning plugin consensus engine") + return engine, nil } //end PluGeth code injection if config.Clique != nil { @@ -186,20 +187,3 @@ func CreateConsensusEngine(config *params.ChainConfig, db ethdb.Database) (conse } return beacon.New(ethash.NewFaker()), nil } - -// CreateConsensusEngine creates a consensus engine for the given chain config. -// Clique is allowed for now to live standalone, but ethash is forbidden and can -// only exist on already merged networks. -func CreateConsensusEngine(config *params.ChainConfig, db ethdb.Database) (consensus.Engine, error) { - // If proof-of-authority is requested, set it up - if config.Clique != nil { - return beacon.New(clique.New(config.Clique, db)), nil - } - // If defaulting to proof-of-work, enforce an already merged network since - // we cannot run PoW algorithms and more, so we cannot even follow a chain - // not coordinated by a beacon node. - if !config.TerminalTotalDifficultyPassed { - return nil, errors.New("ethash is only supported as a historical component of already merged networks") - } - return beacon.New(ethash.NewFaker()), nil -} diff --git a/eth/ethconfig/plugin_hooks.go b/eth/ethconfig/plugin_hooks.go index 8f09f6069..2d4abe455 100644 --- a/eth/ethconfig/plugin_hooks.go +++ b/eth/ethconfig/plugin_hooks.go @@ -3,29 +3,29 @@ package ethconfig import ( "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/plugins" - "github.com/ethereum/go-ethereum/plugins/wrappers" + // "github.com/ethereum/go-ethereum/plugins/wrappers" wengine "github.com/ethereum/go-ethereum/plugins/wrappers/engine" - "github.com/ethereum/go-ethereum/plugins/wrappers/backendwrapper" - "github.com/openrelayxyz/plugeth-utils/core" - "github.com/openrelayxyz/plugeth-utils/restricted" + // "github.com/ethereum/go-ethereum/plugins/wrappers/backendwrapper" + // "github.com/openrelayxyz/plugeth-utils/core" + // "github.com/openrelayxyz/plugeth-utils/restricted" "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/node" + // "github.com/ethereum/go-ethereum/ethdb" + // "github.com/ethereum/go-ethereum/node" pconsensus "github.com/openrelayxyz/plugeth-utils/restricted/consensus" ) -func PluginGetEngine(pl *plugins.PluginLoader, stack *node.Node, notify []string, noverify bool, db ethdb.Database) consensus.Engine { +func PluginGetEngine(pl *plugins.PluginLoader) consensus.Engine { fnList := pl.Lookup("CreateEngine", func(item interface{}) bool { - _, ok := item.(func(core.Node, []string, bool, restricted.Database) pconsensus.Engine) + _, ok := item.(func() pconsensus.Engine) return ok }) for _, fni := range fnList { - if fn, ok := fni.(func(core.Node, []string, bool, restricted.Database) pconsensus.Engine); ok { - if engine := fn(wrappers.NewNode(stack), notify, noverify, backendwrapper.NewDB(db)); engine != nil { + if fn, ok := fni.(func() pconsensus.Engine); ok { + if engine := fn(); engine != nil { wrappedEngine := wengine.NewWrappedEngine(engine) return wrappedEngine } @@ -35,10 +35,10 @@ func PluginGetEngine(pl *plugins.PluginLoader, stack *node.Node, notify []string return nil } -func pluginGetEngine(stack *node.Node, notify []string, noverify bool, db ethdb.Database) consensus.Engine { +func pluginGetEngine() consensus.Engine { if plugins.DefaultPluginLoader == nil { log.Warn("Attempting GetEngine, but default PluginLoader has not been initialized") return nil } - return PluginGetEngine(plugins.DefaultPluginLoader, stack, notify, noverify, db) + return PluginGetEngine(plugins.DefaultPluginLoader) } \ No newline at end of file