Skip to content

Add m008 Data Attestation Bonding mechanism spec#20

Open
CShear wants to merge 2 commits intoregen-network:mainfrom
CShear:feat/m008-attestation-bonding
Open

Add m008 Data Attestation Bonding mechanism spec#20
CShear wants to merge 2 commits intoregen-network:mainfrom
CShear:feat/m008-attestation-bonding

Conversation

@CShear
Copy link
Contributor

@CShear CShear commented Feb 18, 2026

Summary

  • Adds full mechanism spec for m008 (Data Attestation Bonding) following the established m010 pattern
  • Includes SPEC.md (13 sections), JSON schemas (attestation lifecycle, quality score, KPI), reference implementation with deterministic self-test, replay datasets with challenge scenarios
  • 4-factor weighted scoring: bond adequacy (0.30), attester reputation (0.30), evidence completeness (0.25), type risk (0.15)
  • Covers bond schedule by attestation type, 48h activation delay, Arbiter DAO challenge resolution, and slash/release mechanics
  • Updates MECHANISM_CONSUMERS.md with m008 consumer mappings

Test plan

  • node mechanisms/m008-attestation-bonding/reference-impl/m008_score.js — self-test PASS (5 test vectors)
  • npm run verify — PASS
  • npm run check:index — mechanism index up to date
  • m010 regression — self-test still passes
  • Review SPEC.md sections for accuracy against phase-2/2.1 and phase-3/3.1 source material
  • Validate JSON schema coverage against SPEC.md state machine

🤖 Generated with Claude Code

Adds full mechanism spec for m008 following the m010 pattern:
- SPEC.md with 13 sections covering bond lifecycle, Arbiter DAO resolution,
  type-based bond schedule, and 4-factor quality scoring
- JSON schemas for attestation lifecycle, quality score output, and KPI metrics
- Reference implementation (m008_score.js, m008_kpi.js) with deterministic self-test
- Test vectors and replay dataset fixtures including challenge scenarios
- Updates MECHANISM_CONSUMERS.md with m008 consumer mappings

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 a new mechanism, m008 Data Attestation Bonding, aimed at enhancing the integrity and reliability of ecological data within the Regen ecosystem. By requiring attesters to bond REGEN tokens, the system creates economic incentives for high-quality data submissions and establishes a structured process for challenging and resolving disputes. This foundational work provides the necessary specifications, schemas, and reference implementations for future on-chain deployment, fostering a more trustworthy and accountable data attestation environment.

Highlights

  • New Mechanism Added: Introduced the full mechanism specification for m008 (Data Attestation Bonding), following the established pattern of m010.
  • Comprehensive Specification: The mechanism includes a detailed SPEC.md with 13 sections, JSON schemas for attestation lifecycle, quality score, and KPI, a reference implementation with deterministic self-tests, and replay datasets for challenge scenarios.
  • Weighted Scoring Model: Implemented a 4-factor weighted scoring system for attestation quality, considering bond adequacy (0.30), attester reputation (0.30), evidence completeness (0.25), and type risk (0.15).
  • Bonding and Resolution Mechanics: Defined bond schedules by attestation type, a 48-hour activation delay, Arbiter DAO challenge resolution processes, and mechanics for slashing and releasing bonds.
  • Documentation Updates: Updated MECHANISM_CONSUMERS.md to include mappings for the new m008 mechanism.
Changelog
  • README.md
    • Added a link to the newly introduced m008 Data Attestation Bonding mechanism in the mechanisms index.
  • docs/MECHANISM_CONSUMERS.md
    • Documented the m008 Data Attestation Bonding mechanism, detailing its canonical specification, output schemas, deterministic datasets, and known consumers.
  • mechanisms/m008-attestation-bonding/README.md
    • Created a new README file providing an overview of the m008 mechanism, its outputs, v0 advisory limitations, how to reference its components, replay datasets, and schemas.
  • mechanisms/m008-attestation-bonding/SPEC.md
    • Added the comprehensive specification document for m008 Data Attestation Bonding, covering problem statement, actors, signal definition, evidence inputs, scoring function, state machine, token flows, security invariants, attack model, integration points, acceptance tests, and rollout plan.
  • mechanisms/m008-attestation-bonding/datasets/README.md
    • Created a README file for the m008 replay datasets, explaining their purpose and listing the schema and fixture files.
  • mechanisms/m008-attestation-bonding/datasets/fixtures/v0_challenge_sample.json
    • Added a JSON fixture file containing sample attestations that demonstrate various challenge and resolution scenarios for testing.
  • mechanisms/m008-attestation-bonding/datasets/fixtures/v0_sample.json
    • Added a JSON fixture file with sample attestations covering a full lifecycle (active, released, submitted) for testing m008 computations.
  • mechanisms/m008-attestation-bonding/datasets/schema.json
    • Added a JSON Schema defining the structure for m008 replay datasets, including attestation lifecycle records.
  • mechanisms/m008-attestation-bonding/reference-impl/README.md
    • Created a README file for the m008 reference implementation, describing its inputs and outputs for scoring and KPI computations.
  • mechanisms/m008-attestation-bonding/reference-impl/m008_kpi.js
    • Added a JavaScript module to compute Key Performance Indicators (KPIs) for m008, including attestation counts, challenge/slash rates, bond economics, and average quality scores.
  • mechanisms/m008-attestation-bonding/reference-impl/m008_score.js
    • Added a JavaScript module implementing the 4-factor weighted composite scoring function for m008 attestations, along with helper functions and a self-test.
  • mechanisms/m008-attestation-bonding/reference-impl/test_vectors/vector_v0_sample.expected.json
    • Added a JSON file containing expected output scores for the m008_score.js self-test.
  • mechanisms/m008-attestation-bonding/reference-impl/test_vectors/vector_v0_sample.input.json
    • Added a JSON file containing input data for the m008_score.js self-test.
  • mechanisms/m008-attestation-bonding/schemas/README.md
    • Created a README file for the m008 output schemas, explaining their purpose and listing the individual schema files.
  • mechanisms/m008-attestation-bonding/schemas/m008_attestation.schema.json
    • Added a JSON Schema for the m008 attestation lifecycle object, defining its structure, status, and challenge details.
  • mechanisms/m008-attestation-bonding/schemas/m008_kpi.schema.json
    • Added a JSON Schema for the m008 KPI output, defining metrics like attestation counts, challenge rates, and bond economics.
  • mechanisms/m008-attestation-bonding/schemas/m008_quality_score.schema.json
    • Added a JSON Schema for the m008 attestation quality score output, including the score, confidence, and factor breakdown.
  • package.json
    • Updated the package.json to include 'type': 'module', enabling ES module syntax for JavaScript files.
Activity
  • No human activity has been recorded on this pull request yet.
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 m008 Data Attestation Bonding mechanism, including its specification, reference implementation, schemas, and test data. The changes are comprehensive and well-structured. My review focuses on ensuring consistency and clarity across these new artifacts. I've identified a few areas where the specification, schemas, and implementation have minor inconsistencies, particularly around state definitions, transition logic, and return values. Addressing these will improve the overall robustness and clarity of the new mechanism, aligning with established guidelines for state machine documentation and explicit logic definition.

Comment on lines +129 to +134
CHALLENGED → RESOLVED_INVALID
trigger: arbiter_dao.vote(INVALID) OR admin.resolve(INVALID) (v0)
guard: quorum_met (v1), resolution_authority_verified
action: challenger.receive(bond × 0.5 + challenge_deposit - arbiter_fee)
community_pool.receive(bond × 0.5)
attestation.status = SLASHED
Copy link
Contributor

Choose a reason for hiding this comment

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

high

There's an inconsistency in the state machine regarding the RESOLVED_INVALID and SLASHED states. The CHALLENGED → RESOLVED_INVALID transition specifies an action of attestation.status = SLASHED. This implies an invalid resolution directly leads to the SLASHED state. However, RESOLVED_INVALID is also defined as a distinct status in the state list, schemas, and is used in the v0_challenge_sample.json dataset.

Please clarify this relationship. For instance, if a RESOLVED_INVALID outcome always results in the SLASHED state, then RESOLVED_INVALID should probably not be a state itself. The current definition is contradictory.

References
  1. To improve document clarity, co-locate all state definitions and transitions within the primary state machine documentation, including definitions for edge-case flows like escalations.

Comment on lines +70 to +73
"resolution": {
"type": "string",
"enum": ["ATTESTER_WINS", "CHALLENGER_WINS"]
},
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 challenge.resolution property and its enum ["ATTESTER_WINS", "CHALLENGER_WINS"] are inconsistent with SPEC.md and the replay dataset schema (mechanisms/m008-attestation-bonding/datasets/schema.json). The spec and dataset use an outcome property with VALID or INVALID values. To maintain consistency across the mechanism's artifacts, this schema should be aligned with the specification.

Suggested change
"resolution": {
"type": "string",
"enum": ["ATTESTER_WINS", "CHALLENGER_WINS"]
},
"outcome": {
"type": ["string", "null"],
"enum": ["VALID", "INVALID", null]
},

Comment on lines +68 to +70
- If M010 score exists: `f_reputation = m010_score`
- If no M010 score: `f_reputation = 300` (cautious default, below neutral)
- Track record adjustment: `f_reputation = 0.7 × m010_score + 0.3 × (unchallenged_rate × 1000)`
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

There's an ambiguity in how f_reputation is calculated. The spec provides a base calculation (f_reputation = m010_score or a default of 300) and a separate Track record adjustment formula. It's unclear under which conditions the adjustment formula should be used. Does it always apply when a track record exists, overriding the base score, or is it an optional calculation? Please clarify the logic to prevent implementation ambiguity.

For example, you could structure it like this:

- If M010 score exists:
  - If attester has a track record (e.g., `unchallenged_rate` is available):
    `f_reputation = 0.7 × m010_score + 0.3 × (unchallenged_rate × 1000)`
  - Else:
    `f_reputation = m010_score`
- If no M010 score: `f_reputation = 300` (cautious default, below neutral)
References
  1. When specifying transition logic between different mechanisms (e.g., multipliers), explicitly define the function (e.g., max()) and the state-based conditions (phase-gating) that govern the transition to prevent implementation ambiguity.

## 6. State machine

```
States: {BONDED, ACTIVE, CHALLENGED, RESOLVED_VALID, RESOLVED_INVALID, RELEASED, SLASHED}
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 state machine defines BONDED as the initial state. However, the sample dataset v0_sample.json and the dataset schema mechanisms/m008-attestation-bonding/datasets/schema.json include a SUBMITTED status, which appears to precede BONDED. For consistency, the state machine should be updated to include SUBMITTED as the initial state before a bond is confirmed.

Suggested change
States: {BONDED, ACTIVE, CHALLENGED, RESOLVED_VALID, RESOLVED_INVALID, RELEASED, SLASHED}
States: {SUBMITTED, BONDED, ACTIVE, CHALLENGED, RESOLVED_VALID, RESOLVED_INVALID, RELEASED, SLASHED}
References
  1. To improve document clarity, co-locate all state definitions and transitions within the primary state machine documentation, including definitions for edge-case flows like escalations.

Comment on lines +18 to +20
const slash_rate = attestations_challenged > 0
? Number((attestations_slashed / attestations_challenged).toFixed(4))
: null;
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 calculation for slash_rate returns null if attestations_challenged is zero. This is inconsistent with challenge_rate, which returns 0.0 if attestations_submitted is zero. For consistency, slash_rate should also return 0.0 when there are no challenges, as a rate of zero is more accurate than an undefined (null) value in this context.

Suggested change
const slash_rate = attestations_challenged > 0
? Number((attestations_slashed / attestations_challenged).toFixed(4))
: null;
const slash_rate = attestations_challenged > 0
? Number((attestations_slashed / attestations_challenged).toFixed(4))
: 0.0;

…ation clarity

- SPEC.md: add SUBMITTED initial state, remove RESOLVED_INVALID (invalid
  resolution transitions directly to SLASHED), clarify terminal states
- SPEC.md: restructure reputation formula with explicit conditional logic
- m008_attestation.schema.json: rename resolution → outcome, align enum
  with dataset schema (VALID/INVALID instead of ATTESTER_WINS/CHALLENGER_WINS)
- m008_kpi.js: slash_rate returns 0.0 instead of null when no challenges

Fixes Gemini review on PR regen-network#20.

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