Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into encapsulate-signer
Browse files Browse the repository at this point in the history
  • Loading branch information
richardpringle committed Jan 14, 2025
2 parents acd6b46 + e973af8 commit 56c6f9a
Show file tree
Hide file tree
Showing 51 changed files with 427 additions and 1,007 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ jobs:
with:
input: "proto"
pr_comment: false
# buf-action defaults to pushing on non-fork branch pushes
# which is never desirable for this job. The buf-push job is
# responsible for pushes.
push: false
version: 1.35.0
check_generated_protobuf:
name: Up-to-date protobuf
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: labels
on:
push:
branches:
- main
- master
paths:
- .github/labels.yml
- .github/workflows/labels.yml
Expand Down
26 changes: 26 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
# Release Notes

## [v1.12.2](https://github.com/ava-labs/avalanchego/releases/tag/v1.12.2)

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.

The plugin version is unchanged at `38` and is compatible with versions `v1.12.0-v1.12.1`.

### Configs

- Removed static fee config flags
- `--create-subnet-tx-fee`
- `--transform-subnet-tx-fee`
- `--create-blockchain-tx-fee`
- `--add-primary-network-validator-fee`
- `--add-primary-network-delegator-fee`
- `--add-subnet-validator-fee`
- `--add-subnet-delegator-fee`

### APIs

- Removed `info.GetTxFee`
- Added `avm.GetTxFee`

### What's Changed

**Full Changelog**: https://github.com/ava-labs/avalanchego/compare/v1.12.1...v1.12.2

## [v1.12.1](https://github.com/ava-labs/avalanchego/releases/tag/v1.12.1)

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.
Expand Down
7 changes: 0 additions & 7 deletions api/info/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ type Client interface {
GetBlockchainID(context.Context, string, ...rpc.Option) (ids.ID, error)
Peers(context.Context, []ids.NodeID, ...rpc.Option) ([]Peer, error)
IsBootstrapped(context.Context, string, ...rpc.Option) (bool, error)
GetTxFee(context.Context, ...rpc.Option) (*GetTxFeeResponse, error)
Upgrades(context.Context, ...rpc.Option) (*upgrade.Config, error)
Uptime(context.Context, ...rpc.Option) (*UptimeResponse, error)
GetVMs(context.Context, ...rpc.Option) (map[ids.ID][]string, error)
Expand Down Expand Up @@ -99,12 +98,6 @@ func (c *client) IsBootstrapped(ctx context.Context, chainID string, options ...
return res.IsBootstrapped, err
}

func (c *client) GetTxFee(ctx context.Context, options ...rpc.Option) (*GetTxFeeResponse, error) {
res := &GetTxFeeResponse{}
err := c.requester.SendRequest(ctx, "info.getTxFee", struct{}{}, res, options...)
return res, err
}

func (c *client) Upgrades(ctx context.Context, options ...rpc.Option) (*upgrade.Config, error) {
res := &upgrade.Config{}
err := c.requester.SendRequest(ctx, "info.upgrades", struct{}{}, res, options...)
Expand Down
45 changes: 6 additions & 39 deletions api/info/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"go.uber.org/zap"

"github.com/ava-labs/avalanchego/chains"
"github.com/ava-labs/avalanchego/genesis"
"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/network"
"github.com/ava-labs/avalanchego/network/peer"
Expand Down Expand Up @@ -48,13 +47,12 @@ type Info struct {
}

type Parameters struct {
Version *version.Application
NodeID ids.NodeID
NodePOP *signer.ProofOfPossession
NetworkID uint32
TxFeeConfig genesis.TxFeeConfig
VMManager vms.Manager
Upgrades upgrade.Config
Version *version.Application
NodeID ids.NodeID
NodePOP *signer.ProofOfPossession
NetworkID uint32
VMManager vms.Manager
Upgrades upgrade.Config
}

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

type GetTxFeeResponse struct {
TxFee json.Uint64 `json:"txFee"`
CreateAssetTxFee json.Uint64 `json:"createAssetTxFee"`
CreateSubnetTxFee json.Uint64 `json:"createSubnetTxFee"`
TransformSubnetTxFee json.Uint64 `json:"transformSubnetTxFee"`
CreateBlockchainTxFee json.Uint64 `json:"createBlockchainTxFee"`
AddPrimaryNetworkValidatorFee json.Uint64 `json:"addPrimaryNetworkValidatorFee"`
AddPrimaryNetworkDelegatorFee json.Uint64 `json:"addPrimaryNetworkDelegatorFee"`
AddSubnetValidatorFee json.Uint64 `json:"addSubnetValidatorFee"`
AddSubnetDelegatorFee json.Uint64 `json:"addSubnetDelegatorFee"`
}

// GetTxFee returns the transaction fee in nAVAX.
func (i *Info) GetTxFee(_ *http.Request, _ *struct{}, reply *GetTxFeeResponse) error {
i.log.Debug("API called",
zap.String("service", "info"),
zap.String("method", "getTxFee"),
)

reply.TxFee = json.Uint64(i.TxFeeConfig.StaticFeeConfig.TxFee)
reply.CreateAssetTxFee = json.Uint64(i.TxFeeConfig.CreateAssetTxFee)
reply.CreateSubnetTxFee = json.Uint64(i.TxFeeConfig.StaticFeeConfig.CreateSubnetTxFee)
reply.TransformSubnetTxFee = json.Uint64(i.TxFeeConfig.StaticFeeConfig.TransformSubnetTxFee)
reply.CreateBlockchainTxFee = json.Uint64(i.TxFeeConfig.StaticFeeConfig.CreateBlockchainTxFee)
reply.AddPrimaryNetworkValidatorFee = json.Uint64(i.TxFeeConfig.StaticFeeConfig.AddPrimaryNetworkValidatorFee)
reply.AddPrimaryNetworkDelegatorFee = json.Uint64(i.TxFeeConfig.StaticFeeConfig.AddPrimaryNetworkDelegatorFee)
reply.AddSubnetValidatorFee = json.Uint64(i.TxFeeConfig.StaticFeeConfig.AddSubnetValidatorFee)
reply.AddSubnetDelegatorFee = json.Uint64(i.TxFeeConfig.StaticFeeConfig.AddSubnetDelegatorFee)
return nil
}

// GetVMsReply contains the response metadata for GetVMs
type GetVMsReply struct {
VMs map[ids.ID][]string `json:"vms"`
Expand Down
63 changes: 0 additions & 63 deletions api/info/service.md
Original file line number Diff line number Diff line change
Expand Up @@ -382,69 +382,6 @@ curl -X POST --data '{
}
```

### `info.getTxFee`

Get the fees of the network.

**Signature**:

```
info.getTxFee() ->
{
txFee: uint64,
createAssetTxFee: uint64,
createSubnetTxFee: uint64,
transformSubnetTxFee: uint64,
createBlockchainTxFee: uint64,
addPrimaryNetworkValidatorFee: uint64,
addPrimaryNetworkDelegatorFee: uint64,
addSubnetValidatorFee: uint64,
addSubnetDelegatorFee: uint64
}
```

- `txFee` is the default fee for making transactions.
- `createAssetTxFee` is the fee for creating a new asset.
- `createSubnetTxFee` is the fee for creating a new Avalanche L1.
- `transformSubnetTxFee` is the fee for converting a PoA Avalanche L1 into a PoS Avalanche L1.
- `createBlockchainTxFee` is the fee for creating a new blockchain.
- `addPrimaryNetworkValidatorFee` is the fee for adding a new primary network validator.
- `addPrimaryNetworkDelegatorFee` is the fee for adding a new primary network delegator.
- `addSubnetValidatorFee` is the fee for adding a new Avalanche L1 validator.
- `addSubnetDelegatorFee` is the fee for adding a new Avalanche L1 delegator.

All fees are denominated in nAVAX.

**Example Call**:

```sh
curl -X POST --data '{
"jsonrpc":"2.0",
"id" :1,
"method" :"info.getTxFee"
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info
```

**Example Response**:

```json
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"txFee": "1000000",
"createAssetTxFee": "10000000",
"createSubnetTxFee": "1000000000",
"transformSubnetTxFee": "10000000000",
"createBlockchainTxFee": "1000000000",
"addPrimaryNetworkValidatorFee": "0",
"addPrimaryNetworkDelegatorFee": "0",
"addSubnetValidatorFee": "1000000",
"addSubnetDelegatorFee": "1000000"
}
}
```

### `info.getVMs`

Get the virtual machines installed on this node.
Expand Down
17 changes: 3 additions & 14 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,8 @@ import (
"github.com/ava-labs/avalanchego/version"
"github.com/ava-labs/avalanchego/vms/components/gas"
"github.com/ava-labs/avalanchego/vms/platformvm/reward"
"github.com/ava-labs/avalanchego/vms/platformvm/validators/fee"
"github.com/ava-labs/avalanchego/vms/proposervm"

txfee "github.com/ava-labs/avalanchego/vms/platformvm/txs/fee"
validatorfee "github.com/ava-labs/avalanchego/vms/platformvm/validators/fee"
)

const (
Expand Down Expand Up @@ -771,16 +769,7 @@ func getTxFeeConfig(v *viper.Viper, networkID uint32) genesis.TxFeeConfig {
if networkID != constants.MainnetID && networkID != constants.FujiID {
return genesis.TxFeeConfig{
CreateAssetTxFee: v.GetUint64(CreateAssetTxFeeKey),
StaticFeeConfig: txfee.StaticConfig{
TxFee: v.GetUint64(TxFeeKey),
CreateSubnetTxFee: v.GetUint64(CreateSubnetTxFeeKey),
TransformSubnetTxFee: v.GetUint64(TransformSubnetTxFeeKey),
CreateBlockchainTxFee: v.GetUint64(CreateBlockchainTxFeeKey),
AddPrimaryNetworkValidatorFee: v.GetUint64(AddPrimaryNetworkValidatorFeeKey),
AddPrimaryNetworkDelegatorFee: v.GetUint64(AddPrimaryNetworkDelegatorFeeKey),
AddSubnetValidatorFee: v.GetUint64(AddSubnetValidatorFeeKey),
AddSubnetDelegatorFee: v.GetUint64(AddSubnetDelegatorFeeKey),
},
TxFee: v.GetUint64(TxFeeKey),
DynamicFeeConfig: gas.Config{
Weights: gas.Dimensions{
gas.Bandwidth: v.GetUint64(DynamicFeesBandwidthWeightKey),
Expand All @@ -794,7 +783,7 @@ func getTxFeeConfig(v *viper.Viper, networkID uint32) genesis.TxFeeConfig {
MinPrice: gas.Price(v.GetUint64(DynamicFeesMinGasPriceKey)),
ExcessConversionConstant: gas.Gas(v.GetUint64(DynamicFeesExcessConversionConstantKey)),
},
ValidatorFeeConfig: validatorfee.Config{
ValidatorFeeConfig: fee.Config{
Capacity: gas.Gas(v.GetUint64(ValidatorFeesCapacityKey)),
Target: gas.Gas(v.GetUint64(ValidatorFeesTargetKey)),
MinPrice: gas.Price(v.GetUint64(ValidatorFeesMinPriceKey)),
Expand Down
37 changes: 0 additions & 37 deletions config/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -827,43 +827,6 @@ Transaction fee, in nAVAX, for transactions that create new assets. Defaults to
`10000000` nAVAX (.01 AVAX) per transaction. This can only be changed on a local
network.

#### `--create-subnet-tx-fee` (int)

Transaction fee, in nAVAX, for transactions that create new Subnets. Defaults to
`1000000000` nAVAX (1 AVAX) per transaction. This can only be changed on a local
network.

#### `--create-blockchain-tx-fee` (int)

Transaction fee, in nAVAX, for transactions that create new blockchains.
Defaults to `1000000000` nAVAX (1 AVAX) per transaction. This can only be
changed on a local network.

#### `--transform-subnet-tx-fee` (int)

Transaction fee, in nAVAX, for transactions that transform Subnets. Defaults to
`1000000000` nAVAX (1 AVAX) per transaction. This can only be changed on a local network.

#### `--add-primary-network-validator-fee` (int)

Transaction fee, in nAVAX, for transactions that add new primary network validators. Defaults to 0.
This can only be changed on a local network.

#### `--add-primary-network-delegator-fee` (int)

Transaction fee, in nAVAX, for transactions that add new primary network delegators. Defaults to 0.
This can only be changed on a local network.

#### `--add-subnet-validator-fee` (int)

Transaction fee, in nAVAX, for transactions that add new Subnet validators.
Defaults to `10000000` nAVAX (.01 AVAX).

#### `--add-subnet-delegator-fee` (int)

Transaction fee, in nAVAX, for transactions that add new Subnet delegators.
Defaults to `10000000` nAVAX (.01 AVAX).

#### `--min-delegator-stake` (int)

The minimum stake, in nAVAX, that can be delegated to a validator of the Primary Network.
Expand Down
10 changes: 1 addition & 9 deletions config/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,8 @@ func addNodeFlags(fs *pflag.FlagSet) {
fs.Uint64(DynamicFeesMinGasPriceKey, uint64(genesis.LocalParams.DynamicFeeConfig.MinPrice), "Minimum Gas price")
fs.Uint64(DynamicFeesExcessConversionConstantKey, uint64(genesis.LocalParams.DynamicFeeConfig.ExcessConversionConstant), "Constant to convert excess Gas to the Gas price")
// Static fees:
fs.Uint64(TxFeeKey, genesis.LocalParams.StaticFeeConfig.TxFee, "Transaction fee, in nAVAX")
fs.Uint64(TxFeeKey, genesis.LocalParams.TxFee, "Transaction fee, in nAVAX")
fs.Uint64(CreateAssetTxFeeKey, genesis.LocalParams.CreateAssetTxFee, "Transaction fee, in nAVAX, for transactions that create new assets")
fs.Uint64(CreateSubnetTxFeeKey, genesis.LocalParams.StaticFeeConfig.CreateSubnetTxFee, "Transaction fee, in nAVAX, for transactions that create new subnets")
fs.Uint64(TransformSubnetTxFeeKey, genesis.LocalParams.StaticFeeConfig.TransformSubnetTxFee, "Transaction fee, in nAVAX, for transactions that transform subnets")
fs.Uint64(CreateBlockchainTxFeeKey, genesis.LocalParams.StaticFeeConfig.CreateBlockchainTxFee, "Transaction fee, in nAVAX, for transactions that create new blockchains")
fs.Uint64(AddPrimaryNetworkValidatorFeeKey, genesis.LocalParams.StaticFeeConfig.AddPrimaryNetworkValidatorFee, "Transaction fee, in nAVAX, for transactions that add new primary network validators")
fs.Uint64(AddPrimaryNetworkDelegatorFeeKey, genesis.LocalParams.StaticFeeConfig.AddPrimaryNetworkDelegatorFee, "Transaction fee, in nAVAX, for transactions that add new primary network delegators")
fs.Uint64(AddSubnetValidatorFeeKey, genesis.LocalParams.StaticFeeConfig.AddSubnetValidatorFee, "Transaction fee, in nAVAX, for transactions that add new subnet validators")
fs.Uint64(AddSubnetDelegatorFeeKey, genesis.LocalParams.StaticFeeConfig.AddSubnetDelegatorFee, "Transaction fee, in nAVAX, for transactions that add new subnet delegators")

// Database
fs.String(DBTypeKey, leveldb.Name, fmt.Sprintf("Database type to use. Must be one of {%s, %s, %s}", leveldb.Name, memdb.Name, pebbledb.Name))
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")
Expand Down
7 changes: 0 additions & 7 deletions config/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,6 @@ const (
ValidatorFeesExcessConversionConstantKey = "validator-fees-excess-conversion-constant"
TxFeeKey = "tx-fee"
CreateAssetTxFeeKey = "create-asset-tx-fee"
CreateSubnetTxFeeKey = "create-subnet-tx-fee"
TransformSubnetTxFeeKey = "transform-subnet-tx-fee"
CreateBlockchainTxFeeKey = "create-blockchain-tx-fee"
AddPrimaryNetworkValidatorFeeKey = "add-primary-network-validator-fee"
AddPrimaryNetworkDelegatorFeeKey = "add-primary-network-delegator-fee"
AddSubnetValidatorFeeKey = "add-subnet-validator-fee"
AddSubnetDelegatorFeeKey = "add-subnet-delegator-fee"
UptimeRequirementKey = "uptime-requirement"
MinValidatorStakeKey = "min-validator-stake"
MaxValidatorStakeKey = "max-validator-stake"
Expand Down
17 changes: 3 additions & 14 deletions genesis/genesis_fuji.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ import (
"github.com/ava-labs/avalanchego/utils/units"
"github.com/ava-labs/avalanchego/vms/components/gas"
"github.com/ava-labs/avalanchego/vms/platformvm/reward"

txfee "github.com/ava-labs/avalanchego/vms/platformvm/txs/fee"
validatorfee "github.com/ava-labs/avalanchego/vms/platformvm/validators/fee"
"github.com/ava-labs/avalanchego/vms/platformvm/validators/fee"
)

var (
Expand All @@ -24,16 +22,7 @@ var (
FujiParams = Params{
TxFeeConfig: TxFeeConfig{
CreateAssetTxFee: 10 * units.MilliAvax,
StaticFeeConfig: txfee.StaticConfig{
TxFee: units.MilliAvax,
CreateSubnetTxFee: 100 * units.MilliAvax,
TransformSubnetTxFee: 1 * units.Avax,
CreateBlockchainTxFee: 100 * units.MilliAvax,
AddPrimaryNetworkValidatorFee: 0,
AddPrimaryNetworkDelegatorFee: 0,
AddSubnetValidatorFee: units.MilliAvax,
AddSubnetDelegatorFee: units.MilliAvax,
},
TxFee: units.MilliAvax,
DynamicFeeConfig: gas.Config{
Weights: gas.Dimensions{
gas.Bandwidth: 1, // Max block size ~1MB
Expand All @@ -51,7 +40,7 @@ var (
// hardcode the result.
ExcessConversionConstant: 2_164_043, // Double every 30s
},
ValidatorFeeConfig: validatorfee.Config{
ValidatorFeeConfig: fee.Config{
Capacity: 20_000,
Target: 10_000,
MinPrice: gas.Price(512 * units.NanoAvax),
Expand Down
17 changes: 3 additions & 14 deletions genesis/genesis_local.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ import (
"github.com/ava-labs/avalanchego/utils/wrappers"
"github.com/ava-labs/avalanchego/vms/components/gas"
"github.com/ava-labs/avalanchego/vms/platformvm/reward"

txfee "github.com/ava-labs/avalanchego/vms/platformvm/txs/fee"
validatorfee "github.com/ava-labs/avalanchego/vms/platformvm/validators/fee"
"github.com/ava-labs/avalanchego/vms/platformvm/validators/fee"
)

// PrivateKey-vmRQiZeXEXYMyJhEiqdC2z5JhuDbxL8ix9UVvjgMu2Er1NepE => P-local1g65uqn6t77p656w64023nh8nd9updzmxyymev2
Expand All @@ -42,16 +40,7 @@ var (
LocalParams = Params{
TxFeeConfig: TxFeeConfig{
CreateAssetTxFee: units.MilliAvax,
StaticFeeConfig: txfee.StaticConfig{
TxFee: units.MilliAvax,
CreateSubnetTxFee: 100 * units.MilliAvax,
TransformSubnetTxFee: 100 * units.MilliAvax,
CreateBlockchainTxFee: 100 * units.MilliAvax,
AddPrimaryNetworkValidatorFee: 0,
AddPrimaryNetworkDelegatorFee: 0,
AddSubnetValidatorFee: units.MilliAvax,
AddSubnetDelegatorFee: units.MilliAvax,
},
TxFee: units.MilliAvax,
DynamicFeeConfig: gas.Config{
Weights: gas.Dimensions{
gas.Bandwidth: 1, // Max block size ~1MB
Expand All @@ -69,7 +58,7 @@ var (
// hardcode the result.
ExcessConversionConstant: 2_164_043, // Double every 30s
},
ValidatorFeeConfig: validatorfee.Config{
ValidatorFeeConfig: fee.Config{
Capacity: 20_000,
Target: 10_000,
MinPrice: gas.Price(1 * units.NanoAvax),
Expand Down
Loading

0 comments on commit 56c6f9a

Please sign in to comment.