Skip to content

Commit acec94c

Browse files
samliokmeaghanfitzgeraldStephenButtolph
authored
Remove Static Fee Config (#3610)
Signed-off-by: Sam Liokumovich <[email protected]> Co-authored-by: Meaghan FitzGerald <[email protected]> Co-authored-by: Stephen Buttolph <[email protected]>
1 parent b3ec578 commit acec94c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+293
-1006
lines changed

RELEASES.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
# Release Notes
22

3+
## [v1.12.2](https://github.com/ava-labs/avalanchego/releases/tag/v1.12.2)
4+
5+
This version is backwards compatible to [v1.12.0](https://github.com/ava-labs/avalanchego/releases/tag/v1.12.0). It is optional, but encouraged.
6+
7+
The plugin version is unchanged at `38` and is compatible with versions `v1.12.0-v1.12.1`.
8+
9+
### Configs
10+
11+
- Removed static fee config flags
12+
- `--create-subnet-tx-fee`
13+
- `--transform-subnet-tx-fee`
14+
- `--create-blockchain-tx-fee`
15+
- `--add-primary-network-validator-fee`
16+
- `--add-primary-network-delegator-fee`
17+
- `--add-subnet-validator-fee`
18+
- `--add-subnet-delegator-fee`
19+
20+
### APIs
21+
22+
- Removed `info.GetTxFee`
23+
- Added `avm.GetTxFee`
24+
25+
### What's Changed
26+
27+
**Full Changelog**: https://github.com/ava-labs/avalanchego/compare/v1.12.1...v1.12.2
28+
329
## [v1.12.1](https://github.com/ava-labs/avalanchego/releases/tag/v1.12.1)
430

531
This version is backwards compatible to [v1.12.0](https://github.com/ava-labs/avalanchego/releases/tag/v1.12.0). It is optional, but encouraged.

api/info/client.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ type Client interface {
2727
GetBlockchainID(context.Context, string, ...rpc.Option) (ids.ID, error)
2828
Peers(context.Context, []ids.NodeID, ...rpc.Option) ([]Peer, error)
2929
IsBootstrapped(context.Context, string, ...rpc.Option) (bool, error)
30-
GetTxFee(context.Context, ...rpc.Option) (*GetTxFeeResponse, error)
3130
Upgrades(context.Context, ...rpc.Option) (*upgrade.Config, error)
3231
Uptime(context.Context, ...rpc.Option) (*UptimeResponse, error)
3332
GetVMs(context.Context, ...rpc.Option) (map[ids.ID][]string, error)
@@ -99,12 +98,6 @@ func (c *client) IsBootstrapped(ctx context.Context, chainID string, options ...
9998
return res.IsBootstrapped, err
10099
}
101100

102-
func (c *client) GetTxFee(ctx context.Context, options ...rpc.Option) (*GetTxFeeResponse, error) {
103-
res := &GetTxFeeResponse{}
104-
err := c.requester.SendRequest(ctx, "info.getTxFee", struct{}{}, res, options...)
105-
return res, err
106-
}
107-
108101
func (c *client) Upgrades(ctx context.Context, options ...rpc.Option) (*upgrade.Config, error) {
109102
res := &upgrade.Config{}
110103
err := c.requester.SendRequest(ctx, "info.upgrades", struct{}{}, res, options...)

api/info/service.go

Lines changed: 6 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"go.uber.org/zap"
1414

1515
"github.com/ava-labs/avalanchego/chains"
16-
"github.com/ava-labs/avalanchego/genesis"
1716
"github.com/ava-labs/avalanchego/ids"
1817
"github.com/ava-labs/avalanchego/network"
1918
"github.com/ava-labs/avalanchego/network/peer"
@@ -48,13 +47,12 @@ type Info struct {
4847
}
4948

5049
type Parameters struct {
51-
Version *version.Application
52-
NodeID ids.NodeID
53-
NodePOP *signer.ProofOfPossession
54-
NetworkID uint32
55-
TxFeeConfig genesis.TxFeeConfig
56-
VMManager vms.Manager
57-
Upgrades upgrade.Config
50+
Version *version.Application
51+
NodeID ids.NodeID
52+
NodePOP *signer.ProofOfPossession
53+
NetworkID uint32
54+
VMManager vms.Manager
55+
Upgrades upgrade.Config
5856
}
5957

6058
func NewService(
@@ -386,37 +384,6 @@ func (i *Info) Acps(_ *http.Request, _ *struct{}, reply *ACPsReply) error {
386384
return nil
387385
}
388386

389-
type GetTxFeeResponse struct {
390-
TxFee json.Uint64 `json:"txFee"`
391-
CreateAssetTxFee json.Uint64 `json:"createAssetTxFee"`
392-
CreateSubnetTxFee json.Uint64 `json:"createSubnetTxFee"`
393-
TransformSubnetTxFee json.Uint64 `json:"transformSubnetTxFee"`
394-
CreateBlockchainTxFee json.Uint64 `json:"createBlockchainTxFee"`
395-
AddPrimaryNetworkValidatorFee json.Uint64 `json:"addPrimaryNetworkValidatorFee"`
396-
AddPrimaryNetworkDelegatorFee json.Uint64 `json:"addPrimaryNetworkDelegatorFee"`
397-
AddSubnetValidatorFee json.Uint64 `json:"addSubnetValidatorFee"`
398-
AddSubnetDelegatorFee json.Uint64 `json:"addSubnetDelegatorFee"`
399-
}
400-
401-
// GetTxFee returns the transaction fee in nAVAX.
402-
func (i *Info) GetTxFee(_ *http.Request, _ *struct{}, reply *GetTxFeeResponse) error {
403-
i.log.Debug("API called",
404-
zap.String("service", "info"),
405-
zap.String("method", "getTxFee"),
406-
)
407-
408-
reply.TxFee = json.Uint64(i.TxFeeConfig.StaticFeeConfig.TxFee)
409-
reply.CreateAssetTxFee = json.Uint64(i.TxFeeConfig.CreateAssetTxFee)
410-
reply.CreateSubnetTxFee = json.Uint64(i.TxFeeConfig.StaticFeeConfig.CreateSubnetTxFee)
411-
reply.TransformSubnetTxFee = json.Uint64(i.TxFeeConfig.StaticFeeConfig.TransformSubnetTxFee)
412-
reply.CreateBlockchainTxFee = json.Uint64(i.TxFeeConfig.StaticFeeConfig.CreateBlockchainTxFee)
413-
reply.AddPrimaryNetworkValidatorFee = json.Uint64(i.TxFeeConfig.StaticFeeConfig.AddPrimaryNetworkValidatorFee)
414-
reply.AddPrimaryNetworkDelegatorFee = json.Uint64(i.TxFeeConfig.StaticFeeConfig.AddPrimaryNetworkDelegatorFee)
415-
reply.AddSubnetValidatorFee = json.Uint64(i.TxFeeConfig.StaticFeeConfig.AddSubnetValidatorFee)
416-
reply.AddSubnetDelegatorFee = json.Uint64(i.TxFeeConfig.StaticFeeConfig.AddSubnetDelegatorFee)
417-
return nil
418-
}
419-
420387
// GetVMsReply contains the response metadata for GetVMs
421388
type GetVMsReply struct {
422389
VMs map[ids.ID][]string `json:"vms"`

api/info/service.md

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -382,69 +382,6 @@ curl -X POST --data '{
382382
}
383383
```
384384

385-
### `info.getTxFee`
386-
387-
Get the fees of the network.
388-
389-
**Signature**:
390-
391-
```
392-
info.getTxFee() ->
393-
{
394-
txFee: uint64,
395-
createAssetTxFee: uint64,
396-
createSubnetTxFee: uint64,
397-
transformSubnetTxFee: uint64,
398-
createBlockchainTxFee: uint64,
399-
addPrimaryNetworkValidatorFee: uint64,
400-
addPrimaryNetworkDelegatorFee: uint64,
401-
addSubnetValidatorFee: uint64,
402-
addSubnetDelegatorFee: uint64
403-
}
404-
```
405-
406-
- `txFee` is the default fee for making transactions.
407-
- `createAssetTxFee` is the fee for creating a new asset.
408-
- `createSubnetTxFee` is the fee for creating a new Avalanche L1.
409-
- `transformSubnetTxFee` is the fee for converting a PoA Avalanche L1 into a PoS Avalanche L1.
410-
- `createBlockchainTxFee` is the fee for creating a new blockchain.
411-
- `addPrimaryNetworkValidatorFee` is the fee for adding a new primary network validator.
412-
- `addPrimaryNetworkDelegatorFee` is the fee for adding a new primary network delegator.
413-
- `addSubnetValidatorFee` is the fee for adding a new Avalanche L1 validator.
414-
- `addSubnetDelegatorFee` is the fee for adding a new Avalanche L1 delegator.
415-
416-
All fees are denominated in nAVAX.
417-
418-
**Example Call**:
419-
420-
```sh
421-
curl -X POST --data '{
422-
"jsonrpc":"2.0",
423-
"id" :1,
424-
"method" :"info.getTxFee"
425-
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info
426-
```
427-
428-
**Example Response**:
429-
430-
```json
431-
{
432-
"jsonrpc": "2.0",
433-
"id": 1,
434-
"result": {
435-
"txFee": "1000000",
436-
"createAssetTxFee": "10000000",
437-
"createSubnetTxFee": "1000000000",
438-
"transformSubnetTxFee": "10000000000",
439-
"createBlockchainTxFee": "1000000000",
440-
"addPrimaryNetworkValidatorFee": "0",
441-
"addPrimaryNetworkDelegatorFee": "0",
442-
"addSubnetValidatorFee": "1000000",
443-
"addSubnetDelegatorFee": "1000000"
444-
}
445-
}
446-
```
447-
448385
### `info.getVMs`
449386

450387
Get the virtual machines installed on this node.

config/config.go

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,8 @@ import (
4747
"github.com/ava-labs/avalanchego/version"
4848
"github.com/ava-labs/avalanchego/vms/components/gas"
4949
"github.com/ava-labs/avalanchego/vms/platformvm/reward"
50+
"github.com/ava-labs/avalanchego/vms/platformvm/validators/fee"
5051
"github.com/ava-labs/avalanchego/vms/proposervm"
51-
52-
txfee "github.com/ava-labs/avalanchego/vms/platformvm/txs/fee"
53-
validatorfee "github.com/ava-labs/avalanchego/vms/platformvm/validators/fee"
5452
)
5553

5654
const (
@@ -770,16 +768,7 @@ func getTxFeeConfig(v *viper.Viper, networkID uint32) genesis.TxFeeConfig {
770768
if networkID != constants.MainnetID && networkID != constants.FujiID {
771769
return genesis.TxFeeConfig{
772770
CreateAssetTxFee: v.GetUint64(CreateAssetTxFeeKey),
773-
StaticFeeConfig: txfee.StaticConfig{
774-
TxFee: v.GetUint64(TxFeeKey),
775-
CreateSubnetTxFee: v.GetUint64(CreateSubnetTxFeeKey),
776-
TransformSubnetTxFee: v.GetUint64(TransformSubnetTxFeeKey),
777-
CreateBlockchainTxFee: v.GetUint64(CreateBlockchainTxFeeKey),
778-
AddPrimaryNetworkValidatorFee: v.GetUint64(AddPrimaryNetworkValidatorFeeKey),
779-
AddPrimaryNetworkDelegatorFee: v.GetUint64(AddPrimaryNetworkDelegatorFeeKey),
780-
AddSubnetValidatorFee: v.GetUint64(AddSubnetValidatorFeeKey),
781-
AddSubnetDelegatorFee: v.GetUint64(AddSubnetDelegatorFeeKey),
782-
},
771+
TxFee: v.GetUint64(TxFeeKey),
783772
DynamicFeeConfig: gas.Config{
784773
Weights: gas.Dimensions{
785774
gas.Bandwidth: v.GetUint64(DynamicFeesBandwidthWeightKey),
@@ -793,7 +782,7 @@ func getTxFeeConfig(v *viper.Viper, networkID uint32) genesis.TxFeeConfig {
793782
MinPrice: gas.Price(v.GetUint64(DynamicFeesMinGasPriceKey)),
794783
ExcessConversionConstant: gas.Gas(v.GetUint64(DynamicFeesExcessConversionConstantKey)),
795784
},
796-
ValidatorFeeConfig: validatorfee.Config{
785+
ValidatorFeeConfig: fee.Config{
797786
Capacity: gas.Gas(v.GetUint64(ValidatorFeesCapacityKey)),
798787
Target: gas.Gas(v.GetUint64(ValidatorFeesTargetKey)),
799788
MinPrice: gas.Price(v.GetUint64(ValidatorFeesMinPriceKey)),

config/config.md

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -827,43 +827,6 @@ Transaction fee, in nAVAX, for transactions that create new assets. Defaults to
827827
`10000000` nAVAX (.01 AVAX) per transaction. This can only be changed on a local
828828
network.
829829

830-
#### `--create-subnet-tx-fee` (int)
831-
832-
Transaction fee, in nAVAX, for transactions that create new Subnets. Defaults to
833-
`1000000000` nAVAX (1 AVAX) per transaction. This can only be changed on a local
834-
network.
835-
836-
#### `--create-blockchain-tx-fee` (int)
837-
838-
Transaction fee, in nAVAX, for transactions that create new blockchains.
839-
Defaults to `1000000000` nAVAX (1 AVAX) per transaction. This can only be
840-
changed on a local network.
841-
842-
#### `--transform-subnet-tx-fee` (int)
843-
844-
Transaction fee, in nAVAX, for transactions that transform Subnets. Defaults to
845-
`1000000000` nAVAX (1 AVAX) per transaction. This can only be changed on a local network.
846-
847-
#### `--add-primary-network-validator-fee` (int)
848-
849-
Transaction fee, in nAVAX, for transactions that add new primary network validators. Defaults to 0.
850-
This can only be changed on a local network.
851-
852-
#### `--add-primary-network-delegator-fee` (int)
853-
854-
Transaction fee, in nAVAX, for transactions that add new primary network delegators. Defaults to 0.
855-
This can only be changed on a local network.
856-
857-
#### `--add-subnet-validator-fee` (int)
858-
859-
Transaction fee, in nAVAX, for transactions that add new Subnet validators.
860-
Defaults to `10000000` nAVAX (.01 AVAX).
861-
862-
#### `--add-subnet-delegator-fee` (int)
863-
864-
Transaction fee, in nAVAX, for transactions that add new Subnet delegators.
865-
Defaults to `10000000` nAVAX (.01 AVAX).
866-
867830
#### `--min-delegator-stake` (int)
868831

869832
The minimum stake, in nAVAX, that can be delegated to a validator of the Primary Network.

config/flags.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,8 @@ func addNodeFlags(fs *pflag.FlagSet) {
122122
fs.Uint64(DynamicFeesMinGasPriceKey, uint64(genesis.LocalParams.DynamicFeeConfig.MinPrice), "Minimum Gas price")
123123
fs.Uint64(DynamicFeesExcessConversionConstantKey, uint64(genesis.LocalParams.DynamicFeeConfig.ExcessConversionConstant), "Constant to convert excess Gas to the Gas price")
124124
// Static fees:
125-
fs.Uint64(TxFeeKey, genesis.LocalParams.StaticFeeConfig.TxFee, "Transaction fee, in nAVAX")
125+
fs.Uint64(TxFeeKey, genesis.LocalParams.TxFee, "Transaction fee, in nAVAX")
126126
fs.Uint64(CreateAssetTxFeeKey, genesis.LocalParams.CreateAssetTxFee, "Transaction fee, in nAVAX, for transactions that create new assets")
127-
fs.Uint64(CreateSubnetTxFeeKey, genesis.LocalParams.StaticFeeConfig.CreateSubnetTxFee, "Transaction fee, in nAVAX, for transactions that create new subnets")
128-
fs.Uint64(TransformSubnetTxFeeKey, genesis.LocalParams.StaticFeeConfig.TransformSubnetTxFee, "Transaction fee, in nAVAX, for transactions that transform subnets")
129-
fs.Uint64(CreateBlockchainTxFeeKey, genesis.LocalParams.StaticFeeConfig.CreateBlockchainTxFee, "Transaction fee, in nAVAX, for transactions that create new blockchains")
130-
fs.Uint64(AddPrimaryNetworkValidatorFeeKey, genesis.LocalParams.StaticFeeConfig.AddPrimaryNetworkValidatorFee, "Transaction fee, in nAVAX, for transactions that add new primary network validators")
131-
fs.Uint64(AddPrimaryNetworkDelegatorFeeKey, genesis.LocalParams.StaticFeeConfig.AddPrimaryNetworkDelegatorFee, "Transaction fee, in nAVAX, for transactions that add new primary network delegators")
132-
fs.Uint64(AddSubnetValidatorFeeKey, genesis.LocalParams.StaticFeeConfig.AddSubnetValidatorFee, "Transaction fee, in nAVAX, for transactions that add new subnet validators")
133-
fs.Uint64(AddSubnetDelegatorFeeKey, genesis.LocalParams.StaticFeeConfig.AddSubnetDelegatorFee, "Transaction fee, in nAVAX, for transactions that add new subnet delegators")
134-
135127
// Database
136128
fs.String(DBTypeKey, leveldb.Name, fmt.Sprintf("Database type to use. Must be one of {%s, %s, %s}", leveldb.Name, memdb.Name, pebbledb.Name))
137129
fs.Bool(DBReadOnlyKey, false, "If true, database writes are to memory and never persisted. May still initialize database directory/files on disk if they don't exist")

config/keys.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,6 @@ const (
3636
ValidatorFeesExcessConversionConstantKey = "validator-fees-excess-conversion-constant"
3737
TxFeeKey = "tx-fee"
3838
CreateAssetTxFeeKey = "create-asset-tx-fee"
39-
CreateSubnetTxFeeKey = "create-subnet-tx-fee"
40-
TransformSubnetTxFeeKey = "transform-subnet-tx-fee"
41-
CreateBlockchainTxFeeKey = "create-blockchain-tx-fee"
42-
AddPrimaryNetworkValidatorFeeKey = "add-primary-network-validator-fee"
43-
AddPrimaryNetworkDelegatorFeeKey = "add-primary-network-delegator-fee"
44-
AddSubnetValidatorFeeKey = "add-subnet-validator-fee"
45-
AddSubnetDelegatorFeeKey = "add-subnet-delegator-fee"
4639
UptimeRequirementKey = "uptime-requirement"
4740
MinValidatorStakeKey = "min-validator-stake"
4841
MaxValidatorStakeKey = "max-validator-stake"

genesis/genesis_fuji.go

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ import (
1111
"github.com/ava-labs/avalanchego/utils/units"
1212
"github.com/ava-labs/avalanchego/vms/components/gas"
1313
"github.com/ava-labs/avalanchego/vms/platformvm/reward"
14-
15-
txfee "github.com/ava-labs/avalanchego/vms/platformvm/txs/fee"
16-
validatorfee "github.com/ava-labs/avalanchego/vms/platformvm/validators/fee"
14+
"github.com/ava-labs/avalanchego/vms/platformvm/validators/fee"
1715
)
1816

1917
var (
@@ -24,16 +22,7 @@ var (
2422
FujiParams = Params{
2523
TxFeeConfig: TxFeeConfig{
2624
CreateAssetTxFee: 10 * units.MilliAvax,
27-
StaticFeeConfig: txfee.StaticConfig{
28-
TxFee: units.MilliAvax,
29-
CreateSubnetTxFee: 100 * units.MilliAvax,
30-
TransformSubnetTxFee: 1 * units.Avax,
31-
CreateBlockchainTxFee: 100 * units.MilliAvax,
32-
AddPrimaryNetworkValidatorFee: 0,
33-
AddPrimaryNetworkDelegatorFee: 0,
34-
AddSubnetValidatorFee: units.MilliAvax,
35-
AddSubnetDelegatorFee: units.MilliAvax,
36-
},
25+
TxFee: units.MilliAvax,
3726
DynamicFeeConfig: gas.Config{
3827
Weights: gas.Dimensions{
3928
gas.Bandwidth: 1, // Max block size ~1MB
@@ -51,7 +40,7 @@ var (
5140
// hardcode the result.
5241
ExcessConversionConstant: 2_164_043, // Double every 30s
5342
},
54-
ValidatorFeeConfig: validatorfee.Config{
43+
ValidatorFeeConfig: fee.Config{
5544
Capacity: 20_000,
5645
Target: 10_000,
5746
MinPrice: gas.Price(512 * units.NanoAvax),

genesis/genesis_local.go

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ import (
1414
"github.com/ava-labs/avalanchego/utils/wrappers"
1515
"github.com/ava-labs/avalanchego/vms/components/gas"
1616
"github.com/ava-labs/avalanchego/vms/platformvm/reward"
17-
18-
txfee "github.com/ava-labs/avalanchego/vms/platformvm/txs/fee"
19-
validatorfee "github.com/ava-labs/avalanchego/vms/platformvm/validators/fee"
17+
"github.com/ava-labs/avalanchego/vms/platformvm/validators/fee"
2018
)
2119

2220
// PrivateKey-vmRQiZeXEXYMyJhEiqdC2z5JhuDbxL8ix9UVvjgMu2Er1NepE => P-local1g65uqn6t77p656w64023nh8nd9updzmxyymev2
@@ -42,16 +40,7 @@ var (
4240
LocalParams = Params{
4341
TxFeeConfig: TxFeeConfig{
4442
CreateAssetTxFee: units.MilliAvax,
45-
StaticFeeConfig: txfee.StaticConfig{
46-
TxFee: units.MilliAvax,
47-
CreateSubnetTxFee: 100 * units.MilliAvax,
48-
TransformSubnetTxFee: 100 * units.MilliAvax,
49-
CreateBlockchainTxFee: 100 * units.MilliAvax,
50-
AddPrimaryNetworkValidatorFee: 0,
51-
AddPrimaryNetworkDelegatorFee: 0,
52-
AddSubnetValidatorFee: units.MilliAvax,
53-
AddSubnetDelegatorFee: units.MilliAvax,
54-
},
43+
TxFee: units.MilliAvax,
5544
DynamicFeeConfig: gas.Config{
5645
Weights: gas.Dimensions{
5746
gas.Bandwidth: 1, // Max block size ~1MB
@@ -69,7 +58,7 @@ var (
6958
// hardcode the result.
7059
ExcessConversionConstant: 2_164_043, // Double every 30s
7160
},
72-
ValidatorFeeConfig: validatorfee.Config{
61+
ValidatorFeeConfig: fee.Config{
7362
Capacity: 20_000,
7463
Target: 10_000,
7564
MinPrice: gas.Price(1 * units.NanoAvax),

0 commit comments

Comments
 (0)