Skip to content

Commit

Permalink
go fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
samliok committed Dec 17, 2024
1 parent c40d654 commit 90610f8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
12 changes: 6 additions & 6 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
19 changes: 19 additions & 0 deletions vms/platformvm/block/executor/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 90610f8

Please sign in to comment.