Skip to content

Commit

Permalink
dev: add SetAddress cairo type to prepare for EVM object (#305)
Browse files Browse the repository at this point in the history
resolves #293 

implement SetAddress as `EVM` object has `address_to_delete` field that
is a set of addresses
  • Loading branch information
Eikix authored Dec 19, 2024
1 parent 3c9e133 commit f9c9bf6
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/trunk_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- run: rustup update
- name: Rust cache
Expand Down
32 changes: 16 additions & 16 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
# To learn more about the format of this file, see https://docs.trunk.io/reference/trunk-yaml
version: 0.1
cli:
version: 1.22.7
version: 1.22.8
# Trunk provides extensibility via plugins. (https://docs.trunk.io/plugins)
plugins:
sources:
- id: trunk
ref: v1.6.4
ref: v1.6.6
uri: https://github.com/trunk-io/plugins
# Many linters and tools depend on runtimes - configure them here. (https://docs.trunk.io/runtimes)
runtimes:
enabled:
- go@1.21.0
- node@18.12.1
- node@18.20.5
- python@3.10.8
downloads:
- name: rust
Expand Down Expand Up @@ -61,28 +61,28 @@ lint:
read_output_from: stdout
run_linter_from: workspace
enabled:
- cspell@8.15.4
- cspell@8.17.1
- dotenv-linter@3.3.0
- actionlint@1.7.3
- actionlint@1.7.4
- black@24.10.0
- cairo@SYSTEM
- rustfmt@2024-10-31
- clippy@2024-10-31
- checkov@3.2.269
- rustfmt@1.65.0
- clippy@1.65.0
- checkov@3.2.342
- git-diff-check
- hadolint@2.12.0
- hadolint@2.12.1-beta
- isort@5.13.2
- markdownlint@0.42.0
- osv-scanner@1.9.0
- oxipng@9.1.2
- prettier@3.3.3
- ruff@0.7.1
- markdownlint@0.43.0
- osv-scanner@1.9.2
- oxipng@9.1.3
- prettier@3.4.2
- ruff@0.8.3
- shellcheck@0.10.0
- shfmt@3.6.0
- solidity@SYSTEM
- taplo@0.9.3
- trivy@0.56.2
- trufflehog@3.82.13
- trivy@0.58.0
- trufflehog@3.87.2
- yamllint@1.35.1

actions:
Expand Down
17 changes: 16 additions & 1 deletion cairo/ethereum/cancun/fork_types.cairo
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
from starkware.cairo.common.alloc import alloc

from ethereum_types.bytes import Bytes20, Bytes256, Bytes, BytesStruct
from ethereum_types.numeric import Uint, U256, U256Struct
from ethereum_types.numeric import Uint, U256, U256Struct, bool
from ethereum.crypto.hash import Hash32

using Address = Bytes20;

struct SetAddressDictAccess {
key: Address,
prev_value: bool,
new_value: bool,
}

struct SetAddressStruct {
dict_ptr_start: SetAddressDictAccess*,
dict_ptr: SetAddressDictAccess*,
}

struct SetAddress {
value: SetAddressStruct*,
}
using Root = Hash32;

using VersionedHash = Hash32;
Expand Down
1 change: 1 addition & 0 deletions cairo/tests/test_serde.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ def test_type(
Tuple[Mapping[Bytes, Bytes], ...],
Set[Uint],
Mapping[Address, Account],
Set[Address],
],
):
assume(no_empty_sequence(b))
Expand Down
1 change: 1 addition & 0 deletions cairo/tests/utils/args_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
("ethereum", "cancun", "blocks", "TupleLog"): Tuple[Log, ...],
("ethereum", "cancun", "blocks", "Receipt"): Receipt,
("ethereum", "cancun", "fork_types", "Address"): Address,
("ethereum", "cancun", "fork_types", "SetAddress"): Set[Address],
("ethereum", "cancun", "fork_types", "Root"): Root,
("ethereum", "cancun", "fork_types", "Account"): Account,
("ethereum", "cancun", "fork_types", "Bloom"): Bloom,
Expand Down

0 comments on commit f9c9bf6

Please sign in to comment.