Repository navigation
feat(claims): index setactlimit/seedmbrclm and mirror mbrclaim into member_action_claims - #80
Merged
Merged
Conversation
…ember_action_claims - claim_mirror.js applies the contract's mbrclaim arithmetic to member_action_claims: claimaction opens (+1 pending), the first pending → final verifyclaim closes (saturating pending, +1 approved or last_rejected_at = block second), reward adds approved, seedmbrclm overwrites. All writes run on the block-level transaction. - setactlimit writes actions.max_claims_per_account / reclaim_cooldown_seconds (max 0 clears both); an action that isn't indexed is a ResolveError (skip + page). - src/config/lane.js: lane chain :8899 + cambiatus_lane_cpa, refuses :8888 and the shared DBs. - scripts/compare-claim-mirror.sh: chain mbrclaim vs Postgres, per account. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
Claim limits, rollout step 4 (plan Task 7). event-source indexes the two new
cambiatus.cmactions and keeps the backend'smember_action_claimstable in step with the contract'smbrclaimtable.src/claim_mirror.jsapplies the contract's own arithmetic and decides nothing:claimactionadds 1 topending.verifyclaimthat moves a claim from pending to final closes it.pendinggoes down by 1 (never below 0); thenapprovedgoes up by 1, orlast_rejected_atbecomes the block's whole second. A replay finds the claim already final and skips it.rewardadds 1 toapproved.seedmbrclmoverwrites the row.ResolveErrorpath.setactlimitwritesactions.max_claims_per_accountandreclaim_cooldown_seconds; max 0 clears both. An action that isn't indexed raisesResolveError(skip and page).src/config/lane.jspoints at the lane chain (:8899) andcambiatus_lane_cpa. It refuses :8888 and the shared DBs.scripts/compare-claim-mirror.sh <chain> <db> <account>...compares chainmbrclaimwith Postgres for each account.The S3 contract (live since 2026-10-17) and the backend table (#546, on backend main) are already in place. Rows written on chain before this deploy are filled by the S4 backfill (
seedmbrclm), which this PR indexes.Merge after #79. Without #79 the indexer can drop the second part of a split block, and the mirror would drift with it (a lane run without #79 lost 7 claims).
Test plan
5f661569, fresh DB):test_community97/97 andtest_claim_limits81/81 generate the activity;compare-claim-mirror.shprints OK for alice, bob, carol, dave and eve (exit 0);yarn formatis clean.cambiatus_mirrorandcambiatus_review).Known and pre-existing, not changed here:
resolveCreatedActionIdreads the current chain, so an action created and deleted before it is indexed shifts later create ids. The lane test does this in one block; in prod it would need both inside one 500 ms poll.Deploy (needs a go)
On the box:
git status(clean?),git pull --ff-only origin master,pm2 restart event-source. Then watch thatrestart_timestays stable. Noyarn installis needed.🤖 Generated with Claude Code