Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pkg/features/gates.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ var PoseidonEnforcePadding = FeatureGate{Name: "PoseidonEnforcePadding", Address
var FixAltBn128PairingLengthCheck = FeatureGate{Name: "FixAltBn128PairingLengthCheck", Address: base58.MustDecodeFromString("bnYzodLwmybj7e1HAe98yZrdJTd7we69eMMLgCXqKZm")}
var DeprecateRentExemptionThreshold = FeatureGate{Name: "DeprecateRentExemptionThreshold", Address: base58.MustDecodeFromString("rent6iVy6PDoViPBeJ6k5EJQrkj62h7DPyLbWGHwjrC")}
var ProvideInstructionDataOffsetInVmR2 = FeatureGate{Name: "ProvideInstructionDataOffsetInVmR2", Address: base58.MustDecodeFromString("5xXZc66h4UdB6Yq7FzdBxBiRAFMMScMLwHxk2QZDaNZL")}
var VoteStateV4 = FeatureGate{Name: "VoteStateV4", Address: base58.MustDecodeFromString("Gx4XFcrVMt4HUvPzTpTSVkdDVgcDSjKhDN1RqRS6KDuZ")}

var AllFeatureGates = []FeatureGate{StopTruncatingStringsInSyscalls, EnablePartitionedEpochReward, EnablePartitionedEpochRewardsSuperfeature,
LastRestartSlotSysvar, Libsecp256k1FailOnBadCount, Libsecp256k1FailOnBadCount2, EnableBpfLoaderSetAuthorityCheckedIx,
Expand All @@ -81,4 +82,5 @@ var AllFeatureGates = []FeatureGate{StopTruncatingStringsInSyscalls, EnableParti
AccountsLtHash, RemoveAccountsDeltaHash, EnableLoaderV4, EnableSbpfV1DeploymentAndExecution, EnableSbpfV2DeploymentAndExecution,
EnableSbpfV3DeploymentAndExecution, DisableSbpfV0Execution, ReenableSbpfV0Execution, FormalizeLoadedTransactionDataSize, IncreaseCpiAccountInfoLimit,
StaticInstructionLimit, PoseidonEnforcePadding, FixAltBn128PairingLengthCheck, DeprecateRentExemptionThreshold,
ProvideInstructionDataOffsetInVmR2}
ProvideInstructionDataOffsetInVmR2,
VoteStateV4}
3 changes: 3 additions & 0 deletions pkg/replay/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ func recordVoteTimestampAndSlot(slotCtx *sealevel.SlotCtx, acct *accounts.Accoun

case sealevel.VoteStateVersionV1_14_11:
timestamp = voteStateVersioned.V1_14_11.LastTimestamp

case sealevel.VoteStateVersionV4:
timestamp = voteStateVersioned.V4.LastTimestamp
}

slotCtx.VoteTimestampMu.Lock()
Expand Down
4 changes: 4 additions & 0 deletions pkg/rewards/rewards.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,8 @@ func voteCommissionSplit(voteState *sealevel.VoteStateVersions, rewards uint64)
commission = voteState.V0_23_5.Commission
case sealevel.VoteStateVersionV1_14_11:
commission = voteState.V1_14_11.Commission
case sealevel.VoteStateVersionV4:
commission = byte(voteState.V4.InflationRewardsCommissionBps / 100)
}

commissionRate := uint64(min(commission, 100))
Expand Down Expand Up @@ -429,6 +431,8 @@ func calculateStakePointsAndCredits(
epochCredits = voteState.V0_23_5.EpochCredits
case sealevel.VoteStateVersionV1_14_11:
epochCredits = voteState.V1_14_11.EpochCredits
case sealevel.VoteStateVersionV4:
epochCredits = voteState.V4.EpochCredits
default:
panic("invalid vote state - should be impossible")
}
Expand Down
15 changes: 9 additions & 6 deletions pkg/sealevel/vote_program.go
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,7 @@ func VoteProgramAuthorize(execCtx *ExecutionCtx, voteAcct *BorrowedAccount, auth
} else {
return verifySigner(epochAuthorizedVoter, signers)
}
})
}, f)
if err != nil {
return err
}
Expand Down Expand Up @@ -1246,12 +1246,15 @@ func VoteProgramUpdateCommission(execCtx *ExecutionCtx, voteAcct *BorrowedAccoun
}

voteState.Commission = commission
if voteState.wasV4 {
voteState.v4InflationRewardsCommBps = uint16(commission) * 100
}
err = setVoteAccountState(execCtx, voteAcct, voteState, f)

return err
}

func verifyAndGetVoteState(voteAcct *BorrowedAccount, clock SysvarClock, signers []solana.PublicKey) (*VoteState, error) {
func verifyAndGetVoteState(voteAcct *BorrowedAccount, clock SysvarClock, signers []solana.PublicKey, f features.Features) (*VoteState, error) {
versioned, err := UnmarshalVersionedVoteState(voteAcct.Data())
if err != nil {
return nil, err
Expand All @@ -1262,7 +1265,7 @@ func verifyAndGetVoteState(voteAcct *BorrowedAccount, clock SysvarClock, signers
}

voteState := versioned.ConvertToCurrent()
authVoter, err := voteState.GetAndUpdateAuthorizedVoter(clock.Epoch)
authVoter, err := voteState.GetAndUpdateAuthorizedVoter(clock.Epoch, f)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -1378,7 +1381,7 @@ func processVote(voteState *VoteState, vote *VoteInstrVote, slotHashes SysvarSlo
func VoteProgramProcessVote(execCtx *ExecutionCtx, voteAcct *BorrowedAccount, slotHashes SysvarSlotHashes, clock SysvarClock, vote *VoteInstrVote, signers []solana.PublicKey, f features.Features) error {
//mlog.Log.Debugf("Vote / VoteSwitch")

voteState, err := verifyAndGetVoteState(voteAcct, clock, signers)
voteState, err := verifyAndGetVoteState(voteAcct, clock, signers, f)
if err != nil {
return err
}
Expand Down Expand Up @@ -1769,7 +1772,7 @@ func processNewVoteState(voteState *VoteState, newState *deque.Deque[LandedVote]
func VoteProgramProcessVoteStateUpdate(execCtx *ExecutionCtx, voteAcct *BorrowedAccount, slotHashes SysvarSlotHashes, clock SysvarClock, voteStateUpdate *VoteInstrUpdateVoteState, signers []solana.PublicKey, f features.Features) error {
//mlog.Log.Debugf("VoteStateUpdate")

voteState, err := verifyAndGetVoteState(voteAcct, clock, signers)
voteState, err := verifyAndGetVoteState(voteAcct, clock, signers, f)
if err != nil {
return err
}
Expand Down Expand Up @@ -1877,7 +1880,7 @@ var (
)

func VoteProgramProcessTowerSync(execCtx *ExecutionCtx, voteAcct *BorrowedAccount, slotHashes SysvarSlotHashes, clock SysvarClock, towerSync *VoteInstrTowerSync, signers []solana.PublicKey, f features.Features) error {
voteState, err := verifyAndGetVoteState(voteAcct, clock, signers)
voteState, err := verifyAndGetVoteState(voteAcct, clock, signers, f)
if err != nil {
return err
}
Expand Down
Loading
Loading