|
1 |
| -from eth.vm.forks.frontier.constants import REFUND_SELFDESTRUCT |
2 | 1 | from typing import Type
|
3 | 2 |
|
4 | 3 | from eth_hash.auto import keccak
|
|
9 | 8 |
|
10 | 9 | from eth.abc import (
|
11 | 10 | AccountDatabaseAPI,
|
12 |
| - ComputationAPI, |
13 | 11 | MessageAPI,
|
14 | 12 | SignedTransactionAPI,
|
15 | 13 | StateAPI,
|
@@ -90,57 +88,6 @@ def build_evm_message(self, transaction: SignedTransactionAPI) -> MessageAPI:
|
90 | 88 | )
|
91 | 89 | return message
|
92 | 90 |
|
93 |
| - def finalize_computation( |
94 |
| - self, |
95 |
| - transaction: SignedTransactionAPI, |
96 |
| - computation: ComputationAPI |
97 |
| - ) -> ComputationAPI: |
98 |
| - transaction_context = self.vm_state.get_transaction_context(transaction) |
99 |
| - |
100 |
| - # Self Destruct Refunds |
101 |
| - num_deletions = len(computation.get_accounts_for_deletion()) |
102 |
| - if num_deletions: |
103 |
| - computation.refund_gas(REFUND_SELFDESTRUCT * num_deletions) |
104 |
| - |
105 |
| - # Gas Refunds |
106 |
| - gas_remaining = computation.get_gas_remaining() |
107 |
| - gas_refunded = computation.get_gas_refund() |
108 |
| - gas_used = transaction.gas - gas_remaining |
109 |
| - gas_refund = min(gas_refunded, gas_used // 2) |
110 |
| - gas_refund_amount = (gas_refund + gas_remaining) * transaction_context.gas_price |
111 |
| - |
112 |
| - if gas_refund_amount: |
113 |
| - self.vm_state.logger.debug2( |
114 |
| - 'TRANSACTION REFUND: %s -> %s', |
115 |
| - gas_refund_amount, |
116 |
| - encode_hex(computation.msg.sender), |
117 |
| - ) |
118 |
| - |
119 |
| - self.vm_state.delta_balance(computation.msg.sender, gas_refund_amount) |
120 |
| - |
121 |
| - # Miner Fees |
122 |
| - gas_used = transaction.gas - gas_remaining - gas_refund |
123 |
| - transaction_fee = gas_used * self.vm_state.get_tip(transaction) |
124 |
| - self.vm_state.logger.debug2( |
125 |
| - 'TRANSACTION FEE: %s -> %s', |
126 |
| - transaction_fee, |
127 |
| - encode_hex(self.vm_state.coinbase), |
128 |
| - ) |
129 |
| - self.vm_state.delta_balance(self.vm_state.coinbase, transaction_fee) |
130 |
| - |
131 |
| - # Process Self Destructs |
132 |
| - for account, _ in computation.get_accounts_for_deletion(): |
133 |
| - # TODO: need to figure out how we prevent multiple selfdestructs from |
134 |
| - # the same account and if this is the right place to put this. |
135 |
| - self.vm_state.logger.debug2('DELETING ACCOUNT: %s', encode_hex(account)) |
136 |
| - |
137 |
| - # TODO: this balance setting is likely superflous and can be |
138 |
| - # removed since `delete_account` does this. |
139 |
| - self.vm_state.set_balance(account, 0) |
140 |
| - self.vm_state.delete_account(account) |
141 |
| - |
142 |
| - return computation |
143 |
| - |
144 | 91 |
|
145 | 92 | class LondonState(BerlinState):
|
146 | 93 | account_db_class: Type[AccountDatabaseAPI] = AccountDB
|
|
0 commit comments