diff --git a/core/shyft_database_util.go b/core/shyft_database_util.go index 62673984cf..c4232aaf03 100644 --- a/core/shyft_database_util.go +++ b/core/shyft_database_util.go @@ -172,11 +172,14 @@ func SwriteTransactions(sqldb *sql.DB, tx *types.Transaction, blockHash common.H Data: tx.Data(), } - //hash := txData.TxHash + hash := txData.TxHash txHash := txData.TxHash.Hex() - //prayer, _ := IShyftTracer.GetTracerToRun(hash) - //fmt.Printf("%+v\n", prayer) + prayer, _ := IShyftTracer.GetTracerToRun(hash) + fmt.Printf("%+v\n", prayer) + + //var stack *node.Node + //var cfg *eth.Config from := txData.From.Hex() blockHasher := txData.BlockHash diff --git a/eth/api_tracer.go b/eth/api_tracer.go index f8740f3b13..39c5779d9b 100644 --- a/eth/api_tracer.go +++ b/eth/api_tracer.go @@ -38,7 +38,6 @@ import ( "github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rpc" "github.com/ethereum/go-ethereum/trie" - ) const ( @@ -533,6 +532,197 @@ func (api *PrivateDebugAPI) computeStateDB(block *types.Block, reexec uint64) (* // TraceTransaction returns the structured logs created during the execution of EVM // and returns them as a JSON object. func (api *PrivateDebugAPI) TraceTransaction(ctx context.Context, hash common.Hash, config *TraceConfig) (interface{}, error) { + fmt.Println("TRACE TRANSACTION ++++++!+!+!+!+!+!+!+!+!+!+!+!++!") + _, file, no, ok := runtime.Caller(1) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(2) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(3) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(4) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(5) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(6) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(7) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(8) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(9) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(10) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(11) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(12) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(13) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(14) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(15) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(16) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(17) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(18) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(19) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(20) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(21) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(22) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(23) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(24) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(25) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(26) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(27) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(28) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(29) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(30) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(31) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(32) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(33) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(34) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(35) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(36) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(37) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(38) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(39) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(40) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + fmt.Println("////////////// ++++++++++++++++ /////////////////// Phantom *(!*!*!*!*!*!**!*!*") + _, file, no, ok = runtime.Caller(41) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(42) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(43) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + _, file, no, ok = runtime.Caller(44) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + fmt.Println("////////////// ++++++++++++++++ /////////////////// TraceTransaction *(!*!*!*!*!*!**!*!*") + _, file, no, ok = runtime.Caller(45) + if ok { + fmt.Printf("called from %s#%d\n", file, no) + } + // NOTE:SHYFT + //fmt.Printf("\n\t[API_TRACER.GO api.config] %+v", api.config) + //fmt.Printf("\n\t[API_TRACER.GO api.eth] %+v\n", api.eth) + // Retrieve the transaction and assemble its EVM context + //fmt.Println("IN TRACE TRANSACTION the chaindb is ") + //fmt.Println(chaindb) + //fmt.Println("IN TRACE TRANSACTION the common hash is ") + //fmt.Println(hash) tx, blockHash, _, index := core.GetTransaction(api.eth.ChainDb(), hash) if tx == nil { diff --git a/eth/shyft_tracer.go b/eth/shyft_tracer.go index 73bacd3b16..d0c984d961 100644 --- a/eth/shyft_tracer.go +++ b/eth/shyft_tracer.go @@ -1,5 +1,6 @@ package eth + import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/params" @@ -40,4 +41,272 @@ var Global_config *Config func setGlobalConfig(c *Config) { Global_config = c -} \ No newline at end of file +} + +// +//import ( +// "github.com/ethereum/go-ethereum/common" +// "fmt" +// "github.com/ethereum/go-ethereum/core" +// "runtime" +// "context" +//) +// +////const ( +//// // defaultTraceReexec is the number of blocks the tracer is willing to go back +//// // and reexecute to produce missing historical state necessary to run a specific +//// // trace. +//// defaultTraceReexec = uint64(128) +////) +// +////var api *eth.PrivateDebugAPI +// +//var EthereumObject interface{} +// +//type ShyftTracer struct {} +// +//func (st ShyftTracer) MyTraceTransaction(hash string) (interface{}) { +// //fmt.Println("THE stringed hash is in MYTRACETRANSACTION") +// //fmt.Println(hash) +// //fmt.Println(ethObjectInterface.GetEthObject()) +// fmt.Println("CTXXXXXXXXXXXXXXX") +// common_hash := common.HexToHash(hash) +// +// +// fmt.Println("the chain db is in MyTraceTransaction") +// //fmt.Println(Chaindb_global) +// if Chaindb_global == nil { +// return nil +// } +// +// tx, blockHash, _, index := core.GetTransaction(Chaindb_global, common_hash) +// +// if tx == nil { +// fmt.Println("TRANSACTION NOT FOUND IN MyTraceTransaction +++++++++") +// } +// +// reexec := defaultTraceReexec +// //if config != nil && config.Reexec != nil { +// // reexec = *config.Reexec +// //} +// msg, vmctx, statedb, err := DebugApi.computeTxEnv(blockHash, int(index), reexec) +// +// fmt.Println("stuff and nonsense") +// fmt.Println(msg) +// fmt.Println(vmctx) +// fmt.Println(statedb) +// fmt.Println(err) +// fmt.Println("THIS CTX") +// //fmt.Println("the tx is ") +// //fmt.Println(tx) +// //fmt.Println(blockHash) +// //fmt.Println(index) +// //DebugApi.traceTxTest(msg, vmctx, statedb, config) +// return 42 +//} +// +//func (api *PrivateDebugAPI) TraceTransactionTest(ctx context.Context, hash common.Hash, config *TraceConfig) (interface{}, error) { +// fmt.Println("TRACE TRANSACTION ++++++!+!+!+!+!+!+!+!+!+!+!+!++!") +// _, file, no, ok := runtime.Caller(1) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(2) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(3) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(4) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(5) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(6) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(7) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(8) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(9) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(10) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(11) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(12) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(13) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(14) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(15) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(16) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(17) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(18) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(19) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(20) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(21) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(22) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(23) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(24) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(25) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(26) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(27) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(28) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(29) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(30) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(31) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(32) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(33) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(34) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(35) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(36) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(37) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(38) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(39) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(40) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// fmt.Println("////////////// ++++++++++++++++ /////////////////// Phantom *(!*!*!*!*!*!**!*!*") +// _, file, no, ok = runtime.Caller(41) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(42) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(43) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// _, file, no, ok = runtime.Caller(44) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// fmt.Println("////////////// ++++++++++++++++ /////////////////// TraceTransaction *(!*!*!*!*!*!**!*!*") +// _, file, no, ok = runtime.Caller(45) +// if ok { +// fmt.Printf("called from %s#%d\n", file, no) +// } +// +// tx, blockHash, _, index := core.GetTransaction(api.eth.ChainDb(), hash) +// if tx == nil { +// return nil, fmt.Errorf("transaction %x not found", hash) +// } +// +// reexec := defaultTraceReexec +// if config != nil && config.Reexec != nil { +// reexec = *config.Reexec +// } +// msg, vmctx, statedb, err := api.computeTxEnv(blockHash, int(index), reexec) +// if err != nil { +// return nil, err +// } +// fmt.Println("CTX +++++++++++++++++++++++", ctx) +// return api.traceTxTest(ctx, msg, vmctx, statedb, config) +//} +// +//func setEthObject(ethobj interface{}){ +// EthereumObject = ethobj +//} diff --git a/shyfttracerinterface/tracer_interface.go b/shyfttracerinterface/tracer_interface.go index 366b1534d1..dbadf1e39b 100644 --- a/shyfttracerinterface/tracer_interface.go +++ b/shyfttracerinterface/tracer_interface.go @@ -7,3 +7,8 @@ import ( type IShyftTracer interface { GetTracerToRun(hash common.Hash) (interface{}, error) } + +//type IShyftTracer interface { +// MyTraceTransaction(hash string) (interface{}) +//} +