-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Conversation
78ceea6
to
f400b2f
Compare
@@ -39,6 +39,9 @@ pub enum VoteError { | |||
|
|||
#[error("authorized voter has already been changed this epoch")] | |||
TooSoonToReauthorize, | |||
|
|||
#[error("cannot set same authorized voter as latest authorized voter")] | |||
ReauthorizedSameVoter, |
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.
Should this be an error or a noop?
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.
Neither, I got rid of the error and now the behavior locks in the authorized voter again for that future epoch, preventing a switch
programs/vote/src/vote_state.rs
Outdated
@@ -151,6 +157,14 @@ pub struct VoteState { | |||
pub votes: VecDeque<Lockout>, | |||
pub root_slot: Option<u64>, | |||
|
|||
/// the signer for vote transactions | |||
authorized_voter: BTreeMap<u64, Pubkey>, |
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.
This is sorted so doesn't break consistency but make sure it doesn't grow unbounded.
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.
It can only grow as large as the number of epochs that we're using for the leader_schedule_offset
+ 1, so by default should be at most 2
This is an ABI change that'll break compatibility with v0.23.x, so we'll need to figure out a migration plan. Let's chat more on Monday cc: @ryoqun |
9211718
to
546a37f
Compare
Codecov Report
@@ Coverage Diff @@
## master #8303 +/- ##
========================================
+ Coverage 80.2% 80.3% +<.1%
========================================
Files 253 254 +1
Lines 55975 56218 +243
========================================
+ Hits 44929 45164 +235
- Misses 11046 11054 +8 |
programs/vote/src/vote_state.rs
Outdated
F: Fn(Pubkey) -> Result<(), InstructionError>, | ||
{ | ||
let epoch_authorized_voter = self.get_and_update_authorized_voter(epoch).expect( | ||
"the clock epoch is monotonically increasinig, so authorized voter must be known", |
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 clock epoch is monotonically increasinig, so authorized voter must be known", | |
"the clock epoch is monotonically increasing, so authorized voter must be known", |
Carl, what problem is this actually solving? It doesn't seem to to fix anything. Just trying to assess whether we should even make this change at all given it breaks ABI |
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.
.
@mvines, it allows for the ability to check for the authorized voter at the beginning of an epoch, and then have the confidence that that authorized voter will not change for the duration of the epoch without having to constantly checking the status of vote accounts I need this to build an observer on gossip to count how much stake has been voting on a fork, which requires making sure the vote is coming from the authorized voter |
e0781fa
to
9c13604
Compare
Thanks, that helps. What Github issue are you working towards on this? I'd generally expect new features like this to reference an issue and not seemingly come out of the air :-/ |
@@ -133,15 +148,6 @@ pub struct VoteState { | |||
/// the node that votes in this account | |||
pub node_pubkey: Pubkey, | |||
|
|||
/// the signer for vote transactions |
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.
To preserve compatibility with 0.23.x, one option will be to create a VoteState023
struct that matches what's on 0.23.x. The master
Vote program will then need to support deserializing VoteState023
into VoteState
in its process instruction and elsewhere.
@mvines Updated with the relevant issue! |
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.
lgtm
Pull request has been modified.
cf015b7
to
3fb9002
Compare
cfca8ed
to
c75fb53
Compare
6db62a9
to
9f820a7
Compare
ea0ca05
to
2781420
Compare
2781420
to
d6e389e
Compare
d6e389e
to
ca8d041
Compare
automerge (cherry picked from commit 39282be)
Problem
Authorized voter can change at any point during an epoch, making it hard to detect without monitoring vote account.
Working towards: #8232
Summary of Changes
Fix the authorized voter ahead of time, similar to epoch stakes based on the
leader_schedule_epoch
Fixes #