Files
chains/thresholdvm/feegate_test.go
T
zeekay e079072877 thresholdvm: declare NoUserTxPolicy sentinel (service-only chain)
M-Chain is committee-driven — keygen and signing requests come from
validators via consensus, not a user mempool. Attach the
fee.NoUserTxPolicy sentinel in Initialize so the boot-time
fee.Validate explicitly approves the no-user-tx posture and any
caller that reaches the gate gets ErrChainAcceptsNoUserTxs.
2026-05-21 17:15:37 -07:00

33 lines
966 B
Go

// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package thresholdvm
import (
"errors"
"testing"
"github.com/luxfi/log"
"github.com/luxfi/node/vms/types/fee"
)
func TestThresholdVM_FeePolicy_IsNoUserTxSentinel(t *testing.T) {
v := &VM{log: log.NewNoOpLogger(), feePolicy: newFeePolicy()}
if v.FeePolicy() == nil {
t.Fatal("FeePolicy() = nil; want NoUserTxPolicy")
}
if _, ok := v.FeePolicy().(fee.NoUserTxPolicy); !ok {
t.Fatalf("FeePolicy() = %T, want NoUserTxPolicy", v.FeePolicy())
}
if err := fee.Validate(v.FeePolicy()); err != nil {
t.Errorf("fee.Validate(NoUserTxPolicy) = %v, want nil", err)
}
}
func TestThresholdVM_FeePolicy_RejectsAllUserTx(t *testing.T) {
v := &VM{log: log.NewNoOpLogger(), feePolicy: newFeePolicy()}
if err := v.gateUserTx(); !errors.Is(err, fee.ErrChainAcceptsNoUserTxs) {
t.Fatalf("gateUserTx() = %v, want ErrChainAcceptsNoUserTxs", err)
}
}