-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ensure ozvotes / evm_slot_value strategies expose the SingleSlotProof…
… external functions
- Loading branch information
Showing
8 changed files
with
170 additions
and
0 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 |
---|---|---|
|
@@ -166,5 +166,6 @@ mod external { | |
mod herodotus; | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests; | ||
|
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,21 @@ | ||
#[starknet::contract] | ||
mod MockFactsRegistry { | ||
use sx::external::herodotus::IEVMFactsRegistry; | ||
use sx::external::herodotus::{BinarySearchTree, MapperId, Words64}; | ||
|
||
#[storage] | ||
struct Storage {} | ||
|
||
#[abi(embed_v0)] | ||
impl FactsRegistry of IEVMFactsRegistry<ContractState> { | ||
fn get_storage( | ||
self: @ContractState, | ||
block: u256, | ||
account: felt252, | ||
slot: u256, | ||
mpt_proof: Span<Words64> | ||
) -> u256 { | ||
return 1; | ||
} | ||
} | ||
} |
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,22 @@ | ||
#[starknet::contract] | ||
mod MockTimestampRemappers { | ||
use sx::external::herodotus::ITimestampRemappers; | ||
use sx::external::herodotus::{BinarySearchTree, MapperId}; | ||
|
||
#[storage] | ||
struct Storage {} | ||
|
||
#[abi(embed_v0)] | ||
impl TimestampRemappers of ITimestampRemappers<ContractState> { | ||
fn get_closest_l1_block_number( | ||
self: @ContractState, tree: BinarySearchTree, timestamp: u256 | ||
) -> Result<Option<u256>, felt252> { | ||
return Result::Ok(Option::Some(1)); | ||
} | ||
|
||
// Getter for the last timestamp of a given mapper. | ||
fn get_last_mapper_timestamp(self: @ContractState, mapper_id: MapperId) -> u256 { | ||
return 1; | ||
} | ||
} | ||
} |
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,33 @@ | ||
use sx::tests::mocks::{ | ||
timestamp_remappers::MockTimestampRemappers, facts_registry::MockFactsRegistry | ||
}; | ||
use starknet::ContractAddress; | ||
use sx::external::herodotus::BinarySearchTree; | ||
|
||
fn deploy_timestamp_remappers() -> ContractAddress { | ||
let (contract_address, _) = starknet::syscalls::deploy_syscall( | ||
MockTimestampRemappers::TEST_CLASS_HASH.try_into().unwrap(), 0, array![].span(), false, | ||
) | ||
.unwrap(); | ||
contract_address | ||
} | ||
|
||
fn deploy_facts_registry() -> ContractAddress { | ||
let (contract_address, _) = starknet::syscalls::deploy_syscall( | ||
MockFactsRegistry::TEST_CLASS_HASH.try_into().unwrap(), 0, array![].span(), false, | ||
) | ||
.unwrap(); | ||
contract_address | ||
} | ||
|
||
impl DefaultBinarySearchTree of Default<BinarySearchTree> { | ||
fn default() -> BinarySearchTree { | ||
BinarySearchTree { | ||
mapper_id: 1, | ||
last_pos: 1, | ||
peaks: array![].span(), | ||
proofs: array![].span(), | ||
left_neighbor: Option::None, | ||
} | ||
} | ||
} |
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