-
Notifications
You must be signed in to change notification settings - Fork 59
test(platform-wallet): e2e framework + full test suite — triage pins, Found-*/PA-* guards, fail-closed persist, Stage-2 merge #3549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v4.2-dev
Are you sure you want to change the base?
Changes from 77 commits
ac9d9c4
3411283
1316ab2
9286e1c
1bee06e
822562d
543a8dc
a689c5b
51c1c10
16636f0
f52d268
a55a7a0
caae58c
22cecc1
64d3b6d
ebcddf7
0bacd25
e93c5b3
55472a3
0188fa9
25bbb3f
92165ec
5cca0fb
1bbe41c
cf9b6d2
9902cbd
403d29c
fe44be5
55288c6
e9860be
e85d558
b673a7d
0dd5f83
b66e7dd
60a2255
6951523
6bb0017
c00f1d4
262ba34
e7e5d6d
ea8dc63
9a4fc30
047ffca
79c83c6
9ee4e3c
aba7ca3
4526836
72fee50
edd3ea5
c5511a7
02cb61b
63f039a
371e2c3
bd5eb61
926f0a7
ff56c56
fc7e9f8
ce0d555
5466501
30e612b
e4cf6b3
116bc8a
f209063
dc5e611
ba1e85e
399c40a
f112600
27087f8
d7ed4af
420250d
b01be51
be0899b
6955138
b1d35e4
668a222
63ee3ba
d3c02ca
7651ca8
f625f83
f78deda
f5ddda6
c6693df
435b972
91f1ada
d5fb7f5
1110bd0
0376706
db00fbe
e6bd370
7a22f81
e83a43c
35400f1
c26f451
9e24f1f
0618e6e
cba5125
00437db
0e547b0
76baafd
7e57f72
8309f18
7f28778
436d38b
bb09b9b
9f5518c
f18fa0e
a8c0df5
e52b534
ad28b83
2b8eae0
8d5de89
ced1eb5
34e0395
d5d2b3d
5e760dc
8c0d614
fedfce8
6f7b2b1
098484f
8ee78a4
3aeed87
6c3fb02
e2140bd
b85b6a9
cfe3c33
9854e38
9c136cd
7c7a2ec
2957623
94bbb64
ceb4fc8
288ea92
f6a85e7
cda0730
9d9abda
8e66cf1
63e0acf
8e5a995
d381867
94478d0
bfcb1d9
c5e95f9
15cabcb
bebe0fe
a301b6c
c31dcb7
12af754
a16888c
709303d
943832b
76369d6
cf5ff1f
f9746b9
66e361f
54bcf8f
c5c26b7
ba86443
46fe4b8
baf2d27
9033daa
9208b2a
47bced3
9543982
5cc2d4d
e6d0eba
7fe2a5c
40ac756
5199f30
892d8eb
fb9102d
f835750
47687c1
ceda3da
cf61920
f112c98
be2fa6f
a03f7f7
95bcdfb
ab03ec9
ea80fe3
e09afc4
4f43ceb
02d540a
d48e3d1
1e20407
7ad0d6d
e3aa274
5698771
e3f075f
759357b
8727343
a576cc6
44537f3
ee46dba
79e44c1
d4fe855
6dcc033
9a72090
71bb176
ad95987
99f3ba4
09d68cc
a72f117
cbd72a1
541a7b6
2b8b279
c98fce3
e653f42
0b1f1b0
c99e6e4
259ae1d
45c2f93
fda0478
b0b658a
24a317d
133f041
9ae88af
20b549a
3e175d2
980b54c
c83fb0d
64a1b0c
444ee45
42029c3
22f0e79
6461245
6583c82
d47f3a2
a98a52b
df6b84c
b694dcb
4bfbcae
23e6256
cfc2a9f
4df7180
041c49e
b309d64
d692f2d
9dd8195
e851f1d
53e4b7e
f2b156d
34f4f9e
201756a
943f695
370aef0
8b7a781
279fc6b
2f3eba9
aaa4455
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -582,6 +582,36 @@ pub struct PlatformAddressChangeSet { | |
| /// Last block height with recent address changes (compaction marker). | ||
| /// `None` means "no change". | ||
| pub last_known_recent_block: Option<u64>, | ||
| /// Lower-bound static fee estimate for the transfer that produced | ||
| /// this changeset, in credits. `0` for changesets not produced by | ||
| /// `transfer()` (e.g. sync-only changesets). See | ||
| /// [`Self::estimated_min_fee`]. | ||
| pub fee: Credits, | ||
| } | ||
|
|
||
| impl PlatformAddressChangeSet { | ||
| /// Lower-bound static fee estimate for the transfer that produced | ||
| /// this changeset, in credits. | ||
| /// | ||
| /// Returns `0` for changesets that didn't originate from a | ||
| /// `transfer()` call — e.g. sync-only changesets, or changesets | ||
| /// constructed via `Default::default()`. The value is the raw | ||
| /// `AddressFundsTransferTransition::estimate_min_fee(input_count, | ||
| /// output_count, version)` result captured at submit time — it is | ||
| /// **NOT** the actual on-chain fee and is **NOT** adjusted by the | ||
| /// `fee_strategy`. | ||
| /// | ||
| /// `estimate_min_fee` only models the static | ||
| /// `state_transition_min_fees` floor; chain-time fees include | ||
| /// storage + processing costs that scale with the operation set | ||
| /// (~6.5M static vs ~14.94M observed real for 1in/1out at the time | ||
| /// of writing). Tests asserting on the actual chain-time debit | ||
| /// must read the post-broadcast balance delta directly, not this | ||
| /// value. See platform issue #3040 for the open ticket on | ||
| /// upgrading `estimate_min_fee` to a chain-time-accurate estimate. | ||
| pub fn estimated_min_fee(&self) -> Credits { | ||
| self.fee | ||
| } | ||
| } | ||
|
|
||
| impl Merge for PlatformAddressChangeSet { | ||
|
|
@@ -606,13 +636,20 @@ impl Merge for PlatformAddressChangeSet { | |
| .map_or(r, |existing| existing.max(r)), | ||
| ); | ||
| } | ||
| // Fee: append-sum via `saturating_add`. Sync-only merges | ||
| // (`fee == 0`) are a no-op so a transfer's recorded fee | ||
| // survives untouched; merging two transfer changesets sums | ||
| // the per-operation fees so the merged total reflects the | ||
| // "total fee paid across operations in this batch" intent. | ||
| self.fee = self.fee.saturating_add(other.fee); | ||
| } | ||
|
Comment on lines
1260
to
1286
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Suggestion: PlatformAddressChangeSet::fee is a public Credits field whose own doc admits it does not represent the on-chain fee, and Merge silently sums it Confirmed at HEAD. source: ['claude', 'codex'] 🤖 Fix this with AI agents |
||
|
|
||
| fn is_empty(&self) -> bool { | ||
| self.addresses.is_empty() | ||
| && self.sync_height.is_none() | ||
| && self.sync_timestamp.is_none() | ||
| && self.last_known_recent_block.is_none() | ||
| && self.fee == 0 | ||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Suggestion:
PlatformAddressChangeSet::feeis a publicCreditsfield that knowingly misrepresents the on-chain fee, andMergesilently sums itpub fee: CreditsstoresAddressFundsTransferTransition::estimate_min_fee(...), which the accessor's own doc admits is "NOT the actual on-chain fee" — the staticstate_transition_min_feesfloor (~6.5M for 1in/1out) is far below the real chain-time debit (~14.94M observed; see #3040). Because the field is public and shares its type with real credit values, callers reaching forcs.fee(rather than the doc-ladenestimated_min_fee()accessor) get the unfiltered footgun.Merge::mergethen doesself.fee = self.fee.saturating_add(other.fee), so a merged changeset's reported fee is "the sum across operations of a number that already lied for one operation," compounding the misrepresentation. Pick one of: (a) wrap in a newtype likeEstimatedMinFee(Credits)so the type system surfaces the caveat at every call site, (b) rename the field tostatic_min_fee_estimateso accidental consumers can't confuse it with paid fees, or (c) keep itpub(crate)until #3040 lands and the value can mean what callers naturally expect.source: ['claude']
🤖 Fix this with AI agents