mirror of
https://github.com/luxfi/dex.git
synced 2026-09-24 00:26:31 +00:00
dchain: say rail where the code moves value, seam only where it ingests
Co-authored-by: Hanzo Dev <[email protected]>
This commit is contained in:
@@ -45,7 +45,7 @@ import (
|
||||
// beneficiary(20) | asset(32) | amount(8)
|
||||
//
|
||||
// It is byte-identical with precompile/dex native_wire.go, pinned by the golden
|
||||
// vector in atomic_seam_wire_test.go. The two repos cannot import each other, so that
|
||||
// vector in atomic_wire_test.go. The two repos cannot import each other, so that
|
||||
// vector is the whole cross-repo contract; a one-sided change fails at test time
|
||||
// rather than in consensus.
|
||||
//
|
||||
|
||||
+7
-7
@@ -79,9 +79,9 @@ type Block struct {
|
||||
outcomes []txOutcome
|
||||
|
||||
// atomic is the block's accumulated cross-chain shared-memory operations (the
|
||||
// native settlement seam's C->D removes / D->C puts), derived by execute and
|
||||
// funding rail's C->D removes / D->C puts), derived by execute and
|
||||
// applied atomically with the state overlay at Accept (atomic.go commitAtomic).
|
||||
// nil/empty for a block with no seam txs. Stashed on the block alongside the
|
||||
// nil/empty for a block with no crossings. Stashed on the block alongside the
|
||||
// overlay so the same instance a later Accept resolves carries both.
|
||||
atomic *atomicRequests
|
||||
}
|
||||
@@ -263,9 +263,9 @@ func (b *Block) Accept(ctx context.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// Commit the overlay AND the block's cross-chain seam operations (C->D removes /
|
||||
// D->C puts) in one atomic write (atomic.go). With no seam txs this is the plain
|
||||
// overlay commit; with seam txs the shared-memory ops land atomically with the
|
||||
// Commit the overlay AND the block's cross-chain operations (C->D removes /
|
||||
// D->C puts) in one atomic write (atomic.go). With no crossings this is the plain
|
||||
// overlay commit; with them the shared-memory ops land atomically with the
|
||||
// state so a consumed order / produced settlement can never diverge from the
|
||||
// committed ledger.
|
||||
if err := b.vm.commitAtomic(b.overlay, b.atomic); err != nil {
|
||||
@@ -324,7 +324,7 @@ type execResult struct {
|
||||
fills []dex.DEXTrade
|
||||
rows []dex.DEXOrder // canonical resting rows across all touched markets
|
||||
outcomes []txOutcome // one per tx, in block order
|
||||
atomic *atomicRequests // cross-chain seam removes/puts to apply at Accept
|
||||
atomic *atomicRequests // cross-chain removes/puts to apply at Accept
|
||||
}
|
||||
|
||||
// execute runs the block's txs against the overlay, writing order/market/trade
|
||||
@@ -361,7 +361,7 @@ func (b *Block) execute(ctx context.Context, overlay *versiondb.Database) (execR
|
||||
|
||||
var allFills []dex.DEXTrade
|
||||
var tradeSeq uint64
|
||||
// ar accumulates the block's cross-chain seam operations (C->D removes / D->C
|
||||
// ar accumulates the block's cross-chain operations (C->D removes / D->C
|
||||
// puts); it is applied atomically with this overlay at Accept. Empty for a block
|
||||
// with no TxImport/TxExport.
|
||||
ar := newAtomicRequests()
|
||||
|
||||
+4
-4
@@ -54,8 +54,8 @@ type VM struct {
|
||||
// runtime is the chain-scoped wiring the consensus engine hands the VM at
|
||||
// Initialize (block.Init.Runtime). It is the source of the cross-chain atomic
|
||||
// shared-memory handle (GetSharedMemory) and the C-Chain id the native settlement
|
||||
// seam (atomic.go) imports from / exports to. nil when no runtime was wired
|
||||
// (single-chain unit tests with no seam) — the seam then refuses (no mint).
|
||||
// funding rail (atomic.go) imports from / exports to. nil when no runtime was wired
|
||||
// (single-chain unit tests) — the rail then refuses (no mint).
|
||||
runtime *runtime.Runtime
|
||||
// chainID is THIS chain's id, and cChainID the C-Chain's, both resolved from the
|
||||
// runtime. They are the partition a C->D claim is read under (import) and the
|
||||
@@ -158,9 +158,9 @@ func (vm *VM) Initialize(ctx context.Context, init block.Init) error {
|
||||
|
||||
vm.db = init.DB
|
||||
vm.toEngine = init.ToEngine
|
||||
// Capture the cross-chain wiring for the native settlement seam (atomic.go). The
|
||||
// Capture the cross-chain wiring for the funding rail (atomic.go). The
|
||||
// runtime carries the shared-memory handle + the C-Chain id; both are absent in a
|
||||
// single-chain unit test, where the seam refuses rather than mint.
|
||||
// single-chain unit test, where the rail refuses rather than mint.
|
||||
vm.runtime = init.Runtime
|
||||
if init.Runtime != nil {
|
||||
vm.chainID = init.Runtime.ChainID
|
||||
|
||||
Reference in New Issue
Block a user