rename 'txContext' to 'setupTxContext'
This commit is contained in:
parent
933b2dad78
commit
d656f7f701
|
@ -36,13 +36,11 @@ template balance(addressDb: ReadOnlyStateDb, address: EthAddress): GasInt =
|
|||
|
||||
proc binarySearchGas(vmState: var BaseVMState, transaction: Transaction, sender: EthAddress, gasPrice: GasInt, tolerance = 1): GasInt =
|
||||
proc dummyComputation(vmState: var BaseVMState, transaction: Transaction, sender: EthAddress): Computation =
|
||||
let recipient = transaction.getRecipient()
|
||||
# Note that vmState may be altered
|
||||
setupComputation(
|
||||
vmState,
|
||||
transaction,
|
||||
sender,
|
||||
recipient,
|
||||
vmState.blockNumber.toFork)
|
||||
|
||||
proc dummyTransaction(gasLimit, gasPrice: GasInt, destination: EthAddress, value: UInt256): Transaction =
|
||||
|
@ -287,11 +285,10 @@ proc setupEthRpc*(node: EthereumNode, chain: BaseChainDB, rpcsrv: RpcServer) =
|
|||
contractAddress: destination,
|
||||
codeAddress: CREATE_CONTRACT_ADDRESS,
|
||||
value: value,
|
||||
data: data,
|
||||
code: vmState.readOnlyStateDB.getCode(destination).toSeq
|
||||
data: data
|
||||
)
|
||||
|
||||
vmState.txContext(
|
||||
vmState.setupTxContext(
|
||||
origin = sender,
|
||||
gasPrice = gasPrice
|
||||
)
|
||||
|
|
|
@ -43,7 +43,7 @@ proc newBaseVMState*(prevStateRoot: Hash256, header: BlockHeader,
|
|||
new result
|
||||
result.init(prevStateRoot, header, chainDB, tracerFlags)
|
||||
|
||||
proc txContext*(vmState: BaseVMState, origin: EthAddress, gasPrice: GasInt, forkOverride=none(Fork)) =
|
||||
proc setupTxContext*(vmState: BaseVMState, origin: EthAddress, gasPrice: GasInt, forkOverride=none(Fork)) =
|
||||
## this proc will be called each time a new transaction
|
||||
## is going to be executed
|
||||
vmState.txOrigin = origin
|
||||
|
|
|
@ -33,7 +33,7 @@ proc setupComputation*(vmState: BaseVMState, tx: Transaction, sender: EthAddress
|
|||
debug "not enough gas to perform calculation", gas=gas
|
||||
return
|
||||
|
||||
vmState.txContext(
|
||||
vmState.setupTxContext(
|
||||
origin = sender,
|
||||
gasPrice = tx.gasPrice,
|
||||
forkOverride = some(fork)
|
||||
|
|
|
@ -205,7 +205,7 @@ proc initComputation(vmState: BaseVMState, tx: Transaction, sender: EthAddress,
|
|||
|
||||
let gasUsed = 0 #tx.payload.intrinsicGas.GasInt + gasFees[fork][GasTXCreate]
|
||||
|
||||
vmState.txContext(
|
||||
vmState.setupTxContext(
|
||||
origin = sender,
|
||||
gasPrice = tx.gasPrice,
|
||||
forkOverride = some(fork)
|
||||
|
|
|
@ -30,7 +30,7 @@ template doTest(fixture: JsonNode, address: byte, action: untyped): untyped =
|
|||
sender: EthAddress
|
||||
toAddress = initAddress(address)
|
||||
|
||||
vmState.txContext(
|
||||
vmState.setupTxContext(
|
||||
origin = sender,
|
||||
gasPrice = gasPrice
|
||||
)
|
||||
|
|
|
@ -45,7 +45,7 @@ proc testFixture(fixtures: JsonNode, testStatusIMPL: var TestStatus) =
|
|||
setupStateDB(fixture{"pre"}, db)
|
||||
let address = fexec{"address"}.getStr.parseAddress
|
||||
|
||||
vmState.txContext(
|
||||
vmState.setupTxContext(
|
||||
origin = fexec{"origin"}.getStr.parseAddress,
|
||||
gasPrice = fexec{"gasPrice"}.getHexadecimalInt
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue