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.
42 lines
1.4 KiB
Go
42 lines
1.4 KiB
Go
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package bridgevm
|
|
|
|
import (
|
|
"github.com/luxfi/chains/fee"
|
|
)
|
|
|
|
// gateUserBridgeFee refuses a bridge transfer whose declared fee does not meet
|
|
// the chain's declared floor (LP-0130 §8: B-Chain fees). Called on the user-tx
|
|
// entry before any M-Chain signing capacity is consumed.
|
|
func (vm *VM) gateUserBridgeFee(paid uint64) error { return vm.fee.Admit(paid) }
|
|
|
|
// FeePolicy exposes the chain's declared fee policy for diagnostics and the
|
|
// boot-time Validate gate.
|
|
func (vm *VM) FeePolicy() fee.Policy { return vm.fee.Policy() }
|
|
|
|
// mpcGroupPublicKey returns the serialized CGGMP21 custody group public key
|
|
// (established by M-Chain's dealerless keygen), or nil if there is not one.
|
|
// B-Chain never holds a custody secret — only this public point.
|
|
//
|
|
// A group with no shares in it sums to the identity, which marshals to a
|
|
// perfectly well-formed 33 bytes. Handing that back as a key made an empty
|
|
// config look like a finished keygen: the node reported itself ready to
|
|
// attest, and bridge_getInfo said the same, on a chain that could verify
|
|
// nothing. The identity is not a key.
|
|
func (vm *VM) mpcGroupPublicKey() []byte {
|
|
if vm.mpcConfig == nil {
|
|
return nil
|
|
}
|
|
pt := vm.mpcConfig.PublicPoint()
|
|
if pt == nil || pt.IsIdentity() {
|
|
return nil
|
|
}
|
|
b, err := pt.MarshalBinary()
|
|
if err != nil {
|
|
return nil
|
|
}
|
|
return b
|
|
}
|