mirror of
https://github.com/luxfi/node.git
synced 2026-07-27 03:39:39 +00:00
feat(proposervm): configurable MinBlkDelay + timestamp granularity tracks WindowDuration (sub-second cadence foundation)
Two coupled knobs for differentiated cadence — co-located D-Chain/DEX (fast) vs public C-Chain (standard): 1. MinBlkDelay was hardcoded to the 1s DefaultMinBlockDelay in chains/manager.go, ignoring its own --proposervm-min-block-delay flag. Now wired node.Config → ManagerConfig → proposervm.Config (0 ⇒ 1s default). High-throughput nets set it low. 2. Block timestamps were Truncate(time.Second) at 4 sites, quantizing cadence to 1s regardless of WindowDuration — so a sub-second window inflated slot numbers without finer time resolution and could NOT produce blocks faster than 1/s. Truncation now tracks proposer.TimestampGranularity() = min(1s, WindowDuration): mainnet (>=1s) keeps exact 1-second block times; sub-second windows get matching sub-second timestamps. Measured: 1s window/delay → ~95-104 TPS, byte-identical 5/5 finality (unchanged from before, no regression). NOTE: true sub-second cadence additionally requires a slot-handoff fix — at 100ms the slot recomputed in buildChild from a drifted 'now' can differ from the slot timeToBuild scheduled, causing errUnexpectedProposer verify drops; that + multi-sender saturation is the next step. These knobs are the necessary foundation. Co-authored-by: Hanzo Dev <dev@hanzo.ai>
This commit is contained in:
+11
-4
@@ -372,8 +372,11 @@ type ManagerConfig struct {
|
||||
// ProposerWindowDuration overrides the proposervm proposer-slot spacing (0 ⇒
|
||||
// the 5s mainnet default). Small local/dev nets set it low for fast cadence.
|
||||
ProposerWindowDuration time.Duration
|
||||
StakingBLSKey bls.Signer
|
||||
TracingEnabled bool
|
||||
// ProposerMinBlockDelay overrides the proposervm minimum block delay (0 ⇒ the
|
||||
// 1s default). High-throughput / DEX nets set it low (e.g. 1ms).
|
||||
ProposerMinBlockDelay time.Duration
|
||||
StakingBLSKey bls.Signer
|
||||
TracingEnabled bool
|
||||
// Must not be used unless [TracingEnabled] is true as this may be nil.
|
||||
Tracer trace.Tracer
|
||||
Log log.Logger
|
||||
@@ -1289,10 +1292,14 @@ func (m *manager) buildChain(chainParams ChainParameters, sb nets.Net) (*chainIn
|
||||
if regErr != nil {
|
||||
return nil, fmt.Errorf("failed to register proposervm metrics for chain %s: %w", chainParams.ID, regErr)
|
||||
}
|
||||
minBlkDelay := proposervm.DefaultMinBlockDelay
|
||||
if m.ProposerMinBlockDelay > 0 {
|
||||
minBlkDelay = m.ProposerMinBlockDelay
|
||||
}
|
||||
engineVM = proposervm.New(vmTyped, proposervm.Config{
|
||||
Upgrades: m.Upgrades,
|
||||
NetworkID: networkID, // CRITICAL-3: windower uses the SAME set ID as the cert side
|
||||
MinBlkDelay: proposervm.DefaultMinBlockDelay,
|
||||
MinBlkDelay: minBlkDelay,
|
||||
NumHistoricalBlocks: proposervm.DefaultNumHistoricalBlocks,
|
||||
StakingLeafSigner: m.StakingTLSSigner,
|
||||
StakingCertLeaf: m.StakingTLSCert,
|
||||
@@ -1305,7 +1312,7 @@ func (m *manager) buildChain(chainParams ChainParameters, sb nets.Net) (*chainIn
|
||||
log.Stringer("chainID", chainParams.ID),
|
||||
log.Int("K", consensusParams.K),
|
||||
log.Stringer("windowerNetworkID", networkID),
|
||||
log.Duration("minBlockDelay", proposervm.DefaultMinBlockDelay))
|
||||
log.Duration("minBlockDelay", minBlkDelay))
|
||||
}
|
||||
|
||||
m.Log.Info("initializing VM", log.Stringer("chainID", chainParams.ID))
|
||||
|
||||
Reference in New Issue
Block a user