diff --git a/plugins/ptp/README.md b/plugins/ptp/README.md deleted file mode 100644 index ddb595b1a..000000000 --- a/plugins/ptp/README.md +++ /dev/null @@ -1,9 +0,0 @@ -## Plugeth Test Plugin - -This plugin works in a very similar fashion as the [Consensus Engine plugin](https://github.com/openrelayxyz/plugeth-plugins/tree/master/packages/consensus-engine#readme). There is a bash script, `./test/run-test.sh` which instantiates three individual nodes which execute a pseudo blockchain. Throughout the execution of the chain many of the PluGeth hooks and injections are engaged which in turn trigger `pluginBlockChain()` to track the invoked methods and complain if any are not called. Thus we can confirm that the PluGeth application is fully implemented on the target client. - -In order to use the plugin navigate to the `/test/` directory. Change the permissions on `run-test.sh` to enable execution. Then point the executable geth file to a Geth binary like so: `$ /path/to/geth/geth ./run-test.sh `. The test takes roughly 4.5 mins to run. If successful it should close with an exit code of `0`. - -There are four methods not covered by testing at this time: `LiveCaptureFault()`, `LiveCaptureEnter()`, `LiveCaptureExit()`, `LiveTracerResult()`. Also, there are several injections which fall outside of the testing parameters of this application: `./core/` `NewSideBlock()`, `Reorg()`, `BlockProcessingError()`, `./core/rawdb/` `ModifyAncients()`, `AppendAncient()`. These are covered by stand alone standard go tests which can all be run by navigating to the respective directories and running: `go test -v -run TestPlugethInjections`. - -Note: depending on where the script is deployed Geth may complain that the path to the `.ipc` file is too long. Renaming of the directories or moving the project may be necessary. \ No newline at end of file diff --git a/plugins/ptp/engine.go b/plugins/ptp/engine.go deleted file mode 100644 index 047c91f2f..000000000 --- a/plugins/ptp/engine.go +++ /dev/null @@ -1,102 +0,0 @@ -package main - -import( - "errors" - "math/big" - - "github.com/openrelayxyz/plugeth-utils/core" - "github.com/openrelayxyz/plugeth-utils/restricted" - "github.com/openrelayxyz/plugeth-utils/restricted/types" - "github.com/openrelayxyz/plugeth-utils/restricted/hasher" - "github.com/openrelayxyz/plugeth-utils/restricted/consensus" -) - -var ( - pl core.PluginLoader - backend restricted.Backend - log core.Logger - events core.Feed -) - -var httpApiFlagName = "http.api" - -func Initialize(ctx core.Context, loader core.PluginLoader, logger core.Logger) { - pl = loader - events = pl.GetFeed() - log = logger - v := ctx.String(httpApiFlagName) - if v != "" { - ctx.Set(httpApiFlagName, v+",plugeth") - } else { - ctx.Set(httpApiFlagName, "eth,net,web3,plugeth") - log.Info("Loaded consensus engine plugin") - } -} - -type engine struct { -} - -func (e *engine) Author(header *types.Header) (core.Address, error) { - return header.Coinbase, nil -} -func (e *engine) VerifyHeader(chain consensus.ChainHeaderReader, header *types.Header, seal bool) error { - return nil -} -func (e *engine) VerifyHeaders(chain consensus.ChainHeaderReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error) { - quit := make(chan struct{}) - err := make(chan error) - go func () { - for i, h := range headers { - select { - case <-quit: - return - case err<- e.VerifyHeader(chain, h, seals[i]): - } - } - } () - return quit, err -} -func (e *engine) VerifyUncles(chain consensus.ChainReader, block *types.Block) error { - return nil -} -func (e *engine) Prepare(chain consensus.ChainHeaderReader, header *types.Header) error { - header.Difficulty = new(big.Int).SetUint64(123456789) - header.UncleHash = core.HexToHash("1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347") - return nil -} -func (e *engine) Finalize(chain consensus.ChainHeaderReader, header *types.Header, state core.RWStateDB, txs []*types.Transaction,uncles []*types.Header, withdrawals []*types.Withdrawal) { -} -func (e *engine) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state core.RWStateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt, withdrawals []*types.Withdrawal) (*types.Block, error) { - header.Root = state.IntermediateRoot(false) - hasher := hasher.NewStackTrie(nil) - block := types.NewBlockWithWithdrawals(header, txs, uncles, receipts, withdrawals, hasher) - return block, nil - -} -func (e *engine) Seal(chain consensus.ChainHeaderReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error { - if len(block.Transactions()) == 0 { - return errors.New("sealing paused while waiting for transactions") - } - go func () { - results <- block - close(results) - } () - // TO DO: the stop channel will need to be addressed in a non test case scenerio - return nil -} -func (e *engine) SealHash(header *types.Header) core.Hash { - return header.Hash() -} -func (e *engine) CalcDifficulty(chain consensus.ChainHeaderReader, time uint64, parent *types.Header) *big.Int { - return new(big.Int).SetUint64(uint64(123456789)) -} -func (e *engine) APIs(chain consensus.ChainHeaderReader) []core.API { - return []core.API{} -} -func (e *engine) Close() error { - return nil -} - -func CreateEngine() consensus.Engine { - return &engine{} -} \ No newline at end of file diff --git a/plugins/ptp/hooks.go b/plugins/ptp/hooks.go deleted file mode 100644 index 7667c616d..000000000 --- a/plugins/ptp/hooks.go +++ /dev/null @@ -1,187 +0,0 @@ -package main - -import ( - "time" - "math/big" - "sync" - - "github.com/openrelayxyz/plugeth-utils/core" - -) - -var apis []core.API - -type engineService struct { - backend core.Backend - stack core.Node -} - -// cmd/geth/ - -func GetAPIs(stack core.Node, backend core.Backend) []core.API { - // GetAPIs is covered by virtue of the plugeth_captureShutdown method functioning. - apis = []core.API{ - { - Namespace: "plugeth", - Version: "1.0", - Service: &engineService{backend, stack}, - Public: true, - }, - { - Namespace: "plugeth", - Version: "1.0", - Service: &LiveTracerResult{}, - Public: true, - }, - } - return apis -} - -// func OnShutdown(){ - // this injection is covered by another test in this package. See documentation for details. -// } - -// core/ - - -func PreProcessBlock(hash core.Hash, number uint64, encoded []byte) { - m := map[string]struct{}{ - "PreProcessBlock":struct{}{}, - } - hookChan <- m -} - -func PreProcessTransaction(txBytes []byte, txHash, blockHash core.Hash, i int) { - m := map[string]struct{}{ - "PreProcessTransaction":struct{}{}, - } - hookChan <- m -} - -func BlockProcessingError(tx core.Hash, block core.Hash, err error) { - // this injection is covered by a stand alone test: plugeth_injection_test.go in the core/ package. -} - -func PostProcessTransaction(tx core.Hash, block core.Hash, i int, receipt []byte) { - m := map[string]struct{}{ - "PostProcessTransaction":struct{}{}, - } - hookChan <- m -} - -func PostProcessBlock(block core.Hash) { - m := map[string]struct{}{ - "PostProcessBlock":struct{}{}, - } - hookChan <- m -} - -func NewHead(block []byte, hash core.Hash, logs [][]byte, td *big.Int) { - m := map[string]struct{}{ - "NewHead":struct{}{}, - } - hookChan <- m -} - -func NewSideBlock(block []byte, hash core.Hash, logs [][]byte) { // beyond the scope of the test at this time - // this injection is covered by a stand alone test: plugeth_injection_test.go in the core/ package. -} - -func Reorg(commonBlock core.Hash, oldChain, newChain []core.Hash) { // beyond the scope of the test at this time - // this injection is covered by a stand alone test: plugeth_injection_test.go in the core/ package. -} - -func SetTrieFlushIntervalClone(duration time.Duration) time.Duration { - m := map[string]struct{}{ - "SetTrieFlushIntervalClone":struct{}{}, - } - hookChan <- m - return duration -} - -// core/rawdb/ - -func ModifyAncients(index uint64, freezerUpdate map[string]struct{}) { - // this injection is covered by a stand alone test: plugeth_injection_test.go in the core/rawdb package. -} - -func AppendAncient(number uint64, hash, header, body, receipts, td []byte) { - // this injection is covered by a stand alone test: plugeth_injection_test.go in the core/rawdb package. -} - -// 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 -} - -// rpc/ - - -func GetRPCCalls(method string, id string, params string) { - m := map[string]struct{}{ - "GetRPCCalls":struct{}{}, - } - hookChan <- m -} - -var once sync.Once - -func RPCSubscriptionTest() { - go func() { - once.Do(func() { - m := map[string]struct{}{ - "RPCSubscriptionTest":struct{}{}, - } - hookChan <- m - }) - }() -} - -// trie/ - -// func PreTrieCommit(node core.Hash) { - // this injection is covered by another test in this package. See documentation for details. -// } - -// func PostTrieCommit(node core.Hash) { - // this injection is covered by another test in this package. See documentation for details. -// } - -var plugins map[string]struct{} = map[string]struct{}{ - "OnShutdown": struct{}{}, - "SetTrieFlushIntervalClone":struct{}{}, - "StateUpdate": struct{}{}, - "PreProcessBlock": struct{}{}, - "PreProcessTransaction": struct{}{}, - "PostProcessTransaction": struct{}{}, - "PostProcessBlock": struct{}{}, - "NewHead": struct{}{}, - "StandardCaptureStart": struct{}{}, - "StandardCaptureState": struct{}{}, - "StandardCaptureFault": struct{}{}, - "StandardCaptureEnter": struct{}{}, - "StandardCaptureExit": struct{}{}, - "StandardCaptureEnd": struct{}{}, - "StandardTracerResult": struct{}{}, - "GetRPCCalls": struct{}{}, - "RPCSubscriptionTest": struct{}{}, - "LivePreProcessBlock": struct{}{}, - "LivePreProcessTransaction": struct{}{}, - "LivePostProcessTransaction": struct{}{}, - "LivePostProcessBlock": struct{}{}, - "LiveCaptureStart": struct{}{}, - "LiveCaptureState": struct{}{}, - // "LiveCaptureFault": struct{}{}, - // "LiveCaptureEnter": struct{}{}, - // "LiveCaptureExit": struct{}{}, - // "LiveTracerResult": struct{}{}, - "LiveCaptureEnd": struct{}{}, - "PreTrieCommit": struct{}{}, - "PostTrieCommit": struct{}{}, -} - diff --git a/plugins/ptp/live_tracer.go b/plugins/ptp/live_tracer.go deleted file mode 100644 index d57867ad3..000000000 --- a/plugins/ptp/live_tracer.go +++ /dev/null @@ -1,157 +0,0 @@ -package main - -import ( - "context" - "math/big" - "time" - - "github.com/openrelayxyz/plugeth-utils/core" - "github.com/openrelayxyz/plugeth-utils/restricted/hexutil" -) - -type LiveTracerResult struct { - CallStack []CallStack - Results []CallStack -} - -type CallStack struct { - Type string `json:"type"` - From core.Address `json:"from"` - To core.Address `json:"to"` - Value *big.Int `json:"value,omitempty"` - Gas hexutil.Uint64 `json:"gas"` - GasUsed hexutil.Uint64 `json:"gasUsed"` - Input hexutil.Bytes `json:"input"` - Output hexutil.Bytes `json:"output"` - Time string `json:"time,omitempty"` - Calls []CallStack `json:"calls,omitempty"` - Results []CallStack `json:"results,omitempty"` - Error string `json:"error,omitempty"` -} - -func (t *LiveTracerResult) TraceBlock(ctx context.Context) (<-chan []CallStack, error) { - subch := make(chan []CallStack, 1000) - rtrnch := make(chan []CallStack, 1000) - go func() { - log.Info("Subscription Block Tracer setup") - sub := events.Subscribe(subch) - for { - select { - case <-ctx.Done(): - sub.Unsubscribe() - close(subch) - close(rtrnch) - return - case t := <-subch: - rtrnch <- t - case <-sub.Err(): - sub.Unsubscribe() - close(subch) - close(rtrnch) - return - } - } - }() - return rtrnch, nil -} - -func GetLiveTracer(core.Hash, core.StateDB) core.BlockTracer { - return &LiveTracerResult{} -} - -func (r *LiveTracerResult) PreProcessBlock(hash core.Hash, number uint64, encoded []byte) { - m := map[string]struct{}{ - "LivePreProcessBlock":struct{}{}, - } - hookChan <- m - r.Results = []CallStack{} -} - -func (r *LiveTracerResult) PreProcessTransaction(tx core.Hash, block core.Hash, i int) { - m := map[string]struct{}{ - "LivePreProcessTransaction":struct{}{}, - } - hookChan <- m -} - -func (r *LiveTracerResult) BlockProcessingError(tx core.Hash, block core.Hash, err error) { - m := map[string]struct{}{ - "LiveBlockProcessingError":struct{}{}, - } - hookChan <- m -} - -func (r *LiveTracerResult) PostProcessTransaction(tx core.Hash, block core.Hash, i int, receipt []byte) { - m := map[string]struct{}{ - "LivePostProcessTransaction":struct{}{}, - } - hookChan <- m -} - -func (r *LiveTracerResult) PostProcessBlock(block core.Hash) { - m := map[string]struct{}{ - "LivePostProcessBlock":struct{}{}, - } - hookChan <- m - if len(r.Results) > 0 { - events.Send(r.Results) - } -} - -func (r *LiveTracerResult) CaptureStart(from core.Address, to core.Address, create bool, input []byte, gas uint64, value *big.Int) { - r.CallStack = []CallStack{} - m := map[string]struct{}{ - "LiveCaptureStart":struct{}{}, - } - hookChan <- m -} -func (r *LiveTracerResult) CaptureState(pc uint64, op core.OpCode, gas, cost uint64, scope core.ScopeContext, rData []byte, depth int, err error) { - m := map[string]struct{}{ - "LiveCaptureState":struct{}{}, - } - hookChan <- m -} - -func (r *LiveTracerResult) CaptureFault(pc uint64, op core.OpCode, gas, cost uint64, scope core.ScopeContext, depth int, err error) { - // this method is not covered by tests at this time - // m := map[string]struct{}{ - // "LiveCaptureFault":struct{}{}, - // } - // hookChan <- m -} - -func (r *LiveTracerResult) CaptureEnd(output []byte, gasUsed uint64, t time.Duration, err error) { - m := map[string]struct{}{ - "LiveCaptureEnd":struct{}{}, - } - hookChan <- m - if len(r.CallStack) > 0 { - r.Results = append(r.CallStack) - } -} - -func (r *LiveTracerResult) CaptureEnter(typ core.OpCode, from core.Address, to core.Address, input []byte, gas uint64, value *big.Int) { - // this method is not covered by tests at this time - // m := map[string]struct{}{ - // "LiveCaptureEnter":struct{}{}, - // } - // hookChan <- m -} - -func (r *LiveTracerResult) CaptureExit(output []byte, gasUsed uint64, err error) { - // this method is not covered by tests at this time - // m := map[string]struct{}{ - // "LiveCaptureExit":struct{}{}, - // } - // hookChan <- m -} - -func (r *LiveTracerResult) Result() (interface{}, error) { - // this method is not covered by tests at this time - // m := map[string]struct{}{ - // "LiveTracerResult":struct{}{}, - // } - // hookChan <- m - return "", nil -} - diff --git a/plugins/ptp/main.go b/plugins/ptp/main.go deleted file mode 100644 index 2e76f84e1..000000000 --- a/plugins/ptp/main.go +++ /dev/null @@ -1,260 +0,0 @@ -package main - -import ( - "context" - "math/big" - "time" - "os" - - "github.com/openrelayxyz/plugeth-utils/core" - "github.com/openrelayxyz/plugeth-utils/restricted/hexutil" -) - -var hookChan chan map[string]struct{} = make(chan map[string]struct{}, 10) -var quit chan string = make(chan string) - -func (service *engineService) CaptureShutdown(ctx context.Context) { - m := map[string]struct{}{ - "OnShutdown":struct{}{}, - } - hookChan <- m -} - -func (service *engineService) CapturePreTrieCommit(ctx context.Context) { - m := map[string]struct{}{ - "PreTrieCommit":struct{}{}, - } - hookChan <- m -} - -func (service *engineService) CapturePostTrieCommit(ctx context.Context) { - m := map[string]struct{}{ - "PostTrieCommit":struct{}{}, - } - hookChan <- m -} - -func BlockChain() { - - go func () { - for { - select { - case <- quit: - if len(plugins) > 0 { - log.Error("Exit with Error, Plugins map not empty", "Plugins not called", plugins) - os.Exit(1) - } else { - log.Info("Exit without error") - os.Exit(0) - } - case m := <- hookChan: - var ok bool - f := func(key string) bool {_, ok = m[key]; return ok} - switch { - case f("OnShutdown"): - delete(plugins, "OnShutdown") - case f("StateUpdate"): - delete(plugins, "StateUpdate") - case f("PreProcessBlock"): - delete(plugins, "PreProcessBlock") - case f("PreProcessTransaction"): - delete(plugins, "PreProcessTransaction") - case f("PostProcessTransaction"): - delete(plugins, "PostProcessTransaction") - case f("PostProcessBlock"): - delete(plugins, "PostProcessBlock") - case f("NewHead"): - delete(plugins, "NewHead") - case f("LivePreProcessBlock"): - delete(plugins, "LivePreProcessBlock") - case f("LivePreProcessTransaction"): - delete(plugins, "LivePreProcessTransaction") - case f("LivePostProcessTransaction"): - delete(plugins, "LivePostProcessTransaction") - case f("LivePostProcessBlock"): - delete(plugins, "LivePostProcessBlock") - case f("GetRPCCalls"): - delete(plugins, "GetRPCCalls") - case f("RPCSubscriptionTest"): - delete(plugins, "RPCSubscriptionTest") - case f("SetTrieFlushIntervalClone"): - delete(plugins, "SetTrieFlushIntervalClone") - case f("StandardCaptureStart"): - delete(plugins, "StandardCaptureStart") - case f("StandardCaptureState"): - delete(plugins, "StandardCaptureState") - case f("StandardCaptureFault"): - delete(plugins, "StandardCaptureFault") - case f("StandardCaptureEnter"): - delete(plugins, "StandardCaptureEnter") - case f("StandardCaptureExit"): - delete(plugins, "StandardCaptureExit") - case f("StandardCaptureEnd"): - delete(plugins, "StandardCaptureEnd") - case f("StandardTracerResult"): - delete(plugins, "StandardTracerResult") - case f("LivePreProcessBlock"): - delete(plugins, "LivePreProcessBlock") - case f("LiveCaptureStart"): - delete(plugins, "LiveCaptureStart") - case f("LiveCaptureState"): - delete(plugins, "LiveCaptureState") - // These methods are not covered by tests at this time - // case f("LiveCaptureFault"): - // delete(plugins, "LiveCaptureFault") - // case f("LiveCaptureEnter"): - // delete(plugins, "LiveCaptureEnter") - // case f("LiveCaptureExit"): - // 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") - } - } - } - }() - - txFactory() - txTracer() -} - -var t0 core.Hash -var t1 core.Hash -var t2 core.Hash -var t3 core.Hash -var coinBase *core.Address - -func txFactory() { - - cl := apis[0].Service.(*engineService).stack - client, err := cl.Attach() - if err != nil { - log.Error("Error connecting with client txFactory", "err", err) - } - - err = client.Call(&coinBase, "eth_coinbase") - if err != nil { - log.Error("failed to call eth_coinbase txFactory", "err", err) - } - - var peerCount hexutil.Uint64 - for peerCount == 0 { - err = client.Call(&peerCount, "net_peerCount") - if err != nil { - log.Error("failed to call net_peerCount", "err", err) - } - time.Sleep(100 * time.Millisecond) - } - - tx0_params := map[string]interface{}{ - "from": coinBase, - "to": coinBase, - "value": (*hexutil.Big)(big.NewInt(1)), - } - - err = client.Call(&t0, "eth_sendTransaction", tx0_params) - if err != nil { - log.Error("transaction zero failed", "err", err) - } - - tx1_params := map[string]interface{}{ - "input": "0x60018080600053f3", - "from": coinBase, - } - - time.Sleep(2 * time.Second) - err = client.Call(&t1, "eth_sendTransaction", tx1_params) - if err != nil { - log.Error("transaction one failed", "err", err) - } - - tx2_params := map[string]interface{}{ - "input": "0x61520873000000000000000000000000000000000000000060006000600060006000f1", - "from": coinBase, - } - - time.Sleep(2 * time.Second) - err = client.Call(&t2, "eth_sendTransaction", tx2_params) - if err != nil { - log.Error("transaction two failed", "err", err) - } - - genericArg := map[string]interface{}{ - "input": "0x608060405234801561001057600080fd5b5061011a806100206000396000f3fe608060405234801561001057600080fd5b50600436106100375760003560e01c806360fe47b11461003c5780636d4ce63c1461005d57610037565b600080fd5b61004561007e565b60405161005291906100c5565b60405180910390f35b61007c6004803603602081101561007a57600080fd5b50356100c2565b6040516020018083838082843780820191505050505b565b005b6100946100c4565b60405161005291906100bf565b6100d1565b60405180910390f35b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60e11b815260040161010060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146101e557600080fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e7ba30df6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156101ae57600080fd5b505af11580156101c2573d6000803e3d6000fd5b50505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461029157600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fdacd5766040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156102f957600080fd5b505af115801561030d573d6000803e3d6000fd5b50505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168156fea2646970667358221220d4f2763f3a0ae2826cc9ef37a65ff0c14d7a3aafe8d1636ff99f72e2f705413d64736f6c634300060c0033", - "from": coinBase, - } - - for i := 0; i < 126; i ++ { - time.Sleep(2 * time.Second) - err = client.Call(&t3, "eth_sendTransaction", genericArg) - if err != nil { - log.Error("looped transaction failed on index", "i", i, "err", err) - } - } - -} - -type TraceConfig struct { - Tracer *string -} - -func txTracer() { - - cl := apis[0].Service.(*engineService).stack - client, err := cl.Attach() - if err != nil { - log.Error("Error connecting with client block factory") - } - - time.Sleep(2 * time.Second) - tr := "testTracer" - t := TraceConfig{ - Tracer: &tr, - } - - var trResult interface{} - err = client.Call(&trResult, "debug_traceTransaction", t0, t) - if err != nil { - log.Error("debug_traceTransaction failed", "err", err) - } - - debugArg0 := map[string]interface{}{ - "input": "0x60006000fd", - "from": coinBase, - } - - var trResult0 interface{} - err = client.Call(&trResult0, "debug_traceCall", debugArg0, "latest", t) - if err != nil { - log.Error("debug_traceCall 0 failed", "err", err) - } - - debugArg1 := map[string]interface{}{ - "input": "0x61520873000000000000000000000000000000000000000060006000600060006000f1", - "from": coinBase, - } - - var trResult1 interface{} - err = client.Call(&trResult1, "debug_traceCall", debugArg1, "latest", t) - - - final := map[string]interface{}{ - "input": "0x61520873000000000000000000000000000000000000000060006000600060006000f1", - "from": coinBase, - } - - time.Sleep(2 * time.Second) - err = client.Call(&t3, "eth_sendTransaction", final) - if err != nil { - log.Error("contract call failed", "err", err) - } - - quit <- "quit" - -} - diff --git a/plugins/ptp/shutdown.go b/plugins/ptp/shutdown.go deleted file mode 100644 index cc0ce9a87..000000000 --- a/plugins/ptp/shutdown.go +++ /dev/null @@ -1,132 +0,0 @@ -package main - -import ( - "bytes" - "context" - "encoding/json" - "net" - "net/http" - "time" - "sync/atomic" - - "github.com/openrelayxyz/plugeth-utils/core" -) - -var globalId int64 - -var client = &http.Client{Transport: &http.Transport{ - Proxy: http.ProxyFromEnvironment, - DialContext: (&net.Dialer{ - Timeout: 30 * time.Second, - KeepAlive: 30 * time.Second, - }).DialContext, - MaxIdleConnsPerHost: 16, - MaxIdleConns: 16, - IdleConnTimeout: 90 * time.Second, - TLSHandshakeTimeout: 10 * time.Second, - ExpectContinueTimeout: 1 * time.Second, -}} - -type Call struct { - Version string `json:"jsonrpc"` - ID json.RawMessage `json:"id"` - Method string `json:"method"` - Params []json.RawMessage `json:"params"` -} - -func toRawMessages(items ...interface{}) ([]json.RawMessage, error) { - result := make([]json.RawMessage, len(items)) - for i, item := range items { - d, err := json.Marshal(item) - if err != nil { return nil, err } - result[i] = (json.RawMessage)(d) - } - return result, nil -} - -func PreTrieCommit(node core.Hash) { - - id, err := toRawMessages(atomic.AddInt64(&globalId, 1)) - if err != nil { - log.Error("json marshalling error, id", "err", err) - } - - call := &Call{ - Version: "2.0", - ID : id[0], - Method: "plugeth_capturePreTrieCommit", - Params: []json.RawMessage{}, - } - - backendURL := "http://127.0.0.1:9546" - - callBytes, _ := json.Marshal(call) - - request, _ := http.NewRequestWithContext(context.Background(), "POST", backendURL, bytes.NewReader(callBytes)) - request.Header.Add("Content-Type", "application/json") - - _, err = client.Do(request) - - if err != nil { - log.Error("Error calling passive node from PreTrieCommit", "err", err) - } - -} - -func PostTrieCommit(node core.Hash) { - - id, err := toRawMessages(atomic.AddInt64(&globalId, 1)) - if err != nil { - log.Error("json marshalling error, id", "err", err) - } - - call := &Call{ - Version: "2.0", - ID : id[0], - Method: "plugeth_capturePostTrieCommit", - Params: []json.RawMessage{}, - } - - backendURL := "http://127.0.0.1:9546" - - callBytes, _ := json.Marshal(call) - - request, _ := http.NewRequestWithContext(context.Background(), "POST", backendURL, bytes.NewReader(callBytes)) - request.Header.Add("Content-Type", "application/json") - - _, err = client.Do(request) - - if err != nil { - log.Error("Error calling passive node from PostTrieCommit", "err", err) - } - -} - -func OnShutdown() { - - id, err := toRawMessages(atomic.AddInt64(&globalId, 1)) - if err != nil { - log.Error("json marshalling error, id", "err", err) - } - - call := &Call{ - Version: "2.0", - ID : id[0], - Method: "plugeth_captureShutdown", - Params: []json.RawMessage{}, - } - - backendURL := "http://127.0.0.1:9546" - - callBytes, _ := json.Marshal(call) - - request, _ := http.NewRequestWithContext(context.Background(), "POST", backendURL, bytes.NewReader(callBytes)) - request.Header.Add("Content-Type", "application/json") - - _, err = client.Do(request) - - if err != nil { - log.Error("Error calling passive node from OnShutdown", "err", err) - } - -} \ No newline at end of file diff --git a/plugins/ptp/test/UTC--2021-03-02T16-47-39.492920333Z--4204477bf7fce868e761caaba991ffc607717dbf b/plugins/ptp/test/UTC--2021-03-02T16-47-39.492920333Z--4204477bf7fce868e761caaba991ffc607717dbf deleted file mode 100644 index 9f91fa4fa..000000000 --- a/plugins/ptp/test/UTC--2021-03-02T16-47-39.492920333Z--4204477bf7fce868e761caaba991ffc607717dbf +++ /dev/null @@ -1 +0,0 @@ -{"address":"4204477bf7fce868e761caaba991ffc607717dbf","crypto":{"cipher":"aes-128-ctr","ciphertext":"696c049cb65264a96373f7d9aaed51710fd0ebbc8ac32647d129b76449f75e2b","cipherparams":{"iv":"1ef3f18226b66595ff3c960e97790fa2"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":262144,"p":1,"r":8,"salt":"94a3c3acafb55e9af05585531f0a03ec80a0bc0e9d5898f7ee7441b5d4cb3031"},"mac":"f3df0bb6af2c99da74bf4194e867f49f57b296306e3600a99ec6688a973f06e7"},"id":"c7f4a651-6306-44f2-93f7-ed325e658a62","version":3} \ No newline at end of file diff --git a/plugins/ptp/test/UTC--2021-03-02T16-47-49.510918858Z--f2c207111cb6ef761e439e56b25c7c99ac026a01 b/plugins/ptp/test/UTC--2021-03-02T16-47-49.510918858Z--f2c207111cb6ef761e439e56b25c7c99ac026a01 deleted file mode 100644 index 3e59cbe12..000000000 --- a/plugins/ptp/test/UTC--2021-03-02T16-47-49.510918858Z--f2c207111cb6ef761e439e56b25c7c99ac026a01 +++ /dev/null @@ -1 +0,0 @@ -{"address":"f2c207111cb6ef761e439e56b25c7c99ac026a01","crypto":{"cipher":"aes-128-ctr","ciphertext":"c0c42fb1896ef33d8502ee89e17dcaea2ac3416ef44ef6670609a3e6cf23d52e","cipherparams":{"iv":"b974baaaab375cb0f01c0aebbd863f64"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":262144,"p":1,"r":8,"salt":"d76ee5cfaf5c399cbdd2647fde4367729cf2b7f4f45191d700b220c8a7472858"},"mac":"fb22367cccb09c87e86e3d4d2e46f3eb3f1abfecbfc8b700a5e4b30b27e8e136"},"id":"71393286-2d91-42ab-83b1-b314aeab344e","version":3} \ No newline at end of file diff --git a/plugins/ptp/test/UTC--2021-03-02T16-47-59.816632526Z--2cb2e3bdb066a83a7f1191eef1697da51793f631 b/plugins/ptp/test/UTC--2021-03-02T16-47-59.816632526Z--2cb2e3bdb066a83a7f1191eef1697da51793f631 deleted file mode 100644 index 155e193b7..000000000 --- a/plugins/ptp/test/UTC--2021-03-02T16-47-59.816632526Z--2cb2e3bdb066a83a7f1191eef1697da51793f631 +++ /dev/null @@ -1 +0,0 @@ -{"address":"2cb2e3bdb066a83a7f1191eef1697da51793f631","crypto":{"cipher":"aes-128-ctr","ciphertext":"9b144d767e7395c0aee0c315037dc7ab20e942ac9e98667e4934ca67210d06ed","cipherparams":{"iv":"fb484a2cab5e9cbaac5a01c4f111c62b"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":262144,"p":1,"r":8,"salt":"d060787b49eaea67d8e9d1c0368965f9d9b5ebc2a0981ca0d126036ceb7b30c9"},"mac":"39c1a4f67ca6855e148e766c79e1fb944433d9fc68c3b0bf64308860cb788563"},"id":"7b7959d7-098a-451d-b178-5cfcdef9e385","version":3} \ No newline at end of file diff --git a/plugins/ptp/test/config00.toml b/plugins/ptp/test/config00.toml deleted file mode 100644 index f74e601eb..000000000 --- a/plugins/ptp/test/config00.toml +++ /dev/null @@ -1,97 +0,0 @@ -[Eth] -NetworkId = 6448 -SyncMode = "snap" -EthDiscoveryURLs = [] -SnapDiscoveryURLs = [] -NoPruning = false -NoPrefetch = false -TxLookupLimit = 2350000 -LightPeers = 100 -UltraLightFraction = 75 -DatabaseCache = 512 -DatabaseFreezer = "" -TrieCleanCache = 154 -TrieCleanCacheJournal = "triecache" -TrieCleanCacheRejournal = 3600000000000 -TrieDirtyCache = 256 -TrieTimeout = 3600000000000 -SnapshotCache = 102 -Preimages = false -FilterLogCacheSize = 32 -EnablePreimageRecording = false -RPCGasCap = 50000000 -RPCEVMTimeout = 5000000000 -RPCTxFeeCap = 1e+00 - -[Eth.Miner] -Etherbase = "0xf2c207111cb6ef761e439e56b25c7c99ac026a01" -GasFloor = 0 -GasCeil = 30000000 -GasPrice = 1000000000 -Recommit = 2000000000 -NewPayloadTimeout = 2000000000 - -[Eth.TxPool] -Locals = [] -NoLocals = false -Journal = "transactions.rlp" -Rejournal = 3600000000000 -PriceLimit = 1 -PriceBump = 10 -AccountSlots = 16 -GlobalSlots = 5120 -AccountQueue = 64 -GlobalQueue = 1024 -Lifetime = 10800000000000 - -[Eth.GPO] -Blocks = 20 -Percentile = 60 -MaxHeaderHistory = 1024 -MaxBlockHistory = 1024 -MaxPrice = 500000000000 -IgnorePrice = 2 - -[Node] -DataDir = "00" -IPCPath = "geth.ipc" -HTTPHost = "" -HTTPPort = 8545 -HTTPVirtualHosts = ["localhost"] -HTTPModules = ["net", "web3", "eth"] -AuthAddr = "localhost" -AuthPort = 8552 -AuthVirtualHosts = ["localhost"] -WSHost = "" -WSPort = 8546 -WSModules = ["net", "web3", "eth"] -GraphQLVirtualHosts = ["localhost"] - -[Node.P2P] -MaxPeers = 50 -NoDiscovery = true -BootstrapNodes = ["enode://d860a01f9722d78051619d1e2351aba3f43f943f6f00718d1b9baa4101932a1f5011f16bb2b1bb35db20d6fe28fa0bf09636d26a87d31de9ec6203eeedb1f666@18.138.108.67:30303", "enode://22a8232c3abc76a16ae9d6c3b164f98775fe226f0917b0ca871128a74a8e9630b458460865bab457221f1d448dd9791d24c4e5d88786180ac185df813a68d4de@3.209.45.79:30303", "enode://8499da03c47d637b20eee24eec3c356c9a2e6148d6fe25ca195c7949ab8ec2c03e3556126b0d7ed644675e78c4318b08691b7b57de10e5f0d40d05b09238fa0a@52.187.207.27:30303", "enode://103858bdb88756c71f15e9b5e09b56dc1be52f0a5021d46301dbbfb7e130029cc9d0d6f73f693bc29b665770fff7da4d34f3c6379fe12721b5d7a0bcb5ca1fc1@191.234.162.198:30303", "enode://715171f50508aba88aecd1250af392a45a330af91d7b90701c436b618c86aaa1589c9184561907bebbb56439b8f8787bc01f49a7c77276c58c1b09822d75e8e8@52.231.165.108:30303", "enode://5d6d7cd20d6da4bb83a1d28cadb5d409b64edf314c0335df658c1a54e32c7c4a7ab7823d57c39b6a757556e68ff1df17c748b698544a55cb488b52479a92b60f@104.42.217.25:30303", "enode://2b252ab6a1d0f971d9722cb839a42cb81db019ba44c08754628ab4a823487071b5695317c8ccd085219c3a03af063495b2f1da8d18218da2d6a82981b45e6ffc@65.108.70.101:30303", "enode://4aeb4ab6c14b23e2c4cfdce879c04b0748a20d8e9b59e25ded2a08143e265c6c25936e74cbc8e641e3312ca288673d91f2f93f8e277de3cfa444ecdaaf982052@157.90.35.166:30303"] -BootstrapNodesV5 = ["enr:-KG4QOtcP9X1FbIMOe17QNMKqDxCpm14jcX5tiOE4_TyMrFqbmhPZHK_ZPG2Gxb1GE2xdtodOfx9-cgvNtxnRyHEmC0ghGV0aDKQ9aX9QgAAAAD__________4JpZIJ2NIJpcIQDE8KdiXNlY3AyNTZrMaEDhpehBDbZjM_L9ek699Y7vhUJ-eAdMyQW_Fil522Y0fODdGNwgiMog3VkcIIjKA", "enr:-KG4QDyytgmE4f7AnvW-ZaUOIi9i79qX4JwjRAiXBZCU65wOfBu-3Nb5I7b_Rmg3KCOcZM_C3y5pg7EBU5XGrcLTduQEhGV0aDKQ9aX9QgAAAAD__________4JpZIJ2NIJpcIQ2_DUbiXNlY3AyNTZrMaEDKnz_-ps3UUOfHWVYaskI5kWYO_vtYMGYCQRAR3gHDouDdGNwgiMog3VkcIIjKA", "enr:-Ku4QImhMc1z8yCiNJ1TyUxdcfNucje3BGwEHzodEZUan8PherEo4sF7pPHPSIB1NNuSg5fZy7qFsjmUKs2ea1Whi0EBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpD1pf1CAAAAAP__________gmlkgnY0gmlwhBLf22SJc2VjcDI1NmsxoQOVphkDqal4QzPMksc5wnpuC3gvSC8AfbFOnZY_On34wIN1ZHCCIyg", "enr:-Ku4QP2xDnEtUXIjzJ_DhlCRN9SN99RYQPJL92TMlSv7U5C1YnYLjwOQHgZIUXw6c-BvRg2Yc2QsZxxoS_pPRVe0yK8Bh2F0dG5ldHOIAAAAAAAAAACEZXRoMpD1pf1CAAAAAP__________gmlkgnY0gmlwhBLf22SJc2VjcDI1NmsxoQMeFF5GrS7UZpAH2Ly84aLK-TyvH-dRo0JM1i8yygH50YN1ZHCCJxA", "enr:-Ku4QPp9z1W4tAO8Ber_NQierYaOStqhDqQdOPY3bB3jDgkjcbk6YrEnVYIiCBbTxuar3CzS528d2iE7TdJsrL-dEKoBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpD1pf1CAAAAAP__________gmlkgnY0gmlwhBLf22SJc2VjcDI1NmsxoQMw5fqqkw2hHC4F5HZZDPsNmPdB1Gi8JPQK7pRc9XHh-oN1ZHCCKvg", "enr:-IS4QLkKqDMy_ExrpOEWa59NiClemOnor-krjp4qoeZwIw2QduPC-q7Kz4u1IOWf3DDbdxqQIgC4fejavBOuUPy-HE4BgmlkgnY0gmlwhCLzAHqJc2VjcDI1NmsxoQLQSJfEAHZApkm5edTCZ_4qps_1k_ub2CxHFxi-gr2JMIN1ZHCCIyg", "enr:-IS4QDAyibHCzYZmIYZCjXwU9BqpotWmv2BsFlIq1V31BwDDMJPFEbox1ijT5c2Ou3kvieOKejxuaCqIcjxBjJ_3j_cBgmlkgnY0gmlwhAMaHiCJc2VjcDI1NmsxoQJIdpj_foZ02MXz4It8xKD7yUHTBx7lVFn3oeRP21KRV4N1ZHCCIyg", "enr:-Ku4QHqVeJ8PPICcWk1vSn_XcSkjOkNiTg6Fmii5j6vUQgvzMc9L1goFnLKgXqBJspJjIsB91LTOleFmyWWrFVATGngBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpC1MD8qAAAAAP__________gmlkgnY0gmlwhAMRHkWJc2VjcDI1NmsxoQKLVXFOhp2uX6jeT0DvvDpPcU8FWMjQdR4wMuORMhpX24N1ZHCCIyg", "enr:-Ku4QG-2_Md3sZIAUebGYT6g0SMskIml77l6yR-M_JXc-UdNHCmHQeOiMLbylPejyJsdAPsTHJyjJB2sYGDLe0dn8uYBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpC1MD8qAAAAAP__________gmlkgnY0gmlwhBLY-NyJc2VjcDI1NmsxoQORcM6e19T1T9gi7jxEZjk_sjVLGFscUNqAY9obgZaxbIN1ZHCCIyg", "enr:-Ku4QPn5eVhcoF1opaFEvg1b6JNFD2rqVkHQ8HApOKK61OIcIXD127bKWgAtbwI7pnxx6cDyk_nI88TrZKQaGMZj0q0Bh2F0dG5ldHOIAAAAAAAAAACEZXRoMpC1MD8qAAAAAP__________gmlkgnY0gmlwhDayLMaJc2VjcDI1NmsxoQK2sBOLGcUb4AwuYzFuAVCaNHA-dy24UuEKkeFNgCVCsIN1ZHCCIyg", "enr:-Ku4QEWzdnVtXc2Q0ZVigfCGggOVB2Vc1ZCPEc6j21NIFLODSJbvNaef1g4PxhPwl_3kax86YPheFUSLXPRs98vvYsoBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpC1MD8qAAAAAP__________gmlkgnY0gmlwhDZBrP2Jc2VjcDI1NmsxoQM6jr8Rb1ktLEsVcKAPa08wCsKUmvoQ8khiOl_SLozf9IN1ZHCCIyg"] -StaticNodes = ["enode://3a25d05c552af77d4346b82affb6c249c14dc11a9ee08c11b75ca1d05e04b464fa40b1770e3e8dd06b365ff29ba0b24a1f41bef9db4d6004566767b62b19f905@127.0.0.1:64480","enode://56206f2d4d22aacdc89a1d95c0c120437de5ea3bab3ad2bee57a82b3578a0b3af245de80c98e94b8a6c2733e4ae0d5da25fccceb6094132a5c2ab784355f89ef@127.0.0.1:64481","enode://6d5b388dbc3b672606e9731f82bc5ad6443241dd5894e561d272155806d6497770d2e323b011580c661a2e8a40e1f79b017fa5b57ea20a632db95fb90893d04d@127.0.0.1:64482"] -TrustedNodes = [] -ListenAddr = ":64480" -DiscAddr = "" -EnableMsgEvents = false - -[Node.HTTPTimeouts] -ReadTimeout = 30000000000 -ReadHeaderTimeout = 30000000000 -WriteTimeout = 30000000000 -IdleTimeout = 120000000000 - -[Metrics] -HTTP = "127.0.0.1" -Port = 6060 -InfluxDBEndpoint = "http://localhost:8086" -InfluxDBDatabase = "geth" -InfluxDBUsername = "test" -InfluxDBPassword = "test" -InfluxDBTags = "host=localhost" -InfluxDBToken = "test" -InfluxDBBucket = "geth" -InfluxDBOrganization = "geth" diff --git a/plugins/ptp/test/config01.toml b/plugins/ptp/test/config01.toml deleted file mode 100644 index c0e82298f..000000000 --- a/plugins/ptp/test/config01.toml +++ /dev/null @@ -1,97 +0,0 @@ -[Eth] -NetworkId = 6448 -SyncMode = "snap" -EthDiscoveryURLs = [] -SnapDiscoveryURLs = [] -NoPruning = false -NoPrefetch = false -TxLookupLimit = 2350000 -LightPeers = 100 -UltraLightFraction = 75 -DatabaseCache = 512 -DatabaseFreezer = "" -TrieCleanCache = 154 -TrieCleanCacheJournal = "triecache" -TrieCleanCacheRejournal = 3600000000000 -TrieDirtyCache = 256 -TrieTimeout = 3600000000000 -SnapshotCache = 102 -Preimages = false -FilterLogCacheSize = 32 -EnablePreimageRecording = false -RPCGasCap = 50000000 -RPCEVMTimeout = 5000000000 -RPCTxFeeCap = 1e+00 - -[Eth.Miner] -GasFloor = 0 -GasCeil = 30000000 -GasPrice = 1000000000 -Recommit = 2000000000 -NewPayloadTimeout = 2000000000 - -[Eth.TxPool] -Locals = [] -NoLocals = false -Journal = "transactions.rlp" -Rejournal = 3600000000000 -PriceLimit = 1 -PriceBump = 10 -AccountSlots = 16 -GlobalSlots = 5120 -AccountQueue = 64 -GlobalQueue = 1024 -Lifetime = 10800000000000 - -[Eth.GPO] -Blocks = 20 -Percentile = 60 -MaxHeaderHistory = 1024 -MaxBlockHistory = 1024 -MaxPrice = 500000000000 -IgnorePrice = 2 - -[Node] -DataDir = "01" -InsecureUnlockAllowed = true -IPCPath = "geth.ipc" -HTTPHost = "" -HTTPPort = 8545 -HTTPVirtualHosts = ["localhost"] -HTTPModules = ["net", "web3", "eth"] -AuthAddr = "localhost" -AuthPort = 8553 -AuthVirtualHosts = ["localhost"] -WSHost = "127.0.0.1" -WSPort = 8546 -WSModules = ["eth", "admin"] -GraphQLVirtualHosts = ["localhost"] - -[Node.P2P] -MaxPeers = 50 -NoDiscovery = true -BootstrapNodes = ["enode://d860a01f9722d78051619d1e2351aba3f43f943f6f00718d1b9baa4101932a1f5011f16bb2b1bb35db20d6fe28fa0bf09636d26a87d31de9ec6203eeedb1f666@18.138.108.67:30303", "enode://22a8232c3abc76a16ae9d6c3b164f98775fe226f0917b0ca871128a74a8e9630b458460865bab457221f1d448dd9791d24c4e5d88786180ac185df813a68d4de@3.209.45.79:30303", "enode://8499da03c47d637b20eee24eec3c356c9a2e6148d6fe25ca195c7949ab8ec2c03e3556126b0d7ed644675e78c4318b08691b7b57de10e5f0d40d05b09238fa0a@52.187.207.27:30303", "enode://103858bdb88756c71f15e9b5e09b56dc1be52f0a5021d46301dbbfb7e130029cc9d0d6f73f693bc29b665770fff7da4d34f3c6379fe12721b5d7a0bcb5ca1fc1@191.234.162.198:30303", "enode://715171f50508aba88aecd1250af392a45a330af91d7b90701c436b618c86aaa1589c9184561907bebbb56439b8f8787bc01f49a7c77276c58c1b09822d75e8e8@52.231.165.108:30303", "enode://5d6d7cd20d6da4bb83a1d28cadb5d409b64edf314c0335df658c1a54e32c7c4a7ab7823d57c39b6a757556e68ff1df17c748b698544a55cb488b52479a92b60f@104.42.217.25:30303", "enode://2b252ab6a1d0f971d9722cb839a42cb81db019ba44c08754628ab4a823487071b5695317c8ccd085219c3a03af063495b2f1da8d18218da2d6a82981b45e6ffc@65.108.70.101:30303", "enode://4aeb4ab6c14b23e2c4cfdce879c04b0748a20d8e9b59e25ded2a08143e265c6c25936e74cbc8e641e3312ca288673d91f2f93f8e277de3cfa444ecdaaf982052@157.90.35.166:30303"] -BootstrapNodesV5 = ["enr:-KG4QOtcP9X1FbIMOe17QNMKqDxCpm14jcX5tiOE4_TyMrFqbmhPZHK_ZPG2Gxb1GE2xdtodOfx9-cgvNtxnRyHEmC0ghGV0aDKQ9aX9QgAAAAD__________4JpZIJ2NIJpcIQDE8KdiXNlY3AyNTZrMaEDhpehBDbZjM_L9ek699Y7vhUJ-eAdMyQW_Fil522Y0fODdGNwgiMog3VkcIIjKA", "enr:-KG4QDyytgmE4f7AnvW-ZaUOIi9i79qX4JwjRAiXBZCU65wOfBu-3Nb5I7b_Rmg3KCOcZM_C3y5pg7EBU5XGrcLTduQEhGV0aDKQ9aX9QgAAAAD__________4JpZIJ2NIJpcIQ2_DUbiXNlY3AyNTZrMaEDKnz_-ps3UUOfHWVYaskI5kWYO_vtYMGYCQRAR3gHDouDdGNwgiMog3VkcIIjKA", "enr:-Ku4QImhMc1z8yCiNJ1TyUxdcfNucje3BGwEHzodEZUan8PherEo4sF7pPHPSIB1NNuSg5fZy7qFsjmUKs2ea1Whi0EBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpD1pf1CAAAAAP__________gmlkgnY0gmlwhBLf22SJc2VjcDI1NmsxoQOVphkDqal4QzPMksc5wnpuC3gvSC8AfbFOnZY_On34wIN1ZHCCIyg", "enr:-Ku4QP2xDnEtUXIjzJ_DhlCRN9SN99RYQPJL92TMlSv7U5C1YnYLjwOQHgZIUXw6c-BvRg2Yc2QsZxxoS_pPRVe0yK8Bh2F0dG5ldHOIAAAAAAAAAACEZXRoMpD1pf1CAAAAAP__________gmlkgnY0gmlwhBLf22SJc2VjcDI1NmsxoQMeFF5GrS7UZpAH2Ly84aLK-TyvH-dRo0JM1i8yygH50YN1ZHCCJxA", "enr:-Ku4QPp9z1W4tAO8Ber_NQierYaOStqhDqQdOPY3bB3jDgkjcbk6YrEnVYIiCBbTxuar3CzS528d2iE7TdJsrL-dEKoBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpD1pf1CAAAAAP__________gmlkgnY0gmlwhBLf22SJc2VjcDI1NmsxoQMw5fqqkw2hHC4F5HZZDPsNmPdB1Gi8JPQK7pRc9XHh-oN1ZHCCKvg", "enr:-IS4QLkKqDMy_ExrpOEWa59NiClemOnor-krjp4qoeZwIw2QduPC-q7Kz4u1IOWf3DDbdxqQIgC4fejavBOuUPy-HE4BgmlkgnY0gmlwhCLzAHqJc2VjcDI1NmsxoQLQSJfEAHZApkm5edTCZ_4qps_1k_ub2CxHFxi-gr2JMIN1ZHCCIyg", "enr:-IS4QDAyibHCzYZmIYZCjXwU9BqpotWmv2BsFlIq1V31BwDDMJPFEbox1ijT5c2Ou3kvieOKejxuaCqIcjxBjJ_3j_cBgmlkgnY0gmlwhAMaHiCJc2VjcDI1NmsxoQJIdpj_foZ02MXz4It8xKD7yUHTBx7lVFn3oeRP21KRV4N1ZHCCIyg", "enr:-Ku4QHqVeJ8PPICcWk1vSn_XcSkjOkNiTg6Fmii5j6vUQgvzMc9L1goFnLKgXqBJspJjIsB91LTOleFmyWWrFVATGngBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpC1MD8qAAAAAP__________gmlkgnY0gmlwhAMRHkWJc2VjcDI1NmsxoQKLVXFOhp2uX6jeT0DvvDpPcU8FWMjQdR4wMuORMhpX24N1ZHCCIyg", "enr:-Ku4QG-2_Md3sZIAUebGYT6g0SMskIml77l6yR-M_JXc-UdNHCmHQeOiMLbylPejyJsdAPsTHJyjJB2sYGDLe0dn8uYBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpC1MD8qAAAAAP__________gmlkgnY0gmlwhBLY-NyJc2VjcDI1NmsxoQORcM6e19T1T9gi7jxEZjk_sjVLGFscUNqAY9obgZaxbIN1ZHCCIyg", "enr:-Ku4QPn5eVhcoF1opaFEvg1b6JNFD2rqVkHQ8HApOKK61OIcIXD127bKWgAtbwI7pnxx6cDyk_nI88TrZKQaGMZj0q0Bh2F0dG5ldHOIAAAAAAAAAACEZXRoMpC1MD8qAAAAAP__________gmlkgnY0gmlwhDayLMaJc2VjcDI1NmsxoQK2sBOLGcUb4AwuYzFuAVCaNHA-dy24UuEKkeFNgCVCsIN1ZHCCIyg", "enr:-Ku4QEWzdnVtXc2Q0ZVigfCGggOVB2Vc1ZCPEc6j21NIFLODSJbvNaef1g4PxhPwl_3kax86YPheFUSLXPRs98vvYsoBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpC1MD8qAAAAAP__________gmlkgnY0gmlwhDZBrP2Jc2VjcDI1NmsxoQM6jr8Rb1ktLEsVcKAPa08wCsKUmvoQ8khiOl_SLozf9IN1ZHCCIyg"] -StaticNodes = ["enode://3a25d05c552af77d4346b82affb6c249c14dc11a9ee08c11b75ca1d05e04b464fa40b1770e3e8dd06b365ff29ba0b24a1f41bef9db4d6004566767b62b19f905@127.0.0.1:64480","enode://56206f2d4d22aacdc89a1d95c0c120437de5ea3bab3ad2bee57a82b3578a0b3af245de80c98e94b8a6c2733e4ae0d5da25fccceb6094132a5c2ab784355f89ef@127.0.0.1:64481","enode://6d5b388dbc3b672606e9731f82bc5ad6443241dd5894e561d272155806d6497770d2e323b011580c661a2e8a40e1f79b017fa5b57ea20a632db95fb90893d04d@127.0.0.1:64482"] -TrustedNodes = [] -ListenAddr = ":64481" -DiscAddr = "" -EnableMsgEvents = false - -[Node.HTTPTimeouts] -ReadTimeout = 30000000000 -ReadHeaderTimeout = 30000000000 -WriteTimeout = 30000000000 -IdleTimeout = 120000000000 - -[Metrics] -HTTP = "127.0.0.1" -Port = 6060 -InfluxDBEndpoint = "http://localhost:8086" -InfluxDBDatabase = "geth" -InfluxDBUsername = "test" -InfluxDBPassword = "test" -InfluxDBTags = "host=localhost" -InfluxDBToken = "test" -InfluxDBBucket = "geth" -InfluxDBOrganization = "geth" diff --git a/plugins/ptp/test/config02.toml b/plugins/ptp/test/config02.toml deleted file mode 100644 index f12c1fff7..000000000 --- a/plugins/ptp/test/config02.toml +++ /dev/null @@ -1,97 +0,0 @@ -[Eth] -NetworkId = 6448 -SyncMode = "snap" -EthDiscoveryURLs = [] -SnapDiscoveryURLs = [] -NoPruning = false -NoPrefetch = false -TxLookupLimit = 2350000 -LightPeers = 100 -UltraLightFraction = 75 -DatabaseCache = 512 -DatabaseFreezer = "" -TrieCleanCache = 154 -TrieCleanCacheJournal = "triecache" -TrieCleanCacheRejournal = 3600000000000 -TrieDirtyCache = 256 -TrieTimeout = 3600000000000 -SnapshotCache = 102 -Preimages = false -FilterLogCacheSize = 32 -EnablePreimageRecording = false -RPCGasCap = 50000000 -RPCEVMTimeout = 5000000000 -RPCTxFeeCap = 1e+00 - -[Eth.Miner] -GasFloor = 0 -GasCeil = 30000000 -GasPrice = 1000000000 -Recommit = 2000000000 -NewPayloadTimeout = 2000000000 - -[Eth.TxPool] -Locals = [] -NoLocals = false -Journal = "transactions.rlp" -Rejournal = 3600000000000 -PriceLimit = 1 -PriceBump = 10 -AccountSlots = 16 -GlobalSlots = 5120 -AccountQueue = 64 -GlobalQueue = 1024 -Lifetime = 10800000000000 - -[Eth.GPO] -Blocks = 20 -Percentile = 60 -MaxHeaderHistory = 1024 -MaxBlockHistory = 1024 -MaxPrice = 500000000000 -IgnorePrice = 2 - -[Node] -DataDir = "02" -InsecureUnlockAllowed = true -IPCPath = "geth.ipc" -HTTPHost = "" -HTTPPort = 8545 -HTTPVirtualHosts = ["localhost"] -HTTPModules = ["net", "web3", "eth"] -AuthAddr = "localhost" -AuthPort = 8554 -AuthVirtualHosts = ["localhost"] -WSHost = "127.0.0.1" -WSPort = 8547 -WSModules = ["eth", "admin"] -GraphQLVirtualHosts = ["localhost"] - -[Node.P2P] -MaxPeers = 50 -NoDiscovery = true -BootstrapNodes = ["enode://d860a01f9722d78051619d1e2351aba3f43f943f6f00718d1b9baa4101932a1f5011f16bb2b1bb35db20d6fe28fa0bf09636d26a87d31de9ec6203eeedb1f666@18.138.108.67:30303", "enode://22a8232c3abc76a16ae9d6c3b164f98775fe226f0917b0ca871128a74a8e9630b458460865bab457221f1d448dd9791d24c4e5d88786180ac185df813a68d4de@3.209.45.79:30303", "enode://8499da03c47d637b20eee24eec3c356c9a2e6148d6fe25ca195c7949ab8ec2c03e3556126b0d7ed644675e78c4318b08691b7b57de10e5f0d40d05b09238fa0a@52.187.207.27:30303", "enode://103858bdb88756c71f15e9b5e09b56dc1be52f0a5021d46301dbbfb7e130029cc9d0d6f73f693bc29b665770fff7da4d34f3c6379fe12721b5d7a0bcb5ca1fc1@191.234.162.198:30303", "enode://715171f50508aba88aecd1250af392a45a330af91d7b90701c436b618c86aaa1589c9184561907bebbb56439b8f8787bc01f49a7c77276c58c1b09822d75e8e8@52.231.165.108:30303", "enode://5d6d7cd20d6da4bb83a1d28cadb5d409b64edf314c0335df658c1a54e32c7c4a7ab7823d57c39b6a757556e68ff1df17c748b698544a55cb488b52479a92b60f@104.42.217.25:30303", "enode://2b252ab6a1d0f971d9722cb839a42cb81db019ba44c08754628ab4a823487071b5695317c8ccd085219c3a03af063495b2f1da8d18218da2d6a82981b45e6ffc@65.108.70.101:30303", "enode://4aeb4ab6c14b23e2c4cfdce879c04b0748a20d8e9b59e25ded2a08143e265c6c25936e74cbc8e641e3312ca288673d91f2f93f8e277de3cfa444ecdaaf982052@157.90.35.166:30303"] -BootstrapNodesV5 = ["enr:-KG4QOtcP9X1FbIMOe17QNMKqDxCpm14jcX5tiOE4_TyMrFqbmhPZHK_ZPG2Gxb1GE2xdtodOfx9-cgvNtxnRyHEmC0ghGV0aDKQ9aX9QgAAAAD__________4JpZIJ2NIJpcIQDE8KdiXNlY3AyNTZrMaEDhpehBDbZjM_L9ek699Y7vhUJ-eAdMyQW_Fil522Y0fODdGNwgiMog3VkcIIjKA", "enr:-KG4QDyytgmE4f7AnvW-ZaUOIi9i79qX4JwjRAiXBZCU65wOfBu-3Nb5I7b_Rmg3KCOcZM_C3y5pg7EBU5XGrcLTduQEhGV0aDKQ9aX9QgAAAAD__________4JpZIJ2NIJpcIQ2_DUbiXNlY3AyNTZrMaEDKnz_-ps3UUOfHWVYaskI5kWYO_vtYMGYCQRAR3gHDouDdGNwgiMog3VkcIIjKA", "enr:-Ku4QImhMc1z8yCiNJ1TyUxdcfNucje3BGwEHzodEZUan8PherEo4sF7pPHPSIB1NNuSg5fZy7qFsjmUKs2ea1Whi0EBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpD1pf1CAAAAAP__________gmlkgnY0gmlwhBLf22SJc2VjcDI1NmsxoQOVphkDqal4QzPMksc5wnpuC3gvSC8AfbFOnZY_On34wIN1ZHCCIyg", "enr:-Ku4QP2xDnEtUXIjzJ_DhlCRN9SN99RYQPJL92TMlSv7U5C1YnYLjwOQHgZIUXw6c-BvRg2Yc2QsZxxoS_pPRVe0yK8Bh2F0dG5ldHOIAAAAAAAAAACEZXRoMpD1pf1CAAAAAP__________gmlkgnY0gmlwhBLf22SJc2VjcDI1NmsxoQMeFF5GrS7UZpAH2Ly84aLK-TyvH-dRo0JM1i8yygH50YN1ZHCCJxA", "enr:-Ku4QPp9z1W4tAO8Ber_NQierYaOStqhDqQdOPY3bB3jDgkjcbk6YrEnVYIiCBbTxuar3CzS528d2iE7TdJsrL-dEKoBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpD1pf1CAAAAAP__________gmlkgnY0gmlwhBLf22SJc2VjcDI1NmsxoQMw5fqqkw2hHC4F5HZZDPsNmPdB1Gi8JPQK7pRc9XHh-oN1ZHCCKvg", "enr:-IS4QLkKqDMy_ExrpOEWa59NiClemOnor-krjp4qoeZwIw2QduPC-q7Kz4u1IOWf3DDbdxqQIgC4fejavBOuUPy-HE4BgmlkgnY0gmlwhCLzAHqJc2VjcDI1NmsxoQLQSJfEAHZApkm5edTCZ_4qps_1k_ub2CxHFxi-gr2JMIN1ZHCCIyg", "enr:-IS4QDAyibHCzYZmIYZCjXwU9BqpotWmv2BsFlIq1V31BwDDMJPFEbox1ijT5c2Ou3kvieOKejxuaCqIcjxBjJ_3j_cBgmlkgnY0gmlwhAMaHiCJc2VjcDI1NmsxoQJIdpj_foZ02MXz4It8xKD7yUHTBx7lVFn3oeRP21KRV4N1ZHCCIyg", "enr:-Ku4QHqVeJ8PPICcWk1vSn_XcSkjOkNiTg6Fmii5j6vUQgvzMc9L1goFnLKgXqBJspJjIsB91LTOleFmyWWrFVATGngBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpC1MD8qAAAAAP__________gmlkgnY0gmlwhAMRHkWJc2VjcDI1NmsxoQKLVXFOhp2uX6jeT0DvvDpPcU8FWMjQdR4wMuORMhpX24N1ZHCCIyg", "enr:-Ku4QG-2_Md3sZIAUebGYT6g0SMskIml77l6yR-M_JXc-UdNHCmHQeOiMLbylPejyJsdAPsTHJyjJB2sYGDLe0dn8uYBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpC1MD8qAAAAAP__________gmlkgnY0gmlwhBLY-NyJc2VjcDI1NmsxoQORcM6e19T1T9gi7jxEZjk_sjVLGFscUNqAY9obgZaxbIN1ZHCCIyg", "enr:-Ku4QPn5eVhcoF1opaFEvg1b6JNFD2rqVkHQ8HApOKK61OIcIXD127bKWgAtbwI7pnxx6cDyk_nI88TrZKQaGMZj0q0Bh2F0dG5ldHOIAAAAAAAAAACEZXRoMpC1MD8qAAAAAP__________gmlkgnY0gmlwhDayLMaJc2VjcDI1NmsxoQK2sBOLGcUb4AwuYzFuAVCaNHA-dy24UuEKkeFNgCVCsIN1ZHCCIyg", "enr:-Ku4QEWzdnVtXc2Q0ZVigfCGggOVB2Vc1ZCPEc6j21NIFLODSJbvNaef1g4PxhPwl_3kax86YPheFUSLXPRs98vvYsoBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpC1MD8qAAAAAP__________gmlkgnY0gmlwhDZBrP2Jc2VjcDI1NmsxoQM6jr8Rb1ktLEsVcKAPa08wCsKUmvoQ8khiOl_SLozf9IN1ZHCCIyg"] -StaticNodes = ["enode://3a25d05c552af77d4346b82affb6c249c14dc11a9ee08c11b75ca1d05e04b464fa40b1770e3e8dd06b365ff29ba0b24a1f41bef9db4d6004566767b62b19f905@127.0.0.1:64480","enode://56206f2d4d22aacdc89a1d95c0c120437de5ea3bab3ad2bee57a82b3578a0b3af245de80c98e94b8a6c2733e4ae0d5da25fccceb6094132a5c2ab784355f89ef@127.0.0.1:64481","enode://6d5b388dbc3b672606e9731f82bc5ad6443241dd5894e561d272155806d6497770d2e323b011580c661a2e8a40e1f79b017fa5b57ea20a632db95fb90893d04d@127.0.0.1:64482"] -TrustedNodes = [] -ListenAddr = ":64482" -DiscAddr = "" -EnableMsgEvents = false - -[Node.HTTPTimeouts] -ReadTimeout = 30000000000 -ReadHeaderTimeout = 30000000000 -WriteTimeout = 30000000000 -IdleTimeout = 120000000000 - -[Metrics] -HTTP = "127.0.0.1" -Port = 6060 -InfluxDBEndpoint = "http://localhost:8086" -InfluxDBDatabase = "geth" -InfluxDBUsername = "test" -InfluxDBPassword = "test" -InfluxDBTags = "host=localhost" -InfluxDBToken = "test" -InfluxDBBucket = "geth" -InfluxDBOrganization = "geth" diff --git a/plugins/ptp/test/genesis.json b/plugins/ptp/test/genesis.json deleted file mode 100644 index ff201c35e..000000000 --- a/plugins/ptp/test/genesis.json +++ /dev/null @@ -1,811 +0,0 @@ -{ - "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/ptp/test/nodekey00 b/plugins/ptp/test/nodekey00 deleted file mode 100644 index 1645b00e8..000000000 --- a/plugins/ptp/test/nodekey00 +++ /dev/null @@ -1 +0,0 @@ -60eab35e8ff2d588e5ebea2e702db274274e03908deb28680c3e962cfbe5863e \ No newline at end of file diff --git a/plugins/ptp/test/nodekey01 b/plugins/ptp/test/nodekey01 deleted file mode 100644 index 9b0965749..000000000 --- a/plugins/ptp/test/nodekey01 +++ /dev/null @@ -1 +0,0 @@ -dcb6263019d1cf73f3fca130acbbd93a8e5936e297e7a4de5aedd5cfabda4c5d \ No newline at end of file diff --git a/plugins/ptp/test/nodekey02 b/plugins/ptp/test/nodekey02 deleted file mode 100644 index ed36c2fe2..000000000 --- a/plugins/ptp/test/nodekey02 +++ /dev/null @@ -1 +0,0 @@ -e5b6e5670ac9be865d2eb330649c131ff431456a3d15a4d891efb7b63c8f03f1 \ No newline at end of file diff --git a/plugins/ptp/test/passwordfile b/plugins/ptp/test/passwordfile deleted file mode 100644 index 54f0d1906..000000000 --- a/plugins/ptp/test/passwordfile +++ /dev/null @@ -1 +0,0 @@ -supersecretpassword \ No newline at end of file diff --git a/plugins/ptp/test/results.txt b/plugins/ptp/test/results.txt deleted file mode 100644 index 4864d07fd..000000000 --- a/plugins/ptp/test/results.txt +++ /dev/null @@ -1 +0,0 @@ -map[LiveCaptureEnd:{} LiveCaptureStart:{} LiveCaptureState:{} LivePostProcessBlock:{} PostProcessBlock:{}] diff --git a/plugins/ptp/test/run-test.sh b/plugins/ptp/test/run-test.sh deleted file mode 100755 index 6dc9c0764..000000000 --- a/plugins/ptp/test/run-test.sh +++ /dev/null @@ -1,70 +0,0 @@ -[ -f "passwordfile" ] && rm -f passwordfile -[ -d "00/" ] && rm -rf 00/ -[ -d "test00/" ] && rm -rf test00/ -[ -d "01/" ] && rm -rf 01/ -[ -d "test01/" ] && rm -rf test01/ -[ -d "02/" ] && rm -rf 02/ -[ -d "test02/" ] && rm -rf test02/ - -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/ -cd test00/ -go build -buildmode=plugin -o ../00/plugins -cd ../ -cd test01/ -go build -buildmode=plugin -o ../01/plugins -cd ../ -cd test02/ -go build -buildmode=plugin -o ../02/plugins -cd ../ - -cp UTC--2021-03-02T16-47-49.510918858Z--f2c207111cb6ef761e439e56b25c7c99ac026a01 00/keystore -cp UTC--2021-03-02T16-47-39.492920333Z--4204477bf7fce868e761caaba991ffc607717dbf 01/keystore -cp UTC--2021-03-02T16-47-59.816632526Z--2cb2e3bdb066a83a7f1191eef1697da51793f631 02/keystore - -cp nodekey00 00/geth/nodekey -cp nodekey01 01/geth/nodekey -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 - -# 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 & -pid0=$! - -sleep 1 -# passive node -$GETH --cache.preimages --config config01.toml --authrpc.port 8553 --port 64481 --verbosity=3 --syncmode=full --nodiscover --networkid=6448 --datadir=./01/ --unlock 4204477bf7fce868e761caaba991ffc607717dbf --miner.etherbase 4204477bf7fce868e761caaba991ffc607717dbf --password passwordfile --ws --ws.port 8546 --ws.api eth,admin --http --http.api eth,debug,net --http.port 9546 --allow-insecure-unlock & - -sleep 1 - -# shutdown node -$GETH --config config02.toml --authrpc.port 8556 --port 64484 --verbosity=0 --syncmode=full --nodiscover --networkid=6448 --datadir=./02/ --unlock 2cb2e3bdb066a83a7f1191eef1697da51793f631 --miner.etherbase 2cb2e3bdb066a83a7f1191eef1697da51793f631 --password passwordfile --ws --ws.port 8548 --ws.api eth,admin --http --http.api eth,debug,net --http.port 9547 --allow-insecure-unlock & -pid1=$! - -sleep 5 - -if ps -p $pid1 > /dev/null; then - kill $pid1 -fi - -sleep 255 - -if ps -p $pid0 > /dev/null; then - kill $pid0 -fi - -wait - -rm -f passwordfile -rm -rf 00/ 01/ 02/ test00/ test01/ test02/ - - diff --git a/plugins/ptp/test/test.sh b/plugins/ptp/test/test.sh deleted file mode 100644 index 6dc9c0764..000000000 --- a/plugins/ptp/test/test.sh +++ /dev/null @@ -1,70 +0,0 @@ -[ -f "passwordfile" ] && rm -f passwordfile -[ -d "00/" ] && rm -rf 00/ -[ -d "test00/" ] && rm -rf test00/ -[ -d "01/" ] && rm -rf 01/ -[ -d "test01/" ] && rm -rf test01/ -[ -d "02/" ] && rm -rf 02/ -[ -d "test02/" ] && rm -rf test02/ - -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/ -cd test00/ -go build -buildmode=plugin -o ../00/plugins -cd ../ -cd test01/ -go build -buildmode=plugin -o ../01/plugins -cd ../ -cd test02/ -go build -buildmode=plugin -o ../02/plugins -cd ../ - -cp UTC--2021-03-02T16-47-49.510918858Z--f2c207111cb6ef761e439e56b25c7c99ac026a01 00/keystore -cp UTC--2021-03-02T16-47-39.492920333Z--4204477bf7fce868e761caaba991ffc607717dbf 01/keystore -cp UTC--2021-03-02T16-47-59.816632526Z--2cb2e3bdb066a83a7f1191eef1697da51793f631 02/keystore - -cp nodekey00 00/geth/nodekey -cp nodekey01 01/geth/nodekey -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 - -# 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 & -pid0=$! - -sleep 1 -# passive node -$GETH --cache.preimages --config config01.toml --authrpc.port 8553 --port 64481 --verbosity=3 --syncmode=full --nodiscover --networkid=6448 --datadir=./01/ --unlock 4204477bf7fce868e761caaba991ffc607717dbf --miner.etherbase 4204477bf7fce868e761caaba991ffc607717dbf --password passwordfile --ws --ws.port 8546 --ws.api eth,admin --http --http.api eth,debug,net --http.port 9546 --allow-insecure-unlock & - -sleep 1 - -# shutdown node -$GETH --config config02.toml --authrpc.port 8556 --port 64484 --verbosity=0 --syncmode=full --nodiscover --networkid=6448 --datadir=./02/ --unlock 2cb2e3bdb066a83a7f1191eef1697da51793f631 --miner.etherbase 2cb2e3bdb066a83a7f1191eef1697da51793f631 --password passwordfile --ws --ws.port 8548 --ws.api eth,admin --http --http.api eth,debug,net --http.port 9547 --allow-insecure-unlock & -pid1=$! - -sleep 5 - -if ps -p $pid1 > /dev/null; then - kill $pid1 -fi - -sleep 255 - -if ps -p $pid0 > /dev/null; then - kill $pid0 -fi - -wait - -rm -f passwordfile -rm -rf 00/ 01/ 02/ test00/ test01/ test02/ - - diff --git a/plugins/ptp/test/test00/engine.go b/plugins/ptp/test/test00/engine.go deleted file mode 100644 index 047c91f2f..000000000 --- a/plugins/ptp/test/test00/engine.go +++ /dev/null @@ -1,102 +0,0 @@ -package main - -import( - "errors" - "math/big" - - "github.com/openrelayxyz/plugeth-utils/core" - "github.com/openrelayxyz/plugeth-utils/restricted" - "github.com/openrelayxyz/plugeth-utils/restricted/types" - "github.com/openrelayxyz/plugeth-utils/restricted/hasher" - "github.com/openrelayxyz/plugeth-utils/restricted/consensus" -) - -var ( - pl core.PluginLoader - backend restricted.Backend - log core.Logger - events core.Feed -) - -var httpApiFlagName = "http.api" - -func Initialize(ctx core.Context, loader core.PluginLoader, logger core.Logger) { - pl = loader - events = pl.GetFeed() - log = logger - v := ctx.String(httpApiFlagName) - if v != "" { - ctx.Set(httpApiFlagName, v+",plugeth") - } else { - ctx.Set(httpApiFlagName, "eth,net,web3,plugeth") - log.Info("Loaded consensus engine plugin") - } -} - -type engine struct { -} - -func (e *engine) Author(header *types.Header) (core.Address, error) { - return header.Coinbase, nil -} -func (e *engine) VerifyHeader(chain consensus.ChainHeaderReader, header *types.Header, seal bool) error { - return nil -} -func (e *engine) VerifyHeaders(chain consensus.ChainHeaderReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error) { - quit := make(chan struct{}) - err := make(chan error) - go func () { - for i, h := range headers { - select { - case <-quit: - return - case err<- e.VerifyHeader(chain, h, seals[i]): - } - } - } () - return quit, err -} -func (e *engine) VerifyUncles(chain consensus.ChainReader, block *types.Block) error { - return nil -} -func (e *engine) Prepare(chain consensus.ChainHeaderReader, header *types.Header) error { - header.Difficulty = new(big.Int).SetUint64(123456789) - header.UncleHash = core.HexToHash("1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347") - return nil -} -func (e *engine) Finalize(chain consensus.ChainHeaderReader, header *types.Header, state core.RWStateDB, txs []*types.Transaction,uncles []*types.Header, withdrawals []*types.Withdrawal) { -} -func (e *engine) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state core.RWStateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt, withdrawals []*types.Withdrawal) (*types.Block, error) { - header.Root = state.IntermediateRoot(false) - hasher := hasher.NewStackTrie(nil) - block := types.NewBlockWithWithdrawals(header, txs, uncles, receipts, withdrawals, hasher) - return block, nil - -} -func (e *engine) Seal(chain consensus.ChainHeaderReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error { - if len(block.Transactions()) == 0 { - return errors.New("sealing paused while waiting for transactions") - } - go func () { - results <- block - close(results) - } () - // TO DO: the stop channel will need to be addressed in a non test case scenerio - return nil -} -func (e *engine) SealHash(header *types.Header) core.Hash { - return header.Hash() -} -func (e *engine) CalcDifficulty(chain consensus.ChainHeaderReader, time uint64, parent *types.Header) *big.Int { - return new(big.Int).SetUint64(uint64(123456789)) -} -func (e *engine) APIs(chain consensus.ChainHeaderReader) []core.API { - return []core.API{} -} -func (e *engine) Close() error { - return nil -} - -func CreateEngine() consensus.Engine { - return &engine{} -} \ No newline at end of file diff --git a/plugins/ptp/test/test01/engine.go b/plugins/ptp/test/test01/engine.go deleted file mode 100644 index 047c91f2f..000000000 --- a/plugins/ptp/test/test01/engine.go +++ /dev/null @@ -1,102 +0,0 @@ -package main - -import( - "errors" - "math/big" - - "github.com/openrelayxyz/plugeth-utils/core" - "github.com/openrelayxyz/plugeth-utils/restricted" - "github.com/openrelayxyz/plugeth-utils/restricted/types" - "github.com/openrelayxyz/plugeth-utils/restricted/hasher" - "github.com/openrelayxyz/plugeth-utils/restricted/consensus" -) - -var ( - pl core.PluginLoader - backend restricted.Backend - log core.Logger - events core.Feed -) - -var httpApiFlagName = "http.api" - -func Initialize(ctx core.Context, loader core.PluginLoader, logger core.Logger) { - pl = loader - events = pl.GetFeed() - log = logger - v := ctx.String(httpApiFlagName) - if v != "" { - ctx.Set(httpApiFlagName, v+",plugeth") - } else { - ctx.Set(httpApiFlagName, "eth,net,web3,plugeth") - log.Info("Loaded consensus engine plugin") - } -} - -type engine struct { -} - -func (e *engine) Author(header *types.Header) (core.Address, error) { - return header.Coinbase, nil -} -func (e *engine) VerifyHeader(chain consensus.ChainHeaderReader, header *types.Header, seal bool) error { - return nil -} -func (e *engine) VerifyHeaders(chain consensus.ChainHeaderReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error) { - quit := make(chan struct{}) - err := make(chan error) - go func () { - for i, h := range headers { - select { - case <-quit: - return - case err<- e.VerifyHeader(chain, h, seals[i]): - } - } - } () - return quit, err -} -func (e *engine) VerifyUncles(chain consensus.ChainReader, block *types.Block) error { - return nil -} -func (e *engine) Prepare(chain consensus.ChainHeaderReader, header *types.Header) error { - header.Difficulty = new(big.Int).SetUint64(123456789) - header.UncleHash = core.HexToHash("1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347") - return nil -} -func (e *engine) Finalize(chain consensus.ChainHeaderReader, header *types.Header, state core.RWStateDB, txs []*types.Transaction,uncles []*types.Header, withdrawals []*types.Withdrawal) { -} -func (e *engine) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state core.RWStateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt, withdrawals []*types.Withdrawal) (*types.Block, error) { - header.Root = state.IntermediateRoot(false) - hasher := hasher.NewStackTrie(nil) - block := types.NewBlockWithWithdrawals(header, txs, uncles, receipts, withdrawals, hasher) - return block, nil - -} -func (e *engine) Seal(chain consensus.ChainHeaderReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error { - if len(block.Transactions()) == 0 { - return errors.New("sealing paused while waiting for transactions") - } - go func () { - results <- block - close(results) - } () - // TO DO: the stop channel will need to be addressed in a non test case scenerio - return nil -} -func (e *engine) SealHash(header *types.Header) core.Hash { - return header.Hash() -} -func (e *engine) CalcDifficulty(chain consensus.ChainHeaderReader, time uint64, parent *types.Header) *big.Int { - return new(big.Int).SetUint64(uint64(123456789)) -} -func (e *engine) APIs(chain consensus.ChainHeaderReader) []core.API { - return []core.API{} -} -func (e *engine) Close() error { - return nil -} - -func CreateEngine() consensus.Engine { - return &engine{} -} \ No newline at end of file diff --git a/plugins/ptp/test/test01/hooks.go b/plugins/ptp/test/test01/hooks.go deleted file mode 100644 index 7667c616d..000000000 --- a/plugins/ptp/test/test01/hooks.go +++ /dev/null @@ -1,187 +0,0 @@ -package main - -import ( - "time" - "math/big" - "sync" - - "github.com/openrelayxyz/plugeth-utils/core" - -) - -var apis []core.API - -type engineService struct { - backend core.Backend - stack core.Node -} - -// cmd/geth/ - -func GetAPIs(stack core.Node, backend core.Backend) []core.API { - // GetAPIs is covered by virtue of the plugeth_captureShutdown method functioning. - apis = []core.API{ - { - Namespace: "plugeth", - Version: "1.0", - Service: &engineService{backend, stack}, - Public: true, - }, - { - Namespace: "plugeth", - Version: "1.0", - Service: &LiveTracerResult{}, - Public: true, - }, - } - return apis -} - -// func OnShutdown(){ - // this injection is covered by another test in this package. See documentation for details. -// } - -// core/ - - -func PreProcessBlock(hash core.Hash, number uint64, encoded []byte) { - m := map[string]struct{}{ - "PreProcessBlock":struct{}{}, - } - hookChan <- m -} - -func PreProcessTransaction(txBytes []byte, txHash, blockHash core.Hash, i int) { - m := map[string]struct{}{ - "PreProcessTransaction":struct{}{}, - } - hookChan <- m -} - -func BlockProcessingError(tx core.Hash, block core.Hash, err error) { - // this injection is covered by a stand alone test: plugeth_injection_test.go in the core/ package. -} - -func PostProcessTransaction(tx core.Hash, block core.Hash, i int, receipt []byte) { - m := map[string]struct{}{ - "PostProcessTransaction":struct{}{}, - } - hookChan <- m -} - -func PostProcessBlock(block core.Hash) { - m := map[string]struct{}{ - "PostProcessBlock":struct{}{}, - } - hookChan <- m -} - -func NewHead(block []byte, hash core.Hash, logs [][]byte, td *big.Int) { - m := map[string]struct{}{ - "NewHead":struct{}{}, - } - hookChan <- m -} - -func NewSideBlock(block []byte, hash core.Hash, logs [][]byte) { // beyond the scope of the test at this time - // this injection is covered by a stand alone test: plugeth_injection_test.go in the core/ package. -} - -func Reorg(commonBlock core.Hash, oldChain, newChain []core.Hash) { // beyond the scope of the test at this time - // this injection is covered by a stand alone test: plugeth_injection_test.go in the core/ package. -} - -func SetTrieFlushIntervalClone(duration time.Duration) time.Duration { - m := map[string]struct{}{ - "SetTrieFlushIntervalClone":struct{}{}, - } - hookChan <- m - return duration -} - -// core/rawdb/ - -func ModifyAncients(index uint64, freezerUpdate map[string]struct{}) { - // this injection is covered by a stand alone test: plugeth_injection_test.go in the core/rawdb package. -} - -func AppendAncient(number uint64, hash, header, body, receipts, td []byte) { - // this injection is covered by a stand alone test: plugeth_injection_test.go in the core/rawdb package. -} - -// 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 -} - -// rpc/ - - -func GetRPCCalls(method string, id string, params string) { - m := map[string]struct{}{ - "GetRPCCalls":struct{}{}, - } - hookChan <- m -} - -var once sync.Once - -func RPCSubscriptionTest() { - go func() { - once.Do(func() { - m := map[string]struct{}{ - "RPCSubscriptionTest":struct{}{}, - } - hookChan <- m - }) - }() -} - -// trie/ - -// func PreTrieCommit(node core.Hash) { - // this injection is covered by another test in this package. See documentation for details. -// } - -// func PostTrieCommit(node core.Hash) { - // this injection is covered by another test in this package. See documentation for details. -// } - -var plugins map[string]struct{} = map[string]struct{}{ - "OnShutdown": struct{}{}, - "SetTrieFlushIntervalClone":struct{}{}, - "StateUpdate": struct{}{}, - "PreProcessBlock": struct{}{}, - "PreProcessTransaction": struct{}{}, - "PostProcessTransaction": struct{}{}, - "PostProcessBlock": struct{}{}, - "NewHead": struct{}{}, - "StandardCaptureStart": struct{}{}, - "StandardCaptureState": struct{}{}, - "StandardCaptureFault": struct{}{}, - "StandardCaptureEnter": struct{}{}, - "StandardCaptureExit": struct{}{}, - "StandardCaptureEnd": struct{}{}, - "StandardTracerResult": struct{}{}, - "GetRPCCalls": struct{}{}, - "RPCSubscriptionTest": struct{}{}, - "LivePreProcessBlock": struct{}{}, - "LivePreProcessTransaction": struct{}{}, - "LivePostProcessTransaction": struct{}{}, - "LivePostProcessBlock": struct{}{}, - "LiveCaptureStart": struct{}{}, - "LiveCaptureState": struct{}{}, - // "LiveCaptureFault": struct{}{}, - // "LiveCaptureEnter": struct{}{}, - // "LiveCaptureExit": struct{}{}, - // "LiveTracerResult": struct{}{}, - "LiveCaptureEnd": struct{}{}, - "PreTrieCommit": struct{}{}, - "PostTrieCommit": struct{}{}, -} - diff --git a/plugins/ptp/test/test01/live_tracer.go b/plugins/ptp/test/test01/live_tracer.go deleted file mode 100644 index d57867ad3..000000000 --- a/plugins/ptp/test/test01/live_tracer.go +++ /dev/null @@ -1,157 +0,0 @@ -package main - -import ( - "context" - "math/big" - "time" - - "github.com/openrelayxyz/plugeth-utils/core" - "github.com/openrelayxyz/plugeth-utils/restricted/hexutil" -) - -type LiveTracerResult struct { - CallStack []CallStack - Results []CallStack -} - -type CallStack struct { - Type string `json:"type"` - From core.Address `json:"from"` - To core.Address `json:"to"` - Value *big.Int `json:"value,omitempty"` - Gas hexutil.Uint64 `json:"gas"` - GasUsed hexutil.Uint64 `json:"gasUsed"` - Input hexutil.Bytes `json:"input"` - Output hexutil.Bytes `json:"output"` - Time string `json:"time,omitempty"` - Calls []CallStack `json:"calls,omitempty"` - Results []CallStack `json:"results,omitempty"` - Error string `json:"error,omitempty"` -} - -func (t *LiveTracerResult) TraceBlock(ctx context.Context) (<-chan []CallStack, error) { - subch := make(chan []CallStack, 1000) - rtrnch := make(chan []CallStack, 1000) - go func() { - log.Info("Subscription Block Tracer setup") - sub := events.Subscribe(subch) - for { - select { - case <-ctx.Done(): - sub.Unsubscribe() - close(subch) - close(rtrnch) - return - case t := <-subch: - rtrnch <- t - case <-sub.Err(): - sub.Unsubscribe() - close(subch) - close(rtrnch) - return - } - } - }() - return rtrnch, nil -} - -func GetLiveTracer(core.Hash, core.StateDB) core.BlockTracer { - return &LiveTracerResult{} -} - -func (r *LiveTracerResult) PreProcessBlock(hash core.Hash, number uint64, encoded []byte) { - m := map[string]struct{}{ - "LivePreProcessBlock":struct{}{}, - } - hookChan <- m - r.Results = []CallStack{} -} - -func (r *LiveTracerResult) PreProcessTransaction(tx core.Hash, block core.Hash, i int) { - m := map[string]struct{}{ - "LivePreProcessTransaction":struct{}{}, - } - hookChan <- m -} - -func (r *LiveTracerResult) BlockProcessingError(tx core.Hash, block core.Hash, err error) { - m := map[string]struct{}{ - "LiveBlockProcessingError":struct{}{}, - } - hookChan <- m -} - -func (r *LiveTracerResult) PostProcessTransaction(tx core.Hash, block core.Hash, i int, receipt []byte) { - m := map[string]struct{}{ - "LivePostProcessTransaction":struct{}{}, - } - hookChan <- m -} - -func (r *LiveTracerResult) PostProcessBlock(block core.Hash) { - m := map[string]struct{}{ - "LivePostProcessBlock":struct{}{}, - } - hookChan <- m - if len(r.Results) > 0 { - events.Send(r.Results) - } -} - -func (r *LiveTracerResult) CaptureStart(from core.Address, to core.Address, create bool, input []byte, gas uint64, value *big.Int) { - r.CallStack = []CallStack{} - m := map[string]struct{}{ - "LiveCaptureStart":struct{}{}, - } - hookChan <- m -} -func (r *LiveTracerResult) CaptureState(pc uint64, op core.OpCode, gas, cost uint64, scope core.ScopeContext, rData []byte, depth int, err error) { - m := map[string]struct{}{ - "LiveCaptureState":struct{}{}, - } - hookChan <- m -} - -func (r *LiveTracerResult) CaptureFault(pc uint64, op core.OpCode, gas, cost uint64, scope core.ScopeContext, depth int, err error) { - // this method is not covered by tests at this time - // m := map[string]struct{}{ - // "LiveCaptureFault":struct{}{}, - // } - // hookChan <- m -} - -func (r *LiveTracerResult) CaptureEnd(output []byte, gasUsed uint64, t time.Duration, err error) { - m := map[string]struct{}{ - "LiveCaptureEnd":struct{}{}, - } - hookChan <- m - if len(r.CallStack) > 0 { - r.Results = append(r.CallStack) - } -} - -func (r *LiveTracerResult) CaptureEnter(typ core.OpCode, from core.Address, to core.Address, input []byte, gas uint64, value *big.Int) { - // this method is not covered by tests at this time - // m := map[string]struct{}{ - // "LiveCaptureEnter":struct{}{}, - // } - // hookChan <- m -} - -func (r *LiveTracerResult) CaptureExit(output []byte, gasUsed uint64, err error) { - // this method is not covered by tests at this time - // m := map[string]struct{}{ - // "LiveCaptureExit":struct{}{}, - // } - // hookChan <- m -} - -func (r *LiveTracerResult) Result() (interface{}, error) { - // this method is not covered by tests at this time - // m := map[string]struct{}{ - // "LiveTracerResult":struct{}{}, - // } - // hookChan <- m - return "", nil -} - diff --git a/plugins/ptp/test/test01/main.go b/plugins/ptp/test/test01/main.go deleted file mode 100644 index 2e76f84e1..000000000 --- a/plugins/ptp/test/test01/main.go +++ /dev/null @@ -1,260 +0,0 @@ -package main - -import ( - "context" - "math/big" - "time" - "os" - - "github.com/openrelayxyz/plugeth-utils/core" - "github.com/openrelayxyz/plugeth-utils/restricted/hexutil" -) - -var hookChan chan map[string]struct{} = make(chan map[string]struct{}, 10) -var quit chan string = make(chan string) - -func (service *engineService) CaptureShutdown(ctx context.Context) { - m := map[string]struct{}{ - "OnShutdown":struct{}{}, - } - hookChan <- m -} - -func (service *engineService) CapturePreTrieCommit(ctx context.Context) { - m := map[string]struct{}{ - "PreTrieCommit":struct{}{}, - } - hookChan <- m -} - -func (service *engineService) CapturePostTrieCommit(ctx context.Context) { - m := map[string]struct{}{ - "PostTrieCommit":struct{}{}, - } - hookChan <- m -} - -func BlockChain() { - - go func () { - for { - select { - case <- quit: - if len(plugins) > 0 { - log.Error("Exit with Error, Plugins map not empty", "Plugins not called", plugins) - os.Exit(1) - } else { - log.Info("Exit without error") - os.Exit(0) - } - case m := <- hookChan: - var ok bool - f := func(key string) bool {_, ok = m[key]; return ok} - switch { - case f("OnShutdown"): - delete(plugins, "OnShutdown") - case f("StateUpdate"): - delete(plugins, "StateUpdate") - case f("PreProcessBlock"): - delete(plugins, "PreProcessBlock") - case f("PreProcessTransaction"): - delete(plugins, "PreProcessTransaction") - case f("PostProcessTransaction"): - delete(plugins, "PostProcessTransaction") - case f("PostProcessBlock"): - delete(plugins, "PostProcessBlock") - case f("NewHead"): - delete(plugins, "NewHead") - case f("LivePreProcessBlock"): - delete(plugins, "LivePreProcessBlock") - case f("LivePreProcessTransaction"): - delete(plugins, "LivePreProcessTransaction") - case f("LivePostProcessTransaction"): - delete(plugins, "LivePostProcessTransaction") - case f("LivePostProcessBlock"): - delete(plugins, "LivePostProcessBlock") - case f("GetRPCCalls"): - delete(plugins, "GetRPCCalls") - case f("RPCSubscriptionTest"): - delete(plugins, "RPCSubscriptionTest") - case f("SetTrieFlushIntervalClone"): - delete(plugins, "SetTrieFlushIntervalClone") - case f("StandardCaptureStart"): - delete(plugins, "StandardCaptureStart") - case f("StandardCaptureState"): - delete(plugins, "StandardCaptureState") - case f("StandardCaptureFault"): - delete(plugins, "StandardCaptureFault") - case f("StandardCaptureEnter"): - delete(plugins, "StandardCaptureEnter") - case f("StandardCaptureExit"): - delete(plugins, "StandardCaptureExit") - case f("StandardCaptureEnd"): - delete(plugins, "StandardCaptureEnd") - case f("StandardTracerResult"): - delete(plugins, "StandardTracerResult") - case f("LivePreProcessBlock"): - delete(plugins, "LivePreProcessBlock") - case f("LiveCaptureStart"): - delete(plugins, "LiveCaptureStart") - case f("LiveCaptureState"): - delete(plugins, "LiveCaptureState") - // These methods are not covered by tests at this time - // case f("LiveCaptureFault"): - // delete(plugins, "LiveCaptureFault") - // case f("LiveCaptureEnter"): - // delete(plugins, "LiveCaptureEnter") - // case f("LiveCaptureExit"): - // 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") - } - } - } - }() - - txFactory() - txTracer() -} - -var t0 core.Hash -var t1 core.Hash -var t2 core.Hash -var t3 core.Hash -var coinBase *core.Address - -func txFactory() { - - cl := apis[0].Service.(*engineService).stack - client, err := cl.Attach() - if err != nil { - log.Error("Error connecting with client txFactory", "err", err) - } - - err = client.Call(&coinBase, "eth_coinbase") - if err != nil { - log.Error("failed to call eth_coinbase txFactory", "err", err) - } - - var peerCount hexutil.Uint64 - for peerCount == 0 { - err = client.Call(&peerCount, "net_peerCount") - if err != nil { - log.Error("failed to call net_peerCount", "err", err) - } - time.Sleep(100 * time.Millisecond) - } - - tx0_params := map[string]interface{}{ - "from": coinBase, - "to": coinBase, - "value": (*hexutil.Big)(big.NewInt(1)), - } - - err = client.Call(&t0, "eth_sendTransaction", tx0_params) - if err != nil { - log.Error("transaction zero failed", "err", err) - } - - tx1_params := map[string]interface{}{ - "input": "0x60018080600053f3", - "from": coinBase, - } - - time.Sleep(2 * time.Second) - err = client.Call(&t1, "eth_sendTransaction", tx1_params) - if err != nil { - log.Error("transaction one failed", "err", err) - } - - tx2_params := map[string]interface{}{ - "input": "0x61520873000000000000000000000000000000000000000060006000600060006000f1", - "from": coinBase, - } - - time.Sleep(2 * time.Second) - err = client.Call(&t2, "eth_sendTransaction", tx2_params) - if err != nil { - log.Error("transaction two failed", "err", err) - } - - genericArg := map[string]interface{}{ - "input": "0x608060405234801561001057600080fd5b5061011a806100206000396000f3fe608060405234801561001057600080fd5b50600436106100375760003560e01c806360fe47b11461003c5780636d4ce63c1461005d57610037565b600080fd5b61004561007e565b60405161005291906100c5565b60405180910390f35b61007c6004803603602081101561007a57600080fd5b50356100c2565b6040516020018083838082843780820191505050505b565b005b6100946100c4565b60405161005291906100bf565b6100d1565b60405180910390f35b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60e11b815260040161010060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146101e557600080fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e7ba30df6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156101ae57600080fd5b505af11580156101c2573d6000803e3d6000fd5b50505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461029157600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fdacd5766040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156102f957600080fd5b505af115801561030d573d6000803e3d6000fd5b50505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168156fea2646970667358221220d4f2763f3a0ae2826cc9ef37a65ff0c14d7a3aafe8d1636ff99f72e2f705413d64736f6c634300060c0033", - "from": coinBase, - } - - for i := 0; i < 126; i ++ { - time.Sleep(2 * time.Second) - err = client.Call(&t3, "eth_sendTransaction", genericArg) - if err != nil { - log.Error("looped transaction failed on index", "i", i, "err", err) - } - } - -} - -type TraceConfig struct { - Tracer *string -} - -func txTracer() { - - cl := apis[0].Service.(*engineService).stack - client, err := cl.Attach() - if err != nil { - log.Error("Error connecting with client block factory") - } - - time.Sleep(2 * time.Second) - tr := "testTracer" - t := TraceConfig{ - Tracer: &tr, - } - - var trResult interface{} - err = client.Call(&trResult, "debug_traceTransaction", t0, t) - if err != nil { - log.Error("debug_traceTransaction failed", "err", err) - } - - debugArg0 := map[string]interface{}{ - "input": "0x60006000fd", - "from": coinBase, - } - - var trResult0 interface{} - err = client.Call(&trResult0, "debug_traceCall", debugArg0, "latest", t) - if err != nil { - log.Error("debug_traceCall 0 failed", "err", err) - } - - debugArg1 := map[string]interface{}{ - "input": "0x61520873000000000000000000000000000000000000000060006000600060006000f1", - "from": coinBase, - } - - var trResult1 interface{} - err = client.Call(&trResult1, "debug_traceCall", debugArg1, "latest", t) - - - final := map[string]interface{}{ - "input": "0x61520873000000000000000000000000000000000000000060006000600060006000f1", - "from": coinBase, - } - - time.Sleep(2 * time.Second) - err = client.Call(&t3, "eth_sendTransaction", final) - if err != nil { - log.Error("contract call failed", "err", err) - } - - quit <- "quit" - -} - diff --git a/plugins/ptp/test/test01/tracer.go b/plugins/ptp/test/test01/tracer.go deleted file mode 100644 index fe00ffa8f..000000000 --- a/plugins/ptp/test/test01/tracer.go +++ /dev/null @@ -1,59 +0,0 @@ -package main - -import ( - "math/big" - "time" - - "github.com/openrelayxyz/plugeth-utils/core" -) - - type TracerService struct {} - -var Tracers = map[string]func(core.StateDB) core.TracerResult{ - "testTracer": func(core.StateDB) core.TracerResult { - return &TracerService{} - }, -} - -func (b *TracerService) CaptureStart(from core.Address, to core.Address, create bool, input []byte, gas uint64, value *big.Int) { - m := map[string]struct{}{ - "StandardCaptureStart": struct{}{}, - } - hookChan <- m -} -func (b *TracerService) CaptureState(pc uint64, op core.OpCode, gas, cost uint64, scope core.ScopeContext, rData []byte, depth int, err error) { - m := map[string]struct{}{ - "StandardCaptureState": struct{}{}, - } - hookChan <- m -} -func (b *TracerService) CaptureFault(pc uint64, op core.OpCode, gas, cost uint64, scope core.ScopeContext, depth int, err error) { - m := map[string]struct{}{ - "StandardCaptureFault": struct{}{}, - } - hookChan <- m -} -func (b *TracerService) CaptureEnd(output []byte, gasUsed uint64, t time.Duration, err error) { - m := map[string]struct{}{ - "StandardCaptureEnd": struct{}{}, - } - hookChan <- m -} -func (b *TracerService) CaptureEnter(typ core.OpCode, from core.Address, to core.Address, input []byte, gas uint64, value *big.Int) { - m := map[string]struct{}{ - "StandardCaptureEnter": struct{}{}, - } - hookChan <- m -} -func (b *TracerService) CaptureExit(output []byte, gasUsed uint64, err error) { - m := map[string]struct{}{ - "StandardCaptureExit": struct{}{}, - } - hookChan <- m -} -func (b *TracerService) Result() (interface{}, error) { - m := map[string]struct{}{ - "StandardTracerResult": struct{}{}, - } - hookChan <- m - return "", nil } \ No newline at end of file diff --git a/plugins/ptp/test/test02/engine.go b/plugins/ptp/test/test02/engine.go deleted file mode 100644 index 047c91f2f..000000000 --- a/plugins/ptp/test/test02/engine.go +++ /dev/null @@ -1,102 +0,0 @@ -package main - -import( - "errors" - "math/big" - - "github.com/openrelayxyz/plugeth-utils/core" - "github.com/openrelayxyz/plugeth-utils/restricted" - "github.com/openrelayxyz/plugeth-utils/restricted/types" - "github.com/openrelayxyz/plugeth-utils/restricted/hasher" - "github.com/openrelayxyz/plugeth-utils/restricted/consensus" -) - -var ( - pl core.PluginLoader - backend restricted.Backend - log core.Logger - events core.Feed -) - -var httpApiFlagName = "http.api" - -func Initialize(ctx core.Context, loader core.PluginLoader, logger core.Logger) { - pl = loader - events = pl.GetFeed() - log = logger - v := ctx.String(httpApiFlagName) - if v != "" { - ctx.Set(httpApiFlagName, v+",plugeth") - } else { - ctx.Set(httpApiFlagName, "eth,net,web3,plugeth") - log.Info("Loaded consensus engine plugin") - } -} - -type engine struct { -} - -func (e *engine) Author(header *types.Header) (core.Address, error) { - return header.Coinbase, nil -} -func (e *engine) VerifyHeader(chain consensus.ChainHeaderReader, header *types.Header, seal bool) error { - return nil -} -func (e *engine) VerifyHeaders(chain consensus.ChainHeaderReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error) { - quit := make(chan struct{}) - err := make(chan error) - go func () { - for i, h := range headers { - select { - case <-quit: - return - case err<- e.VerifyHeader(chain, h, seals[i]): - } - } - } () - return quit, err -} -func (e *engine) VerifyUncles(chain consensus.ChainReader, block *types.Block) error { - return nil -} -func (e *engine) Prepare(chain consensus.ChainHeaderReader, header *types.Header) error { - header.Difficulty = new(big.Int).SetUint64(123456789) - header.UncleHash = core.HexToHash("1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347") - return nil -} -func (e *engine) Finalize(chain consensus.ChainHeaderReader, header *types.Header, state core.RWStateDB, txs []*types.Transaction,uncles []*types.Header, withdrawals []*types.Withdrawal) { -} -func (e *engine) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state core.RWStateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt, withdrawals []*types.Withdrawal) (*types.Block, error) { - header.Root = state.IntermediateRoot(false) - hasher := hasher.NewStackTrie(nil) - block := types.NewBlockWithWithdrawals(header, txs, uncles, receipts, withdrawals, hasher) - return block, nil - -} -func (e *engine) Seal(chain consensus.ChainHeaderReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error { - if len(block.Transactions()) == 0 { - return errors.New("sealing paused while waiting for transactions") - } - go func () { - results <- block - close(results) - } () - // TO DO: the stop channel will need to be addressed in a non test case scenerio - return nil -} -func (e *engine) SealHash(header *types.Header) core.Hash { - return header.Hash() -} -func (e *engine) CalcDifficulty(chain consensus.ChainHeaderReader, time uint64, parent *types.Header) *big.Int { - return new(big.Int).SetUint64(uint64(123456789)) -} -func (e *engine) APIs(chain consensus.ChainHeaderReader) []core.API { - return []core.API{} -} -func (e *engine) Close() error { - return nil -} - -func CreateEngine() consensus.Engine { - return &engine{} -} \ No newline at end of file diff --git a/plugins/ptp/test/test02/shutdown.go b/plugins/ptp/test/test02/shutdown.go deleted file mode 100644 index cc0ce9a87..000000000 --- a/plugins/ptp/test/test02/shutdown.go +++ /dev/null @@ -1,132 +0,0 @@ -package main - -import ( - "bytes" - "context" - "encoding/json" - "net" - "net/http" - "time" - "sync/atomic" - - "github.com/openrelayxyz/plugeth-utils/core" -) - -var globalId int64 - -var client = &http.Client{Transport: &http.Transport{ - Proxy: http.ProxyFromEnvironment, - DialContext: (&net.Dialer{ - Timeout: 30 * time.Second, - KeepAlive: 30 * time.Second, - }).DialContext, - MaxIdleConnsPerHost: 16, - MaxIdleConns: 16, - IdleConnTimeout: 90 * time.Second, - TLSHandshakeTimeout: 10 * time.Second, - ExpectContinueTimeout: 1 * time.Second, -}} - -type Call struct { - Version string `json:"jsonrpc"` - ID json.RawMessage `json:"id"` - Method string `json:"method"` - Params []json.RawMessage `json:"params"` -} - -func toRawMessages(items ...interface{}) ([]json.RawMessage, error) { - result := make([]json.RawMessage, len(items)) - for i, item := range items { - d, err := json.Marshal(item) - if err != nil { return nil, err } - result[i] = (json.RawMessage)(d) - } - return result, nil -} - -func PreTrieCommit(node core.Hash) { - - id, err := toRawMessages(atomic.AddInt64(&globalId, 1)) - if err != nil { - log.Error("json marshalling error, id", "err", err) - } - - call := &Call{ - Version: "2.0", - ID : id[0], - Method: "plugeth_capturePreTrieCommit", - Params: []json.RawMessage{}, - } - - backendURL := "http://127.0.0.1:9546" - - callBytes, _ := json.Marshal(call) - - request, _ := http.NewRequestWithContext(context.Background(), "POST", backendURL, bytes.NewReader(callBytes)) - request.Header.Add("Content-Type", "application/json") - - _, err = client.Do(request) - - if err != nil { - log.Error("Error calling passive node from PreTrieCommit", "err", err) - } - -} - -func PostTrieCommit(node core.Hash) { - - id, err := toRawMessages(atomic.AddInt64(&globalId, 1)) - if err != nil { - log.Error("json marshalling error, id", "err", err) - } - - call := &Call{ - Version: "2.0", - ID : id[0], - Method: "plugeth_capturePostTrieCommit", - Params: []json.RawMessage{}, - } - - backendURL := "http://127.0.0.1:9546" - - callBytes, _ := json.Marshal(call) - - request, _ := http.NewRequestWithContext(context.Background(), "POST", backendURL, bytes.NewReader(callBytes)) - request.Header.Add("Content-Type", "application/json") - - _, err = client.Do(request) - - if err != nil { - log.Error("Error calling passive node from PostTrieCommit", "err", err) - } - -} - -func OnShutdown() { - - id, err := toRawMessages(atomic.AddInt64(&globalId, 1)) - if err != nil { - log.Error("json marshalling error, id", "err", err) - } - - call := &Call{ - Version: "2.0", - ID : id[0], - Method: "plugeth_captureShutdown", - Params: []json.RawMessage{}, - } - - backendURL := "http://127.0.0.1:9546" - - callBytes, _ := json.Marshal(call) - - request, _ := http.NewRequestWithContext(context.Background(), "POST", backendURL, bytes.NewReader(callBytes)) - request.Header.Add("Content-Type", "application/json") - - _, err = client.Do(request) - - if err != nil { - log.Error("Error calling passive node from OnShutdown", "err", err) - } - -} \ No newline at end of file diff --git a/plugins/ptp/tracer.go b/plugins/ptp/tracer.go deleted file mode 100644 index fe00ffa8f..000000000 --- a/plugins/ptp/tracer.go +++ /dev/null @@ -1,59 +0,0 @@ -package main - -import ( - "math/big" - "time" - - "github.com/openrelayxyz/plugeth-utils/core" -) - - type TracerService struct {} - -var Tracers = map[string]func(core.StateDB) core.TracerResult{ - "testTracer": func(core.StateDB) core.TracerResult { - return &TracerService{} - }, -} - -func (b *TracerService) CaptureStart(from core.Address, to core.Address, create bool, input []byte, gas uint64, value *big.Int) { - m := map[string]struct{}{ - "StandardCaptureStart": struct{}{}, - } - hookChan <- m -} -func (b *TracerService) CaptureState(pc uint64, op core.OpCode, gas, cost uint64, scope core.ScopeContext, rData []byte, depth int, err error) { - m := map[string]struct{}{ - "StandardCaptureState": struct{}{}, - } - hookChan <- m -} -func (b *TracerService) CaptureFault(pc uint64, op core.OpCode, gas, cost uint64, scope core.ScopeContext, depth int, err error) { - m := map[string]struct{}{ - "StandardCaptureFault": struct{}{}, - } - hookChan <- m -} -func (b *TracerService) CaptureEnd(output []byte, gasUsed uint64, t time.Duration, err error) { - m := map[string]struct{}{ - "StandardCaptureEnd": struct{}{}, - } - hookChan <- m -} -func (b *TracerService) CaptureEnter(typ core.OpCode, from core.Address, to core.Address, input []byte, gas uint64, value *big.Int) { - m := map[string]struct{}{ - "StandardCaptureEnter": struct{}{}, - } - hookChan <- m -} -func (b *TracerService) CaptureExit(output []byte, gasUsed uint64, err error) { - m := map[string]struct{}{ - "StandardCaptureExit": struct{}{}, - } - hookChan <- m -} -func (b *TracerService) Result() (interface{}, error) { - m := map[string]struct{}{ - "StandardTracerResult": struct{}{}, - } - hookChan <- m - return "", nil } \ No newline at end of file