Skip to content

feat: add peer ids to each staker#100

Merged
arad-starkware merged 1 commit into
mainfrom
arad/add-peer-id
Apr 6, 2026
Merged

feat: add peer ids to each staker#100
arad-starkware merged 1 commit into
mainfrom
arad/add-peer-id

Conversation

@arad-starkware

@arad-starkware arad-starkware commented Mar 22, 2026

Copy link
Copy Markdown
Contributor

This change is Reviewable


Note

High Risk
High risk because it changes on-chain storage and public interfaces/events (including get_stakers return type), which can break downstream consumers and requires careful migration/compatibility validation.

Overview
Adds a new per-staker PeerId (u256) that can be set by stakers via set_peer_id, takes effect after K epochs, and is readable via get_current_peer_id; emits a new PeerIdSet event and introduces related validation/errors.

Extends the consensus API get_stakers to include Option<PeerId> alongside Option<PublicKey>, wires peer-id storage/lookup into staking.cairo, and updates the spec/docs accordingly.

Updates test utilities and flow/unit/fork tests to cover peer-id behavior (activation delay, pause/unstake/upgrade edge-cases) and to accommodate the expanded get_stakers tuple.

Reviewed by Cursor Bugbot for commit 74cfb58. Bugbot is set up for automated code reviews on this repo. Configure here.

arad-starkware commented Mar 22, 2026

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@codecov

codecov Bot commented Mar 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.12644% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.90%. Comparing base (06d3d2e) to head (74cfb58).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/staking/tests/test.cairo 97.16% 6 Missing ⚠️
src/staking/staking.cairo 87.50% 3 Missing ⚠️
src/staking/tests/pause_test.cairo 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #100      +/-   ##
==========================================
- Coverage   95.91%   95.90%   -0.01%     
==========================================
  Files          43       43              
  Lines       10797    11115     +318     
==========================================
+ Hits        10356    10660     +304     
- Misses        441      455      +14     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@arad-starkware arad-starkware force-pushed the arad/add-peer-id branch 2 times, most recently from 0594ea5 to 47b97c2 Compare March 29, 2026 10:10
@arad-starkware arad-starkware marked this pull request as ready for review March 29, 2026 10:10

@NirLevi-starkware NirLevi-starkware left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

:lgtm:

@NirLevi-starkware reviewed 13 files and all commit messages, and made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on arad-starkware).

@graphite-app

graphite-app Bot commented Apr 5, 2026

Copy link
Copy Markdown

Merge activity

  • Apr 5, 2:41 PM UTC: This pull request can not be added to the Graphite merge queue. Please try rebasing and resubmitting to merge when ready.
  • Apr 5, 2:41 PM UTC: Graphite disabled "merge when ready" on this PR due to: a merge conflict with the target branch; resolve the conflict and try again..
  • Apr 6, 9:27 AM UTC: @arad-starkware merged this pull request with Graphite.

@arad-starkware arad-starkware merged commit 7a7add2 into main Apr 6, 2026
6 of 8 checks passed
@arad-starkware arad-starkware deleted the arad/add-peer-id branch April 6, 2026 09:27
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