Skip to content

Commit

Permalink
Merge pull request #87 from HerodotusDev/feat/add_header_timestamp_ge…
Browse files Browse the repository at this point in the history
…tter

feat: add missing timestamp function
  • Loading branch information
petscheit authored Oct 9, 2024
2 parents 9b3e803 + ffe01f2 commit f5f0191
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions cairo/src/memorizer/header_memorizer.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,16 @@ pub impl HeaderMemorizerImpl of HeaderMemorizerTrait {
.unwrap_syscall();
u256 { low: (*value[0]).try_into().unwrap(), high: (*value[1]).try_into().unwrap() }
}
fn get_timestamp(self: @Memorizer, key: HeaderKey) -> u256 {
let value = call_contract_syscall(
HEADER_MEMORIZER.try_into().unwrap(),
HEADER_MEMORIZER_GET_TIMESTAMP,
array![*self.dict.segment_index, *self.dict.offset, key.chain_id, key.block_number,]
.span()
)
.unwrap_syscall();
u256 { low: (*value[0]).try_into().unwrap(), high: (*value[1]).try_into().unwrap() }
}
fn get_mix_hash(self: @Memorizer, key: HeaderKey) -> u256 {
let value = call_contract_syscall(
HEADER_MEMORIZER.try_into().unwrap(),
Expand Down
2 changes: 1 addition & 1 deletion tests/python/test_tx_decoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def fetch_tx(tx_hash):

def fetch_transaction_dict(tx_hash):
tx = fetch_tx(tx_hash)
assert tx_hash == "0x" + tx.hash().hex(), "TX hashes do not match!"
assert tx_hash == tx.hash().hex(), "TX hashes do not match!"
rlp = bytes_to_8_bytes_chunks_little(tx.raw_rlp())
tx_dict = {
"rlp": rlp,
Expand Down
2 changes: 1 addition & 1 deletion tools/make/full_flow_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ cairo-compile --cairo_path="packages/eth_essentials" "src/hdp.cairo" --output "b

# Clone the repository if the directory doesn't exist
if [ ! -d "hdp-test" ]; then
git clone https://github.com/HerodotusDev/hdp-test
git clone https://github.com/HerodotusDev/hdp-test && cd hdp-test && git checkout hotfix-0.6.0 && cd ..
fi

echo "Starting tests..."
Expand Down

0 comments on commit f5f0191

Please sign in to comment.