Skip to content

Commit 5486961

Browse files
committed
fix existing tests
1 parent 892eeea commit 5486961

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

crates/module-system/module-implementations/sov-uniqueness/tests/integration/call_tests.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use sov_modules_api::macros::config_value;
22
use sov_modules_api::{CredentialId, TxEffect};
3+
use sov_modules_api::capabilities::UniquenessData;
34
use sov_test_utils::{BatchType, SlotInput, TransactionTestCase, TxProcessingError};
45
use sov_uniqueness::Uniqueness;
56

@@ -58,15 +59,15 @@ fn do_max_stored_tx_hashes_per_credential_test() {
5859
// Generate txs to fill up our "bucket" of stored transaction hashes.
5960
for i in 0..txs_per_generation {
6061
for generation in 0..num_generations {
61-
txs.push(generate_value_setter_tx(generation, i as u32, &admin));
62+
txs.push(generate_value_setter_tx(UniquenessData::Generation(generation), i as u32, &admin));
6263
}
6364
}
6465
// We divided txs evenly across generations - if there was a remainder, account for it by putting the
6566
// extra txs in the first bucket.
6667
for i in 0..extra_txs_in_first_generation {
6768
txs.push(generate_value_setter_tx(
68-
0,
69-
(i + txs_per_generation) as u32,
69+
UniquenessData::Generation(0),
70+
(i + txs_per_generation) as u32,
7071
&admin,
7172
))
7273
}
@@ -87,7 +88,7 @@ fn do_max_stored_tx_hashes_per_credential_test() {
8788
// Send one more transaction with a current generation number.
8889
// This transaction should be skipped because it would cause the bucket to overflow.
8990
runner.execute_transaction(TransactionTestCase {
90-
input: generate_value_setter_tx(0, u32::MAX, &admin),
91+
input: generate_value_setter_tx(UniquenessData::Generation(0), u32::MAX, &admin),
9192
assert: Box::new(move |ctx, _| {
9293
let TxEffect::Skipped(skipped) = ctx.tx_receipt else {
9394
panic!("Transaction should be skipped");
@@ -106,7 +107,7 @@ fn do_max_stored_tx_hashes_per_credential_test() {
106107
// Increment the generation number. Now the transaction should be accepted because it won't cause the bucket to overflow.
107108
// Note that we need to add 1 to the number of generations because we have a strict inequality comparison for buckets.
108109
runner.execute_transaction(TransactionTestCase {
109-
input: generate_value_setter_tx(num_generations + 1, txs_per_generation as u32, &admin),
110+
input: generate_value_setter_tx(UniquenessData::Generation(num_generations + 1), txs_per_generation as u32, &admin),
110111
assert: Box::new(move |ctx, _| {
111112
assert!(
112113
ctx.tx_receipt.is_successful(),

crates/module-system/module-implementations/sov-uniqueness/tests/integration/utils.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@ pub(crate) fn generate_default_tx(
7979
create_contract_tx,
8080
))
8181
}
82-
UniquenessData::Generation(generation) => generate_value_setter_tx(generation, 10, admin),
82+
x => generate_value_setter_tx(x, 10, admin),
8383
}
8484
}
8585

8686
pub(crate) fn generate_value_setter_tx(
87-
generation: u64,
87+
nonce: UniquenessData,
8888
value: u32,
8989
admin: &TestUser<S>,
9090
) -> TransactionType<RT, S> {
@@ -99,7 +99,7 @@ pub(crate) fn generate_value_setter_tx(
9999
config_chain_id(),
100100
TEST_DEFAULT_MAX_PRIORITY_FEE,
101101
TEST_DEFAULT_MAX_FEE,
102-
UniquenessData::Generation(generation),
102+
nonce,
103103
None,
104104
);
105105

0 commit comments

Comments
 (0)