Skip to content

fix(#146): MpoolPushMessage lotus-parity hardening - #149

Merged
Reiers merged 1 commit into
mainfrom
fix/146-mpoolpushmessage-hardening
Jul 23, 2026
Merged

fix(#146): MpoolPushMessage lotus-parity hardening#149
Reiers merged 1 commit into
mainfrom
fix/146-mpoolpushmessage-hardening

Conversation

@Reiers

@Reiers Reiers commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Implements the correctness tier of #146 (items 1, 2, 3, 5, 6 — MsgUuid dedup stays open as the follow-up):

  • No caller mutation — old code did *msg = *estim through the caller's pointer; embedded consumers (pkg/daemon / curio-core) got their structs rewritten under them.
  • Per-sender push lock across estimate+sign+publish (mirrors lotus PushLocks): concurrent pushes from one From can't grab the same nonce anymore.
  • ID-From rewrite to the deterministic pubkey address before signing.
  • Balance gate: balance < Value + RequiredFunds is rejected instead of published-and-doomed (the mpool: pending-tx confirm + rebroadcast loop (published-but-unmined messages silently stall) #47 rebroadcaster used to loop on those). Skipped when no state accessor is wired (wallet-only CLI shapes).
  • GasPremium > GasFeeCap rejected after estimation.

Tests: no-mutation, premium>feecap rejection, and an 8-goroutine same-sender -race test. Full ./rpc/handlers suite green.

Closes nothing yet — #146 item 4 (MsgUuid dedup) remains.

- Work on a copy: never mutate the caller's message (old code did
  *msg = *estim through the caller's pointer)
- Per-sender push lock across estimate+sign+publish: concurrent pushes
  from one From can no longer read the same nonce and produce
  colliding messages (mirrors lotus PushLocks)
- Rewrite ID-typed From (f0...) to the deterministic pubkey address
  before signing (ID addresses are not reorg-stable)
- Balance gate: reject when balance < Value + RequiredFunds instead of
  publishing a doomed message that loops in the #47 rebroadcaster
  (skipped when no state accessor is wired, e.g. wallet-only CLI)
- Reject GasPremium > GasFeeCap after estimation

Three new tests incl. a -race concurrent-sender test.
@Reiers
Reiers merged commit a70b0a8 into main Jul 23, 2026
2 checks passed
@Reiers
Reiers deleted the fix/146-mpoolpushmessage-hardening branch July 23, 2026 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant