Skip to content

Commit 3e9de3a

Browse files
committed
go/consensus/cometbft/config: Move allow duplicate IP config
1 parent cd5651b commit 3e9de3a

7 files changed

Lines changed: 23 additions & 7 deletions

File tree

.changelog/6551.cfg.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
go/consensus/cometbft/config: Move allow duplicate IP config
2+
3+
Allowing multiple P2P connections from the same IP is useful in local
4+
sentry-like setups where multiple nodes run behind the same IP address.
5+
The option is therefore no longer a debug option and no longer requires
6+
the unsafe `--debug.dont_blame_oasis` flag.
7+
8+
This is a breaking configuration change. The following configuration
9+
option has been removed:
10+
11+
- `consensus.debug.allow_duplicate_ip`.
12+
13+
The following configuration option has been added:
14+
15+
- `consensus.p2p.allow_duplicate_ip`.

docs/development-setup/deploying-a-runtime.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ oasis-node \
334334
--runtime.supported $RUNTIME_ID \
335335
--runtime.paths $RUNTIME_ID=$RUNTIME_BINARY \
336336
--consensus.cometbft.debug.addr_book_lenient \
337-
--consensus.cometbft.debug.allow_duplicate_ip \
337+
--consensus.cometbft.p2p.allow_duplicate_ip \
338338
--consensus.cometbft.p2p.seed $SEED_NODE_ADDRESS \
339339
--debug.dont_blame_oasis \
340340
--debug.allow_test_keys

go/consensus/cometbft/config/config.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ type P2PConfig struct {
9090
DisablePeerExchange bool `yaml:"disable_peer_exchange"`
9191
// CometBFT max timeout when redialing a persistent peer (default: unlimited).
9292
PersistentPeersMaxDialPeriod time.Duration `yaml:"persistent_peers_max_dial_period"`
93+
94+
// Allow multiple P2P connections from the same IP.
95+
AllowDuplicateIP bool `yaml:"allow_duplicate_ip"`
9396
}
9497

9598
// SubmissionConfig is the transaction submission configuration.
@@ -171,8 +174,6 @@ type SupplementarySanityConfig struct {
171174
type DebugConfig struct {
172175
// Allow non-routable addresses in P2P address book.
173176
P2PAddrBookLenient bool `yaml:"addr_book_lenient,omitempty"`
174-
// Allow multiple P2P connections from the same IP.
175-
P2PAllowDuplicateIP bool `yaml:"allow_duplicate_ip,omitempty"`
176177

177178
// Enable automatic recovery from corrupted WAL during replay (UNSAFE).
178179
UnsafeReplayRecoverCorruptedWAL bool `yaml:"unsafe_replay_recover_corrupted_wal,omitempty"`

go/consensus/cometbft/full/full.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ func (t *fullService) lazyInit() error { // nolint: gocyclo
630630
cometConfig.P2P.UnconditionalPeerIDs = strings.Join(unconditionalPeers, ",")
631631
cometConfig.P2P.Seeds = strings.Join(seeds, ",")
632632
cometConfig.P2P.AddrBookStrict = !(config.GlobalConfig.Consensus.Debug.P2PAddrBookLenient && cmflags.DebugDontBlameOasis())
633-
cometConfig.P2P.AllowDuplicateIP = config.GlobalConfig.Consensus.Debug.P2PAllowDuplicateIP && cmflags.DebugDontBlameOasis()
633+
cometConfig.P2P.AllowDuplicateIP = config.GlobalConfig.Consensus.P2P.AllowDuplicateIP
634634
cometConfig.RPC.ListenAddress = ""
635635

636636
if len(sentryUpstreamAddrs) > 0 {

go/consensus/cometbft/seed/seed.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ func New(dataDir string, identity *identity.Identity, doc *genesis.Document) (*S
173173
p2pCfg.SendRate = config.GlobalConfig.Consensus.P2P.SendRate
174174
p2pCfg.RecvRate = config.GlobalConfig.Consensus.P2P.RecvRate
175175
p2pCfg.AddrBookStrict = !(config.GlobalConfig.Consensus.Debug.P2PAddrBookLenient && cmflags.DebugDontBlameOasis())
176-
p2pCfg.AllowDuplicateIP = config.GlobalConfig.Consensus.Debug.P2PAllowDuplicateIP && cmflags.DebugDontBlameOasis()
176+
p2pCfg.AllowDuplicateIP = config.GlobalConfig.Consensus.P2P.AllowDuplicateIP
177177

178178
nodeKey := &cmtp2p.NodeKey{PrivKey: crypto.SignerToCometBFT(identity.P2PSigner)}
179179

go/oasis-test-runner/oasis/byzantine.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func (worker *Byzantine) ModifyConfig() error {
6565
worker.Config.Consensus.ListenAddress = allInterfacesAddr + ":" + strconv.Itoa(int(worker.consensusPort))
6666
worker.Config.Consensus.ExternalAddress = localhostAddr + ":" + strconv.Itoa(int(worker.consensusPort))
6767

68-
worker.Config.Consensus.Debug.P2PAllowDuplicateIP = true
68+
worker.Config.Consensus.P2P.AllowDuplicateIP = true
6969
worker.Config.Consensus.Debug.P2PAddrBookLenient = true
7070

7171
worker.Config.P2P.Port = worker.p2pPort

go/oasis-test-runner/oasis/network.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ func (net *Network) startOasisNode(
680680
}
681681

682682
cfg.Consensus.Debug.P2PAddrBookLenient = true
683-
cfg.Consensus.Debug.P2PAllowDuplicateIP = true
683+
cfg.Consensus.P2P.AllowDuplicateIP = true
684684
cfg.Consensus.UpgradeStopDelay = 10 * time.Second
685685

686686
extraArgs = extraArgs.debugAllowDebugEnclaves()

0 commit comments

Comments
 (0)