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

[2.1] Stacking pox-2 #1354

Merged
merged 39 commits into from
Nov 23, 2022
Merged

[2.1] Stacking pox-2 #1354

merged 39 commits into from
Nov 23, 2022

Conversation

janniks
Copy link
Collaborator

@janniks janniks commented Sep 13, 2022

This PR was published to npm with the version 5.0.3-pr.50a78ae.0
e.g. npm install @stacks/[email protected] --save-exact

Methods for the upcoming @stacks/stacking changes to PoX-v2

  • one test is skipped waiting for transition unlock events
  • squash this PR!
feat: Add PoX-2 methods to @stacks/stacking client

A StackingClient will now automatically detect which PoX version to use for Stacking.
Adds the following PoX Stacking methods to the StackingClient: `stackExtend`, `stackIncrease`, `delegateStackExtend`, `delegateStackIncrease`, `stackAggregationCommitIndexed`, `stackAggregationIncrease`.
Adds the following helper methods to the StackingClient: `getAccountExtendedBalances`, `getAccountBalanceLocked`, `getDelegationStatus`, `getRewardSet`.

For Follow-Up PRs:

  • Optimize period detection to make less network requests (semver compatible)
  • Add explicit poxContract parameter to stacking methods, for users to choose specifically (semver compatible)

@vercel
Copy link

vercel bot commented Sep 13, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
stacksjs-docs ✅ Ready (Inspect) Visit Preview Nov 23, 2022 at 1:58AM (UTC)

@codecov-commenter
Copy link

codecov-commenter commented Oct 27, 2022

Codecov Report

❗ No coverage uploaded for pull request base (stacks-2.1@cc0c50c). Click here to learn what that means.
The diff coverage is n/a.

❗ Current head 6b2e9b1 differs from pull request most recent head 50a78ae. Consider uploading reports for the commit 50a78ae to get more accurate results

@@              Coverage Diff              @@
##             stacks-2.1    #1354   +/-   ##
=============================================
  Coverage              ?   63.48%           
=============================================
  Files                 ?      116           
  Lines                 ?     8493           
  Branches              ?     1877           
=============================================
  Hits                  ?     5392           
  Misses                ?     2973           
  Partials              ?      128           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@janniks janniks changed the title [2.1] Stacking pox-2 stubs [2.1] Stacking pox-2 Oct 28, 2022
@janniks
Copy link
Collaborator Author

janniks commented Oct 28, 2022

@zone117x What's the best way to detect period-2 via API endpoints?
I've tried using the docker regtest env with tag stacks2.1-transition, but period 1 and 2 seem indistinguishable from each other.

e.g. Running docker run -p "20443:20443" -e "MINE_INTERVAL=30s" -e "STACKS_21_HEIGHT=110" -e "STACKS_POX2_HEIGHT=120" zone117x/stacks-api-e2e:stacks2.1-transition :
These are the /v2/pox outputs for block 108 (before 2.1) and 111 (after 2.1, but before pox-2)
differing lines are highlighted in blue/gray

@zone117x
Copy link
Member

zone117x commented Nov 1, 2022

@zone117x What's the best way to detect period-2 via API endpoints?

IIRC, during period 2, contract_id will be .pox-2, yet contract_versions[1].activation_burnchain_block_height will be less than current_burnchain_block_height.

@janniks
Copy link
Collaborator Author

janniks commented Nov 22, 2022

@zone117x ready for another review

  • Requested btc address test vectors were added
  • Missing aggregation.. methods were added

@janniks
Copy link
Collaborator Author

janniks commented Nov 22, 2022

Noticed there was still incorrect Period definitions in there. 3 was basically 2b, now I added all periods and more explicit tests. ✅

Copy link
Member

@zone117x zone117x left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @janniks!

@janniks janniks merged commit 6112f20 into stacks-2.1 Nov 23, 2022
@janniks janniks deleted the stacking-v2-stubs branch November 23, 2022 13:21
janniks added a commit that referenced this pull request Nov 23, 2022
BREAKING CHANGE:
Remove the getBTCAddress method, since it does not work with modern BTC addresses.
A StackingClient will now automatically detect which PoX version to use for Stacking.
Adds the following PoX Stacking methods to the StackingClient: `stackExtend`, `stackIncrease`, `delegateStackExtend`, `delegateStackIncrease`, `stackAggregationCommitIndexed`, `stackAggregationIncrease`.
Adds the following helper methods to the StackingClient: `getAccountExtendedBalances`, `getAccountBalanceLocked`, `getDelegationStatus`, `getRewardSet`.
janniks added a commit that referenced this pull request Nov 23, 2022
BREAKING CHANGE:
Remove the getBTCAddress method, since it does not work with modern BTC addresses.
A StackingClient will now automatically detect which PoX version to use for Stacking.
Adds the following PoX Stacking methods to the StackingClient: `stackExtend`, `stackIncrease`, `delegateStackExtend`, `delegateStackIncrease`, `stackAggregationCommitIndexed`, `stackAggregationIncrease`.
Adds the following helper methods to the StackingClient: `getAccountExtendedBalances`, `getAccountBalanceLocked`, `getDelegationStatus`, `getRewardSet`.
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.

[Stacks 2.1] Support Stacks 2.1 in @stacks/stacking (PoX-2)
3 participants