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

refactor(composer): streamline geth and executor run_until_stopped #1361

Conversation

ethanoroshiba
Copy link
Contributor

@ethanoroshiba ethanoroshiba commented Aug 12, 2024

Summary

Shortened and streamlined geth and executor run_until_stopped() functions to get rid of clippy exceptions and ensure events are emitted within spans.

Background

#1326 removed instrumentation on these run_until_stopped() functions, which revealed a clippy warning for too many lines. Additionally, this made it so that logging inside these functions would not be emitted within any span.

Changes

  • Delegated many tasks to helper functions with instrumentation.
  • Created new utils module to house a shared report_exit_reason() function.
  • Moved ensure_chain_id_is_correct() and get_latest_nonce() to init() (previosuly pre_run_checks())

Testing

Passing all tests.

Related Issues

Part of #1321

@github-actions github-actions bot added the composer pertaining to composer label Aug 12, 2024
@ethanoroshiba ethanoroshiba marked this pull request as ready for review August 12, 2024 15:46
@ethanoroshiba ethanoroshiba requested a review from a team as a code owner August 12, 2024 15:46
Copy link
Contributor

@Fraser999 Fraser999 left a comment

Choose a reason for hiding this comment

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

A few nitpicks, but the moved logic all seems to be unchanged.

crates/astria-composer/src/executor/mod.rs Outdated Show resolved Hide resolved
crates/astria-composer/src/executor/mod.rs Outdated Show resolved Hide resolved
crates/astria-composer/src/executor/mod.rs Outdated Show resolved Hide resolved
crates/astria-composer/src/executor/mod.rs Outdated Show resolved Hide resolved
crates/astria-composer/src/executor/mod.rs Outdated Show resolved Hide resolved
crates/astria-composer/src/executor/mod.rs Outdated Show resolved Hide resolved
crates/astria-composer/src/executor/mod.rs Outdated Show resolved Hide resolved
crates/astria-composer/src/executor/mod.rs Outdated Show resolved Hide resolved
crates/astria-composer/src/executor/mod.rs Outdated Show resolved Hide resolved
crates/astria-composer/src/collectors/geth.rs Outdated Show resolved Hide resolved
ethanoroshiba and others added 2 commits August 14, 2024 07:09
Co-authored-by: Fraser Hutchison <190532+Fraser999@users.noreply.github.com>
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.

Looks mosly fine except for some oddities.

Requesting changes because an early return in the select loop skips shutdown logic.

crates/astria-composer/src/executor/mod.rs Outdated Show resolved Hide resolved
} else {
// log all the bundles that have not been drained
let report: Vec<SizedBundleReport> =
bundles_to_drain.iter().map(SizedBundleReport).collect();
Copy link
Member

Choose a reason for hiding this comment

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

I think we might be able to avoid the extra allocation here entirely by using: https://docs.rs/serde/latest/serde/ser/trait.Serializer.html#method.collect_seq. But leave it to a followup probably.

crates/astria-composer/src/executor/mod.rs Outdated Show resolved Hide resolved
crates/astria-composer/src/executor/mod.rs Outdated Show resolved Hide resolved
crates/astria-composer/src/utils.rs Outdated Show resolved Hide resolved
crates/astria-composer/src/utils.rs Outdated Show resolved Hide resolved
crates/astria-composer/src/executor/mod.rs Outdated Show resolved Hide resolved
crates/astria-composer/src/executor/mod.rs Outdated Show resolved Hide resolved
crates/astria-composer/src/executor/mod.rs Outdated Show resolved Hide resolved
crates/astria-composer/src/collectors/geth.rs Outdated Show resolved Hide resolved
crates/astria-composer/src/collectors/geth.rs Outdated Show resolved Hide resolved
crates/astria-composer/src/collectors/geth.rs Outdated Show resolved Hide resolved
crates/astria-composer/src/executor/mod.rs Outdated Show resolved Hide resolved
crates/astria-composer/src/executor/mod.rs Outdated Show resolved Hide resolved
ethanoroshiba and others added 3 commits August 21, 2024 09:05
Co-authored-by: Richard Janis Goldschmidt <github@aberrat.io>
Co-authored-by: Richard Janis Goldschmidt <github@aberrat.io>
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.

Looks great, thank you for your work. Made a suggestion to clean up report_exit_reason, but otherwise this is good to merge.

crates/astria-composer/src/executor/mod.rs Outdated Show resolved Hide resolved
crates/astria-composer/src/executor/mod.rs Outdated Show resolved Hide resolved
crates/astria-composer/src/utils.rs Outdated Show resolved Hide resolved
@ethanoroshiba ethanoroshiba merged commit c876d2b into ENG-670/add_composer_instrumentation Aug 28, 2024
42 checks passed
@ethanoroshiba ethanoroshiba deleted the ENG-670/refactor_for_composer_instrumentation branch August 28, 2024 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-quality composer pertaining to composer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants