mirror of
https://github.com/luxfi/chains.git
synced 2026-09-24 00:26:00 +00:00
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.
33 lines
966 B
Go
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)
|
|
}
|
|
}
|