add more options to debug_traceTransaction
This commit is contained in:
parent
8d42ad997e
commit
0b7b577af6
|
@ -18,6 +18,7 @@ type
|
|||
disableStorage: Option[bool]
|
||||
disableMemory: Option[bool]
|
||||
disableStack: Option[bool]
|
||||
disableState: Option[bool]
|
||||
|
||||
proc isTrue(x: Option[bool]): bool =
|
||||
result = x.isSome and x.get() == true
|
||||
|
@ -40,6 +41,7 @@ proc setupDebugRpc*(chainDB: BaseChainDB, rpcsrv: RpcServer) =
|
|||
## * disableStorage: BOOL. Setting this to true will disable storage capture (default = false).
|
||||
## * disableMemory: BOOL. Setting this to true will disable memory capture (default = false).
|
||||
## * disableStack: BOOL. Setting this to true will disable stack capture (default = false).
|
||||
## * disableState: BOOL. Setting this to true will disable state trie capture (default = false).
|
||||
let
|
||||
txHash = toHash(data)
|
||||
txDetails = chainDB.getTransactionKey(txHash)
|
||||
|
@ -55,5 +57,6 @@ proc setupDebugRpc*(chainDB: BaseChainDB, rpcsrv: RpcServer) =
|
|||
if opts.disableStorage.isTrue: flags.incl TracerFlags.DisableStorage
|
||||
if opts.disableMemory.isTrue: flags.incl TracerFlags.DisableMemory
|
||||
if opts.disableStack.isTrue: flags.incl TracerFlags.DisableStack
|
||||
if opts.disableState.isTrue: flags.incl TracerFlags.DisableState
|
||||
|
||||
traceTransaction(chainDB, blockHeader, blockBody, txDetails.index, flags)
|
||||
|
|
|
@ -13,7 +13,7 @@ proc traceTransaction*(db: BaseChainDB, header: BlockHeader,
|
|||
body: BlockBody, txIndex: int, tracerFlags: set[TracerFlags]): JsonNode =
|
||||
let
|
||||
parent = db.getParentHeader(header)
|
||||
# we add a memory layer between backend/upper layer db
|
||||
# we add a memory layer between backend/lower layer db
|
||||
# and capture state db snapshot during transaction execution
|
||||
memoryDB = newMemoryDB()
|
||||
captureDB = newCaptureDB(db.db, memoryDB)
|
||||
|
@ -40,7 +40,8 @@ proc traceTransaction*(db: BaseChainDB, header: BlockHeader,
|
|||
result["gas"] = %gasUsed
|
||||
|
||||
# now we dump captured state db
|
||||
var n = newJObject()
|
||||
for k, v in pairsInMemoryDB(memoryDB):
|
||||
n[k.prefixHex] = %v.prefixHex
|
||||
result["snapshot"] = n
|
||||
if TracerFlags.DisableState notin tracerFlags:
|
||||
var n = newJObject()
|
||||
for k, v in pairsInMemoryDB(memoryDB):
|
||||
n[k.prefixHex] = %v.prefixHex
|
||||
result["state"] = n
|
||||
|
|
|
@ -32,6 +32,7 @@ type
|
|||
DisableStorage
|
||||
DisableMemory
|
||||
DisableStack
|
||||
DisableState
|
||||
|
||||
TransactionTracer* = object
|
||||
trace*: JsonNode
|
||||
|
|
Loading…
Reference in New Issue