Skip to content

Version v1.2.13: reward authority rotation primitive (RewardPool)#260

Merged
rickyrombo merged 1 commit into
mainfrom
mjp-version-1.2.13
May 12, 2026
Merged

Version v1.2.13: reward authority rotation primitive (RewardPool)#260
rickyrombo merged 1 commit into
mainfrom
mjp-version-1.2.13

Conversation

@rickyrombo
Copy link
Copy Markdown
Contributor

Summary

Ships as v1.2.13 (.version.json bumped in this PR). Releases the RewardPool cometbft primitive merged in #254, which unblocks the artist-coin attestation kill switch added in v1.2.11 (#215).

What's in v1.2.13

PR #254 — Reward authority rotation primitive (RewardPool):

  • Schema (migration 00034_reward_pools.sql): new core_reward_pools table keyed by the Solana RM pubkey; core_rewards.rewards_manager_pubkey FK with reads aliased as claim_authorities via LEFT JOIN. launchpad_authority_rm seed table maps each per-mint claim authority eth address → its Solana RM, backfilling existing reward rows to real-RM-bound pools. The legacy core_rewards.claim_authorities column is dropped.
  • Cometbft txs: body+signature envelope; new CreateRewardPool and SetRewardPoolAuthorities actions. CreateReward now requires an existing pool; signer must be in the pool's authorities. CreateRewardPool additionally requires an ed25519 rm_owner_signature over the body bytes, produced by the RM's keypair — defeats pool-creation frontrunning by an observer who watches Solana RM init events but lacks the launchpad's deterministic secret.
  • Wire compat: legacy reward bytes are rejected at CheckTx/ProcessProposal but accepted at FinalizeBlock for block-sync replay of historical state.
  • Validator endpoints: GetRewardAttestation restored from the Temporarily block artist-coin attestations at the node #215 kill switch; auth check uses the pool's current authorities so rotation immediately revokes attestation rights. GetRewardSenderAttestation / GetDeleteRewardSenderAttestation gate per-RM (pool members for pool-managed RMs; validator/AAO trust set only for the configured AUDIO RM; everything else is refused).
  • AUDIO denylist: validateCreateRewardPool refuses the configured AUDIO RM, so AUDIO attestation authority remains on the network-wide trust set.

What changed

  • pkg/version/.version.json: 1.2.121.2.13.

Implications for rollout

This release pairs with corresponding API-repo work (deferred from PR #254) that lands CreateRewardPool calls before CreateReward for new launchpad mints. Until that ships, new mints will fail at validateCreateReward's pool-existence check. Existing mints work via the migration backfill.

The wire-compat layer keeps the chain replayable for any node bootstrapping from genesis. PR #232 (separate, post-network-restart cleanup) strips it later.

Test plan

  • CI green
  • Local: migration applies cleanly to a fresh DB and to a snapshot of staging
  • After merge: trigger Create Release workflow with version=v1.2.13
  • Roll v1.2.13 to edge and verify the AUDIO denylist is active in the chosen environment (AudioRewardsManagerPubkey() returns the expected RM)
  • Verify a CreateRewardPool integration test against devnet round-trips: pool created → reward created against pool → authority rotated via SetRewardPoolAuthorities → rotated-out authority can no longer attest

🤖 Generated with Claude Code

Ships PR #254. Adds CometBFT-side `RewardPool` so the eth addresses
authorized to attest for programmatic rewards under a Solana RM can be
updated without reissuing reward rows. Unblocks the artist-coin
attestation kill-switch from v1.2.11/#215.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@rickyrombo rickyrombo merged commit 01735f6 into main May 12, 2026
4 checks passed
@rickyrombo rickyrombo deleted the mjp-version-1.2.13 branch May 12, 2026 19:29
rickyrombo added a commit to AudiusProject/api that referenced this pull request May 14, 2026
## Summary

Adapts the two CreateReward call sites in this repo to the new cometbft
`RewardPool` primitive shipping in go-openaudio v1.2.13
([OpenAudio/go-openaudio#254](OpenAudio/go-openaudio#254)).
Without this, the launchpad reward-code flow breaks at deploy: the new
`CreateReward` proto reserves the old `claim_authorities` /
`deadline_block_height` fields, and the validator now refuses any
`CreateReward` whose RM has no pool.

## Why

The pool primitive moves the eth addresses authorized to attest for
programmatic rewards off each `core_rewards` row and onto a
`core_reward_pools` row keyed by the Solana RM pubkey. Rewards now
reference a pool by `rewards_manager_pubkey`; the pool's authority set
is mutable via cometbft transactions; validators consult the pool's
*current* authorities when serving claim attestations. Rotation becomes
a one-row update instead of mass row reissuance.

For us to call `CreateReward`, a pool keyed by the mint's RM must
already exist. Brand-new mints need a one-time `CreateRewardPool` call
first.

## What changed

### `utils/derive_reward_manager_keypair.go` (new)

`DeriveRewardManagerKeypair(secretHex, mint) ed25519.PrivateKey` returns
the deterministic ed25519 keypair the solana-relay used to init the
Solana reward manager state account for a given mint. Seed material
matches `apps/.../solana-relay/.../launchpad/launch_coin.ts`'s
`deriveKeypair('reward-manager', mint)`:

```
seed = sha256(secret_utf8 || "audius-launchpad" || "reward-manager" || mint_bytes)
```

The returned private key's public key IS the `rewards_manager_pubkey`
cometbft carries. Used to sign `CreateRewardPool`'s envelope-level
ed25519 `rm_owner_signature`, which is the frontrunning defense — only
callers who hold the launchpad's deterministic secret can produce it.

### `api/v1_create_reward_code.go` and `cmd/create_reward_codes/main.go`

Both rewards code paths reshaped identically:

1. **Derive the RM keypair** for this mint (above).
2. **Ensure the pool exists**:
`oap.Rewards.GetRewardPool(rewardsManagerPubkey)`. If `CodeNotFound`,
call `oap.Rewards.CreateRewardPool(...)` with the RM private key as the
new `rmKey` argument. Pool authorities = the per-mint claim authority
eth address (the existing `DeriveEthAddressForMint` output).
3. **Submit `CreateReward`** with `RewardsManagerPubkey:
rewardsManagerPubkey`. The legacy `ClaimAuthorities` slice and inline
`DeadlineBlockHeight` are gone (proto tags 4–6 reserved on
`CreateReward`); deadline is now a separate SDK argument.

The CLI's "reward already exists, look up the stored address"
idempotency path is preserved. The HTTP path's no-op behavior when
`LaunchpadDeterministicSecret` is unset is preserved.

### `go.mod`

`github.com/OpenAudio/go-openaudio v1.2.11` → `v1.2.13` (pseudo-version
pointing at the merge commit).

## Test plan

- [x] `go build ./...` and `go vet ./...` clean.
- [x] `go test ./utils/...` — new `TestDeriveRewardManagerKeypair`
covers well-formedness, determinism, sign/verify round-trip, and that
different mints / secrets produce different keypairs (5 subtests).
- [ ] After merge: bump `go.mod` to the clean `v1.2.13` tag once
go-openaudio cuts it.
- [ ] Devnet smoke: launch a new coin via the launchpad-relay, POST
`/v1/rewards/code`, observe the first call creates both the pool and the
reward, subsequent calls for the same mint create only the reward.
- [ ] Staging: run the CLI against a fresh mint; verify the same
two-call pattern then the idempotent reuse path on a second run.

## Dependencies

- Blocked on:
[OpenAudio/go-openaudio#254](OpenAudio/go-openaudio#254)
(merged).
- Coordinated with:
[OpenAudio/go-openaudio#260](OpenAudio/go-openaudio#260)
(the v1.2.13 version bump; this PR's go.mod pseudo-version will be
rewritten to the clean tag after that lands).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

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.

2 participants