mirror of
https://github.com/luxfi/node.git
synced 2026-07-27 03:39:39 +00:00
feat(proposervm): configurable window duration (fast local cadence) + strict-PQ classical-proposer refusal
Two changes, both node-local: 1. CADENCE — proposer.WindowDuration (the proposer-slot spacing, a validator's min build delay = slot index x WindowDuration) was a hardcoded 5s const tuned for mainnet-scale validator sets, flooring small/local block cadence at 5s per slot. It is now a startup-configurable var (default 5s, unchanged for mainnet) set via the new --proposervm-window-duration flag → node.Config → ManagerConfig → proposervm.Config → proposer.SetWindowDuration at VM init. Read by both the windower delay math and TimeToSlot, so they stay consistent. Measured on a 5-node strict-PQ net: 5s→1s took sustained C-Chain from 44 TPS / 14s-per-block to 104 TPS / 3.8s-per-block, still 5/5 byte-identical finality. 2. SECURITY (cryptographer MEDIUM-1) — postForkCommonComponents.Verify now refuses a block carrying a CLASSICAL secp256k1 proposer identity when the chain is strict-PQ (StakingMLDSASigner set), UNCONDITIONALLY (before the consensusState==Ready gate, so it also holds during bootstrap/state-sync). Fills the documented-but-unwired 'proposer' SchemeGate site: the downgrade defense is now an explicit fail-closed in-perimeter gate, not merely emergent from 20-byte NodeID collision-resistance + upstream enforcement. Adds SignedBlock.HasClassicalProposer(). Mirrors contract.RefuseUnderStrictPQ. Pins consensus v1.36.7 (consume-on-error build loop — kills the non-leader BuildBlock spin). Block + proposervm VM tests green. Co-authored-by: Hanzo Dev <dev@hanzo.ai>
This commit is contained in:
@@ -1762,6 +1762,10 @@ func GetNodeConfig(v *viper.Viper) (node.Config, error) {
|
||||
if nodeConfig.HealthCheckFreq < 0 {
|
||||
return node.Config{}, fmt.Errorf("%s must be positive", HealthCheckFreqKey)
|
||||
}
|
||||
nodeConfig.ProposerWindowDuration = v.GetDuration(ProposerVMWindowDurationKey)
|
||||
if nodeConfig.ProposerWindowDuration < 0 {
|
||||
return node.Config{}, fmt.Errorf("%s must not be negative", ProposerVMWindowDurationKey)
|
||||
}
|
||||
// Halflife of continuous averager used in health checks
|
||||
healthCheckAveragerHalflife := v.GetDuration(HealthCheckAveragerHalflifeKey)
|
||||
if healthCheckAveragerHalflife <= 0 {
|
||||
|
||||
@@ -369,6 +369,7 @@ func addNodeFlags(fs *pflag.FlagSet) {
|
||||
// ProposerVM
|
||||
fs.Bool(ProposerVMUseCurrentHeightKey, false, "Have the ProposerVM always report the last accepted P-chain block height")
|
||||
fs.Duration(ProposerVMMinBlockDelayKey, proposervm.DefaultMinBlockDelay, "Minimum delay to enforce when building a chain++ block for the primary network chains and the default minimum delay for chains")
|
||||
fs.Duration(ProposerVMWindowDurationKey, 0, "Proposer-slot spacing for block production (0 uses the 5s mainnet default); shrink for fast cadence on small/local networks")
|
||||
|
||||
// Metrics
|
||||
fs.Bool(MeterVMsEnabledKey, true, "Enable Meter VMs to track VM performance with more granularity")
|
||||
|
||||
@@ -187,6 +187,7 @@ const (
|
||||
ConsensusFrontierPollFrequencyKey = "consensus-frontier-poll-frequency"
|
||||
ProposerVMUseCurrentHeightKey = "proposervm-use-current-height"
|
||||
ProposerVMMinBlockDelayKey = "proposervm-min-block-delay"
|
||||
ProposerVMWindowDurationKey = "proposervm-window-duration"
|
||||
FdLimitKey = "fd-limit"
|
||||
IndexEnabledKey = "index-enabled"
|
||||
IndexAllowIncompleteKey = "index-allow-incomplete"
|
||||
|
||||
@@ -177,6 +177,11 @@ type Config struct {
|
||||
// Health
|
||||
HealthCheckFreq time.Duration `json:"healthCheckFreq"`
|
||||
|
||||
// ProposerWindowDuration overrides the proposervm proposer-slot spacing.
|
||||
// Zero keeps the 5s mainnet default; small local/dev nets set it low (e.g.
|
||||
// 1s) so block cadence is not floored at 5s per proposer slot.
|
||||
ProposerWindowDuration time.Duration `json:"proposerWindowDuration"`
|
||||
|
||||
// Network configuration
|
||||
NetworkConfig network.Config `json:"networkConfig"`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user