From 45d018a99973e4c7f12e89d2d27dccf0dfa6079a Mon Sep 17 00:00:00 2001 From: Alex Metelli Date: Fri, 24 May 2024 05:35:22 +0800 Subject: [PATCH] fixes on rlp headers extractor --- .../src/library/blockheader_rlp_extractor.cairo | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/starknet/src/library/blockheader_rlp_extractor.cairo b/starknet/src/library/blockheader_rlp_extractor.cairo index 7fe88eb..186d81f 100644 --- a/starknet/src/library/blockheader_rlp_extractor.cairo +++ b/starknet/src/library/blockheader_rlp_extractor.cairo @@ -23,28 +23,27 @@ mod decoder { } pub fn decode_parent_hash(block_rlp: Words64Sequence) -> u256 { - extract_data(block_rlp, PARENT_HASH_START, PARENT_HASH_START.into() + 32).from_words64() + extract_data(block_rlp, PARENT_HASH_START, 32).from_words64() } pub fn decode_uncle_hash(block_rlp: Words64Sequence) -> u256 { - extract_data(block_rlp, UNCLE_HASH_START, UNCLE_HASH_START.into() + 32).from_words64() + extract_data(block_rlp, UNCLE_HASH_START, 32).from_words64() } pub fn decode_beneficiary(block_rlp: Words64Sequence) -> EthAddress { - extract_data(block_rlp, BENEFICIARY_START, BENEFICIARY_START.into() + 20).from_words64() + extract_data(block_rlp, BENEFICIARY_START, 20).from_words64() } pub fn decode_state_root(block_rlp: Words64Sequence) -> u256 { - extract_data(block_rlp, STATE_ROOT_START, STATE_ROOT_START.into() + 32).from_words64() + extract_data(block_rlp, STATE_ROOT_START, 32).from_words64() } pub fn decode_transactions_root(block_rlp: Words64Sequence) -> u256 { - extract_data(block_rlp, TRANSACTIONS_ROOT_START, TRANSACTIONS_ROOT_START.into() + 32) - .from_words64() + extract_data(block_rlp, TRANSACTIONS_ROOT_START, 32).from_words64() } pub fn decode_receipts_root(block_rlp: Words64Sequence) -> u256 { - extract_data(block_rlp, RECEIPTS_ROOT_START, RECEIPTS_ROOT_START.into() + 32).from_words64() + extract_data(block_rlp, RECEIPTS_ROOT_START, 32).from_words64() } pub fn decode_difficulty(block_rlp: Words64Sequence) -> u64 {