mirror of
https://github.com/luxfi/relay.git
synced 2026-10-30 15:20:05 +00:00
luxfi/node is being retired. The vms, vms/artifacts and vms/types/fee packages it hosted now have a permanent home in luxfi/vm, so R-Chain imports them from there and no longer depends on the node at all. luxfi/vm v1.3.17 needs Go 1.26.5. Co-authored-by: Hanzo Dev <[email protected]>
33 lines
959 B
Go
33 lines
959 B
Go
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package vm
|
|
|
|
import (
|
|
"errors"
|
|
"testing"
|
|
|
|
"github.com/luxfi/log"
|
|
"github.com/luxfi/vm/vms/types/fee"
|
|
)
|
|
|
|
func TestRelayVM_FeePolicy_IsNoUserTxSentinel(t *testing.T) {
|
|
v := &VM{log: log.NewNoOpLogger(), feePolicy: fee.NoUserTxPolicy{}}
|
|
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 TestRelayVM_FeePolicy_RejectsAllUserTx(t *testing.T) {
|
|
v := &VM{log: log.NewNoOpLogger(), feePolicy: fee.NoUserTxPolicy{}}
|
|
if err := v.gateUserTx(); !errors.Is(err, fee.ErrChainAcceptsNoUserTxs) {
|
|
t.Fatalf("gateUserTx() = %v, want ErrChainAcceptsNoUserTxs", err)
|
|
}
|
|
}
|