Skip to content

Commit

Permalink
Merge pull request #79 from KasarLabs/deoxys/dev
Browse files Browse the repository at this point in the history
prDeoxys/dev
  • Loading branch information
antiyro authored Oct 30, 2023
2 parents 894d519 + 009da45 commit 207beac
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15,898 deletions.
11 changes: 8 additions & 3 deletions crates/primitives/commitments/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,18 +279,23 @@ pub fn calculate_transaction_hash_with_signature<H: HasherT>(
where
H: HasherT,
{
let signature_hash = if matches!(tx, Transaction::Invoke(_)) {
let include_signature = block_number >= 61394;

let signature_hash = if matches!(tx, Transaction::Invoke(_)) || include_signature {
// Include signatures for Invoke transactions or for all transactions
// starting from block 61394
H::compute_hash_on_elements(
&tx.signature().iter().map(|elt| FieldElement::from(*elt)).collect::<Vec<FieldElement>>(),
)
} else {
// Before block 61394, and for non-Invoke transactions, signatures are not included
H::compute_hash_on_elements(&[])
};

let transactions_hashes =
let transaction_hashes =
H::hash_elements(FieldElement::from(tx.compute_hash::<H>(chain_id, false, Some(block_number))), signature_hash);

transactions_hashes
transaction_hashes
}

/// Calculate the hash of an event.
Expand Down
6 changes: 3 additions & 3 deletions tests/tests/tests-deoxys/rpc/starknet_getBlockWithTxs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ dotenv.config();

const REMOTE_RPC_URL = process.env.REMOTE_RPC;
const LOCAL_RPC_URL = process.env.DEOXYS_RPC;
const BLOCK_NUMBER = 10;
const START_BLOCK = 32642;
const END_BLOCK = 40000;
const BLOCK_NUMBER = 61394;
const START_BLOCK = 58985;
const END_BLOCK = 80000;

const requestDataForMethod = (method: string, params: any[]) => ({
id: 1,
Expand Down
Loading

0 comments on commit 207beac

Please sign in to comment.