mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-02-25 02:15:30 +00:00
commit
2521ff1950
@ -25,7 +25,7 @@ proc setupDebugRpc*(chain: BaseChainDB, rpcsrv: RpcServer) =
|
|||||||
if not chain.getBlockBody(hash, result):
|
if not chain.getBlockBody(hash, result):
|
||||||
raise newException(ValueError, "Error when retrieving block body")
|
raise newException(ValueError, "Error when retrieving block body")
|
||||||
|
|
||||||
rpcsrv.rpc("debug_traceTransaction") do(data: HexDataStr, options: Option[TraceTxOptions]) -> JsonNode:
|
rpcsrv.rpc("debug_traceTransaction") do(data: EthHashStr, options: Option[TraceTxOptions]) -> JsonNode:
|
||||||
## The traceTransaction debugging method will attempt to run the transaction in the exact
|
## The traceTransaction debugging method will attempt to run the transaction in the exact
|
||||||
## same manner as it was executed on the network. It will replay any transaction that may
|
## same manner as it was executed on the network. It will replay any transaction that may
|
||||||
## have been executed prior to this one before it will finally attempt to execute the
|
## have been executed prior to this one before it will finally attempt to execute the
|
||||||
@ -38,7 +38,7 @@ proc setupDebugRpc*(chain: BaseChainDB, rpcsrv: RpcServer) =
|
|||||||
## * disableMemory: BOOL. Setting this to true will disable memory 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).
|
## * disableStack: BOOL. Setting this to true will disable stack capture (default = false).
|
||||||
let
|
let
|
||||||
txHash = strToHash(data.string)
|
txHash = toHash(data)
|
||||||
txDetails = chain.getTransactionKey(txHash)
|
txDetails = chain.getTransactionKey(txHash)
|
||||||
blockHeader = chain.getBlockHeader(txDetails.blockNumber)
|
blockHeader = chain.getBlockHeader(txDetails.blockNumber)
|
||||||
blockHash = chain.getBlockHash(txDetails.blockNumber)
|
blockHash = chain.getBlockHash(txDetails.blockNumber)
|
||||||
|
@ -29,14 +29,6 @@ import
|
|||||||
proc `%`*(value: Time): JsonNode =
|
proc `%`*(value: Time): JsonNode =
|
||||||
result = %value.toSeconds
|
result = %value.toSeconds
|
||||||
|
|
||||||
func toAddress(value: EthAddressStr): EthAddress = hexToPaddedByteArray[20](value.string)
|
|
||||||
|
|
||||||
func toHash(value: array[32, byte]): Hash256 {.inline.} =
|
|
||||||
result.data = value
|
|
||||||
|
|
||||||
func toHash(value: EthHashStr): Hash256 {.inline.} =
|
|
||||||
result = hexToPaddedByteArray[32](value.string).toHash
|
|
||||||
|
|
||||||
template balance(addressDb: AccountStateDb, address: EthAddress): GasInt =
|
template balance(addressDb: AccountStateDb, address: EthAddress): GasInt =
|
||||||
# TODO: Account balance u256 but GasInt is int64?
|
# TODO: Account balance u256 but GasInt is int64?
|
||||||
addressDb.getBalance(address).truncate(int64)
|
addressDb.getBalance(address).truncate(int64)
|
||||||
|
@ -9,10 +9,11 @@
|
|||||||
|
|
||||||
import hexstrings, nimcrypto, eth_common, byteutils
|
import hexstrings, nimcrypto, eth_common, byteutils
|
||||||
|
|
||||||
func strToAddress*(value: string): EthAddress = hexToPaddedByteArray[20](value)
|
func toAddress*(value: EthAddressStr): EthAddress = hexToPaddedByteArray[20](value.string)
|
||||||
|
|
||||||
func toHash*(value: array[32, byte]): Hash256 {.inline.} =
|
func toHash*(value: array[32, byte]): Hash256 {.inline.} =
|
||||||
result.data = value
|
result.data = value
|
||||||
|
|
||||||
func strToHash*(value: string): Hash256 {.inline.} =
|
func toHash*(value: EthHashStr): Hash256 {.inline.} =
|
||||||
result = hexToPaddedByteArray[32](value).toHash
|
result = hexToPaddedByteArray[32](value.string).toHash
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user