feat(p2p): carry the accept-interval key through the legacy config mapping - #47
Conversation
…pping WriteConfigToDir regenerates config.toml wholesale from the legacy structs, so any config.toml key with no corresponding field on legacyP2P is silently dropped on the next write rather than preserved. sei-chain is adding a p2p accept-interval key to make the router's inbound accept rate configurable (sei-protocol/sei-chain#3899); without a matching field here, seictl and sei-k8s-controller would strip that key from any node they write, silently reverting the node to the compiled-in 1 accept/s. Add AcceptInterval alongside DialInterval across all five sites the contract requires: the unified P2PConfig (accept_interval), legacyP2P (accept-interval), baseDefaults, toLegacyTendermint and fromLegacy. The default matches the one sei-chain#3899 sets, so a node written by this library and a node using seid's own defaults agree. Verified the round-trip assertion discriminates rather than merely passing: removing the toLegacyTendermint mapping fails it with "got 0s, want 25ms", which is the silent-drop failure mode this guards. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
PR SummaryLow Risk Overview The field is wired like
Reviewed by Cursor Bugbot for commit e7392ca. Bugbot is set up for automated code reviews on this repo. Configure here. |
Companion to sei-protocol/sei-chain#3899, which adds a p2p
accept-intervalkey so the router's inbound accept rate can be configured instead of being pinned to its compiled-in default of 1 accept/second.Why this repo has to change too
WriteConfigToDirregeneratesconfig.tomlwholesale from the legacy structs:A key with no corresponding field on
legacyP2Pis therefore silently dropped on the next write — not preserved, not rejected. Without this change,seictlandsei-k8s-controllerwould stripaccept-intervalfrom any node config they write, reverting that node to 1 accept/s with no diagnostic. The sei-chain change alone does not survive contact with a fleet managed by this library.Change
Five sites, following
DialIntervalexactly, per the contract inCLAUDE.md:config.go— unifiedP2PConfigAcceptInterval Duration \toml:"accept_interval"``legacy.go—legacyP2PAcceptInterval Duration \toml:"accept-interval"``defaults.go—baseDefaults()Dur(10 * time.Millisecond)legacy.go—toLegacyTendermint()legacy.go—fromLegacy()Note the deliberate tag asymmetry, matching every neighbouring key: underscore in the unified schema (
accept_interval), hyphen in the legacy file (accept-interval).The default matches the one sei-chain#3899 sets, so a node written by this library and a node relying on seid's own defaults agree rather than silently diverging.
No
enrichments.goentry —DialIntervalhas none either, so that layer is curated rather than exhaustive. Happy to add one if you'd rather it be surfaced in the field registry.Tests
Extended
TestWriteReadRoundTripperCLAUDE.md("Every new field should be exercised in at least one round-trip test"), using thetestingpackage only, per the repo's no-assertion-library rule.Verified it discriminates rather than merely passing — with the
toLegacyTendermintmapping removed it fails as:which is precisely the silent-drop failure mode this guards. Full suite green with the mapping in place:
make vetis clean.make lintreports 6 pre-existinglllviolations (config_test.go:38/55/93/118/126,migrate.go:189) that reproduce identically on unmodifiedorigin/main; none are lines this PR adds.Sequencing
This should land before anything starts writing
accept-intervalinto node configs, otherwise the key is written and then stripped on the next reconcile. Consumers (seid,seictl,sei-k8s-controller) pick it up on the next release + dependency bump; I have not touchedversion.json, since releases here appear to be their ownchore: releasecommits.🤖 Generated with Claude Code