@@ -16,6 +16,7 @@ import (
16
16
"github.com/ava-labs/avalanchego/vms/platformvm/state"
17
17
"github.com/ava-labs/avalanchego/vms/platformvm/txs"
18
18
"github.com/ava-labs/avalanchego/vms/platformvm/txs/executor"
19
+ "github.com/ava-labs/avalanchego/vms/platformvm/txs/fee"
19
20
"github.com/ava-labs/avalanchego/vms/platformvm/txs/mempool"
20
21
"github.com/ava-labs/avalanchego/vms/platformvm/validators"
21
22
)
@@ -168,6 +169,24 @@ func (m *manager) VerifyTx(tx *txs.Tx) error {
168
169
return fmt .Errorf ("failed to advance the chain time: %w" , err )
169
170
}
170
171
172
+ if timestamp := stateDiff .GetTimestamp (); m .txExecutorBackend .Config .UpgradeConfig .IsEtnaActivated (timestamp ) {
173
+ complexity , err := fee .TxComplexity (tx .Unsigned )
174
+ if err != nil {
175
+ return fmt .Errorf ("failed to calculate tx complexity: %w" , err )
176
+ }
177
+ gas , err := complexity .ToGas (m .txExecutorBackend .Config .DynamicFeeConfig .Weights )
178
+ if err != nil {
179
+ return fmt .Errorf ("failed to calculate tx gas: %w" , err )
180
+ }
181
+
182
+ // TODO: After the mempool is updated, convert this check to use the
183
+ // maximum mempool capacity.
184
+ feeState := stateDiff .GetFeeState ()
185
+ if gas > feeState .Capacity {
186
+ return fmt .Errorf ("tx exceeds current gas capacity: %d > %d" , gas , feeState .Capacity )
187
+ }
188
+ }
189
+
171
190
feeCalculator := state .PickFeeCalculator (m .txExecutorBackend .Config , stateDiff )
172
191
_ , _ , _ , err = executor .StandardTx (
173
192
m .txExecutorBackend ,
0 commit comments