Skip to content

feat: Add M015 Contribution-Weighted Rewards mechanism#26

Open
CShear wants to merge 2 commits intoregen-network:mainfrom
CShear:feat/m015-contribution-rewards
Open

feat: Add M015 Contribution-Weighted Rewards mechanism#26
CShear wants to merge 2 commits intoregen-network:mainfrom
CShear:feat/m015-contribution-rewards

Conversation

@CShear
Copy link
Contributor

@CShear CShear commented Feb 18, 2026

Summary

  • Adds standalone mechanisms/m015-contribution-weighted-rewards/ directory with full mechanism specification, reference implementation, JSON schemas, and deterministic test fixtures
  • M015 replaces passive staking rewards with activity-based distribution from the Community Pool, scoring participants on credit purchases (0.30), credit retirements (0.30), platform facilitation (0.20), governance voting (0.10), and proposal submission (0.10)
  • Includes a stability tier for long-term holders (6% annual, 6–24 month lock, 30% cap of Community Pool inflow)

What's included

File Description
SPEC.md 13-section specification: problem, scoring function, stability tier, state machine, attack model, acceptance tests, rollout plan
README.md Mechanism overview with cross-references
reference-impl/m015_score.js Canonical JS implementation: computeActivityScore, computeStabilityAllocation, computeDistribution + self-test harness
reference-impl/test_vectors/ Deterministic input/expected JSON for 4 participants with diverse activity profiles
schemas/ JSON Schema (draft-07) for activity scores, stability commitments, and KPI output
datasets/fixtures/v0_sample.json Single epoch distribution fixture (4 participants)
datasets/fixtures/v0_stability_sample.json 5 stability tier scenarios: normal, multiple commitments, cap hit, matured, early exit
package.json Added "type": "module" for ESM imports
README.md (root) Mechanism index regenerated to include m015

Verification

  • node mechanisms/m015-contribution-weighted-rewards/reference-impl/m015_score.jsPASS
  • node scripts/build-mechanism-index.mjs --checkOK
  • node scripts/verify.mjsPASS

Test plan

  • Self-test passes: node mechanisms/m015-contribution-weighted-rewards/reference-impl/m015_score.js
  • Repo verify passes: npm run verify
  • Mechanism index up to date: npm run check:index
  • Review SPEC.md scoring formula against phase-2/2.6-economic-reboot-mechanisms.md M015 section for consistency
  • Review stability tier cap behavior in v0_stability_sample.json scenario 3 (cap hit)
  • Confirm JSON schemas validate against fixture outputs

🤖 Generated with Claude Code

…e impl, schemas, and fixtures

Full standalone mechanism directory for M015 including:
- SPEC.md: 13-section specification (scoring, stability tier, state machine, attack model)
- reference-impl/m015_score.js: canonical scoring, stability allocation, and distribution
- reference-impl/test_vectors/: deterministic input/expected fixtures (4 participants)
- schemas/: JSON schemas for activity scores, stability commitments, and KPI output
- datasets/fixtures/: v0_sample (single epoch) and v0_stability_sample (5 scenarios)
- README.md: mechanism overview with cross-references
- package.json: add "type": "module" for ESM imports
- README.md mechanism index regenerated

Self-test and repo verify both pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @CShear, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces the M015 Contribution-Weighted Rewards mechanism, fundamentally shifting the network's reward system from passive staking to an activity-based model. It incentivizes participants for their ecological and governance contributions, ensuring rewards align with value creation within the ecosystem. Additionally, it establishes a stability tier to offer predictable returns for long-term token holders, balancing active participation with holder stability.

Highlights

  • New Mechanism Added: A new mechanism, m015-contribution-weighted-rewards, has been introduced with its dedicated directory, including a full specification, reference implementation, JSON schemas, and deterministic test fixtures.
  • Activity-Based Rewards: The M015 mechanism replaces passive staking rewards with an activity-based distribution system, funding participants from the Community Pool based on their ecological and governance contributions.
  • Stability Tier: A stability tier has been implemented for long-term token holders, offering a fixed 6% annual return with lock-up periods between 6 and 24 months, capped at 30% of Community Pool inflow.
  • Comprehensive Documentation and Tools: The pull request includes a detailed specification (SPEC.md), a canonical JavaScript reference implementation (m015_score.js), JSON schemas for outputs, and various test vectors and fixtures to ensure determinism and verifiability.
Changelog
  • README.md
    • Added a link to the new M015 mechanism in the main index.
  • mechanisms/m015-contribution-weighted-rewards/README.md
    • Documented the M015 mechanism, outlining its outputs, v0 limitations, reference points, replay datasets, and associated schemas.
  • mechanisms/m015-contribution-weighted-rewards/SPEC.md
    • Detailed the full specification for M015, covering its problem statement, target actors, signal definition, evidence inputs, scoring function, stability tier, state transitions, economic linkages, on-chain/off-chain boundaries, attack model, integration points, acceptance tests, and rollout plan.
  • mechanisms/m015-contribution-weighted-rewards/datasets/fixtures/v0_sample.json
    • Provided a sample JSON fixture demonstrating a single distribution period with four participants and their computed rewards.
  • mechanisms/m015-contribution-weighted-rewards/datasets/fixtures/v0_stability_sample.json
    • Included a JSON fixture illustrating various stability tier scenarios, such as normal commitment, multiple commitments, cap hit, matured commitment, and early exit.
  • mechanisms/m015-contribution-weighted-rewards/reference-impl/m015_score.js
    • Implemented the canonical JavaScript reference for computing activity scores, stability allocations, and overall distributions, complete with a self-test harness.
  • mechanisms/m015-contribution-weighted-rewards/reference-impl/test_vectors/vector_v0_sample.expected.json
    • Defined the expected output for the v0_sample test vector, used for validating the reference implementation.
  • mechanisms/m015-contribution-weighted-rewards/reference-impl/test_vectors/vector_v0_sample.input.json
    • Specified the input data for the v0_sample test vector, detailing participant activities and stability commitments.
  • mechanisms/m015-contribution-weighted-rewards/schemas/README.md
    • Explained the purpose of the M015 JSON schemas and listed the individual schema files.
  • mechanisms/m015-contribution-weighted-rewards/schemas/m015_activity_score.schema.json
    • Defined the JSON schema for the M015 activity score output, including breakdown by activity type.
  • mechanisms/m015-contribution-weighted-rewards/schemas/m015_kpi.schema.json
    • Established the JSON schema for the M015 Key Performance Indicator (KPI) output, summarizing distribution metrics.
  • mechanisms/m015-contribution-weighted-rewards/schemas/m015_stability_commitment.schema.json
    • Created the JSON schema for M015 stability tier commitment records, detailing lock periods and lifecycle states.
  • package.json
    • Configured the package to use ES modules by adding "type": "module".
Activity
  • The m015_score.js self-test passed successfully.
  • The mechanism index build check completed without issues.
  • The repository verification process passed.
  • Reviewers are requested to verify the SPEC.md scoring formula against the economic reboot mechanisms document.
  • Reviewers are requested to examine the stability tier cap behavior in the v0_stability_sample.json fixture.
  • Reviewers are requested to confirm that the JSON schemas validate against the fixture outputs.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the M015 Contribution-Weighted Rewards mechanism, a significant new feature. The submission is comprehensive, including a detailed specification, a reference implementation, JSON schemas, and test fixtures. The code is well-structured and includes a self-test harness. However, I have identified a critical design flaw in the core scoring formula which disproportionately favors monetary activities over governance participation. Additionally, there is a schema mismatch in a test fixture, which should align with project data standards, and a minor code improvement opportunity. Addressing these points will be crucial for the mechanism's fairness and the overall quality of the codebase.

Comment on lines +90 to +96
activity_score[p] = (
credit_purchase_value[p] * 0.30 +
credit_retirement_value[p] * 0.30 +
platform_facilitation_value[p] * 0.20 +
governance_votes_cast[p] * 0.10 +
proposal_credit * 0.10
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The current scoring formula directly combines monetary values (e.g., credit_purchase_value in uregen) with simple counts (e.g., governance_votes_cast). This creates a significant imbalance where monetary activities can completely dominate the score, rendering governance participation almost meaningless. For example, a single credit purchase of 1,000,000 uregen contributes 300,000 to the score, while casting 10 votes only contributes 1. To ensure a more balanced reward system that properly incentivizes all desired activities, consider normalizing these different types of inputs before applying weights. For instance, monetary values could be log-scaled, or all activity values could be normalized to a common range (e.g., 0-1) based on their distribution within the epoch.

@@ -0,0 +1,113 @@
{
"$schema": "../../schemas/m015_kpi.schema.json",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The JSON schema referenced here, m015_kpi.schema.json, does not match the structure of this fixture file. For example, this file contains a participants array which is not defined in the schema, and it lacks required schema properties like mechanism_id, scope, and as_of. To ensure data integrity and clarity, please either update this fixture to match the schema, or create and reference a new schema that accurately describes this data structure.

References
  1. When defining data structures or type definitions, ensure they are aligned with the project's central data standards repository (regen-data-standards) to maintain coherence.

* @param {Array<{passed: boolean, reached_quorum: boolean}>} opts.activities.proposals - proposals submitted
* @returns {{ total_score: number, breakdown: Object }}
*/
export function computeActivityScore({ participant, activities }) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The participant parameter is declared but not used within the function. It should be removed to improve code clarity.

Suggested change
export function computeActivityScore({ participant, activities }) {
export function computeActivityScore({ activities }) {

… param

- SPEC.md: add section 5.4 documenting deliberate scoring unit imbalance
  (monetary values dominate governance counts by design; v1 may normalize)
- v0_sample.json: remove incorrect $schema ref to m015_kpi.schema.json
  (this is a replay dataset, not a KPI output)
- m015_score.js: remove unused participant param from computeActivityScore

Fixes Gemini review on PR regen-network#26.

Co-Authored-By: Claude Opus 4.6 <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