mirror of
https://github.com/luxfi/chains.git
synced 2026-09-24 00:26:00 +00:00
The VM never built its chain store, so Initialize dereferenced a nil store and B-Chain could not start at all. What a block settles — the transfers, and the day's running total per destination — is now written in the same commit as the block. Both lived in maps on the heap, so a restart forgot every transfer the chain had released and handed back the whole day's allowance: a restart was a free reset of the cap that bounds what this bridge can move. The counter is cut from the block's own timestamp, so every node closes the window on the same block, and it only ever grew before, which stopped the chain for good once total volume passed the limit. A request's id is now the digest of the transfer it carries, and Verify refuses one where it is not. The id was a label the proposer chose while the replay guard, the daily counter and the release worker all keyed off it, so one deposit could ride in under any number of names. Verify now resolves the parent, refuses one beneath the tip, requires the height and the timestamp to follow it, and registers what it accepted so a follower can verify the second block of a run. It read none of that before. Blocks are bounded and canonically encoded, the chain id is hashed into every block id, and assembly admits exactly what Verify admits, so an uncarryable transfer no longer wedges the proposer. The signer set's threshold is ⌈2n/3⌉ in integers rather than a float that asked for unanimity at three signers and for two of one at one, the bond it declares is enforced where a signer registers, and a replacement takes the slot it replaces. Deleted: the block and request MPC signature carriage, which nothing produced and whose deserializer could not decode a canonical secp256k1 signature, so it could only ever reject; the chain-name list beside the routing table; the confirmation depth and observation time that each node read for itself and then wrote to the wire; a worker pool, a party id and an engine channel nobody read.
27 lines
950 B
Go
27 lines
950 B
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/chain"
|
|
"github.com/luxfi/constants"
|
|
"github.com/luxfi/ids"
|
|
)
|
|
|
|
// VMID identifies B-Chain: cross-chain settlement.
|
|
//
|
|
// It is an immutable one-way door — the node resolves a plugin binary by this
|
|
// id, so a chain created under one value can never be served by a binary
|
|
// answering to another. It is therefore taken from luxfi/constants and nowhere
|
|
// else; a private literal beside the shared one is two declarations of a value
|
|
// that must be one.
|
|
var VMID = constants.BridgeVMID
|
|
|
|
// The bytes, asserted at compile time so a change to either declaration is a
|
|
// build failure rather than a chain nothing can open.
|
|
var _ = map[bool]struct{}{VMID == ids.ID{'b', 'r', 'i', 'd', 'g', 'e', 'v', 'm'}: {}}
|
|
|
|
// Factory creates B-Chain VM instances.
|
|
type Factory = chain.Factory[VM]
|