diff --git a/node/node.go b/node/node.go index b6f05fb343ae..ba66b4e05270 100644 --- a/node/node.go +++ b/node/node.go @@ -1403,12 +1403,12 @@ func (n *Node) initInfoAPI() error { service, err := info.NewService( info.Parameters{ - Version: version.CurrentApp, - NodeID: n.ID, - NodePOP: signer.NewProofOfPossession(n.Config.StakingSigningKey), - NetworkID: n.Config.NetworkID, - VMManager: n.VMManager, - Upgrades: n.Config.UpgradeConfig, + Version: version.CurrentApp, + NodeID: n.ID, + NodePOP: signer.NewProofOfPossession(n.Config.StakingSigningKey), + NetworkID: n.Config.NetworkID, + VMManager: n.VMManager, + Upgrades: n.Config.UpgradeConfig, }, n.Log, n.vdrs, diff --git a/vms/platformvm/block/executor/manager.go b/vms/platformvm/block/executor/manager.go index 48330dd74788..33b29354a59e 100644 --- a/vms/platformvm/block/executor/manager.go +++ b/vms/platformvm/block/executor/manager.go @@ -16,6 +16,7 @@ import ( "github.com/ava-labs/avalanchego/vms/platformvm/state" "github.com/ava-labs/avalanchego/vms/platformvm/txs" "github.com/ava-labs/avalanchego/vms/platformvm/txs/executor" + "github.com/ava-labs/avalanchego/vms/platformvm/txs/fee" "github.com/ava-labs/avalanchego/vms/platformvm/txs/mempool" "github.com/ava-labs/avalanchego/vms/platformvm/validators" ) @@ -168,6 +169,24 @@ func (m *manager) VerifyTx(tx *txs.Tx) error { return fmt.Errorf("failed to advance the chain time: %w", err) } + if timestamp := stateDiff.GetTimestamp(); m.txExecutorBackend.Config.UpgradeConfig.IsEtnaActivated(timestamp) { + complexity, err := fee.TxComplexity(tx.Unsigned) + if err != nil { + return fmt.Errorf("failed to calculate tx complexity: %w", err) + } + gas, err := complexity.ToGas(m.txExecutorBackend.Config.DynamicFeeConfig.Weights) + if err != nil { + return fmt.Errorf("failed to calculate tx gas: %w", err) + } + + // TODO: After the mempool is updated, convert this check to use the + // maximum mempool capacity. + feeState := stateDiff.GetFeeState() + if gas > feeState.Capacity { + return fmt.Errorf("tx exceeds current gas capacity: %d > %d", gas, feeState.Capacity) + } + } + feeCalculator := state.PickFeeCalculator(m.txExecutorBackend.Config, stateDiff) _, _, _, err = executor.StandardTx( m.txExecutorBackend,