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

chore: delete unused code in src #701

Merged
merged 10 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from 9 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
4 changes: 2 additions & 2 deletions cairo/ethereum/cancun/bloom.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ from ethereum.crypto.hash import keccak256
from ethereum.cancun.blocks import TupleLog
from ethereum.cancun.fork_types import Bloom

from src.utils.bytes import uint256_to_bytes32, felt_to_bytes16_little
from src.utils.dict import dict_squash, dict_read, dict_write
from legacy.utils.bytes import uint256_to_bytes32, felt_to_bytes16_little
from legacy.utils.dict import dict_squash, dict_read, dict_write
from cairo_core.maths import pow2
from cairo_core.comparison import is_zero
const BIT_MASK_11_BITS = 0x07FF;
Expand Down
4 changes: 2 additions & 2 deletions cairo/ethereum/cancun/fork.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ from ethereum.utils.numeric import (
from ethereum.cancun.transactions import recover_sender
from cairo_core.comparison import is_zero

from src.utils.array import count_not_zero
from src.utils.dict import hashdict_write
from legacy.utils.array import count_not_zero
from legacy.utils.dict import hashdict_write

const ELASTICITY_MULTIPLIER = 2;
const BASE_FEE_MAX_CHANGE_DENOMINATOR = 8;
Expand Down
4 changes: 2 additions & 2 deletions cairo/ethereum/cancun/state.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ from starkware.cairo.common.dict_access import DictAccess
from starkware.cairo.common.registers import get_fp_and_pc
from starkware.cairo.common.math import assert_not_zero
from starkware.cairo.common.uint256 import Uint256
from src.utils.uint256 import uint256_add, uint256_sub
from legacy.utils.uint256 import uint256_add, uint256_sub
from starkware.cairo.common.alloc import alloc
from starkware.cairo.common.squash_dict import squash_dict
from starkware.cairo.common.memcpy import memcpy
Expand Down Expand Up @@ -48,7 +48,7 @@ from ethereum_types.numeric import U256, U256Struct, Bool, bool, Uint
from ethereum.utils.numeric import U256_le, U256_sub, U256_add, U256_mul
from cairo_core.comparison import is_zero

from src.utils.dict import (
from legacy.utils.dict import (
hashdict_read,
hashdict_write,
dict_new_empty,
Expand Down
2 changes: 1 addition & 1 deletion cairo/ethereum/cancun/transactions.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ from ethereum_rlp.rlp import (

from ethereum.cancun.blocks import UnionBytesLegacyTransaction
from ethereum.cancun.utils.constants import MAX_CODE_SIZE
from src.utils.array import count_not_zero
from legacy.utils.array import count_not_zero

func calculate_intrinsic_cost{range_check_ptr}(tx: Transaction) -> Uint {
alloc_locals;
Expand Down
4 changes: 2 additions & 2 deletions cairo/ethereum/cancun/trie.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ from starkware.cairo.lang.compiler.lib.registers import get_fp_and_pc
from starkware.cairo.common.cairo_builtins import KeccakBuiltin
from starkware.cairo.common.memcpy import memcpy

from src.utils.bytes import uint256_to_bytes32_little
from src.utils.dict import hashdict_read, hashdict_write, dict_new_empty
from legacy.utils.bytes import uint256_to_bytes32_little
from legacy.utils.dict import hashdict_read, hashdict_write, dict_new_empty
from ethereum.crypto.hash import keccak256
from ethereum.utils.numeric import min
from ethereum_rlp.rlp import encode, _encode_bytes, _encode
Expand Down
2 changes: 1 addition & 1 deletion cairo/ethereum/cancun/utils/address.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ from ethereum.cancun.fork_types import Address
from ethereum.crypto.hash import keccak256
from ethereum.utils.numeric import divmod

from src.utils.bytes import (
from legacy.utils.bytes import (
felt_to_bytes20_little,
bytes_to_felt,
felt_to_bytes,
Expand Down
2 changes: 1 addition & 1 deletion cairo/ethereum/cancun/utils/message.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ from starkware.cairo.common.registers import get_fp_and_pc, get_label_location
from starkware.cairo.common.memcpy import memcpy
from starkware.cairo.common.dict_access import DictAccess

from src.utils.dict import hashdict_write
from legacy.utils.dict import hashdict_write

const PRECOMPILED_ADDRESSES_SIZE = 10;

Expand Down
2 changes: 1 addition & 1 deletion cairo/ethereum/cancun/vm.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ from ethereum.cancun.state import account_exists_and_is_empty
from ethereum.cancun.vm.memory import Memory
from cairo_core.comparison import is_zero
from starkware.cairo.common.memcpy import memcpy
from src.utils.dict import (
from legacy.utils.dict import (
hashdict_write,
hashdict_read,
dict_update,
Expand Down
3 changes: 1 addition & 2 deletions cairo/ethereum/cancun/vm/gas.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ from starkware.cairo.common.math_cmp import is_le, is_not_zero, RC_BOUND, is_le_
from starkware.cairo.common.math import assert_le_felt
from starkware.cairo.common.uint256 import ALL_ONES, uint256_eq, uint256_le

from src.utils.uint256 import uint256_add
from src.constants import Constants
from legacy.utils.uint256 import uint256_add

from cairo_core.comparison import is_zero

Expand Down
4 changes: 2 additions & 2 deletions cairo/ethereum/cancun/vm/instructions/arithmetic.cairo
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from starkware.cairo.common.cairo_builtins import BitwiseBuiltin, KeccakBuiltin, PoseidonBuiltin
from starkware.cairo.common.uint256 import uint256_mul, ALL_ONES, uint256_lt

from src.utils.uint256 import (
from legacy.utils.uint256 import (
uint256_eq,
uint256_fast_exp,
uint256_signextend,
Expand All @@ -11,7 +11,7 @@ from src.utils.uint256 import (
uint256_signed_div_rem,
uint256_mul_div_mod,
)
from src.utils.utils import Helpers
from legacy.utils.utils import Helpers
from ethereum.cancun.vm.stack import Stack, pop, push
from ethereum.cancun.vm import Evm, EvmImpl
from ethereum.exceptions import EthereumException
Expand Down
2 changes: 1 addition & 1 deletion cairo/ethereum/cancun/vm/instructions/bitwise.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ from starkware.cairo.common.uint256 import (
Uint256,
)

from src.utils.uint256 import uint256_lt
from legacy.utils.uint256 import uint256_lt
from ethereum.cancun.vm.stack import Stack, pop, push
from ethereum.cancun.vm import Evm, EvmImpl
from ethereum.exceptions import EthereumException
Expand Down
4 changes: 2 additions & 2 deletions cairo/ethereum/cancun/vm/instructions/block.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ from ethereum.exceptions import EthereumException
from ethereum.cancun.vm.gas import charge_gas, GasConstants
from ethereum.cancun.vm.stack import Stack, pop, push
from ethereum.utils.numeric import U256_from_be_bytes32
from src.utils.bytes import felt_to_bytes20_little
from src.utils.utils import Helpers
from legacy.utils.bytes import felt_to_bytes20_little
from legacy.utils.utils import Helpers

// @notice Get the hash of one of the 256 most recent complete blocks
func block_hash{
Expand Down
2 changes: 1 addition & 1 deletion cairo/ethereum/cancun/vm/instructions/comparison.cairo
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from starkware.cairo.common.cairo_builtins import BitwiseBuiltin, KeccakBuiltin, PoseidonBuiltin
from starkware.cairo.common.uint256 import uint256_eq, Uint256

from src.utils.uint256 import uint256_lt, uint256_signed_lt
from legacy.utils.uint256 import uint256_lt, uint256_signed_lt
from ethereum.cancun.vm.stack import Stack, pop, push
from ethereum.cancun.vm import Evm, EvmImpl
from ethereum.exceptions import EthereumException
Expand Down
4 changes: 2 additions & 2 deletions cairo/ethereum/cancun/vm/instructions/control_flow.cairo
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from starkware.cairo.common.bool import TRUE, FALSE
from starkware.cairo.common.cairo_builtins import BitwiseBuiltin, KeccakBuiltin, PoseidonBuiltin
from starkware.cairo.common.dict import DictAccess
from src.utils.dict import dict_read
from legacy.utils.dict import dict_read

from ethereum_types.numeric import (
U256,
Expand All @@ -19,7 +19,7 @@ from ethereum.cancun.vm.exceptions import InvalidJumpDestError
from ethereum.cancun.vm.gas import charge_gas, GasConstants
from ethereum.cancun.vm.stack import Stack, pop, push

from src.utils.dict import hashdict_read
from legacy.utils.dict import hashdict_read

// @notice Stop further execution of EVM code
func stop{
Expand Down
6 changes: 3 additions & 3 deletions cairo/ethereum/cancun/vm/instructions/environment.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ from ethereum.utils.numeric import (
U256_from_be_bytes20,
)

from src.utils.bytes import felt_to_bytes20_little
from src.utils.dict import hashdict_read, hashdict_write
from src.utils.utils import Helpers
from legacy.utils.bytes import felt_to_bytes20_little
from legacy.utils.dict import hashdict_read, hashdict_write
from legacy.utils.utils import Helpers

// @notice Pushes the address of the current executing account to the stack.
func address{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ from ethereum_types.others import (
TupleU256U256,
TupleU256U256Struct,
)
from src.utils.bytes import uint256_to_bytes32
from src.utils.utils import Helpers
from legacy.utils.bytes import uint256_to_bytes32
from legacy.utils.utils import Helpers

// @notice Stores a word to memory
func mstore{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from starkware.cairo.common.cairo_builtins import BitwiseBuiltin, KeccakBuiltin, PoseidonBuiltin
from starkware.cairo.common.math_cmp import is_le
from starkware.cairo.common.dict import DictAccess
from src.utils.dict import dict_read, dict_write
from legacy.utils.dict import dict_read, dict_write

from ethereum.cancun.vm.stack import push, StackDictAccess, Stack, StackStruct, pop as stack_pop
from ethereum.cancun.vm import Evm, EvmImpl
Expand All @@ -10,7 +10,7 @@ from ethereum.cancun.vm.exceptions import StackUnderflowError
from ethereum.cancun.vm.gas import charge_gas, GasConstants
from ethereum_types.numeric import Uint, U256, U256Struct
from ethereum.cancun.vm.memory import buffer_read
from src.utils.utils import Helpers
from legacy.utils.utils import Helpers

from cairo_core.comparison import is_zero

Expand Down
4 changes: 2 additions & 2 deletions cairo/ethereum/cancun/vm/instructions/storage.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ from ethereum.cancun.fork_types import (
from ethereum_types.bytes import Bytes32
from ethereum_types.numeric import Uint, U256, U256Struct
from ethereum.utils.numeric import U256_to_be_bytes
from src.utils.dict import hashdict_read, hashdict_write
from src.utils.utils import Helpers
from legacy.utils.dict import hashdict_read, hashdict_write
from legacy.utils.utils import Helpers

from starkware.cairo.common.cairo_builtins import BitwiseBuiltin, KeccakBuiltin, PoseidonBuiltin
from starkware.cairo.lang.compiler.lib.registers import get_fp_and_pc
Expand Down
4 changes: 2 additions & 2 deletions cairo/ethereum/cancun/vm/instructions/system.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ from ethereum.utils.numeric import (
U256_le,
U256__eq__,
)
from src.utils.dict import hashdict_write, dict_copy
from legacy.utils.dict import hashdict_write, dict_copy
from starkware.cairo.common.uint256 import uint256_lt
from starkware.cairo.common.alloc import alloc
from src.utils.dict import hashdict_read
from legacy.utils.dict import hashdict_read
from cairo_core.comparison import is_zero

func generic_call{
Expand Down
2 changes: 1 addition & 1 deletion cairo/ethereum/cancun/vm/interpreter.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ from ethereum.cancun.state import (
touch_account,
)

from src.utils.dict import hashdict_write, dict_squash
from legacy.utils.dict import hashdict_write, dict_squash

struct MessageCallOutput {
value: MessageCallOutputStruct*,
Expand Down
4 changes: 2 additions & 2 deletions cairo/ethereum/cancun/vm/memory.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ from starkware.cairo.common.math_cmp import is_le, is_not_zero
from ethereum_types.bytes import Bytes, BytesStruct, Bytes1DictAccess
from ethereum_types.numeric import U256, Uint
from ethereum.utils.numeric import max
from src.utils.bytes import uint256_to_bytes32
from src.utils.dict import dict_read, dict_write
from legacy.utils.bytes import uint256_to_bytes32
from legacy.utils.dict import dict_read, dict_write

struct MemoryStruct {
dict_ptr_start: Bytes1DictAccess*,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ from ethereum.cancun.vm.gas import GasConstants, charge_gas
from ethereum_types.numeric import Uint
from ethereum_types.bytes import Bytes, BytesStruct, ListBytes4, ListBytes4Struct

from src.utils.utils import Helpers
from legacy.utils.utils import Helpers
from cairo_core.hash.sha256 import sha256_be_output
from cairo_core.maths import unsigned_div_rem

Expand Down
10 changes: 5 additions & 5 deletions cairo/ethereum/cancun/vm/runtime.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ from starkware.cairo.common.dict_access import DictAccess
from ethereum_types.bytes import Bytes, BytesStruct
from ethereum_types.numeric import SetUint, SetUintStruct, SetUintDictAccess

from src.utils.utils import Helpers
from src.utils.dict import dict_write
from cairo_core.comparison import is_le_unchecked
from legacy.utils.dict import dict_write

func get_valid_jump_destinations{range_check_ptr}(code: Bytes) -> SetUint {
alloc_locals;
Expand All @@ -32,8 +32,8 @@ func get_valid_jump_destinations{range_check_ptr}(code: Bytes) -> SetUint {
let range_check_ptr = range_check_ptr + 1;

tempvar opcode = [bytecode.data + i];
let is_opcode_ge_0x5f = Helpers.is_le_unchecked(0x5f, opcode);
let is_opcode_le_0x7f = Helpers.is_le_unchecked(opcode, 0x7f);
let is_opcode_ge_0x5f = is_le_unchecked(0x5f, opcode);
let is_opcode_le_0x7f = is_le_unchecked(opcode, 0x7f);
let is_push_opcode = is_opcode_ge_0x5f * is_opcode_le_0x7f;
let next_i = i + 1 + is_push_opcode * (opcode - 0x5f); // 0x5f is the first PUSHN opcode, opcode - 0x5f is the number of arguments.

Expand Down Expand Up @@ -65,7 +65,7 @@ func get_valid_jump_destinations{range_check_ptr}(code: Bytes) -> SetUint {
let range_check_ptr = [ap - 3];
let i = [ap - 1];
// Verify that i >= bytecode_len to ensure loop terminated correctly.
let check = Helpers.is_le_unchecked(code.value.len, i);
let check = is_le_unchecked(code.value.len, i);
assert check = 1;

let dict_ptr_start = cast(valid_jumpdests_start, SetUintDictAccess*);
Expand Down
2 changes: 1 addition & 1 deletion cairo/ethereum/cancun/vm/stack.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ from ethereum_types.bytes import BytesStruct, Bytes
from starkware.cairo.common.dict import DictAccess
from ethereum.exceptions import EthereumException
from ethereum.cancun.vm.exceptions import StackOverflowError, StackUnderflowError
from src.utils.dict import dict_read, dict_write
from legacy.utils.dict import dict_read, dict_write

struct Stack {
value: StackStruct*,
Expand Down
2 changes: 1 addition & 1 deletion cairo/ethereum/crypto/hash.cairo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from ethereum_types.bytes import Bytes32, Bytes
from src.utils.bytes import bytes_to_bytes8_little_endian
from legacy.utils.bytes import bytes_to_bytes8_little_endian
from starkware.cairo.common.builtin_keccak.keccak import keccak
from starkware.cairo.common.cairo_builtins import BitwiseBuiltin, KeccakBuiltin
from starkware.cairo.common.uint256 import Uint256
Expand Down
2 changes: 1 addition & 1 deletion cairo/ethereum/utils/bytes.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ from starkware.cairo.common.math import assert_not_equal, split_int
from starkware.cairo.common.memcpy import memcpy
from starkware.cairo.common.memset import memset
from starkware.cairo.common.cairo_builtins import BitwiseBuiltin
from src.utils.bytes import (
from legacy.utils.bytes import (
felt_to_bytes20_little,
uint256_to_bytes_little,
uint256_to_bytes32_little,
Expand Down
6 changes: 3 additions & 3 deletions cairo/ethereum/utils/numeric.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ from starkware.cairo.common.math import assert_le_felt

from starkware.cairo.common.math import split_felt
from starkware.cairo.common.uint256 import word_reverse_endian, Uint256, uint256_le, uint256_mul
from src.utils.uint256 import uint256_add, uint256_sub
from src.utils.utils import Helpers
from src.utils.bytes import bytes_to_felt, uint256_from_bytes_be
from legacy.utils.uint256 import uint256_add, uint256_sub
from legacy.utils.utils import Helpers
from legacy.utils.bytes import bytes_to_felt, uint256_from_bytes_be

func min{range_check_ptr}(a: felt, b: felt) -> felt {
alloc_locals;
Expand Down
4 changes: 2 additions & 2 deletions cairo/ethereum_rlp/rlp.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ from ethereum.utils.numeric import (
)
from ethereum.utils.bytes import Bytes8_to_Bytes
from cairo_core.comparison import is_zero
from src.utils.array import reverse
from src.utils.bytes import (
from legacy.utils.array import reverse
from legacy.utils.bytes import (
felt_to_bytes,
felt_to_bytes_little,
bytes_to_felt,
Expand Down
2 changes: 1 addition & 1 deletion cairo/ethereum_types/bytes.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from starkware.cairo.common.dict_access import DictAccess
from starkware.cairo.common.math import assert_not_equal
from starkware.cairo.common.uint256 import Uint256
from src.utils.utils import Helpers
from legacy.utils.utils import Helpers
from ethereum_types.numeric import U128, bool

// Bytes types
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ from starkware.cairo.common.memset import memset
from starkware.cairo.common.registers import get_label_location
from starkware.cairo.common.uint256 import uint256_reverse_endian

from src.utils.array import reverse
from legacy.utils.array import reverse
from cairo_core.maths import unsigned_div_rem

func felt_to_ascii{range_check_ptr}(dst: felt*, n: felt) -> felt {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading
Loading