Skip to content

Remove legacy reward wire-compat layer (post-restart cleanup)#232

Open
rickyrombo wants to merge 4 commits intomjp-reward-pools-endpointsfrom
mjp-remove-legacy-reward-types
Open

Remove legacy reward wire-compat layer (post-restart cleanup)#232
rickyrombo wants to merge 4 commits intomjp-reward-pools-endpointsfrom
mjp-remove-legacy-reward-types

Conversation

@rickyrombo
Copy link
Copy Markdown
Contributor

@rickyrombo rickyrombo commented May 7, 2026

Summary

Strips the launchpad-era CreateReward / DeleteReward wire-compat layer added in #225, and adds a follow-up migration 00034 that drops the launchpad_authority_rm table introduced in #222. After we restart the network with genesis replay, no historical legacy bytes exist on chain and the wire-compat code becomes pure dead weight.

Sequencing: this PR is intended to ship after:

  1. Add reward_pools schema and migrate core_rewards #222 (schema), Add reward pool cometbft transactions (PR 2 of 3) #225 (txs), Cutover validator endpoints to per-RM pool gate (PR 3) #228 (endpoints) all merge.
  2. The network restarts with genesis replay.

Until that restart, the wire-compat layer is required to keep block-sync-from-genesis deterministic on the existing chain.

What's removed (code)

Removal Why
LegacyRewardMessage / LegacyCreateReward / LegacyDeleteReward proto types Wire shape no longer exists on chain post-restart.
pkg/common/legacy_reward_signing.go (sha256-over-canonical-string scheme) Only used to recover signers from legacy bytes; legacy bytes don't exist post-restart.
tryParseLegacyReward + Body == nil dispatch in isValidRewardTransaction and finalizeRewards New shape is always present; Body == nil is just an error now.
pkg/core/server/rewards_legacy.go and rewards_legacy_test.go (~200 lines) Dead.
GetLaunchpadRMByAuthority SQL query Was used at replay time only.
UpsertSyntheticRewardPool SQL query Was used by finalizeLegacyCreateReward only.
MigratedPoolAddress helper + tests The mig_<md5> synthetic-pool concept is gone.

Schema cleanup (migration 00034)

launchpad_authority_rm (created by #222's migration 00033, populated with 72 launchpad authority → RM mappings) is dropped via a new migration 00034_drop_launchpad_authority_rm.sql. 00033 itself is unchanged — modifying an already-applied migration in place would diverge from each existing chain's migration history; 00034 brings the schema in line with the code's expectations on both fresh-genesis and post-restart state.

What's left after this lands

  • isValidRewardTransaction / finalizeRewards: if envelope.Body == nil, return "reward message body is nil". No special-casing.
  • validateRewardsManagerPubkey: shape validation (base58 32 bytes) + AUDIO denylist. No mig_ prefix handling.
  • pkg/rewards/reward_pool.go: only CanonicalAuthorities (still needed for normalizing pool authority sets).

Test plan

  • go build ./... clean.
  • go test ./pkg/common/... ./pkg/core/server/ ./pkg/rewards/... passes.
  • Integration tests still compile (go test -c ./pkg/integration_tests/).
  • After network restart: confirm devnet bring-up + the rotation-flow integration test (13_reward_pools_test.go) still pass against the simplified codebase.

🤖 Generated with Claude Code

@rickyrombo rickyrombo force-pushed the mjp-remove-legacy-reward-types branch from d2357cc to 5280ec0 Compare May 7, 2026 01:45
@rickyrombo rickyrombo force-pushed the mjp-reward-pools-endpoints branch from 3cf1a9a to 8c4c696 Compare May 7, 2026 02:55
@rickyrombo rickyrombo force-pushed the mjp-remove-legacy-reward-types branch from 5280ec0 to 03d9e91 Compare May 7, 2026 02:57
@rickyrombo rickyrombo force-pushed the mjp-reward-pools-endpoints branch from 8c4c696 to 2188197 Compare May 7, 2026 05:50
The launchpad-era CreateReward / DeleteReward proto shapes (RewardMessage
oneof at tags 1000/1001 with deadline + signature embedded inside each
action) are pre-pool-rollout artifacts. They were preserved in PR #225's
wire-compat layer so block-sync-from-genesis could replay historical
reward txs without diverging from the migration's apphash.

We're planning a network restart with genesis replay anyway, so the new
chain will never contain those legacy bytes. The wire-compat path
becomes dead code after the restart, and this PR removes it.

Removed:
- LegacyRewardMessage / LegacyCreateReward / LegacyDeleteReward proto
  types.
- pkg/common/legacy_reward_signing.go (sha256-over-canonical-string
  legacy signing scheme).
- tryParseLegacyReward + the Body == nil dispatch branches in
  isValidRewardTransaction and finalizeRewards.
- pkg/core/server/rewards_legacy.go and rewards_legacy_test.go
  (~200 lines).
- GetLaunchpadRMByAuthority SQL query.
- UpsertSyntheticRewardPool SQL query.
- MigratedPoolAddress helper + tests.

Schema cleanup via new migration 00034:
- launchpad_authority_rm table dropped via 00034. PR1's 00033 stays
  unchanged on disk: existing chains have already applied it, and a
  modify-in-place would diverge between the on-disk version and
  what's recorded in their migration history. 00034 brings the
  schema in line with the code's expectations on both fresh-genesis
  and post-restart state.

After this PR:
- isValidRewardTransaction / finalizeRewards return "reward message
  body is nil" for any envelope with Body == nil. No special-casing.
- validateRewardsManagerPubkey is just shape validation (base58 32
  bytes) plus the AUDIO denylist.

Sequencing: this PR ships AFTER #222, #225, #228 merge AND the network
restart with genesis replay. Until that restart, the wire-compat layer
remains needed to keep historical replay deterministic.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@rickyrombo rickyrombo force-pushed the mjp-remove-legacy-reward-types branch from 03d9e91 to 5420982 Compare May 8, 2026 00:31
@rickyrombo rickyrombo force-pushed the mjp-reward-pools-endpoints branch from 2188197 to 2645ab1 Compare May 8, 2026 01:12
rickyrombo and others added 2 commits May 7, 2026 18:27
00034_drop_launchpad_authority_rm.sql removes the table; leaving it in
state_sync.go's snapshot list would either fail the dump for nodes that
have already applied the migration, or pollute snapshots with a phantom
table for nodes that haven't.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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