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:
parent
713cbdfdc1
commit
e7b8cd46e1
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -3838,7 +3838,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ghost-slow-clap"
|
name = "ghost-slow-clap"
|
||||||
version = "0.4.27"
|
version = "0.4.28"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"frame-benchmarking",
|
"frame-benchmarking",
|
||||||
"frame-support",
|
"frame-support",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "ghost-slow-clap"
|
name = "ghost-slow-clap"
|
||||||
version = "0.4.27"
|
version = "0.4.28"
|
||||||
description = "Applause protocol for the EVM bridge"
|
description = "Applause protocol for the EVM bridge"
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
authors.workspace = true
|
authors.workspace = true
|
||||||
|
|||||||
@ -670,6 +670,7 @@ impl<T: Config> Pallet<T> {
|
|||||||
let mut clap_args_str = clap.receiver.encode();
|
let mut clap_args_str = clap.receiver.encode();
|
||||||
clap_args_str.extend(&clap.amount.encode());
|
clap_args_str.extend(&clap.amount.encode());
|
||||||
clap_args_str.extend(&clap.block_number.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());
|
clap_args_str.extend(&clap.network_id.encode());
|
||||||
|
|
||||||
H256::from_slice(&sp_io::hashing::keccak_256(&clap_args_str)[..])
|
H256::from_slice(&sp_io::hashing::keccak_256(&clap_args_str)[..])
|
||||||
|
|||||||
@ -822,7 +822,7 @@ fn should_clap_without_applause_on_gatekeeper_amount_overflow() {
|
|||||||
let first_receiver: u64 = 1337;
|
let first_receiver: u64 = 1337;
|
||||||
let second_receiver: u64 = 420;
|
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);
|
generate_unique_hash(None, None, Some(first_receiver), Some(big_amount), None);
|
||||||
|
|
||||||
new_test_ext().execute_with(|| {
|
new_test_ext().execute_with(|| {
|
||||||
@ -840,13 +840,17 @@ fn should_clap_without_applause_on_gatekeeper_amount_overflow() {
|
|||||||
receiver: first_receiver,
|
receiver: first_receiver,
|
||||||
amount: big_amount,
|
amount: big_amount,
|
||||||
};
|
};
|
||||||
|
let unique_hash = SlowClap::generate_unique_hash(&clap);
|
||||||
let authority = UintAuthorityId::from(authority_index as u64);
|
let authority = UintAuthorityId::from(authority_index as u64);
|
||||||
let signature = authority.sign(&clap.encode()).unwrap();
|
let signature = authority.sign(&clap.encode()).unwrap();
|
||||||
assert_ok!(SlowClap::slow_clap(RuntimeOrigin::none(), clap, signature));
|
assert_ok!(SlowClap::slow_clap(RuntimeOrigin::none(), clap, signature));
|
||||||
|
|
||||||
assert_clapped(&session_index, &unique_hash, authority_index, true);
|
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(&first_receiver), big_amount);
|
||||||
assert_eq!(Balances::total_balance(&second_receiver), 0);
|
assert_eq!(Balances::total_balance(&second_receiver), 0);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user