Skip to content

feat(config): add EventBusBufferCapacity setting - #5849

Merged
swift1337 merged 15 commits into
cometbft:mainfrom
JayT106:feat/event-bus-buffer-capacity
Jun 5, 2026
Merged

swift1337 merged 15 commits into
cometbft:mainfrom
JayT106:feat/event-bus-buffer-capacity

Conversation

@JayT106

@JayT106 JayT106 commented May 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Currently it's noway to turn on a buffered eventbus in cometBFT, this PR add new config settings to let downstream projects to be able to turn on without fork/patch cometBFT repo.

  • Add event_bus_buffer_capacity field to BaseConfig (default 0, preserves existing unbuffered behavior).
  • Wire the value through node.createAndStartEventBus to types.NewEventBusWithBufferCapacity.
  • Surface the new field in the generated config.toml template.

Expose the EventBus pubsub buffer capacity via a new `event_bus_buffer_capacity`
BaseConfig field. Defaults to 0 (unbuffered) to preserve current behavior.
Wires through node.createAndStartEventBus to call
types.NewEventBusWithBufferCapacity.
@JayT106
JayT106 requested a review from a team as a code owner May 8, 2026 15:08
@greptile-apps

greptile-apps Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor

PR author is not in the allowed authors list.

@JayT106

JayT106 commented May 8, 2026 •

Copy link
Copy Markdown
Contributor Author

If the PR approved, please backport to v0.38.x/v0.39.x, thanks.

ref #5578

@aljo242 aljo242 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed and validated locally:
go test ./config ./node -run TestNodeStartStop -count=1

LGTM. Config plumbing and event bus construction changes are straightforward and preserve default behavior (0 remains unbuffered).

Comment thread node/setup.go Resolved

@aljo242 aljo242 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requesting test

JayT106 added a commit to JayT106/cometbft that referenced this pull request May 21, 2026
Verify NewEventBus defaults to an unbuffered (cap=0) bus and that
NewEventBusWithBufferCapacity propagates the capacity to the underlying
pubsub server. Also demonstrate the buffering limit by publishing to an
unstarted bus: publishes up to the cap succeed while the next one blocks
and times out via the context deadline.

Adds an EventBus.BufferCapacity getter that proxies to the pubsub server
so external callers and tests can inspect the configured value.

Addresses review feedback on cometbft#5849.
Verify NewEventBus defaults to an unbuffered (cap=0) bus and that
NewEventBusWithBufferCapacity propagates the capacity to the underlying
pubsub server. Also demonstrate the buffering limit by publishing to an
unstarted bus: publishes up to the cap succeed while the next one blocks
and times out via the context deadline.

Adds an EventBus.BufferCapacity getter that proxies to the pubsub server
so external callers and tests can inspect the configured value.

Addresses review feedback on cometbft#5849.
@JayT106
JayT106 force-pushed the feat/event-bus-buffer-capacity branch from 46bd381 to 5795da4 Compare May 21, 2026 14:25
@JayT106

JayT106 commented May 21, 2026

Copy link
Copy Markdown
Contributor Author

requesting test

Done!

@aljo242

aljo242 commented May 21, 2026

Copy link
Copy Markdown
Collaborator

one gap - no validation on negative values. event_bus_buffer_capacity = -1 in config panics at node startup (make(chan T, -1)). worth a >= 0 check in ValidateBasic.

JayT106 added a commit to JayT106/cometbft that referenced this pull request May 22, 2026
Adds a `>= 0` check in BaseConfig.ValidateBasic so that a negative
event_bus_buffer_capacity is rejected at config-load time rather than
panicking at node startup via `make(chan T, -1)`.

Addresses review feedback on cometbft#5849.
Adds a `>= 0` check in BaseConfig.ValidateBasic so that a negative
event_bus_buffer_capacity is rejected at config-load time rather than
panicking at node startup via `make(chan T, -1)`.

Addresses review feedback on cometbft#5849.
@JayT106

JayT106 commented May 22, 2026

Copy link
Copy Markdown
Contributor Author

one gap - no validation on negative values. event_bus_buffer_capacity = -1 in config panics at node startup (make(chan T, -1)). worth a >= 0 check in ValidateBasic.

Updated.

aljo242 pushed a commit that referenced this pull request May 26, 2026
Adds a `>= 0` check in BaseConfig.ValidateBasic so that a negative
event_bus_buffer_capacity is rejected at config-load time rather than
panicking at node startup via `make(chan T, -1)`.

Addresses review feedback on #5849.
@swift1337 swift1337 added the backport-to-v0.38.x Tell Mergify to backport the PR to v0.38.x label Jun 5, 2026
@swift1337 swift1337 added the backport-to-v0.39.x Tell Mergify to backport the PR to v0.39.x label Jun 5, 2026
@swift1337
swift1337 enabled auto-merge June 5, 2026 11:28
@swift1337
swift1337 added this pull request to the merge queue Jun 5, 2026
Merged via the queue into cometbft:main with commit 4df23c5 Jun 5, 2026
2 checks passed
mergify Bot added a commit that referenced this pull request Jun 11, 2026
)

## Summary
Currently it's noway to turn on a buffered eventbus in cometBFT, this PR
add new config settings to let downstream projects to be able to turn on
without fork/patch cometBFT repo.

- Add `event_bus_buffer_capacity` field to `BaseConfig` (default `0`,
preserves existing unbuffered behavior).
- Wire the value through `node.createAndStartEventBus` to
`types.NewEventBusWithBufferCapacity`.
- Surface the new field in the generated `config.toml` template.
<hr>This is an automatic backport of pull request #5849 done by
[Mergify](https://mergify.com).

---------

Co-authored-by: JayT106 <[email protected]>
Co-authored-by: Alex | Cosmos Labs <[email protected]>
aljo242 added a commit that referenced this pull request Jun 12, 2026
)

## Summary
Currently it's noway to turn on a buffered eventbus in cometBFT, this PR
add new config settings to let downstream projects to be able to turn on
without fork/patch cometBFT repo.

- Add `event_bus_buffer_capacity` field to `BaseConfig` (default `0`,
preserves existing unbuffered behavior).
- Wire the value through `node.createAndStartEventBus` to
`types.NewEventBusWithBufferCapacity`.
- Surface the new field in the generated `config.toml` template.
<hr>This is an automatic backport of pull request #5849 done by
[Mergify](https://mergify.com).

---------

Co-authored-by: JayT106 <[email protected]>
Co-authored-by: Alex | Cosmos Labs <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
kevindharmawan pushed a commit to SeeMoReLab/cometbft that referenced this pull request Jul 30, 2026
## Summary
Currently it's noway to turn on a buffered eventbus in cometBFT, this PR
add new config settings to let downstream projects to be able to turn on
without fork/patch cometBFT repo.

- Add `event_bus_buffer_capacity` field to `BaseConfig` (default `0`,
preserves existing unbuffered behavior).
- Wire the value through `node.createAndStartEventBus` to
`types.NewEventBusWithBufferCapacity`.
- Surface the new field in the generated `config.toml` template.

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Dmitry S <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-to-v0.38.x Tell Mergify to backport the PR to v0.38.x backport-to-v0.39.x Tell Mergify to backport the PR to v0.39.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants