Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PoX-4 signer key read/write with base Rust tests #4209

Merged
merged 9 commits into from
Jan 2, 2024
Merged

Conversation

MarvinJanssen
Copy link
Member

@MarvinJanssen MarvinJanssen commented Dec 21, 2023

Description

This PR adds pox4 signer key read/write and useful helpers to interact with pox4 functions. The focus is to add base Rust tests to be used as a foundation for upcoming work items like #4059, #4058, #4147, and so on. There is also a basic check to make sure that a signer key is 33 bytes and to prevent key reuse.

Applicable issues

Additional info (benefits, drawbacks, caveats)

I kept this PR as narrow as possible for the purpose of unblocking other work and to (hopefully) make a merge straightforward. Processing the signer keys, calculating the aggregate key, and the signer StackerDB work is slated for subsequent PRs.

Comprehensive PoX4 smart contract tests will also be introduced in a different PR. (Pending clarunit tooling.)

Checklist

  • Test coverage for new or modified code paths
  • Changelog is updated
  • Required documentation changes (e.g., docs/rpc/openapi.yaml and rpc-endpoints.md for v2 endpoints, event-dispatcher.md for new events)
  • New clarity functions have corresponding PR in clarity-benchmarking repo
  • New integration test(s) added to bitcoin-tests.yml

Copy link

codecov bot commented Dec 22, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (ee3afa5) 82.91% compared to head (8e9cf99) 82.96%.

Files Patch % Lines
...tackslib/src/chainstate/stacks/boot/pox_4_tests.rs 99.51% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             next    #4209      +/-   ##
==========================================
+ Coverage   82.91%   82.96%   +0.04%     
==========================================
  Files         429      429              
  Lines      302304   302748     +444     
==========================================
+ Hits       250650   251169     +519     
+ Misses      51654    51579      -75     

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

@setzeus
Copy link
Collaborator

setzeus commented Dec 22, 2023

Looks like formatting failed in CI, have to run the following before committing:

cargo fmt --all -- --config group_imports=StdExternalCrate,imports_granularity=Module

Copy link
Collaborator

@setzeus setzeus left a comment

Choose a reason for hiding this comment

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

Some minimal comments/thoughts, really glad to see the work here!

Will go a long way to making PoX-related Rust tests easier / increasing code coverage for the rest of PoX-4 tasks.

stackslib/src/chainstate/stacks/boot/pox-4.clar Outdated Show resolved Hide resolved
stackslib/src/chainstate/stacks/boot/pox_4_tests.rs Outdated Show resolved Hide resolved
stackslib/src/chainstate/stacks/boot/pox_4_tests.rs Outdated Show resolved Hide resolved
@MarvinJanssen
Copy link
Member Author

Strange, I have auto-formatting on. Must be a setting mismatch somewhere.

I'll tend to the changes as soon as possible.

Appreciate the quick review.

@jferrant
Copy link
Collaborator

Strange, I have auto-formatting on. Must be a setting mismatch somewhere.

I'll tend to the changes as soon as possible.

Appreciate the quick review.

Make sure you use cargo fmt-stacks in your auto settings as it has some additional flags to it that may change as the repo changes (so you don't have to update your auto fmting each time they do)

Copy link
Member

@moodmosaic moodmosaic left a comment

Choose a reason for hiding this comment

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

Thank you, @MarvinJanssen!

The direction of this draft looks good. While I haven't pulled this locally yet, I wanted to initiate a discussion on potentially creating common abstractions to further streamline and condense the tests. I've left a detailed comment regarding this. Looking forward to your thoughts.

@MarvinJanssen
Copy link
Member Author

MarvinJanssen commented Dec 22, 2023

Make sure you use cargo fmt-stacks in your auto settings as it has some additional flags to it that may change as the repo changes (so you don't have to update your auto fmting each time they do)

Yep I saw that, I had old settings in there. Thank you for the pointer!

@setzeus setzeus added the PoX-4 label Dec 22, 2023
@setzeus setzeus mentioned this pull request Dec 22, 2023
8 tasks
@moodmosaic moodmosaic changed the title pox4 signer key read/write with base Rust tests PoX-4 signer key read/write with base Rust tests Dec 22, 2023
@MarvinJanssen MarvinJanssen marked this pull request as ready for review December 28, 2023 12:42
@jcnelson
Copy link
Member

Overall looks good but please address my comments first. Thanks!

@MarvinJanssen
Copy link
Member Author

@wileyj this one is good to go I believe.

@wileyj wileyj merged commit fa6a3a6 into next Jan 2, 2024
2 checks passed
@jcnelson
Copy link
Member

jcnelson commented Jan 2, 2024

@wileyj I had asked to avoid merging this before reviewing

@AshtonStephens
Copy link
Collaborator

@wileyj I had asked to avoid merging this before reviewing

I don't think Jesse was in that discussion.

@wileyj
Copy link
Contributor

wileyj commented Jan 2, 2024

@wileyj I had asked to avoid merging this before reviewing

ahh my mistake. was looking over the PR comments/approvals and it appeared good to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Status: ✅ Done
8 participants