functional test plugin.
This PR will also include the stand alone tests.
This commit is contained in:
parent
8a33d8e506
commit
b3f1d35171
@ -357,7 +357,6 @@ func geth(ctx *cli.Context) error {
|
|||||||
stack.RegisterAPIs(pluginGetAPIs(stack, wrapperBackend))
|
stack.RegisterAPIs(pluginGetAPIs(stack, wrapperBackend))
|
||||||
startNode(ctx, stack, backend, false)
|
startNode(ctx, stack, backend, false)
|
||||||
pluginBlockChain()
|
pluginBlockChain()
|
||||||
pluginHookTester()
|
|
||||||
//end PluGeth code injection
|
//end PluGeth code injection
|
||||||
stack.Wait()
|
stack.Wait()
|
||||||
return nil
|
return nil
|
||||||
|
@ -86,7 +86,6 @@ func pluginsInitializeNode(stack *node.Node, backend restricted.Backend) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func OnShutdown(pl *plugins.PluginLoader) {
|
func OnShutdown(pl *plugins.PluginLoader) {
|
||||||
log.Error("inside of on shutdown")
|
|
||||||
fnList := pl.Lookup("OnShutdown", func(item interface{}) bool {
|
fnList := pl.Lookup("OnShutdown", func(item interface{}) bool {
|
||||||
_, ok := item.(func())
|
_, ok := item.(func())
|
||||||
return ok
|
return ok
|
||||||
@ -120,22 +119,4 @@ func pluginBlockChain() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
BlockChain(plugins.DefaultPluginLoader)
|
BlockChain(plugins.DefaultPluginLoader)
|
||||||
}
|
|
||||||
|
|
||||||
func HookTester(pl *plugins.PluginLoader) {
|
|
||||||
fnList := pl.Lookup("HookTester", func(item interface{}) bool {
|
|
||||||
_, ok := item.(func())
|
|
||||||
return ok
|
|
||||||
})
|
|
||||||
for _, fni := range fnList {
|
|
||||||
fni.(func())()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func pluginHookTester() {
|
|
||||||
if plugins.DefaultPluginLoader == nil {
|
|
||||||
log.Warn("Attempting HookTester, but default PluginLoader has not been initialized")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
HookTester(plugins.DefaultPluginLoader)
|
|
||||||
}
|
}
|
@ -1333,7 +1333,6 @@ func (bc *BlockChain) writeKnownBlock(block *types.Block) error {
|
|||||||
// writeBlockWithState writes block, metadata and corresponding state data to the
|
// writeBlockWithState writes block, metadata and corresponding state data to the
|
||||||
// database.
|
// database.
|
||||||
func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types.Receipt, state *state.StateDB) error {
|
func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types.Receipt, state *state.StateDB) error {
|
||||||
log.Error("inside of the target function")
|
|
||||||
// Calculate the total difficulty of the block
|
// Calculate the total difficulty of the block
|
||||||
ptd := bc.GetTd(block.ParentHash(), block.NumberU64()-1)
|
ptd := bc.GetTd(block.ParentHash(), block.NumberU64()-1)
|
||||||
if ptd == nil {
|
if ptd == nil {
|
||||||
|
@ -125,7 +125,6 @@ func PluginNewHead(pl *plugins.PluginLoader, block *types.Block, hash common.Has
|
|||||||
_, ok := item.(func([]byte, core.Hash, [][]byte, *big.Int))
|
_, ok := item.(func([]byte, core.Hash, [][]byte, *big.Int))
|
||||||
return ok
|
return ok
|
||||||
})
|
})
|
||||||
log.Error("inside of pluginNewHead()", "len fnList", len(fnList))
|
|
||||||
blockBytes, _ := rlp.EncodeToBytes(block)
|
blockBytes, _ := rlp.EncodeToBytes(block)
|
||||||
logBytes := make([][]byte, len(logs))
|
logBytes := make([][]byte, len(logs))
|
||||||
for i, l := range logs {
|
for i, l := range logs {
|
||||||
|
@ -956,17 +956,14 @@ func (api *API) traceTx(ctx context.Context, message *core.Message, txctx *Conte
|
|||||||
if config == nil {
|
if config == nil {
|
||||||
config = &TraceConfig{}
|
config = &TraceConfig{}
|
||||||
}
|
}
|
||||||
log.Error("outside of geth condition", "config", config.Tracer)
|
|
||||||
// Default tracer is the struct logger
|
// Default tracer is the struct logger
|
||||||
tracer = logger.NewStructLogger(config.Config)
|
tracer = logger.NewStructLogger(config.Config)
|
||||||
if config.Tracer != nil {
|
if config.Tracer != nil {
|
||||||
// Get the tracer from the plugin loader
|
// Get the tracer from the plugin loader
|
||||||
//begin PluGeth code injection
|
//begin PluGeth code injection
|
||||||
if tr, ok := getPluginTracer(*config.Tracer); ok {
|
if tr, ok := getPluginTracer(*config.Tracer); ok {
|
||||||
log.Error("inside geth", "tracer config", *config.Tracer)
|
|
||||||
tracer = tr(statedb, vmctx)
|
tracer = tr(statedb, vmctx)
|
||||||
} else {
|
} else {
|
||||||
log.Error("default geth condition", "config", config.Tracer)
|
|
||||||
tracer, err = DefaultDirectory.New(*config.Tracer, txctx, config.TracerConfig)
|
tracer, err = DefaultDirectory.New(*config.Tracer, txctx, config.TracerConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"reflect"
|
"reflect"
|
||||||
"github.com/ethereum/go-ethereum/log"
|
"github.com/ethereum/go-ethereum/log"
|
||||||
|
"github.com/ethereum/go-ethereum/plugins"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -121,7 +122,24 @@ func callbackifyChanPubSub(receiver, fn reflect.Value) *callback {
|
|||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func RPCSubscription(pl *plugins.PluginLoader) {
|
||||||
|
fnList := pl.Lookup("RPCSubscriptionTest", func(item interface{}) bool {
|
||||||
|
_, ok := item.(func())
|
||||||
|
return ok
|
||||||
|
})
|
||||||
|
for _, fni := range fnList {
|
||||||
|
if fn, ok := fni.(func()); ok {
|
||||||
|
fn()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func pluginExtendedCallbacks(callbacks map[string]*callback, receiver reflect.Value) {
|
func pluginExtendedCallbacks(callbacks map[string]*callback, receiver reflect.Value) {
|
||||||
|
if plugins.DefaultPluginLoader == nil {
|
||||||
|
log.Warn("Attempting RPCSubscriptionTest, but default PluginLoader has not been initialized")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
RPCSubscription(plugins.DefaultPluginLoader)
|
||||||
typ := receiver.Type()
|
typ := receiver.Type()
|
||||||
for m := 0; m < typ.NumMethod(); m++ {
|
for m := 0; m < typ.NumMethod(); m++ {
|
||||||
method := typ.Method(m)
|
method := typ.Method(m)
|
||||||
|
Loading…
Reference in New Issue
Block a user