mirror of
https://github.com/luxfi/chains.git
synced 2026-09-24 00:26:00 +00:00
VMs now live in ONE place: chains/<name>/ owns the full implementation. Previously split across node/vms/<name>/ (impl) + chains/<name>/main.go (plugin wrapper). Now consolidated. New layout: chains/<name>vm/*.go — package <name>vm (VM code) chains/<name>vm/cmd/plugin/main.go — package main (plugin binary) chains/<name>vm/go.mod — module github.com/luxfi/chains/<name>vm Moved 11 VMs: aivm, bridgevm, dexvm, graphvm, identityvm, keyvm, oraclevm, quantumvm, relayvm, thresholdvm, zkvm. External callers now import github.com/luxfi/chains/<name> directly.
49 lines
1.0 KiB
Go
49 lines
1.0 KiB
Go
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package aivm
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/luxfi/consensus/core/choices"
|
|
"github.com/luxfi/ids"
|
|
)
|
|
|
|
func TestAIVertexConflicts_SameJobID(t *testing.T) {
|
|
v1 := &AIVertex{
|
|
id: ids.GenerateTestID(),
|
|
status: choices.Processing,
|
|
jobIDs: []string{"job-123", "job-456"},
|
|
}
|
|
v2 := &AIVertex{
|
|
id: ids.GenerateTestID(),
|
|
status: choices.Processing,
|
|
jobIDs: []string{"job-123", "job-789"},
|
|
}
|
|
|
|
if !v1.Conflicts(v2) {
|
|
t.Fatal("expected conflict: both reference job-123")
|
|
}
|
|
if !v2.Conflicts(v1) {
|
|
t.Fatal("expected conflict: symmetric check failed")
|
|
}
|
|
}
|
|
|
|
func TestAIVertexConflicts_DisjointJobIDs(t *testing.T) {
|
|
v1 := &AIVertex{
|
|
id: ids.GenerateTestID(),
|
|
status: choices.Processing,
|
|
jobIDs: []string{"job-A"},
|
|
}
|
|
v2 := &AIVertex{
|
|
id: ids.GenerateTestID(),
|
|
status: choices.Processing,
|
|
jobIDs: []string{"job-B"},
|
|
}
|
|
|
|
if v1.Conflicts(v2) {
|
|
t.Fatal("expected no conflict: independent jobs commute")
|
|
}
|
|
}
|