mirror of
https://github.com/luxfi/oracle.git
synced 2026-10-30 15:23:21 +00:00
luxfi/node is being retired. The version, vms, vms/artifacts and vms/types/fee packages it hosted now have permanent homes in luxfi/version and luxfi/vm, so O-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
961 B
Go
33 lines
961 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 TestOracleVM_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 TestOracleVM_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)
|
|
}
|
|
}
|