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
14 changes: 9 additions & 5 deletions genesis/genesis_fuji.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,15 @@ var (
gas.DBWrite: 1,
gas.Compute: 1,
},
MaxCapacity: 1_000_000,
MaxPerSecond: 1_000,
TargetPerSecond: 500,
MinPrice: 1,
ExcessConversionConstant: 5_000,
MaxCapacity: 1_000_000, // Max block size ~1MB
MaxPerSecond: 250_000,
TargetPerSecond: 125_000, // Target block size ~125KB
MinPrice: 1,
// ExcessConversionConstant = (MaxPerSecond - TargetPerSecond) * NumberOfSecondsPerDoubling / ln(2)
//
// ln(2) is a float and the result is consensus critical, so we
// hardcode the result.
ExcessConversionConstant: 5_410_106, // Double every 30s
},
ValidatorFeeConfig: validatorfee.Config{
Capacity: 20_000,
Expand Down
14 changes: 9 additions & 5 deletions genesis/genesis_local.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,15 @@ var (
gas.DBWrite: 1,
gas.Compute: 1,
},
MaxCapacity: 1_000_000,
MaxPerSecond: 1_000,
TargetPerSecond: 500,
MinPrice: 1,
ExcessConversionConstant: 5_000,
MaxCapacity: 1_000_000, // Max block size ~1MB
MaxPerSecond: 250_000,
TargetPerSecond: 125_000, // Target block size ~125KB
MinPrice: 1,
// ExcessConversionConstant = (MaxPerSecond - TargetPerSecond) * NumberOfSecondsPerDoubling / ln(2)
//
// ln(2) is a float and the result is consensus critical, so we
// hardcode the result.
ExcessConversionConstant: 5_410_106, // Double every 30s
},
ValidatorFeeConfig: validatorfee.Config{
Capacity: 20_000,
Expand Down
14 changes: 9 additions & 5 deletions genesis/genesis_mainnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,15 @@ var (
gas.DBWrite: 1,
gas.Compute: 1,
},
MaxCapacity: 1_000_000,
MaxPerSecond: 1_000,
TargetPerSecond: 500,
MinPrice: 1,
ExcessConversionConstant: 5_000,
MaxCapacity: 1_000_000, // Max block size ~1MB
MaxPerSecond: 250_000,
TargetPerSecond: 125_000, // Target block size ~125KB
MinPrice: 1,
// ExcessConversionConstant = (MaxPerSecond - TargetPerSecond) * NumberOfSecondsPerDoubling / ln(2)
//
// ln(2) is a float and the result is consensus critical, so we
// hardcode the result.
ExcessConversionConstant: 5_410_106, // Double every 30s
},
ValidatorFeeConfig: validatorfee.Config{
Capacity: 20_000,
Expand Down
21 changes: 15 additions & 6 deletions vms/platformvm/block/executor/verifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,18 @@ func TestBlockExecutionWithComplexity(t *testing.T) {
blockGas, err := blockComplexity.ToGas(verifier.txExecutorBackend.Config.DynamicFeeConfig.Weights)
require.NoError(t, err)

const secondsToAdvance = 10

initialFeeState := gas.State{}
feeStateAfterTimeAdvanced := initialFeeState.AdvanceTime(
verifier.txExecutorBackend.Config.DynamicFeeConfig.MaxCapacity,
verifier.txExecutorBackend.Config.DynamicFeeConfig.MaxPerSecond,
verifier.txExecutorBackend.Config.DynamicFeeConfig.TargetPerSecond,
secondsToAdvance,
)
feeStateAfterGasConsumed, err := feeStateAfterTimeAdvanced.ConsumeGas(blockGas)
require.NoError(t, err)

tests := []struct {
name string
timestamp time.Time
Expand All @@ -1151,12 +1163,9 @@ func TestBlockExecutionWithComplexity(t *testing.T) {
expectedErr: gas.ErrInsufficientCapacity,
},
{
name: "updates fee state",
timestamp: genesistest.DefaultValidatorStartTime.Add(10 * time.Second),
expectedFeeState: gas.State{
Capacity: gas.Gas(0).AddPerSecond(verifier.txExecutorBackend.Config.DynamicFeeConfig.MaxPerSecond, 10) - blockGas,
Excess: blockGas,
},
name: "updates fee state",
timestamp: genesistest.DefaultValidatorStartTime.Add(secondsToAdvance * time.Second),
expectedFeeState: feeStateAfterGasConsumed,
},
}
for _, test := range tests {
Expand Down
Loading