cleanup: remove setupComputation from vm2

setupComputation already replaced by runComputation
in transaction/call_common.nim
This commit is contained in:
jangko 2021-10-28 10:30:56 +07:00
parent 0ba3c682e4
commit df85cd779b
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
1 changed files with 0 additions and 25 deletions

View File

@ -49,31 +49,6 @@ proc setupTxContext*(vmState: BaseVMState, origin: EthAddress, gasPrice: GasInt,
vmState.gasCosts = vmState.fork.forkToSchedule vmState.gasCosts = vmState.fork.forkToSchedule
proc setupComputation*(vmState: BaseVMState, tx: Transaction, sender: EthAddress, fork: Fork) : Computation =
var gas = tx.gasLimit - tx.intrinsicGas(fork)
assert gas >= 0
vmState.setupTxContext(
origin = sender,
gasPrice = tx.gasPrice,
forkOverride = some(fork)
)
let msg = Message(
kind: if tx.contractCreation: evmcCreate else: evmcCall,
depth: 0,
gas: gas,
sender: sender,
contractAddress: tx.getRecipient(sender),
codeAddress: tx.destination,
value: tx.value,
data: tx.payload
)
result = newComputation(vmState, msg)
doAssert result.isOriginComputation
proc refundGas*(c: Computation, tx: Transaction, sender: EthAddress) = proc refundGas*(c: Computation, tx: Transaction, sender: EthAddress) =
let maxRefund = (tx.gasLimit - c.gasMeter.gasRemaining) div 2 let maxRefund = (tx.gasLimit - c.gasMeter.gasRemaining) div 2
c.gasMeter.returnGas min(c.getGasRefund(), maxRefund) c.gasMeter.returnGas min(c.getGasRefund(), maxRefund)