Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix t8n tool errors #797

Merged
merged 5 commits into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/ethereum/arrow_glacier/fork.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ def check_transaction(
base_fee_per_gas: Uint,
gas_available: Uint,
chain_id: U64,
) -> Tuple[Address, U256]:
) -> Tuple[Address, Uint]:
"""
Check if the transaction is includable in the block.

Expand Down Expand Up @@ -426,6 +426,7 @@ def check_transaction(

if isinstance(tx, FeeMarketTransaction):
ensure(tx.max_fee_per_gas >= tx.max_priority_fee_per_gas, InvalidBlock)
ensure(tx.max_fee_per_gas >= base_fee_per_gas, InvalidBlock)

priority_fee_per_gas = min(
tx.max_priority_fee_per_gas,
Expand Down Expand Up @@ -730,7 +731,7 @@ def pay_rewards(

def process_transaction(
env: vm.Environment, tx: Transaction
) -> Tuple[U256, Tuple[Log, ...], bool]:
) -> Tuple[Uint, Tuple[Log, ...], bool]:
"""
Execute a transaction against the provided environment.

Expand Down
14 changes: 7 additions & 7 deletions src/ethereum/arrow_glacier/fork_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ class LegacyTransaction:
"""

nonce: U256
gas_price: U256
gas: U256
gas_price: Uint
gas: Uint
to: Union[Bytes0, Address]
value: U256
data: Bytes
Expand All @@ -71,8 +71,8 @@ class AccessListTransaction:

chain_id: U64
nonce: U256
gas_price: U256
gas: U256
gas_price: Uint
gas: Uint
to: Union[Bytes0, Address]
value: U256
data: Bytes
Expand All @@ -91,9 +91,9 @@ class FeeMarketTransaction:

chain_id: U64
nonce: U256
max_priority_fee_per_gas: U256
max_fee_per_gas: U256
gas: U256
max_priority_fee_per_gas: Uint
max_fee_per_gas: Uint
gas: Uint
to: Union[Bytes0, Address]
value: U256
data: Bytes
Expand Down
2 changes: 1 addition & 1 deletion src/ethereum/arrow_glacier/utils/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def prepare_message(
target: Union[Bytes0, Address],
value: U256,
data: Bytes,
gas: U256,
gas: Uint,
env: Environment,
code_address: Optional[Address] = None,
should_transfer_value: bool = True,
Expand Down
6 changes: 3 additions & 3 deletions src/ethereum/arrow_glacier/vm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Environment:
number: Uint
base_fee_per_gas: Uint
gas_limit: Uint
gas_price: U256
gas_price: Uint
time: U256
difficulty: Uint
state: State
Expand All @@ -55,7 +55,7 @@ class Message:
caller: Address
target: Union[Bytes0, Address]
current_target: Address
gas: U256
gas: Uint
value: U256
data: Bytes
code_address: Optional[Address]
Expand All @@ -75,7 +75,7 @@ class Evm:
stack: List[U256]
memory: bytearray
code: Bytes
gas_left: U256
gas_left: Uint
env: Environment
valid_jump_destinations: Set[Uint]
logs: Tuple[Log, ...]
Expand Down
2 changes: 1 addition & 1 deletion src/ethereum/arrow_glacier/vm/instructions/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def gasprice(evm: Evm) -> None:
charge_gas(evm, GAS_BASE)

# OPERATION
push(evm.stack, evm.env.gas_price)
push(evm.stack, U256(evm.env.gas_price))

# PROGRAM COUNTER
evm.pc += 1
Expand Down
6 changes: 3 additions & 3 deletions src/ethereum/arrow_glacier/vm/instructions/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def generic_create(
evm.accessed_addresses.add(contract_address)

create_message_gas = max_message_call_gas(Uint(evm.gas_left))
evm.gas_left -= U256(create_message_gas)
evm.gas_left -= create_message_gas

ensure(not evm.message.is_static, WriteInStaticContext)
evm.return_data = b""
Expand Down Expand Up @@ -103,7 +103,7 @@ def generic_create(
child_message = Message(
caller=evm.message.current_target,
target=Bytes0(),
gas=U256(create_message_gas),
gas=create_message_gas,
value=endowment,
data=b"",
code=call_data,
Expand Down Expand Up @@ -272,7 +272,7 @@ def generic_call(
child_message = Message(
caller=caller,
target=to,
gas=U256(gas),
gas=gas,
value=value,
data=call_data,
code=code,
Expand Down
8 changes: 4 additions & 4 deletions src/ethereum/arrow_glacier/vm/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class MessageCallOutput:
6. `has_erred`: True if execution has caused an error.
"""

gas_left: U256
gas_left: Uint
refund_counter: U256
logs: Tuple[Log, ...]
accounts_to_delete: Set[Address]
Expand Down Expand Up @@ -100,7 +100,7 @@ def process_message_call(
)
if is_collision:
return MessageCallOutput(
U256(0), U256(0), tuple(), set(), set(), True
Uint(0), U256(0), tuple(), set(), set(), True
)
else:
evm = process_create_message(message, env)
Expand Down Expand Up @@ -175,7 +175,7 @@ def process_create_message(message: Message, env: Environment) -> Evm:
ensure(len(contract_code) <= MAX_CODE_SIZE, OutOfGasError)
except ExceptionalHalt:
rollback_transaction(env.state)
evm.gas_left = U256(0)
evm.gas_left = Uint(0)
evm.output = b""
evm.has_erred = True
else:
Expand Down Expand Up @@ -281,7 +281,7 @@ def execute_code(message: Message, env: Environment) -> Evm:
op_implementation[op](evm)

except ExceptionalHalt:
evm.gas_left = U256(0)
evm.gas_left = Uint(0)
evm.output = b""
evm.has_erred = True
except Revert as e:
Expand Down
2 changes: 1 addition & 1 deletion src/ethereum/berlin/fork.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ def pay_rewards(

def process_transaction(
env: vm.Environment, tx: Transaction
) -> Tuple[U256, Tuple[Log, ...], bool]:
) -> Tuple[Uint, Tuple[Log, ...], bool]:
"""
Execute a transaction against the provided environment.

Expand Down
8 changes: 4 additions & 4 deletions src/ethereum/berlin/fork_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ class LegacyTransaction:
"""

nonce: U256
gas_price: U256
gas: U256
gas_price: Uint
gas: Uint
to: Union[Bytes0, Address]
value: U256
data: Bytes
Expand All @@ -72,8 +72,8 @@ class AccessListTransaction:

chain_id: U64
nonce: U256
gas_price: U256
gas: U256
gas_price: Uint
gas: Uint
to: Union[Bytes0, Address]
value: U256
data: Bytes
Expand Down
2 changes: 1 addition & 1 deletion src/ethereum/berlin/utils/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def prepare_message(
target: Union[Bytes0, Address],
value: U256,
data: Bytes,
gas: U256,
gas: Uint,
env: Environment,
code_address: Optional[Address] = None,
should_transfer_value: bool = True,
Expand Down
6 changes: 3 additions & 3 deletions src/ethereum/berlin/vm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Environment:
coinbase: Address
number: Uint
gas_limit: Uint
gas_price: U256
gas_price: Uint
time: U256
difficulty: Uint
state: State
Expand All @@ -54,7 +54,7 @@ class Message:
caller: Address
target: Union[Bytes0, Address]
current_target: Address
gas: U256
gas: Uint
value: U256
data: Bytes
code_address: Optional[Address]
Expand All @@ -74,7 +74,7 @@ class Evm:
stack: List[U256]
memory: bytearray
code: Bytes
gas_left: U256
gas_left: Uint
env: Environment
valid_jump_destinations: Set[Uint]
logs: Tuple[Log, ...]
Expand Down
2 changes: 1 addition & 1 deletion src/ethereum/berlin/vm/instructions/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def gasprice(evm: Evm) -> None:
charge_gas(evm, GAS_BASE)

# OPERATION
push(evm.stack, evm.env.gas_price)
push(evm.stack, U256(evm.env.gas_price))

# PROGRAM COUNTER
evm.pc += 1
Expand Down
6 changes: 3 additions & 3 deletions src/ethereum/berlin/vm/instructions/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def generic_create(
evm.accessed_addresses.add(contract_address)

create_message_gas = max_message_call_gas(Uint(evm.gas_left))
evm.gas_left -= U256(create_message_gas)
evm.gas_left -= create_message_gas

ensure(not evm.message.is_static, WriteInStaticContext)
evm.return_data = b""
Expand Down Expand Up @@ -103,7 +103,7 @@ def generic_create(
child_message = Message(
caller=evm.message.current_target,
target=Bytes0(),
gas=U256(create_message_gas),
gas=create_message_gas,
value=endowment,
data=b"",
code=call_data,
Expand Down Expand Up @@ -272,7 +272,7 @@ def generic_call(
child_message = Message(
caller=caller,
target=to,
gas=U256(gas),
gas=gas,
value=value,
data=call_data,
code=code,
Expand Down
8 changes: 4 additions & 4 deletions src/ethereum/berlin/vm/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class MessageCallOutput:
6. `has_erred`: True if execution has caused an error.
"""

gas_left: U256
gas_left: Uint
refund_counter: U256
logs: Tuple[Log, ...]
accounts_to_delete: Set[Address]
Expand Down Expand Up @@ -99,7 +99,7 @@ def process_message_call(
)
if is_collision:
return MessageCallOutput(
U256(0), U256(0), tuple(), set(), set(), True
Uint(0), U256(0), tuple(), set(), set(), True
)
else:
evm = process_create_message(message, env)
Expand Down Expand Up @@ -174,7 +174,7 @@ def process_create_message(message: Message, env: Environment) -> Evm:
ensure(len(contract_code) <= MAX_CODE_SIZE, OutOfGasError)
except ExceptionalHalt:
rollback_transaction(env.state)
evm.gas_left = U256(0)
evm.gas_left = Uint(0)
evm.output = b""
evm.has_erred = True
else:
Expand Down Expand Up @@ -280,7 +280,7 @@ def execute_code(message: Message, env: Environment) -> Evm:
op_implementation[op](evm)

except ExceptionalHalt:
evm.gas_left = U256(0)
evm.gas_left = Uint(0)
evm.output = b""
evm.has_erred = True
except Revert as e:
Expand Down
2 changes: 1 addition & 1 deletion src/ethereum/byzantium/fork.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ def pay_rewards(

def process_transaction(
env: vm.Environment, tx: Transaction
) -> Tuple[U256, Tuple[Log, ...], bool]:
) -> Tuple[Uint, Tuple[Log, ...], bool]:
"""
Execute a transaction against the provided environment.

Expand Down
4 changes: 2 additions & 2 deletions src/ethereum/byzantium/fork_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ class Transaction:
"""

nonce: U256
gas_price: U256
gas: U256
gas_price: Uint
gas: Uint
to: Union[Bytes0, Address]
value: U256
data: Bytes
Expand Down
2 changes: 1 addition & 1 deletion src/ethereum/byzantium/utils/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def prepare_message(
target: Union[Bytes0, Address],
value: U256,
data: Bytes,
gas: U256,
gas: Uint,
env: Environment,
code_address: Optional[Address] = None,
should_transfer_value: bool = True,
Expand Down
6 changes: 3 additions & 3 deletions src/ethereum/byzantium/vm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Environment:
coinbase: Address
number: Uint
gas_limit: Uint
gas_price: U256
gas_price: Uint
time: U256
difficulty: Uint
state: State
Expand All @@ -53,7 +53,7 @@ class Message:
caller: Address
target: Union[Bytes0, Address]
current_target: Address
gas: U256
gas: Uint
value: U256
data: Bytes
code_address: Optional[Address]
Expand All @@ -71,7 +71,7 @@ class Evm:
stack: List[U256]
memory: bytearray
code: Bytes
gas_left: U256
gas_left: Uint
env: Environment
valid_jump_destinations: Set[Uint]
logs: Tuple[Log, ...]
Expand Down
2 changes: 1 addition & 1 deletion src/ethereum/byzantium/vm/instructions/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def gasprice(evm: Evm) -> None:
charge_gas(evm, GAS_BASE)

# OPERATION
push(evm.stack, evm.env.gas_price)
push(evm.stack, U256(evm.env.gas_price))

# PROGRAM COUNTER
evm.pc += 1
Expand Down
6 changes: 3 additions & 3 deletions src/ethereum/byzantium/vm/instructions/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def create(evm: Evm) -> None:
charge_gas(evm, GAS_CREATE + extend_memory.cost)

create_message_gas = max_message_call_gas(Uint(evm.gas_left))
evm.gas_left -= U256(create_message_gas)
evm.gas_left -= create_message_gas

# OPERATION
ensure(not evm.message.is_static, WriteInStaticContext)
Expand Down Expand Up @@ -109,7 +109,7 @@ def create(evm: Evm) -> None:
child_message = Message(
caller=evm.message.current_target,
target=Bytes0(),
gas=U256(create_message_gas),
gas=create_message_gas,
value=endowment,
data=b"",
code=call_data,
Expand Down Expand Up @@ -201,7 +201,7 @@ def generic_call(
child_message = Message(
caller=caller,
target=to,
gas=U256(gas),
gas=gas,
value=value,
data=call_data,
code=code,
Expand Down
Loading
Loading