Skip to content

Commit

Permalink
ACP-77: Include validator capacity into the fee config (#3464)
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenButtolph authored Oct 11, 2024
1 parent 724bd36 commit b9e2af2
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -793,8 +793,8 @@ func getTxFeeConfig(v *viper.Viper, networkID uint32) genesis.TxFeeConfig {
MinPrice: gas.Price(v.GetUint64(DynamicFeesMinGasPriceKey)),
ExcessConversionConstant: gas.Gas(v.GetUint64(DynamicFeesExcessConversionConstantKey)),
},
ValidatorFeeCapacity: gas.Gas(v.GetUint64(ValidatorFeesCapacityKey)),
ValidatorFeeConfig: validatorfee.Config{
Capacity: gas.Gas(v.GetUint64(ValidatorFeesCapacityKey)),
Target: gas.Gas(v.GetUint64(ValidatorFeesTargetKey)),
MinPrice: gas.Price(v.GetUint64(ValidatorFeesMinPriceKey)),
ExcessConversionConstant: gas.Gas(v.GetUint64(ValidatorFeesExcessConversionConstantKey)),
Expand Down
2 changes: 1 addition & 1 deletion config/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func addNodeFlags(fs *pflag.FlagSet) {

// AVAX fees:
// Validator fees:
fs.Uint64(ValidatorFeesCapacityKey, uint64(genesis.LocalParams.ValidatorFeeCapacity), "Maximum number of validators")
fs.Uint64(ValidatorFeesCapacityKey, uint64(genesis.LocalParams.ValidatorFeeConfig.Capacity), "Maximum number of validators")
fs.Uint64(ValidatorFeesTargetKey, uint64(genesis.LocalParams.ValidatorFeeConfig.Target), "Target number of validators")
fs.Uint64(ValidatorFeesMinPriceKey, uint64(genesis.LocalParams.ValidatorFeeConfig.MinPrice), "Minimum validator price in nAVAX per second")
fs.Uint64(ValidatorFeesExcessConversionConstantKey, uint64(genesis.LocalParams.ValidatorFeeConfig.ExcessConversionConstant), "Constant to convert validator excess price")
Expand Down
2 changes: 1 addition & 1 deletion genesis/genesis_fuji.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ var (
MinPrice: 1,
ExcessConversionConstant: 5_000,
},
ValidatorFeeCapacity: 20_000,
ValidatorFeeConfig: validatorfee.Config{
Capacity: 20_000,
Target: 10_000,
MinPrice: gas.Price(512 * units.NanoAvax),
// ExcessConversionConstant = (Capacity - Target) * NumberOfSecondsPerDoubling / ln(2)
Expand Down
2 changes: 1 addition & 1 deletion genesis/genesis_local.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ var (
MinPrice: 1,
ExcessConversionConstant: 5_000,
},
ValidatorFeeCapacity: 20_000,
ValidatorFeeConfig: validatorfee.Config{
Capacity: 20_000,
Target: 10_000,
MinPrice: gas.Price(1 * units.NanoAvax),
// ExcessConversionConstant = (Capacity - Target) * NumberOfSecondsPerDoubling / ln(2)
Expand Down
2 changes: 1 addition & 1 deletion genesis/genesis_mainnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ var (
MinPrice: 1,
ExcessConversionConstant: 5_000,
},
ValidatorFeeCapacity: 20_000,
ValidatorFeeConfig: validatorfee.Config{
Capacity: 20_000,
Target: 10_000,
MinPrice: gas.Price(512 * units.NanoAvax),
// ExcessConversionConstant = (Capacity - Target) * NumberOfSecondsPerDoubling / ln(2)
Expand Down
9 changes: 4 additions & 5 deletions genesis/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,10 @@ type StakingConfig struct {
}

type TxFeeConfig struct {
CreateAssetTxFee uint64 `json:"createAssetTxFee"`
StaticFeeConfig txfee.StaticConfig `json:"staticFeeConfig"`
DynamicFeeConfig gas.Config `json:"dynamicFeeConfig"`
ValidatorFeeCapacity gas.Gas `json:"validatorFeeCapacity"`
ValidatorFeeConfig validatorfee.Config `json:"validatorFeeConfig"`
CreateAssetTxFee uint64 `json:"createAssetTxFee"`
StaticFeeConfig txfee.StaticConfig `json:"staticFeeConfig"`
DynamicFeeConfig gas.Config `json:"dynamicFeeConfig"`
ValidatorFeeConfig validatorfee.Config `json:"validatorFeeConfig"`
}

type Params struct {
Expand Down
1 change: 0 additions & 1 deletion node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,6 @@ func (n *Node) initVMs() error {
CreateAssetTxFee: n.Config.CreateAssetTxFee,
StaticFeeConfig: n.Config.StaticFeeConfig,
DynamicFeeConfig: n.Config.DynamicFeeConfig,
ValidatorFeeCapacity: n.Config.ValidatorFeeCapacity,
ValidatorFeeConfig: n.Config.ValidatorFeeConfig,
UptimePercentage: n.Config.UptimeRequirement,
MinValidatorStake: n.Config.MinValidatorStake,
Expand Down
3 changes: 1 addition & 2 deletions vms/platformvm/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ type Config struct {
DynamicFeeConfig gas.Config

// ACP-77 validator fees are active after Etna
ValidatorFeeCapacity gas.Gas
ValidatorFeeConfig validatorfee.Config
ValidatorFeeConfig validatorfee.Config

// Provides access to the uptime manager as a thread safe data structure
UptimeLockedCalculator uptime.LockedCalculator
Expand Down
1 change: 1 addition & 0 deletions vms/platformvm/validators/fee/fee.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (

// Config contains all the static parameters of the dynamic fee mechanism.
type Config struct {
Capacity gas.Gas `json:"capacity"`
Target gas.Gas `json:"target"`
MinPrice gas.Price `json:"minPrice"`
ExcessConversionConstant gas.Gas `json:"excessConversionConstant"`
Expand Down

0 comments on commit b9e2af2

Please sign in to comment.