Skip to content

Commit

Permalink
Opcode tracer (#1320)
Browse files Browse the repository at this point in the history
* OpcodeTracer

* Cleanup, rename to opcode_tracer

* Bring back check_change_sets, remove repeated vars

* Cleanup, gofmt

* Linter, cleanup

* Rename "segments" to "basic blocks", "bblocks"

* gofmt

* Lintci madness
  • Loading branch information
hmijail authored Oct 30, 2020
1 parent 99af6c4 commit ed1819e
Show file tree
Hide file tree
Showing 2 changed files with 685 additions and 0 deletions.
30 changes: 30 additions & 0 deletions cmd/state/commands/opcode_tracer.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package commands

import (
"github.com/ledgerwatch/turbo-geth/cmd/state/stateless"
"github.com/spf13/cobra"
)

var (
numBlocks uint64
saveOpcodes bool
saveBBlocks bool
)

func init() {
withBlock(opcodeTracer)
withChaindata(opcodeTracer)
opcodeTracer.Flags().Uint64Var(&numBlocks, "numBlocks", 1, "number of blocks to run the operation on")
opcodeTracer.Flags().BoolVar(&saveOpcodes, "saveOpcodes", false, "set to save the opcodes")
opcodeTracer.Flags().BoolVar(&saveBBlocks, "saveBBlocks", false, "set to save the basic blocks")

rootCmd.AddCommand(opcodeTracer)
}

var opcodeTracer = &cobra.Command{
Use: "opcodeTracer",
Short: "Re-executes historical transactions in read-only mode and traces them at the opcode level",
RunE: func(cmd *cobra.Command, args []string) error {
return stateless.OpcodeTracer(genesis, block, chaindata, numBlocks, saveOpcodes, saveBBlocks)
},
}
Loading

0 comments on commit ed1819e

Please sign in to comment.