Repository navigation
fix(activity): fill unknown stored fee rate on sync (#186) - #187
Conversation
talosmachina
left a comment
There was a problem hiding this comment.
No findings. Lets a preserving sync fill a stored fee_rate of 0 (unknown) from a later snapshot while still keeping a known positive rate, fixing #186. Reviewed db7d76be, full tier, static: the head is on a fork, so I did not build or run it.
What I checked, and 3 candidates I ruled out
Read in full: upsert_onchain_activities_with_fee_rate_policy, upsert_onchain_activity_preserving_fee_rate and its export in src/lib.rs, record_rbf_boost, transfer_pre_activity_metadata_in_transaction, the new test.
CI: SwiftPM, manifests and wake-tests green; iOS/Android bindgen and usdt-tests pending. No workflow runs modules::activity (only modules::wake and modules::usdt), so the new test is not exercised by CI.
Ruled out
- A real zero rate gets overwritten: the schema allows
fee_rate >= 0, butrecord_rbf_boostrejects0and a broadcast send cannot pay 0 sat/vB, so a stored0only ever means unknown. A snapshot that also carries0writes0again, no regression. - Snapshot rate from another txid filling the gap: the preserving path resolves the row by
(wallet_id, tx_id)and refuses an id that belongs to a different transaction, so the filled rate always describes the stored txid. - Pending RBF metadata losing to the snapshot: metadata with
fee_rate > 0is applied after the upsert in the same transaction, so a pending replacement rate still wins over the snapshot's.
Merge confidence: 4/5, the change is covered by preserving_sync_fills_unknown_stored_fee_rate, but CI does not run the activity tests and the fork head was not run here.
coreyphillips
left a comment
There was a problem hiding this comment.
Two independent reviews, nothing blocking a merge.
worth doing, does not block
- README still says the preserving upsert keeps the stored rate (src/modules/activity/README.md:127-131). The README paragraph on
upsert_onchain_activity_preserving_fee_ratestill says it preserves the stored rate, which is no longer true for a stored0. It also omits the rule callers now depend on: the first positive rate to reach a stored0sticks. A scratch test with snapshots of0,12, then30left12. So a caller that sends a fallback such as1for an unknown rate turns the row into a known rate of1, and the real confirmed rate can no longer replace it. Before this change that row stayed at0. The README should say that0means unknown, that the first positive snapshot rate fills it, and that callers should send0rather than a fallback. The doc comments inimplementation.rsandlib.rssay "known" rate and remain accurate.
There was a problem hiding this comment.
No correctness defects identified in the reviewed change at db7d76b. Preserving sync upserts now fill a stored zero fee rate from the incoming snapshot while retaining positive stored rates. Ordinary overwrite behavior, wallet/txid identity safeguards and transactional metadata precedence remain intact.
The supplied validation result reports all 12 focused RBF tests passing, including the new regression, addressing the earlier execution gap. This informed verification ran no tests. Dedicated security coverage remains unestablished: the general review's request to clarify prior security coverage is unresolved, rather than evidence of an established bug. Full-suite, external-caller and device coverage are not established by this packet.
|
@Tyagiquamar Thank you for another patch! Please sign commits :) |
Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com>
db7d76b to
01160d0
Compare
|
Hi @pwltr, re-signed the commit with verified GPG signature as requested. |
Summary
Fixes #186 by allowing an unknown stored
fee_rate(value0) to be populated from subsequent activity sync snapshots when preserving known fee rates.Problem & Root Cause
When outgoing on-chain activities are first created, they may be stored with an unknown fee rate (
0).In
src/modules/activity/implementation.rs,upsert_onchain_activity_preserving_fee_rateexecutes:When
preserve_fee_rate(?16) is true, this unconditionally retainsonchain_activity.fee_rate, causing an initial0to persist permanently across later confirmed snapshots even when those snapshots carry the confirmed transaction's actual fee rate.Solution
Updated the upsert query in
upsert_onchain_activities_with_fee_rate_policyto:This ensures:
0), later syncs that carry the actual fee rate can populate it.preserving_sync_fills_unknown_stored_fee_rateinsrc/modules/activity/rbf_tests.rs.Test Plan
rust:1.99-bookworm:cargo test rbf_testscargo fmt -- --checkwith 0 formatting warnings.