Skip to content

Commit 229b326

Browse files
georgepisaltugui1117actions-user
authored
Backport #6418 to stable2412 (#6496)
This PR is a backport of #6418. For context, `TransactionExtension`, introduced in #3685, is part of the `stable2412` release, and this PR brings important fixes and quality of life improvements. Doing the backport now allows us to not break the interface later. Opened against #6473 as the changes in the original PR were made on top of the changes in this backport. --------- Signed-off-by: georgepisaltu <[email protected]> Co-authored-by: Guillaume Thiolliere <[email protected]> Co-authored-by: GitHub Action <[email protected]>
1 parent 61fc2d1 commit 229b326

103 files changed

Lines changed: 5745 additions & 5072 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bridges/bin/runtime-common/src/extensions.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,7 @@ mod tests {
615615
&(),
616616
0,
617617
External,
618+
0,
618619
),
619620
InvalidTransaction::Custom(1)
620621
);
@@ -623,7 +624,8 @@ mod tests {
623624
42u64.into(),
624625
&MockCall { data: 1 },
625626
&(),
626-
0
627+
0,
628+
0,
627629
),
628630
InvalidTransaction::Custom(1)
629631
);
@@ -635,6 +637,7 @@ mod tests {
635637
&(),
636638
0,
637639
External,
640+
0,
638641
),
639642
InvalidTransaction::Custom(2)
640643
);
@@ -643,21 +646,22 @@ mod tests {
643646
42u64.into(),
644647
&MockCall { data: 2 },
645648
&(),
646-
0
649+
0,
650+
0,
647651
),
648652
InvalidTransaction::Custom(2)
649653
);
650654

651655
assert_eq!(
652656
BridgeRejectObsoleteHeadersAndMessages
653-
.validate_only(42u64.into(), &MockCall { data: 3 }, &(), 0, External)
657+
.validate_only(42u64.into(), &MockCall { data: 3 }, &(), 0, External, 0)
654658
.unwrap()
655659
.0,
656660
ValidTransaction { priority: 3, ..Default::default() },
657661
);
658662
assert_eq!(
659663
BridgeRejectObsoleteHeadersAndMessages
660-
.validate_and_prepare(42u64.into(), &MockCall { data: 3 }, &(), 0)
664+
.validate_and_prepare(42u64.into(), &MockCall { data: 3 }, &(), 0, 0)
661665
.unwrap()
662666
.0
663667
.unwrap(),

bridges/modules/relayers/src/extension/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,6 +1081,7 @@ mod tests {
10811081
&DispatchInfo::default(),
10821082
0,
10831083
External,
1084+
0,
10841085
)
10851086
.map(|t| t.0)
10861087
}
@@ -1094,6 +1095,7 @@ mod tests {
10941095
&DispatchInfo::default(),
10951096
0,
10961097
External,
1098+
0,
10971099
)
10981100
.map(|t| t.0)
10991101
}
@@ -1107,6 +1109,7 @@ mod tests {
11071109
&DispatchInfo::default(),
11081110
0,
11091111
External,
1112+
0,
11101113
)
11111114
.map(|t| t.0)
11121115
}
@@ -1132,6 +1135,7 @@ mod tests {
11321135
&call,
11331136
&DispatchInfo::default(),
11341137
0,
1138+
0,
11351139
)
11361140
.map(|(pre, _)| pre)
11371141
}
@@ -1149,6 +1153,7 @@ mod tests {
11491153
&call,
11501154
&DispatchInfo::default(),
11511155
0,
1156+
0,
11521157
)
11531158
.map(|(pre, _)| pre)
11541159
}
@@ -1166,6 +1171,7 @@ mod tests {
11661171
&call,
11671172
&DispatchInfo::default(),
11681173
0,
1174+
0,
11691175
)
11701176
.map(|(pre, _)| pre)
11711177
}

cumulus/primitives/storage-weight-reclaim/src/tests.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ fn basic_refund() {
9090
assert_ok!(CheckWeight::<Test>::do_prepare(&info, LEN, next_len));
9191

9292
let (pre, _) = StorageWeightReclaim::<Test>(PhantomData)
93-
.validate_and_prepare(Some(ALICE.clone()).into(), CALL, &info, LEN)
93+
.validate_and_prepare(Some(ALICE.clone()).into(), CALL, &info, LEN, 0)
9494
.unwrap();
9595
assert_eq!(pre, Some(0));
9696

@@ -130,7 +130,7 @@ fn underestimating_refund() {
130130
assert_ok!(CheckWeight::<Test>::do_prepare(&info, LEN, next_len));
131131

132132
let (pre, _) = StorageWeightReclaim::<Test>(PhantomData)
133-
.validate_and_prepare(Some(ALICE.clone()).into(), CALL, &info, LEN)
133+
.validate_and_prepare(Some(ALICE.clone()).into(), CALL, &info, LEN, 0)
134134
.unwrap();
135135
assert_eq!(pre, Some(0));
136136

@@ -168,7 +168,7 @@ fn sets_to_node_storage_proof_if_higher() {
168168
assert_ok!(CheckWeight::<Test>::do_prepare(&info, LEN, next_len));
169169

170170
let (pre, _) = StorageWeightReclaim::<Test>(PhantomData)
171-
.validate_and_prepare(Some(ALICE.clone()).into(), CALL, &info, LEN)
171+
.validate_and_prepare(Some(ALICE.clone()).into(), CALL, &info, LEN, 0)
172172
.unwrap();
173173
assert_eq!(pre, Some(1000));
174174

@@ -211,7 +211,7 @@ fn sets_to_node_storage_proof_if_higher() {
211211
assert_ok!(CheckWeight::<Test>::do_prepare(&info, LEN, next_len));
212212

213213
let (pre, _) = StorageWeightReclaim::<Test>(PhantomData)
214-
.validate_and_prepare(Some(ALICE.clone()).into(), CALL, &info, LEN)
214+
.validate_and_prepare(Some(ALICE.clone()).into(), CALL, &info, LEN, 0)
215215
.unwrap();
216216
assert_eq!(pre, Some(175));
217217

@@ -256,7 +256,7 @@ fn does_nothing_without_extension() {
256256
assert_ok!(CheckWeight::<Test>::do_prepare(&info, LEN, next_len));
257257

258258
let (pre, _) = StorageWeightReclaim::<Test>(PhantomData)
259-
.validate_and_prepare(Some(ALICE.clone()).into(), CALL, &info, LEN)
259+
.validate_and_prepare(Some(ALICE.clone()).into(), CALL, &info, LEN, 0)
260260
.unwrap();
261261
assert_eq!(pre, None);
262262

@@ -288,7 +288,7 @@ fn negative_refund_is_added_to_weight() {
288288
assert_ok!(CheckWeight::<Test>::do_prepare(&info, LEN, next_len));
289289

290290
let (pre, _) = StorageWeightReclaim::<Test>(PhantomData)
291-
.validate_and_prepare(Some(ALICE.clone()).into(), CALL, &info, LEN)
291+
.validate_and_prepare(Some(ALICE.clone()).into(), CALL, &info, LEN, 0)
292292
.unwrap();
293293
assert_eq!(pre, Some(100));
294294

@@ -321,7 +321,7 @@ fn test_zero_proof_size() {
321321
assert_ok!(CheckWeight::<Test>::do_prepare(&info, LEN, next_len));
322322

323323
let (pre, _) = StorageWeightReclaim::<Test>(PhantomData)
324-
.validate_and_prepare(Some(ALICE.clone()).into(), CALL, &info, LEN)
324+
.validate_and_prepare(Some(ALICE.clone()).into(), CALL, &info, LEN, 0)
325325
.unwrap();
326326
assert_eq!(pre, Some(0));
327327

@@ -354,7 +354,7 @@ fn test_larger_pre_dispatch_proof_size() {
354354
assert_ok!(CheckWeight::<Test>::do_prepare(&info, LEN, next_len));
355355

356356
let (pre, _) = StorageWeightReclaim::<Test>(PhantomData)
357-
.validate_and_prepare(Some(ALICE.clone()).into(), CALL, &info, LEN)
357+
.validate_and_prepare(Some(ALICE.clone()).into(), CALL, &info, LEN, 0)
358358
.unwrap();
359359
assert_eq!(pre, Some(300));
360360

@@ -394,7 +394,7 @@ fn test_incorporates_check_weight_unspent_weight() {
394394
assert_ok!(CheckWeight::<Test>::do_prepare(&info, LEN, next_len));
395395

396396
let (pre, _) = StorageWeightReclaim::<Test>(PhantomData)
397-
.validate_and_prepare(Some(ALICE.clone()).into(), CALL, &info, LEN)
397+
.validate_and_prepare(Some(ALICE.clone()).into(), CALL, &info, LEN, 0)
398398
.unwrap();
399399
assert_eq!(pre, Some(100));
400400

@@ -434,7 +434,7 @@ fn test_incorporates_check_weight_unspent_weight_on_negative() {
434434
assert_ok!(CheckWeight::<Test>::do_prepare(&info, LEN, next_len));
435435

436436
let (pre, _) = StorageWeightReclaim::<Test>(PhantomData)
437-
.validate_and_prepare(Some(ALICE.clone()).into(), CALL, &info, LEN)
437+
.validate_and_prepare(Some(ALICE.clone()).into(), CALL, &info, LEN, 0)
438438
.unwrap();
439439
assert_eq!(pre, Some(100));
440440

@@ -478,7 +478,7 @@ fn test_nothing_relcaimed() {
478478
assert_eq!(get_storage_weight().total().proof_size(), 250);
479479

480480
let (pre, _) = StorageWeightReclaim::<Test>(PhantomData)
481-
.validate_and_prepare(Some(ALICE.clone()).into(), CALL, &info, LEN)
481+
.validate_and_prepare(Some(ALICE.clone()).into(), CALL, &info, LEN, 0)
482482
.unwrap();
483483
// Should return `setup_test_externalities` proof recorder value: 100.
484484
assert_eq!(pre, Some(0));
@@ -525,7 +525,7 @@ fn test_incorporates_check_weight_unspent_weight_reverse_order() {
525525
assert_ok!(CheckWeight::<Test>::do_prepare(&info, LEN, next_len));
526526

527527
let (pre, _) = StorageWeightReclaim::<Test>(PhantomData)
528-
.validate_and_prepare(Some(ALICE.clone()).into(), CALL, &info, LEN)
528+
.validate_and_prepare(Some(ALICE.clone()).into(), CALL, &info, LEN, 0)
529529
.unwrap();
530530
assert_eq!(pre, Some(100));
531531

@@ -567,7 +567,7 @@ fn test_incorporates_check_weight_unspent_weight_on_negative_reverse_order() {
567567
assert_ok!(CheckWeight::<Test>::do_prepare(&info, LEN, next_len));
568568

569569
let (pre, _) = StorageWeightReclaim::<Test>(PhantomData)
570-
.validate_and_prepare(Some(ALICE.clone()).into(), CALL, &info, LEN)
570+
.validate_and_prepare(Some(ALICE.clone()).into(), CALL, &info, LEN, 0)
571571
.unwrap();
572572
assert_eq!(pre, Some(100));
573573

polkadot/runtime/common/src/claims.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,7 @@ mod tests {
10781078
});
10791079
let di = c.get_dispatch_info();
10801080
assert_eq!(di.pays_fee, Pays::No);
1081-
let r = p.validate_only(Some(42).into(), &c, &di, 20, External);
1081+
let r = p.validate_only(Some(42).into(), &c, &di, 20, External, 0);
10821082
assert_eq!(r.unwrap().0, ValidTransaction::default());
10831083
});
10841084
}
@@ -1091,13 +1091,13 @@ mod tests {
10911091
statement: StatementKind::Regular.to_text().to_vec(),
10921092
});
10931093
let di = c.get_dispatch_info();
1094-
let r = p.validate_only(Some(42).into(), &c, &di, 20, External);
1094+
let r = p.validate_only(Some(42).into(), &c, &di, 20, External, 0);
10951095
assert!(r.is_err());
10961096
let c = RuntimeCall::Claims(ClaimsCall::attest {
10971097
statement: StatementKind::Saft.to_text().to_vec(),
10981098
});
10991099
let di = c.get_dispatch_info();
1100-
let r = p.validate_only(Some(69).into(), &c, &di, 20, External);
1100+
let r = p.validate_only(Some(69).into(), &c, &di, 20, External, 0);
11011101
assert!(r.is_err());
11021102
});
11031103
}
@@ -1739,7 +1739,7 @@ mod benchmarking {
17391739
#[block]
17401740
{
17411741
assert!(ext
1742-
.test_run(RawOrigin::Signed(account).into(), &call, &info, 0, |_| {
1742+
.test_run(RawOrigin::Signed(account).into(), &call, &info, 0, 0, |_| {
17431743
Ok(Default::default())
17441744
})
17451745
.unwrap()

0 commit comments

Comments
 (0)