Remove legacy reward wire-compat layer (post-restart cleanup)#232
Open
rickyrombo wants to merge 4 commits intomjp-reward-pools-endpointsfrom
Open
Remove legacy reward wire-compat layer (post-restart cleanup)#232rickyrombo wants to merge 4 commits intomjp-reward-pools-endpointsfrom
rickyrombo wants to merge 4 commits intomjp-reward-pools-endpointsfrom
Conversation
d2357cc to
5280ec0
Compare
3cf1a9a to
8c4c696
Compare
5280ec0 to
03d9e91
Compare
8c4c696 to
2188197
Compare
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>
03d9e91 to
5420982
Compare
2188197 to
2645ab1
Compare
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>
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Strips the launchpad-era
CreateReward/DeleteRewardwire-compat layer added in #225, and adds a follow-up migration00034that drops thelaunchpad_authority_rmtable 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:
Until that restart, the wire-compat layer is required to keep block-sync-from-genesis deterministic on the existing chain.
What's removed (code)
LegacyRewardMessage/LegacyCreateReward/LegacyDeleteRewardproto typespkg/common/legacy_reward_signing.go(sha256-over-canonical-string scheme)tryParseLegacyReward+Body == nildispatch inisValidRewardTransactionandfinalizeRewardsBody == nilis just an error now.pkg/core/server/rewards_legacy.goandrewards_legacy_test.go(~200 lines)GetLaunchpadRMByAuthoritySQL queryUpsertSyntheticRewardPoolSQL queryfinalizeLegacyCreateRewardonly.MigratedPoolAddresshelper + testsmig_<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 migration00034_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: ifenvelope.Body == nil, return"reward message body is nil". No special-casing.validateRewardsManagerPubkey: shape validation (base58 32 bytes) + AUDIO denylist. Nomig_prefix handling.pkg/rewards/reward_pool.go: onlyCanonicalAuthorities(still needed for normalizing pool authority sets).Test plan
go build ./...clean.go test ./pkg/common/... ./pkg/core/server/ ./pkg/rewards/...passes.go test -c ./pkg/integration_tests/).13_reward_pools_test.go) still pass against the simplified codebase.🤖 Generated with Claude Code