-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from HerodotusDev/chore/chain_id
1 - adds chain id to datalake
- Loading branch information
Showing
57 changed files
with
2,833 additions
and
2,685 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
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
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,2 +1,3 @@ | ||
pub mod header_memorizer; | ||
pub mod account_memorizer; | ||
pub mod storage_memorizer; |
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
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use hdp_cairo::Memorizer; | ||
use starknet::syscalls::call_contract_syscall; | ||
use starknet::{SyscallResult, SyscallResultTrait}; | ||
|
||
const STORAGE_MEMORIZER: felt252 = 2; | ||
|
||
const STORAGE_MEMORIZER_GET_SLOT: felt252 = 0; | ||
|
||
#[derive(Serde, Drop)] | ||
pub struct StorageKey { | ||
pub chain_id: felt252, | ||
pub block_number: felt252, | ||
pub address: felt252, | ||
pub storage_slot: u256, | ||
} | ||
|
||
#[generate_trait] | ||
pub impl StorageMemorizerImpl of StorageMemorizerTrait { | ||
fn get_slot(self: @Memorizer, key: StorageKey) -> u256 { | ||
let value = call_contract_syscall( | ||
STORAGE_MEMORIZER.try_into().unwrap(), | ||
STORAGE_MEMORIZER_GET_SLOT, | ||
array![ | ||
*self.dict.segment_index, | ||
*self.dict.offset, | ||
key.chain_id, | ||
key.block_number, | ||
key.address, | ||
key.storage_slot.high.into(), | ||
key.storage_slot.low.into(), | ||
] | ||
.span() | ||
) | ||
.unwrap_syscall(); | ||
u256 { low: (*value[0]).try_into().unwrap(), high: (*value[1]).try_into().unwrap() } | ||
} | ||
} |
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.