-
Notifications
You must be signed in to change notification settings - Fork 677
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
.signers StackerDB contract and PoX 4 signer key changes #4263
Conversation
With just a quick skim, I have some high-level feedback about the approach in this PR. This PR sets the signing-key via a separate list (actually data-map index) from the reward set list. But unless I'm misunderstanding how signing keys and the PoX reward set should operate, these should be the same list: any entry in the PoX reward set should have a signing-key and any signing-key should be associated with a reward-set entry. This also impacts the signing-set calculation method, because really this should be calculated via the same See the note here: |
Thanks @kantai I appreciate you giving the background and linking those files. For this PR the scope was to introduce As for the coupling of PoX reward slots and signer keys we have some open questions. (#4247 and others.) With the state of the PR it will be easy to move the signer keys elsewhere / handle them differently in the PoX contract. I'll update the OP to reflect the above. |
Should I rename |
stackslib/src/burnchains/mod.rs
Outdated
@@ -520,6 +520,17 @@ impl PoxConstants { | |||
(effective_height % u64::from(self.reward_cycle_length)) == 1 | |||
} | |||
|
|||
pub fn is_prepare_phase_start(&self, first_block_height: u64, burn_height: u64) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty sure this is off-by-one.
16da912
to
8f9670f
Compare
@kantai I rebased this onto your branch and filled in the missing pieces and finished the PoX changes. My basic unit test works. There is a bit of code repetition. Let me know if this is the direction you are thinking of and I can clean it up and add some more tests to get it merged. For now I'm also targeting your branch, if yours gets merged first then I will rebase off |
@@ -444,12 +450,13 @@ | |||
;; A PoX address can be added to at most 12 consecutive cycles. | |||
;; No checking is done. | |||
(define-private (add-pox-partial-stacked (pox-addr (tuple (version (buff 1)) (hashbytes (buff 32)))) | |||
(signer principal) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does the partial stacked state need to know about the signer?
Thinking about pooled stacking, it makes sense to provide the key only on aggregate contract calls. The voting slots are based on aggregate values as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah -- I agree with this. Partial stacking state shouldn't have the signer, the signer should be set on aggregate-commit. The stacking-state
map also should not have a signer-key
field.
So I'd recommend:
- Removing
signer-key
fromstacking-state
- Removing
signer
from thepartial-stacked-by-cycle
- Add
signer-key
argument to theaggregate-commit
method.
Otherwise, the changes in pox-4 look good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy. Wrote similar thoughts here #4247 just a few mins ago. Assigning to here / @MarvinJanssen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep we were going back and forth on it. Will change it soon. Thanks @friedger
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Edit: is having the signer key in stacking state not useful to have?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So is the plan to use (signer principal)
or (signer-key (buff 33))
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The arguments to stacking are (signer-key (buff 33))
, but the internal data maps store principal
. The stacks functions will need to compute the principal from the signer key.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah -- I agree with this. Partial stacking state shouldn't have the signer, the signer should be set on aggregate-commit. The
stacking-state
map also should not have asigner-key
field.So I'd recommend:
- Removing
signer-key
fromstacking-state
- Removing
signer
from thepartial-stacked-by-cycle
- Add
signer-key
argument to theaggregate-commit
method.Otherwise, the changes in pox-4 look good to me.
@kantai Are you going to make this happen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kantai @MarvinJanssen @hstove per @jferrant, we actually need to store the signing keys to the stacker map after all.
Okay, my last push contained a handful of things that I'd appreciate some feedback on (some of these need @jcnelson's eyes):
Once I've got an okay on the above, I'll wrap this PR up by applying the last pox-4 changes discussed above (i.e., removing the pub fn get_reward_set_nakamoto(
&self,
cycle_start_burn_height: u64,
chainstate: &mut StacksChainState,
burnchain: &Burnchain,
sortdb: &SortitionDB,
block_id: &StacksBlockId,
) -> Result<RewardSet, Error> {
// TODO: this method should read the .signers contract to get the reward set entries.
// they will have been set via `NakamotoChainState::check_and_handle_prepare_phase_start()`.
let cycle = burnchain
.block_height_to_reward_cycle(cycle_start_burn_height)
.expect("FATAL: no reward cycle for burn height"); Because implementing that will take a bit of time, and its not needed for unblocking the signer-miner block proposal work. So, I'd rather take care of it in a separate PR. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## feat/stacker-bitvec #4263 +/- ##
======================================================
Coverage ? 28.62%
======================================================
Files ? 434
Lines ? 307604
Branches ? 0
======================================================
Hits ? 88050
Misses ? 219554
Partials ? 0 ☔ View full report in Codecov by Sentry. |
…al, fix test to prepare for merge with #4269
…s, update end to end test
…pdate anchor block selection, fix miner issue
8056694
to
e9fd4a9
Compare
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description
Now rebased onto #4269.
Work in progress that adds:
(buff 33)
parameter where needed, converts and stores them asprincipal
..signers
StackerDB contract.make_reward_set()
to calculate the signer slots..signers
.As for the coupling of PoX reward slots and signer keys we have some open questions. (#4247 and others.)
This PR should unblock @friedger's work on the
.voting
boot contract.Applicable issues
Addresses:
Additional info (benefits, drawbacks, caveats)
Checklist
docs/rpc/openapi.yaml
andrpc-endpoints.md
for v2 endpoints,event-dispatcher.md
for new events)clarity-benchmarking
repobitcoin-tests.yml