Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sequencer, charts)!: support uds for abci #1877

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

joroshiba
Copy link
Member

@joroshiba joroshiba commented Dec 13, 2024

Summary

Add support to the sequencer to support running the ABCI connection over UDS instead of TCP only, updates to chart to use the UDS connection by default.

Background

Local testing found up to a 25x speed up using UDS instead of TCP loopback for ABCI communication. We can continue to offer the option of using TCP connections, and support the faster connection within our charts by default.

Changes

  • mild refactor of sequencer startup to move abci server start to it's own function, mirroring grpc server setup
  • replace old listen_addr config with new abci_listener_url config where protocol is used to inform sequencer whether to use tcp or unix

Testing

Synced a full node with mainnet, and tested with ABCI replay.

Changelogs

Changelogs updated.

Breaking Changelist

  • Removed ASTRIA_SEQUENCER_LISTEN_ADDR config variable, replaced with ASTRIA_SEQUENCER_ABCI_LISTENER_URL

Related Issues

closes #1891

@github-actions github-actions bot added sequencer pertaining to the astria-sequencer crate cd labels Dec 13, 2024
@joroshiba joroshiba force-pushed the joroshiba/uds-for-abci branch 4 times, most recently from 3b54ffc to 9a1a550 Compare December 16, 2024 22:36
@joroshiba joroshiba changed the title feat(sequencer): use uds for abci feat(sequencer, charts)!: use uds for abci Dec 16, 2024
@joroshiba joroshiba force-pushed the joroshiba/uds-for-abci branch from 55b645e to e931f1c Compare January 7, 2025 17:45
@joroshiba joroshiba changed the title feat(sequencer, charts)!: use uds for abci feat(sequencer, charts)!: support uds for abci Jan 7, 2025
@joroshiba joroshiba force-pushed the joroshiba/uds-for-abci branch from e931f1c to 6a0632a Compare January 7, 2025 17:51
@joroshiba joroshiba force-pushed the joroshiba/uds-for-abci branch from 6a0632a to 3daee25 Compare January 7, 2025 17:53
@joroshiba joroshiba requested a review from SuperFluffy January 7, 2025 17:55
@joroshiba joroshiba marked this pull request as ready for review January 7, 2025 17:55
@joroshiba joroshiba requested review from a team as code owners January 7, 2025 17:55
@joroshiba joroshiba requested a review from steezeburger January 7, 2025 17:55
Copy link
Member

@SuperFluffy SuperFluffy left a comment

Choose a reason for hiding this comment

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

From a high level this looks fine, but I would like to see a slightly more elegant approach that is unit testable by providing an enum for the two supported server URL kinds.

mempool_service: service::Mempool,
listen_url: &str,
server_exit_tx: oneshot::Sender<()>,
) -> Result<JoinHandle<()>, Report> {
Copy link
Member

Choose a reason for hiding this comment

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

Replace this by the eyre::Result type alias:

Suggested change
) -> Result<JoinHandle<()>, Report> {
) -> eyre::Result<JoinHandle<()>> {

service::Info::new(storage.clone()).wrap_err("failed initializing info service")?;
let snapshot_service = service::Snapshot;

// Builds the server but does not start listening.
Copy link
Member

Choose a reason for hiding this comment

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

Remove comment

.finish()
.ok_or_eyre("server builder didn't return server; are all fields set?")?;

// Validate and parse the listen_url received from the config.
Copy link
Member

Choose a reason for hiding this comment

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

This (as well as the subsequent server start) could be done more elegantly by providing a type AbciListenUrl with variants Tcp and Unix and implement FromStr for it. Then we could also have a few simple unit tests.

"unix" => match abci_url.to_file_path() {
Ok(_) => Ok(abci_url.path().to_string()),
Err(e) => Err(eyre!(
"failed parsing unix listen_addr file path, error: {:?}",
Copy link
Member

Choose a reason for hiding this comment

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

I figure eyre::WrapErr::wrap_err was not doable because this is a boxed error? We have solved a related issue in astria_eyre by wrapping the boxed error. You can then construct a proper chain:

eyre!(e).wrap_err("failed rasing unix listen_addr file path")

Copy link
Member

@SuperFluffy SuperFluffy left a comment

Choose a reason for hiding this comment

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

I have added an enum AbciListenUrl with variants Tcp and Uds, together with a FromStr impl. I have also moved the parse to the config because that seemed to be the appropriate place for it (sequencer always runs by binding to a socket; lazy eval at a later point does not seem to make sense in this case).

Final change was from ASTRIA_SEQUENCER_ABCI_LISTENER_URL to ASTRIA_SEQUENCER_ABCI_LISTEN_URL because we are listening on that socket, not expecting a listener (CometBFT connects to the app, not the other way round).

@SuperFluffy SuperFluffy enabled auto-merge January 17, 2025 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cd sequencer pertaining to the astria-sequencer crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for UDS ABCI connections
4 participants