-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4dd2a38
commit dda8791
Showing
29 changed files
with
1,054 additions
and
504 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,68 @@ | ||
from starkware.cairo.common.dict_access import DictAccess | ||
from starkware.cairo.common.uint256 import Uint256 | ||
|
||
struct Bytes { | ||
// Int types | ||
struct bool { | ||
value: felt, | ||
} | ||
struct U64 { | ||
value: felt, | ||
} | ||
struct U128 { | ||
value: felt, | ||
} | ||
struct Uint { | ||
value: felt, | ||
} | ||
struct U256 { | ||
value: Uint256*, | ||
} | ||
|
||
// Bytes types | ||
struct Bytes0 { | ||
value: felt, | ||
} | ||
struct Bytes8 { | ||
value: felt, | ||
} | ||
struct Bytes20 { | ||
value: felt, | ||
} | ||
struct Bytes32 { | ||
value: Uint256*, | ||
} | ||
struct Bytes256 { | ||
value: U128*, | ||
} | ||
|
||
// Iterables types | ||
struct BytesStruct { | ||
data: felt*, | ||
len: felt, | ||
} | ||
|
||
using bool = felt; | ||
using U64 = felt; | ||
using U128 = felt; | ||
using U256 = Uint256; | ||
using Uint = felt; | ||
|
||
using Bytes0 = felt; | ||
using Bytes8 = felt; | ||
using Bytes20 = felt; | ||
using Bytes32 = Uint256; | ||
using Bytes256 = felt*; | ||
struct Bytes { | ||
value: BytesStruct*, | ||
} | ||
// Some parts of the exec spec use bytes, so just easier to copy/paste | ||
using bytes = Bytes; | ||
|
||
using Dict = DictAccess; | ||
using List = felt*; | ||
using Set = felt*; | ||
using Tuple = felt*; | ||
// In Cairo, tuples are not a first-class type, so we need to define a custom | ||
// struct to represent a tuple of Bytes32. | ||
struct TupleBytesStruct { | ||
value: Bytes, | ||
len: felt, | ||
} | ||
|
||
struct TupleBytes { | ||
value: TupleBytesStruct*, | ||
} | ||
|
||
struct TupleBytes32Struct { | ||
value: Bytes32, | ||
len: felt, | ||
} | ||
|
||
struct TupleBytes32 { | ||
value: TupleBytes32Struct*, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,18 @@ | ||
from ethereum.crypto.hash import Hash32 | ||
from ethereum.base_types import Bytes20, Bytes256, Uint, U256, bytes | ||
from ethereum.base_types import Bytes20, Bytes256, Uint, U256, Bytes, bytes | ||
|
||
using Address = Bytes20; | ||
using Root = Hash32; | ||
using VersionedHash = Hash32; | ||
|
||
using Bloom = Bytes256; | ||
|
||
struct Account { | ||
struct AccountStruct { | ||
nonce: Uint, | ||
balance: U256*, | ||
code: bytes*, | ||
balance: U256, | ||
code: bytes, | ||
} | ||
|
||
EMPTY_ACCOUNT: | ||
dw 0; // nonce | ||
dw 0; // balance | ||
dw 0; // code | ||
|
||
// @notice See .venv/lib/python3.10/site-packages/ethereum/cancun/fork_types.py | ||
// for the reference implementation of this function. | ||
// TODO: Implement this function. | ||
func encode_account(raw_account_data: Account*, storage_root: Root*) -> bytes* { | ||
return storage_root; | ||
struct Account { | ||
value: AccountStruct*, | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.