pox-4 signer key authorizations for amount of STX
#4424
Replies: 4 comments 2 replies
-
|
This plan makes sense to me! |
Beta Was this translation helpful? Give feedback.
-
|
Overall looks good. A few questions:
I think you mean,
Can we call it something besides
I think sniping is a real problem because it could be used to instigate a chain liveness failure for a relatively cheap cost. I think requiring that only What if the authorization imposed a minimum STX amount as well?
No, I don't think we want |
Beta Was this translation helpful? Give feedback.
-
|
Rethinking & rereading comments here I don't think we have consensus on whether it's critical to track the max-amount by a nominal amount vs. relative to the global amount. When discussed w/ @hstove & per the comments above it's clear that assigning/tracking a max amount per individual stacker is easier to implement; but I'm not entirely convinced that this way would attain the desired behavior? As a signer, would I care about a nominal amount of STX assigned to me? Or do I care more about the signing weight assigned to me? My understanding is that signers care more about the latter - especially if they'd like to stay under a weight threshold. I do see how per individual stacker basis does at least create ballpark that the signer can keep track of but it won't guarantee that in any given reward cycle they stay below an intended threshold (say if a signer wants to stay below 50% of the signing weight for that cycle). |
Beta Was this translation helpful? Give feedback.
-
|
As a signer, I am probably not too worried about the stacking weight the stackers bring because I have an off-chain agreement with them via the signature. As a pool operator, I can manage the total amount of stacked STX via aggregate commit and ensuring that the amount is below the agreed amount with the signer. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In discussions relating to #4417, it came up that we should add an authorization check to the amount of STX being stacked in addition to the other existing checks (period, reward cycle, method, and PoX address). That issue is being tracked in #4422
I'm outlining a potential approach here before we work on the code for these two issues.
Action 1: validate
amountbased on the amount of STX being stacked in each transactionBecause there is no way to easily validate the "new total" stacked during a particular transaction, we'll validate that the amount being stacked is less than or equal to a
max-amountproperty in the authorization.This
max-amountis compared against:amount-ustxinstack-stxincrease-byinstack-increasestacked-amountin thepartial-stackedtuple duringstack-aggregation-commitu0instack-extend"Infinite amount" authorizations can be done by using
u128::max.Action 2: add a
noncefield to the authorizationBecause this change makes it so that we are authorizing an amount of STX being stacked, we'll need to also add a
nonceto authorizations. To allow for out-of-order transactions, thisnoncedoesn't need to be monotonically increasing, it just needs to be unique.This is needed because, without a nonce, a stacker can simply stacking transactions multiple times with less than the maximum allow STX, thus violating the intent of this new "max amount" authorization field.
When an authorization is used (either via signatures or a previously added authorization), a map entry is inserted based on the
(reward-cycle, period, topic, pox-addr, nonce, max-amount)tuple. If this entry already exists, the authorization fails.Summary of code changes
max-amountandnoncefield to the authorization tuple (both via signature message and via authorizations map)used-authorizationsmap to track already used(reward-cycle, period, topic, nonce, pox-addr, max-amount)authorizationsverify-signer-key-sig:amount,nonce, andmax-amountargumentsamount <= max-amountmax-amountin the authorization message hash and in thesigner-key-authorizationsmapset-signer-key-authorizationto include anonceandmax-amountfieldnonceandmax-amountargumentsamount, toverify-signer-key-sigstack-incas a valid topicstack-stxburn op, includenonceandmax-amountin the datastack-increasechangesIn relation to #4417, the changes needed would be:
signer-keyandsigner-sigargs (to solve for 4417)nonce,max-amountargs for 4422verify-signer-key-sigperiodas the number of cycles being updatedsigner-keybuffer inreward-cycle-pox-address-listwith this newsigner-keyargumentQuestions
senderprincipal to authorizations, which would be validated againsttx-sender.signer-keytostack-increase, should this update each map entry with the newly providedsigner-keyargument?signer-key -> total-stacked-for-this-key. Given that tradeoff, is this the right decision?Beta Was this translation helpful? Give feedback.
All reactions