add transaction hash to the unique identifier of the bridging tx

Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
This commit is contained in:
Uncle Stinky 2026-03-03 22:18:32 +03:00
parent 713cbdfdc1
commit e7b8cd46e1
Signed by: st1nky
GPG Key ID: 016064BD97603B40
4 changed files with 9 additions and 4 deletions

2
Cargo.lock generated
View File

@ -3838,7 +3838,7 @@ dependencies = [
[[package]]
name = "ghost-slow-clap"
version = "0.4.27"
version = "0.4.28"
dependencies = [
"frame-benchmarking",
"frame-support",

View File

@ -1,6 +1,6 @@
[package]
name = "ghost-slow-clap"
version = "0.4.27"
version = "0.4.28"
description = "Applause protocol for the EVM bridge"
license.workspace = true
authors.workspace = true

View File

@ -670,6 +670,7 @@ impl<T: Config> Pallet<T> {
let mut clap_args_str = clap.receiver.encode();
clap_args_str.extend(&clap.amount.encode());
clap_args_str.extend(&clap.block_number.encode());
clap_args_str.extend(&clap.transaction_hash.encode());
clap_args_str.extend(&clap.network_id.encode());
H256::from_slice(&sp_io::hashing::keccak_256(&clap_args_str)[..])

View File

@ -822,7 +822,7 @@ fn should_clap_without_applause_on_gatekeeper_amount_overflow() {
let first_receiver: u64 = 1337;
let second_receiver: u64 = 420;
let (network_id, block_number, unique_hash) =
let (network_id, block_number, _) =
generate_unique_hash(None, None, Some(first_receiver), Some(big_amount), None);
new_test_ext().execute_with(|| {
@ -840,13 +840,17 @@ fn should_clap_without_applause_on_gatekeeper_amount_overflow() {
receiver: first_receiver,
amount: big_amount,
};
let unique_hash = SlowClap::generate_unique_hash(&clap);
let authority = UintAuthorityId::from(authority_index as u64);
let signature = authority.sign(&clap.encode()).unwrap();
assert_ok!(SlowClap::slow_clap(RuntimeOrigin::none(), clap, signature));
assert_clapped(&session_index, &unique_hash, authority_index, true);
if authority_index > 2 {
assert_applaused(&session_index, &unique_hash);
}
}
assert_applaused(&session_index, &unique_hash);
assert_eq!(Balances::total_balance(&first_receiver), big_amount);
assert_eq!(Balances::total_balance(&second_receiver), 0);