Skip to content

Commit bb21777

Browse files
rootulpclaude
andcommitted
merge: resolve conflicts with upstream/main
Upstream PR #2811 removed mempool type from config.toml template which conflicts with this branch. Take upstream's changes since CAT is the only mempool after this PR. Updated test to only check "cat" and "nop" types (removed "flood" and "priority" which no longer exist). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2 parents 55fd952 + 077961a commit bb21777

File tree

7 files changed

+41
-70
lines changed

7 files changed

+41
-70
lines changed

config/toml.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -341,15 +341,6 @@ dial_timeout = "{{ .P2P.DialTimeout }}"
341341
#######################################################
342342
[mempool]
343343
344-
# The type of mempool for this node to use.
345-
#
346-
# Possible types:
347-
# - "cat" : content addressable mempool (default)
348-
# - "nop" : nop-mempool (short for no operation; the ABCI app is responsible
349-
# for storing, disseminating and proposing txs). "create_empty_blocks=false" is
350-
# not supported.
351-
type = "{{ .Mempool.Type }}"
352-
353344
# Recheck (default: true) defines whether CometBFT should recheck the
354345
# validity for all remaining transaction in the mempool after a block.
355346
# Since a block affects the application state, some transactions in the

config/toml_test.go

Lines changed: 16 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -83,38 +83,22 @@ func assertValidConfig(t *testing.T, configFile string) {
8383
}
8484
}
8585

86-
func TestMempoolTypeTemplate(t *testing.T) {
87-
// Test that mempool type is correctly templated and not hardcoded
88-
testCases := []struct {
89-
name string
90-
mempoolType string
91-
}{
92-
{"cat", config.MempoolTypeCAT},
93-
{"nop", config.MempoolTypeNop},
94-
}
86+
func TestMempoolTypeNotInTemplate(t *testing.T) {
87+
cfg := test.ResetTestRoot("mempool-type-not-in-template")
88+
defer os.RemoveAll(cfg.RootDir)
89+
90+
configFile := filepath.Join(cfg.RootDir, config.DefaultConfigDir, config.DefaultConfigFileName)
91+
config.WriteConfigFile(configFile, cfg)
92+
93+
data, err := os.ReadFile(configFile)
94+
require.NoError(t, err)
95+
configContent := string(data)
9596

96-
for _, tc := range testCases {
97-
t.Run(tc.name, func(t *testing.T) {
98-
// Create test root with config
99-
cfg := test.ResetTestRoot(fmt.Sprintf("mempool-type-%s", tc.mempoolType))
100-
defer os.RemoveAll(cfg.RootDir)
101-
102-
// Set mempool type
103-
cfg.Mempool.Type = tc.mempoolType
104-
105-
// Write config using template
106-
configFile := filepath.Join(cfg.RootDir, config.DefaultConfigDir, config.DefaultConfigFileName)
107-
config.WriteConfigFile(configFile, cfg)
108-
109-
// Read generated config file
110-
data, err := os.ReadFile(configFile)
111-
require.NoError(t, err)
112-
configContent := string(data)
113-
114-
// Verify mempool type is correctly rendered
115-
expectedLine := fmt.Sprintf("type = \"%s\"", tc.mempoolType)
116-
assert.Contains(t, configContent, expectedLine,
117-
"Config should contain the correct mempool type")
118-
})
97+
// The mempool type field should not appear in the generated config.
98+
// Use a specific pattern to avoid matching unrelated fields like trace_type.
99+
for _, mempoolType := range []string{"cat", "nop"} {
100+
pattern := fmt.Sprintf("type = \"%s\"", mempoolType)
101+
assert.NotContains(t, configContent, pattern,
102+
"Config should not contain mempool type field")
119103
}
120104
}

consensus/byzantine_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ func TestByzantinePrevoteEquivocation(t *testing.T) {
237237
}
238238

239239
// omit the last signature in the commit
240+
require.NotEmpty(t, extCommit.ExtendedSignatures)
240241
extCommit.ExtendedSignatures[len(extCommit.ExtendedSignatures)-1] = types.NewExtendedCommitSigAbsent()
241242

242243
if lazyProposer.privValidatorPubKey == nil {
@@ -316,7 +317,7 @@ func TestByzantinePrevoteEquivocation(t *testing.T) {
316317
}
317318

318319
// Stop watching after a reasonable number of blocks to prevent hanging
319-
if blockCount >= 10 {
320+
if blockCount >= 30 {
320321
t.Logf("Validator %d watched %d blocks without finding evidence", i, blockCount)
321322
return
322323
}
@@ -335,9 +336,8 @@ func TestByzantinePrevoteEquivocation(t *testing.T) {
335336
assert.Equal(t, pubkey.Address(), ev.VoteA.ValidatorAddress)
336337
assert.Equal(t, prevoteHeight, ev.Height())
337338
t.Logf("Successfully found evidence: %v", ev)
338-
case <-time.After(20 * time.Second):
339-
// Increased timeout and better error message
340-
t.Fatalf("Timed out waiting for validators to commit evidence after 20 seconds")
339+
case <-time.After(60 * time.Second):
340+
t.Fatalf("Timed out waiting for validators to commit evidence after 60 seconds")
341341
}
342342
}
343343

consensus/reactor_test.go

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -508,12 +508,10 @@ func TestReactorVotingPowerChange(t *testing.T) {
508508
waitForAndValidateBlock(t, nVals, activeVals, blocksSubs, css)
509509
waitForAndValidateBlock(t, nVals, activeVals, blocksSubs, css)
510510

511-
if css[0].GetRoundState().LastValidators.TotalVotingPower() == previousTotalVotingPower {
512-
t.Fatalf(
513-
"expected voting power to change (before: %d, after: %d)",
514-
previousTotalVotingPower,
515-
css[0].GetRoundState().LastValidators.TotalVotingPower())
516-
}
511+
require.Eventually(t, func() bool {
512+
return css[0].GetRoundState().LastValidators.TotalVotingPower() != previousTotalVotingPower
513+
}, 10*time.Second, 100*time.Millisecond,
514+
"expected voting power to change from %d", previousTotalVotingPower)
517515

518516
updateValidatorTx = kvstore.MakeValSetChangeTx(val1PubKeyABCI, 2)
519517
previousTotalVotingPower = css[0].GetRoundState().LastValidators.TotalVotingPower()
@@ -523,12 +521,10 @@ func TestReactorVotingPowerChange(t *testing.T) {
523521
waitForAndValidateBlock(t, nVals, activeVals, blocksSubs, css)
524522
waitForAndValidateBlock(t, nVals, activeVals, blocksSubs, css)
525523

526-
if css[0].GetRoundState().LastValidators.TotalVotingPower() == previousTotalVotingPower {
527-
t.Fatalf(
528-
"expected voting power to change (before: %d, after: %d)",
529-
previousTotalVotingPower,
530-
css[0].GetRoundState().LastValidators.TotalVotingPower())
531-
}
524+
require.Eventually(t, func() bool {
525+
return css[0].GetRoundState().LastValidators.TotalVotingPower() != previousTotalVotingPower
526+
}, 10*time.Second, 100*time.Millisecond,
527+
"expected voting power to change from %d", previousTotalVotingPower)
532528

533529
updateValidatorTx = kvstore.MakeValSetChangeTx(val1PubKeyABCI, 26)
534530
previousTotalVotingPower = css[0].GetRoundState().LastValidators.TotalVotingPower()
@@ -538,12 +534,10 @@ func TestReactorVotingPowerChange(t *testing.T) {
538534
waitForAndValidateBlock(t, nVals, activeVals, blocksSubs, css)
539535
waitForAndValidateBlock(t, nVals, activeVals, blocksSubs, css)
540536

541-
if css[0].GetRoundState().LastValidators.TotalVotingPower() == previousTotalVotingPower {
542-
t.Fatalf(
543-
"expected voting power to change (before: %d, after: %d)",
544-
previousTotalVotingPower,
545-
css[0].GetRoundState().LastValidators.TotalVotingPower())
546-
}
537+
require.Eventually(t, func() bool {
538+
return css[0].GetRoundState().LastValidators.TotalVotingPower() != previousTotalVotingPower
539+
}, 10*time.Second, 100*time.Millisecond,
540+
"expected voting power to change from %d", previousTotalVotingPower)
547541
}
548542

549543
func TestReactorValidatorSetChanges(t *testing.T) {

consensus/state_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,9 @@ func TestStateBadProposal(t *testing.T) {
257257
}
258258

259259
func TestStateOversizedBlock(t *testing.T) {
260-
ensureTimeout = 500 * time.Millisecond
260+
origTimeout := ensureTimeout
261+
ensureTimeout = 2 * time.Second
262+
defer func() { ensureTimeout = origTimeout }()
261263
const maxBytes = int64(types.BlockPartSizeBytes)
262264

263265
for _, testCase := range []struct {

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ require (
5454
golang.org/x/net v0.50.0
5555
golang.org/x/sync v0.19.0
5656
gonum.org/v1/gonum v0.17.0
57-
google.golang.org/grpc v1.78.0
57+
google.golang.org/grpc v1.79.1
5858
google.golang.org/protobuf v1.36.11
5959
)
6060

@@ -325,7 +325,7 @@ require (
325325
golang.org/x/sys v0.41.0 // indirect
326326
golang.org/x/text v0.34.0 // indirect
327327
golang.org/x/tools v0.42.0 // indirect
328-
google.golang.org/genproto/googleapis/rpc v0.0.0-20251029180050-ab9386a59fda // indirect
328+
google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect
329329
gopkg.in/warnings.v0 v0.1.2 // indirect
330330
gopkg.in/yaml.v3 v3.0.1 // indirect
331331
gotest.tools v2.2.0+incompatible // indirect

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -999,15 +999,15 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7
999999
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
10001000
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
10011001
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
1002-
google.golang.org/genproto/googleapis/rpc v0.0.0-20251029180050-ab9386a59fda h1:i/Q+bfisr7gq6feoJnS/DlpdwEL4ihp41fvRiM3Ork0=
1003-
google.golang.org/genproto/googleapis/rpc v0.0.0-20251029180050-ab9386a59fda/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk=
1002+
google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 h1:gRkg/vSppuSQoDjxyiGfN4Upv/h/DQmIR10ZU8dh4Ww=
1003+
google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk=
10041004
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
10051005
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
10061006
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
10071007
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
10081008
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
1009-
google.golang.org/grpc v1.78.0 h1:K1XZG/yGDJnzMdd/uZHAkVqJE+xIDOcmdSFZkBUicNc=
1010-
google.golang.org/grpc v1.78.0/go.mod h1:I47qjTo4OKbMkjA/aOOwxDIiPSBofUtQUI5EfpWvW7U=
1009+
google.golang.org/grpc v1.79.1 h1:zGhSi45ODB9/p3VAawt9a+O/MULLl9dpizzNNpq7flY=
1010+
google.golang.org/grpc v1.79.1/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ=
10111011
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
10121012
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
10131013
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=

0 commit comments

Comments
 (0)