mirror of
https://github.com/luxfi/chains.git
synced 2026-09-24 00:26:00 +00:00
A plugin is its own binary; the daemon that loads it has no business being linked into it. Twelve VMs reached into github.com/luxfi/node for four things, and each one now programs against a home that is actually its own: - fee admission (Policy, FlatPolicy, NoUserTxPolicy, Validate) joins the settlement half already in chains/fee. One fee package, and the nodefee alias that marked the split is gone. - the cross-chain artifact types move to chains/artifacts. - the factory the daemon registers is luxfi/vm/manager.Factory, and the version types are luxfi/version. Both are ordinary modules the daemon reads too, so a VM imports them directly rather than through anything of ours. The GPU switch is deleted, not moved. It was a global set during daemon startup that a separate process could never observe, so every plugin read its default; FHEOptions.Backend is the switch that was really there. go list -deps names no luxfi/node for aivm, bridgevm, dexvm, evm, fhevm, graphvm, identityvm, keyvm, mpcvm, quantumvm, schain or zkvm, and the built plugin binaries carry no such string. oraclevm and relayvm still do: they are re-export shims over luxfi/oracle and luxfi/relay, which build their fee policies upstream. Their tests keep naming the daemon's fee package because that is the type their value has.
40 lines
1.4 KiB
Go
40 lines
1.4 KiB
Go
// Copyright (C) 2019-2026, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package fhevm
|
|
|
|
import (
|
|
"github.com/luxfi/constants"
|
|
"github.com/luxfi/ids"
|
|
"github.com/luxfi/log"
|
|
"github.com/luxfi/vm/manager"
|
|
)
|
|
|
|
var _ manager.Factory = (*Factory)(nil)
|
|
|
|
// VMID identifies F-Chain: coordination of confidential compute — ciphertext
|
|
// handles, access permits, and threshold decryption (LP-8200, LP-167). It is
|
|
// constants.FHEVMID and nothing else.
|
|
//
|
|
// A vmID is an immutable one-way door: it is baked into the CreateChainTx at
|
|
// genesis, it is the plugin binary's filename, and it is what the P-Chain
|
|
// stores forever. Every declaration of it must agree, so there is exactly one —
|
|
// this alias — and it points at the single source of truth in luxfi/constants,
|
|
// which node/node/vms.go already lists in OptionalVMs under the plugin name
|
|
// "fhevm".
|
|
var VMID = constants.FHEVMID
|
|
|
|
// Assert at compile time that the alias really is the shared constant, so a
|
|
// future edit cannot silently introduce a private literal.
|
|
var _ = map[bool]struct{}{VMID == ids.ID{'f', 'h', 'e', 'v', 'm'}: {}}
|
|
|
|
// Factory creates F-Chain VM instances.
|
|
type Factory struct{}
|
|
|
|
// New returns a new F-Chain VM. Everything that needs configuration, a
|
|
// database, or a committee is set up in Initialize; a Factory-built VM holds no
|
|
// state.
|
|
func (f *Factory) New(log.Logger) (interface{}, error) {
|
|
return &VM{}, nil
|
|
}
|