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(proto, conductor, cd)!: changes for Forma migration #1843

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

Conversation

ethanoroshiba
Copy link
Contributor

@ethanoroshiba ethanoroshiba commented Dec 3, 2024

Summary

Makes the changes necessary in the monorepo to migrate Forma to Mainnet.

Background

Migrating Forma to mainnet necessitates introducing stop and start logic into the Conductor. This makes the proto and Conductor changes necessary for that. In addition to this, this will allow for future needs to stop and start EVMs on our networks. These changes will also need to be reflected in the GenesisInfo sent by rollups to the conductor.

The shutdown and restart logic for the Conductor should be as follows:

  • Firm Only Mode: Once the stop height is reached for the firm block stream, the firm block at this height is executed (and commitment state updated) before restarting the internal conductor, prompting the rollup for a new GenesisInfo with new start/stop heights (and potentially chain IDs).
  • Soft and Firm Mode: Once the stop height is reached for the soft block stream, no more soft blocks are executed (including the one at the stop height). The firm block is still executed for this height, and then Conductor restarts.
  • Soft Only Mode: Once the stop height is reached for the soft block stream, no more soft blocks are executed (including the one at the stop height). Conductor is then restarted.

The aforementioned rollup changes to be made in astria-geth necessitate changing our current charts config for the following. "Forks" now describes a set of instructions for when and how to stop and restart the EVM at different heights, such that changes (such as network migration) can be made.

config:
        # < non astria-prefixed items... >
        AstriaOverrideGenesisExtraData:
        AstriaRollupName:
        AstriaForks: []
                # - < fork name >:
                #         height: ""
                #         halt: ""
                #         snapshotChecksum: ""
                #         extraDataOverride: ""
                #         feeCollector: ""
                #         EIP1559Params: {}
                #         sequencer:
                #                 chainId: ""
                #                 addressPrefix: ""
                #                 startHeight: ""
                #                 stopHeight: ""
                #         celestia:
                #                 chainId: ""
                #                 startHeight: ""
                #                 heightVariance: ""
                #         bridgeAddresses: []

Changes

  • Changed sequencer_genesis_block_height to sequencer_start_block_height in GenesisInfo (in the execution API).
  • Added sequencer_stop_block_height, rollup_start_block_height, sequencer_chain_id, and celestia_chain_id to GenesisInfo.
  • Changed sequencer to rollup height calculation to start from rollup_start_block_height in GenesisInfo, so that Conductor doesn't start from rollup height 1 again after restarting.
  • Removed sequencer and celestia chain ID environment vars from Conductor, and changed chain ID checks to rely on obtaining these from the initialized executor state.
  • Added astriaForks to EVM rollup config, to reflect changes in astria-geth: https://github.com/astriaorg/astria-geth/pull/59/files.
  • Added restart logic for when the stop height is reached.

Testing

  • Added restart logic to check_for_restart_ok unit test.
  • Added blackbox tests to ensure conductor correctly restarts in each mode, and continues to execute at the correct height after fetching updated genesis info and commitment state.

Changelogs

Changelogs updated

Breaking Changelist

  • Proto changes are not technically breaking, since fields were only added, but the old genesis info shape will be rejected since it does not contain the chain IDs to validate against the networks the conductor is connecting to (and would fail even if this was the case, due to sequencer_stop_block_height being read from wire format as 0). Thus, rollups will need to provide an updated GenesisInfo to conductor (includingastria-geth).
  • Broke domain type GenesisInfo

Related Issues

closes #1841

@github-actions github-actions bot added conductor pertaining to the astria-conductor crate proto pertaining to the Astria Protobuf spec cd labels Dec 3, 2024
@ethanoroshiba
Copy link
Contributor Author

Opening this for review despite failing status checks so that review isn't blocking on Geth changes. Once a Geth image can be pulled, we'll be able to run the smoke tests.

@ethanoroshiba ethanoroshiba marked this pull request as ready for review December 9, 2024 21:36
@ethanoroshiba ethanoroshiba requested review from a team as code owners December 9, 2024 21:36
@@ -14,9 +14,15 @@ message GenesisInfo {
// The rollup_id is the unique identifier for the rollup chain.
astria.primitive.v1.RollupId rollup_id = 1;
// The first block height of sequencer chain to use for rollup transactions.
uint32 sequencer_genesis_block_height = 2;
uint32 sequencer_start_block_height = 2;
Copy link
Member

Choose a reason for hiding this comment

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

Does this warrant a breaking change?

Copy link
Contributor Author

@ethanoroshiba ethanoroshiba Dec 10, 2024

Choose a reason for hiding this comment

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

I don't believe this would be a breaking change (even though the proto breaking changes lint would disagree), since the field is identified by the number itself as opposed to the name. The name change is just to more accurately reflect the new functionality, since conductor can now start from anywhere, not just genesis. I do think the proto changes at large are effectively breaking though, since the old shape will no longer work with with conductor (chain IDs will be empty strings, so the components will never pass initialization).

Copy link
Member

Choose a reason for hiding this comment

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

You are right that the name is indeed a better reflection of how this field is used.

However, I would in general be more conservative when changing APIs: a breaking change (in this case, in the JSON serialization) weighs heavier than a name that's no longer a completely honest representation of the functionality.

@SuperFluffy
Copy link
Member

Note on the PR: the document #1843 is private. Please put all relevant information into this PR without referring to an outside, private document.

@ethanoroshiba ethanoroshiba changed the title feat(proto, conductor)!: changes for Forma migration feat(proto, conductor, cd)!: changes for Forma migration Dec 12, 2024
sequencer_genesis_block_height: tendermint::block::Height,
sequencer_start_block_height: tendermint::block::Height,
/// The Sequencer block height to stop at.
sequencer_stop_block_height: tendermint::block::Height,
Copy link
Member

Choose a reason for hiding this comment

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

The case stop_block_height < start_block_height is not covered in the tests. Should they be?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, I think it would still just restart in this case? Josh introduced some logic such that if it receives a stop height of 0, it acts as if there is no stop block height. But in the case where stop block height is not 0 and is less than start block height, the conductor will go to execute and then just restart again, so the functionality should already be tested, but I can add a specific test for this scenario just to be sure if you'd like. In either case, if the stop height is ever below the start, I think something is wrong on the rollup end

crates/astria-core/src/execution/v1/mod.rs Outdated Show resolved Hide resolved
crates/astria-core/src/execution/v1/mod.rs Outdated Show resolved Hide resolved
@@ -61,14 +69,34 @@ impl GenesisInfo {
}

#[must_use]
pub fn sequencer_genesis_block_height(&self) -> tendermint::block::Height {
self.sequencer_genesis_block_height
pub fn sequencer_start_block_height(&self) -> tendermint::block::Height {
Copy link
Member

Choose a reason for hiding this comment

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

If you are breaking the astria-core anyway, let's make tendermint::block::Height an implementation detail and have this method return u32 instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Height supports Into<u64> but not u32, so I used that instead in 2f7ed73. Can convert again to u32 if preferred.

}

#[must_use]
pub fn sequencer_stop_block_height(&self) -> tendermint::block::Height {
Copy link
Member

Choose a reason for hiding this comment

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

Same here, let's have this return a u32 instead

crates/astria-conductor/src/executor/mod.rs Outdated Show resolved Hide resolved
crates/astria-conductor/src/executor/mod.rs Show resolved Hide resolved
crates/astria-conductor/src/executor/mod.rs Outdated Show resolved Hide resolved
@@ -396,6 +412,35 @@ impl Executor {
// TODO(https://github.com/astriaorg/astria/issues/624): add retry logic before failing hard.
Copy link
Member

Choose a reason for hiding this comment

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

Comment for above: the error cases are not actual errors but part of normal execution. As such, I would change the return type of execute_soft to encode if a restart should happen due to the max being reached.

@@ -457,19 +505,36 @@ impl Executor {
err,
))]
async fn execute_firm(&mut self, block: ReconstructedBlock) -> eyre::Result<()> {
Copy link
Member

Choose a reason for hiding this comment

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

The same arguments as for execute_soft also apply to execute_firm. Please see my comments there,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
allow-breaking-proto cd conductor pertaining to the astria-conductor crate override-freeze proto pertaining to the Astria Protobuf spec
Projects
None yet
Development

Successfully merging this pull request may close these issues.

proto, conductor: changes for Forma migration
3 participants