From 32607e1e02f35047631c3e1435f618de318df98d Mon Sep 17 00:00:00 2001 From: Justin Starry Date: Fri, 24 Jan 2025 04:23:42 +0000 Subject: [PATCH 1/6] SIMD-0232: Custom Commission Collector Account --- proposals/0232-custom-commission-collector.md | 133 ++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 proposals/0232-custom-commission-collector.md diff --git a/proposals/0232-custom-commission-collector.md b/proposals/0232-custom-commission-collector.md new file mode 100644 index 000000000..9c81eeeb7 --- /dev/null +++ b/proposals/0232-custom-commission-collector.md @@ -0,0 +1,133 @@ +--- +simd: '0232' +title: Custom Commission Collector Account +authors: Justin Starry (Anza) +category: Standard +type: Core +status: Review +created: 2025-01-24 +feature: (fill in with feature tracking issues once accepted) +--- + +## Summary + +Allow validators to specify custom commission collector accounts where block +revenue and inflation rewards commissions will be deposited. + +## Motivation + +Validator commission collector accounts must currently be the same as their +identity hot wallet account. This means that program derived addresses are +unable to be used for block revenue collection adding friction to validators +wishing to distribute their revenue in custom ways. By allowing validators to +specify a separate custom commission collector account, they can use onchain +programs to customize how their block revenue is distributed. + +## Alternatives Considered + +NA + +## New Terminology + +- Block Revenue Commission Collector: The account used to collect commissioned +block revenue for validators. Previously collected by default into the validator +identity account. + +- Inflation Rewards Commission Collector: The account used to collect +commissioned inflation rewards for validators. Previously collected by default +into the vote account. + +## Detailed Design + +This proposal requires the adoption of SIMD-0180 and SIMD-0185. SIMD-0180 +adjusts the leader schedule algorithm to make it possible to designate a +specific vote account for a given leader slot. SIMD-0185 adds block revenue and +inflation rewards commission collector address fields to the vote account state. + +### Runtime + +#### Block Revenue Commission Collection + +When collecting block fee revenue after processing all transactions in a block, +the runtime must look up the validator's specified block revenue collector +address. After adoption of SIMD-0180 and SIMD-0185, a given block's fee +commission collector address can be looked up via the designated vote account +for the leader schedule slot that the block was produced in. Note that by +default, the commission rate for block fee revenue is 100% and support for other +rates will be added in SIMD-0249. + +In order to eliminate the overhead of tracking the latest commission collector +address of each vote account, the commission collector address should be fetched +from the state of the vote account at the beginning of the previous epoch. This +is the same vote account state used to build the leader schedule for the current +epoch. + +Note that the fee collector constraints defined in SIMD-0085 still hold. The +designated commission collector must be a system program owned account that is +rent-exempt after receiving collected block fee rewards. Additionally, the +designated commission collector must not be a reserved account (note that +currently the only system program owned reserved accounts are the native loader +and the sysvar owner id). If any of these constraints are violated, the fees +collected for that block will be burned. + +#### Inflation Rewards Commission Collection + +The inflation rewards collector address should be fetched from the state +of the vote account at the beginning of the previous epoch. This is the same +vote account state used to build the leader schedule for the current epoch. + +The designated commission collector must either be a system or vote program +owned account that is rent-exempt after receiving collected block fee rewards. +Additionally, the designated commission collector must not be a reserved account +(note that currently the only system program owned reserved accounts are the +native loader and the sysvar owner id). If any of these constraints are +violated, the inflation rewards commission collected for that epoch will be +burned. + +### Vote Program + +```rust +pub enum VoteInstruction { + // .. + UpdateCommissionCollector { // 16u32 + pubkey: Pubkey, + kind: CommissionKind, + }, +} + +#[repr(u8)] +pub enum CommissionKind { + InflationRewards = 0, + BlockRevenue = 1, +} +``` + +#### `UpdateCommissionCollector` + +A new instruction for setting collector accounts will be added to the vote +program with the enum discriminant value of `16u32` little endian encoded in the +first 4 bytes. + +## Impact + +Validator identity and fee collector accounts no longer need to be the same +account. This opens up the ability to use PDA accounts for block revenue +collection. + +Inflation reward commissions no longer need to be collected into a validator's +vote account. This validators more flexibility over managing inflation reward +income. + +## Security Considerations + +NA + +## Drawbacks *(Optional)* + +NA + +## Backwards Compatibility *(Optional)* + +This change will require the use of a new feature gate which will enable +collecting block fees and inflation rewards into custom commission collector +addresses if specified by a validator. From 6e131ed8bf10ae79c64b1f8270da3ea0f14b961b Mon Sep 17 00:00:00 2001 From: Justin Starry Date: Wed, 14 May 2025 09:41:36 +0000 Subject: [PATCH 2/6] expand vote instruction details --- proposals/0232-custom-commission-collector.md | 62 ++++++++++++++----- 1 file changed, 46 insertions(+), 16 deletions(-) diff --git a/proposals/0232-custom-commission-collector.md b/proposals/0232-custom-commission-collector.md index 9c81eeeb7..29d6d8121 100644 --- a/proposals/0232-custom-commission-collector.md +++ b/proposals/0232-custom-commission-collector.md @@ -62,13 +62,16 @@ from the state of the vote account at the beginning of the previous epoch. This is the same vote account state used to build the leader schedule for the current epoch. -Note that the fee collector constraints defined in SIMD-0085 still hold. The -designated commission collector must be a system program owned account that is -rent-exempt after receiving collected block fee rewards. Additionally, the -designated commission collector must not be a reserved account (note that -currently the only system program owned reserved accounts are the native loader -and the sysvar owner id). If any of these constraints are violated, the fees -collected for that block will be burned. +The designated commission collector must either be equal to the vote account's +address OR satisfy the following constraints: + +1. Must be a system program owned account +2. Must be rent-exempt after receiving collected block fee rewards +3. Must not be a reserved account (note that currently the only system program +owned reserved accounts are the native loader and the sysvar owner id). + +If any of these constraints are violated, the fees collected for that block will +be burned. #### Inflation Rewards Commission Collection @@ -76,21 +79,26 @@ The inflation rewards collector address should be fetched from the state of the vote account at the beginning of the previous epoch. This is the same vote account state used to build the leader schedule for the current epoch. -The designated commission collector must either be a system or vote program -owned account that is rent-exempt after receiving collected block fee rewards. -Additionally, the designated commission collector must not be a reserved account -(note that currently the only system program owned reserved accounts are the -native loader and the sysvar owner id). If any of these constraints are -violated, the inflation rewards commission collected for that epoch will be -burned. +The designated commission collector must either be equal to the vote account's +address OR satisfy the following constraints: + +1. Must be a system program owned account +2. Must be rent-exempt after receiving collected block fee rewards +3. Must not be a reserved account (note that currently the only system program +owned reserved accounts are the native loader and the sysvar owner id). + +If any of these constraints are violated, the inflation rewards commission +collected for that epoch will be burned. ### Vote Program ```rust pub enum VoteInstruction { - // .. + /// # Account references + /// 0. `[WRITE]` Vote account to be updated with the new collector public key + /// 1. `[WRITE]` New collector account + /// 2. `[SIGNER]` Withdraw authority UpdateCommissionCollector { // 16u32 - pubkey: Pubkey, kind: CommissionKind, }, } @@ -108,6 +116,28 @@ A new instruction for setting collector accounts will be added to the vote program with the enum discriminant value of `16u32` little endian encoded in the first 4 bytes. +Perform the following checks: + +- If the number of account inputs is less than 2, return +`InstructionError::NotEnoughAccountKeys` +- If the vote account (index `0`) fails to deserialize, return +`InstructionError::InvalidAccountData` +- If the vote account's authorized withdrawer is not an account input for the +instruction or is not a signer, return +`InstructionError::MissingRequiredSignature` +- If the new collector account (index `1`) is not the same as the vote account +and not system program owned, return `InstructionError::InvalidAccountOwner` +- If the new collector account is not rent-exempt, return +`InstructionError::InsufficientFunds` +- If the new collector account is not writable, return +`InstructionError::InvalidArgument`. Note that this check is performed to ensure +that the new collector account is not a reserved account. + +Update the corresponding field for the specified commission kind: + +- `CommissionKind::InflationRewards`: update the `inflation_rewards_collector` field +- `CommissionKind::BlockRevenue`: update the `block_revenue_collector` field + ## Impact Validator identity and fee collector accounts no longer need to be the same From ebc881e4ecd333d1ec69ae5e416dbbb6082b0b0e Mon Sep 17 00:00:00 2001 From: Justin Starry Date: Thu, 22 May 2025 21:22:59 +0000 Subject: [PATCH 3/6] add note about incinerator --- proposals/0232-custom-commission-collector.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/proposals/0232-custom-commission-collector.md b/proposals/0232-custom-commission-collector.md index 29d6d8121..7991ac647 100644 --- a/proposals/0232-custom-commission-collector.md +++ b/proposals/0232-custom-commission-collector.md @@ -73,6 +73,10 @@ owned reserved accounts are the native loader and the sysvar owner id). If any of these constraints are violated, the fees collected for that block will be burned. +Note that it's technically allowed to set the collector account to the +incinerator address. Incinerator funds are burned after block revenue collection +at the end of the block. + #### Inflation Rewards Commission Collection The inflation rewards collector address should be fetched from the state @@ -83,13 +87,16 @@ The designated commission collector must either be equal to the vote account's address OR satisfy the following constraints: 1. Must be a system program owned account -2. Must be rent-exempt after receiving collected block fee rewards +2. Must be rent-exempt after depositing inflation rewards commission 3. Must not be a reserved account (note that currently the only system program owned reserved accounts are the native loader and the sysvar owner id). If any of these constraints are violated, the inflation rewards commission collected for that epoch will be burned. +Note that it's technically allowed to set the collector account to the +incinerator address. Incinerator funds are burned at the end of the block. + ### Vote Program ```rust From 6baf29e1326e0b5eb7925e51469f060a2995cafe Mon Sep 17 00:00:00 2001 From: Justin Starry Date: Thu, 22 May 2025 21:24:47 +0000 Subject: [PATCH 4/6] feedback --- proposals/0232-custom-commission-collector.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/proposals/0232-custom-commission-collector.md b/proposals/0232-custom-commission-collector.md index 7991ac647..8405c8727 100644 --- a/proposals/0232-custom-commission-collector.md +++ b/proposals/0232-custom-commission-collector.md @@ -63,10 +63,10 @@ is the same vote account state used to build the leader schedule for the current epoch. The designated commission collector must either be equal to the vote account's -address OR satisfy the following constraints: +address OR satisfy ALL of the following constraints: 1. Must be a system program owned account -2. Must be rent-exempt after receiving collected block fee rewards +2. Must be rent-exempt after depositing block revenue commission 3. Must not be a reserved account (note that currently the only system program owned reserved accounts are the native loader and the sysvar owner id). @@ -84,7 +84,7 @@ of the vote account at the beginning of the previous epoch. This is the same vote account state used to build the leader schedule for the current epoch. The designated commission collector must either be equal to the vote account's -address OR satisfy the following constraints: +address OR satisfy ALL of the following constraints: 1. Must be a system program owned account 2. Must be rent-exempt after depositing inflation rewards commission From 1311713d378d04f993b8dd9470476a199704d919 Mon Sep 17 00:00:00 2001 From: Justin Starry Date: Fri, 23 May 2025 20:57:46 +0000 Subject: [PATCH 5/6] dependencies section --- proposals/0232-custom-commission-collector.md | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/proposals/0232-custom-commission-collector.md b/proposals/0232-custom-commission-collector.md index 8405c8727..13a221c16 100644 --- a/proposals/0232-custom-commission-collector.md +++ b/proposals/0232-custom-commission-collector.md @@ -23,6 +23,22 @@ wishing to distribute their revenue in custom ways. By allowing validators to specify a separate custom commission collector account, they can use onchain programs to customize how their block revenue is distributed. +## Dependencies + +This proposal depends on the following previously accepted proposals: + +- **[SIMD-0180]: Use Vote Account Address To Key Leader Schedule** + + Necessary for designating a specific vote account for a given leader slot + +- **[SIMD-0185]: Vote Account v4** + + Adds necessary block revenue and inflation rewards commission collector + address fields to the vote account state + +[SIMD-0180]: https://github.com/solana-foundation/solana-improvement-documents/pull/180 +[SIMD-0185]: https://github.com/solana-foundation/solana-improvement-documents/pull/185 + ## Alternatives Considered NA @@ -39,11 +55,6 @@ into the vote account. ## Detailed Design -This proposal requires the adoption of SIMD-0180 and SIMD-0185. SIMD-0180 -adjusts the leader schedule algorithm to make it possible to designate a -specific vote account for a given leader slot. SIMD-0185 adds block revenue and -inflation rewards commission collector address fields to the vote account state. - ### Runtime #### Block Revenue Commission Collection @@ -95,7 +106,8 @@ If any of these constraints are violated, the inflation rewards commission collected for that epoch will be burned. Note that it's technically allowed to set the collector account to the -incinerator address. Incinerator funds are burned at the end of the block. +incinerator address. Incinerator funds are burned at the end of the rewards +distribution block. ### Vote Program From b150a983e0f9ab0bd3711f187b4d402e5f5f3cbe Mon Sep 17 00:00:00 2001 From: Justin Starry Date: Thu, 29 May 2025 21:52:54 +0000 Subject: [PATCH 6/6] update inflation rewards commission collection --- proposals/0232-custom-commission-collector.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/proposals/0232-custom-commission-collector.md b/proposals/0232-custom-commission-collector.md index 13a221c16..cfde51187 100644 --- a/proposals/0232-custom-commission-collector.md +++ b/proposals/0232-custom-commission-collector.md @@ -61,11 +61,11 @@ into the vote account. When collecting block fee revenue after processing all transactions in a block, the runtime must look up the validator's specified block revenue collector -address. After adoption of SIMD-0180 and SIMD-0185, a given block's fee +address. After adoption of [SIMD-0180] and [SIMD-0185], a given block's fee commission collector address can be looked up via the designated vote account for the leader schedule slot that the block was produced in. Note that by default, the commission rate for block fee revenue is 100% and support for other -rates will be added in SIMD-0249. +rates will be added in [SIMD-0123]. In order to eliminate the overhead of tracking the latest commission collector address of each vote account, the commission collector address should be fetched @@ -88,11 +88,19 @@ Note that it's technically allowed to set the collector account to the incinerator address. Incinerator funds are burned after block revenue collection at the end of the block. +[SIMD-0123]: https://github.com/solana-foundation/solana-improvement-documents/pull/123 + #### Inflation Rewards Commission Collection -The inflation rewards collector address should be fetched from the state -of the vote account at the beginning of the previous epoch. This is the same -vote account state used to build the leader schedule for the current epoch. +For a given epoch `E`, the earned inflation rewards for each vote account are +calculated at the beginning of the next epoch `E + 1`. This proposal doesn't +change the commission calculation but it does define new rules for how the +calculated commission rewards are collected into an account. Rather than +collecting the inflation rewards commission into the vote accounts by default, +the protocol must fetch the inflation rewards commission collector address from +the vote account state at the beginning of epoch `E + 1`. This is the same +vote account state used to get the commission rate and latest vote credits +for inflation rewards calculation. The designated commission collector must either be equal to the vote account's address OR satisfy ALL of the following constraints: