Skip to content

fix(node): anchor the real old_sha and issue a per-ref certificate#72

Open
beardthelion wants to merge 1 commit into
mainfrom
fix/arweave-anchor-real-oldsha-per-ref-cert
Open

fix(node): anchor the real old_sha and issue a per-ref certificate#72
beardthelion wants to merge 1 commit into
mainfrom
fix/arweave-anchor-real-oldsha-per-ref-cert

Conversation

@beardthelion

Copy link
Copy Markdown
Collaborator

Refs #26 (integrity subset only; the issue stays open for the foundation work).

What was wrong

The push handler built the Arweave anchor from a copy of the ref updates that had already dropped the real old_sha, then hardcoded old_sha to 64 zeros. The signed RefCertificate with the real old -> new stayed local. On top of that, a multi-ref push only ever produced one certificate (for the first ref), and an empty push signed a timestamp string as new_sha. The 64-zero placeholder was also the wrong width: git object ids are 40-hex SHA-1.

What this changes

  • Thread the parsed old_sha through the clone moved into the anchoring task, so the anchor records the real old -> new transition. This drops the "0".repeat(64) placeholder and fixes the width mismatch.
  • Issue a signed RefCertificate for every ref the push advanced, each carrying that ref's real old/new, instead of one cert for the first ref.

No new dependencies, no schema or config changes.

Scope

Deliberately the integrity subset of #26. Carrying the signed certificate on Turbo, capturing the pusher signature, chaining certificates, and gl-side verification against the anchor remain open under #26.

Tests

  • New arweave::tests::test_anchor_body_carries_real_old_sha locks the anchor-body contract: the upload must serialize the real old_sha/new_sha, never a placeholder.
  • Full gitlawb-node suite green (126 passed); fmt and clippy clean.

The per-ref certificate issuance and old_sha threading live in the git_receive_pack handler, which has no test harness (it needs a live Postgres and git), so those are verified by compile and review rather than an automated test.

The push handler discarded the real old->new transition before anchoring
and only certified the first ref of a multi-ref push, so the permanent
Arweave record was a weaker, incomplete copy of facts the node had
already parsed.

- Thread the parsed old_sha through the clone moved into the anchor task
  instead of hardcoding a 64-zero placeholder. This also fixes the SHA
  width mismatch: object ids are 40-hex SHA-1, not 64-hex.
- Issue a signed RefCertificate for every ref the push advanced, each
  carrying that ref's real old/new, rather than one cert for the first
  ref (which, on an empty push, signed a timestamp string as new_sha).

Lock the anchor-body contract with a test asserting the upload carries
the real old_sha and new_sha, never a placeholder.

Scope is the integrity subset only. Carrying the signed certificate on
Turbo, capturing the pusher signature, chaining certificates, and
gl-side verification remain open under #26.

Refs #26
@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@beardthelion, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 24 minutes and 4 seconds. Learn how PR review limits work.

To continue reviewing without waiting, enable usage-based billing in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ef1e2480-042b-40c5-8b76-adf2ce955eac

📥 Commits

Reviewing files that changed from the base of the PR and between e37ea7f and 31ed541.

📒 Files selected for processing (2)
  • crates/gitlawb-node/src/api/repos.rs
  • crates/gitlawb-node/src/arweave.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/arweave-anchor-real-oldsha-per-ref-cert

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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