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.
-
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
amount
based 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-amount
property in the authorization.This
max-amount
is compared against:amount-ustx
instack-stx
increase-by
instack-increase
stacked-amount
in thepartial-stacked
tuple duringstack-aggregation-commit
u0
instack-extend
"Infinite amount" authorizations can be done by using
u128::max
.Action 2: add a
nonce
field 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
nonce
to authorizations. To allow for out-of-order transactions, thisnonce
doesn'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-amount
andnonce
field to the authorization tuple (both via signature message and via authorizations map)used-authorizations
map to track already used(reward-cycle, period, topic, nonce, pox-addr, max-amount)
authorizationsverify-signer-key-sig
:amount
,nonce
, andmax-amount
argumentsamount <= max-amount
max-amount
in the authorization message hash and in thesigner-key-authorizations
mapset-signer-key-authorization
to include anonce
andmax-amount
fieldnonce
andmax-amount
argumentsamount
, toverify-signer-key-sig
stack-inc
as a valid topicstack-stx
burn op, includenonce
andmax-amount
in the datastack-increase
changesIn relation to #4417, the changes needed would be:
signer-key
andsigner-sig
args (to solve for 4417)nonce
,max-amount
args for 4422verify-signer-key-sig
period
as the number of cycles being updatedsigner-key
buffer inreward-cycle-pox-address-list
with this newsigner-key
argumentQuestions
sender
principal to authorizations, which would be validated againsttx-sender
.signer-key
tostack-increase
, should this update each map entry with the newly providedsigner-key
argument?signer-key -> total-stacked-for-this-key
. Given that tradeoff, is this the right decision?Beta Was this translation helpful? Give feedback.
All reactions