mirror of
https://github.com/luxfi/chains.git
synced 2026-09-24 00:26:00 +00:00
Accept set the status and moved lastAccepted before writing anything, then issued one Put per credential with the error DROPPED on the credential writes themselves. A failure partway left earlier credentials on disk, the tip already advanced, and the chain believing a block it had only half applied. It now goes through the shared store: the credentials are staged, committed in one batch with the block and the tip, and the revocations, identities and status become visible only afterwards. A failure discards all of it and leaves the tip where it was. The dropped error is checked. Beside the fix, what this chain kept restating goes away: the pending queue becomes the shared pool, the blocks in flight and the tip come from the store under its one lock, the fee declaration is a value rather than a policy plus a network id, and the factory no longer half-populates a VM that Initialize rebuilds anyway. Two things change that were not behaviour anyone could rely on. Genesis was stamped with time.Now, so its id — the hash of its own fields — differed on every node and every restart; it now comes from genesis itself, as on K and F. And the per-VM GPU session the factory allocated was never read and never released. Restoring the original Accept fails all three atomicity tests.
22 lines
808 B
Go
22 lines
808 B
Go
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package identityvm
|
|
|
|
import (
|
|
"github.com/luxfi/node/vms/types/fee"
|
|
)
|
|
|
|
// gateUserFee refuses paidFee below the chain's declared floor. Called from
|
|
// each mutating service RPC (CreateIdentity, IssueCredential,
|
|
// RevokeCredential, CreateProof, RegisterIssuer) before the state-modifying VM
|
|
// method runs.
|
|
//
|
|
// Read-only RPCs (GetIdentity, GetCredential, VerifyCredential, GetIssuer,
|
|
// ListIssuers, ResolveIdentity, Health) are not gated.
|
|
func (vm *VM) gateUserFee(paidFee uint64) error { return vm.fee.Admit(paidFee) }
|
|
|
|
// 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() }
|