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

StateTransitionRunner refactoring. #614

Merged
merged 10 commits into from
Aug 7, 2023
Merged

StateTransitionRunner refactoring. #614

merged 10 commits into from
Aug 7, 2023

Conversation

bkolad
Copy link
Member

@bkolad bkolad commented Aug 3, 2023

Description

The goal of this PR is to restructure the logic for running the rollup, enabling it to function with various combinations of Runtime/Data-Availability/State-Transition-Function. This modification has several benefits:

  1. It makes the logic independent of a particular rollup (currently it is hardcoded in demo-rollup).
  2. Simplifies testing (point 1).
  3. Facilitates the implementation of in-memory DA.

After this PR, the responsibilities of the relevant components are as follows:

  • sov-stf-runner: Abstracts the logic for executing the STF.
  • demo-stf: Contains code specific to a particular Runtime, including hooks, configs, and a concrete STFR.
  • demo-rollup: Uses both sov-stf-runner and demo-stf, acting as the glue code to initiate the rollup process.

The changes introduced in this PR are as follows:

  1. StateTransitionRunner(STFR) is transformed into a concrete type and moved from the rollup-interface to a separate crate full-node/sov-stf-runner. By making it a concrete type, we were able to eliminate DemoAppRunner, NativeAppRunner, and DemoApp, all of which essentially represent the same type beneath the surface. To simplify matters, we removed DaVerifier from the STFR since it was initially included solely for demonstration purposes. However, it can easily be reintroduced if necessary. The logic for running the rollup lives in the run method.

  2. We eliminated the RpcRunner trait. As there were no methods or types reliant on this trait, so we didn't really make use of it.

  3. All the ledger_XXX rpc methods ware moved to sov-stf-runner because they are common to any kind of rollup.

Future work:

  1. Implement MockDA and test sov-stf-runner.
  2. The demo-prover/host also has blob processing logic which is similar to the one in STFR, but it simultaneously writes to the host. If we hide the host behind a trait and make it a noop for the node we will be able to extend STFR and use it both in the prover & node
  3. The code in sov-stf-runner was mostly copied from demo-stf & demo-rollup and it needs to be cleanup further. For example we have many different Configs with the same name. The code is mostly internal to the crate and don't leak outside.

Linked Issues

  • Fixes # (issue, if applicable)
  • Related to # (issue)

Testing

Ci passes.

Docs

All related docs to StateTransitionRunner updated.

@codecov
Copy link

codecov bot commented Aug 3, 2023

@bkolad bkolad changed the title WIP rollup runner WIP rollup runner: NOT READY Aug 3, 2023
@bkolad bkolad force-pushed the blaze/rollup_runner branch from 6d6e05d to 9f3aaf6 Compare August 4, 2023 08:06
@bkolad bkolad changed the title WIP rollup runner: NOT READY StateTransitionRunner refactoring. Aug 7, 2023
@bkolad bkolad marked this pull request as ready for review August 7, 2023 12:55
@citizen-stig
Copy link
Member

@bkolad, does design in this PR accommodates running a prover? Or is it only for a full node?

@bkolad bkolad requested a review from citizen-stig August 7, 2023 13:14
@bkolad
Copy link
Member Author

bkolad commented Aug 7, 2023

2. The demo-prover/host also has blob processing logic which is similar to the one in STFR, but it simultaneously writes to the host. If we hide the host behind a trait and make it a noop for the node we will be able to extend STFR and use it both in the prover & node

Future work:
"The demo-prover/host also has blob processing logic which is similar to the one in STFR, but it simultaneously writes to the host. If we hide the host behind a trait and make it a noop for the node we will be able to extend STFR and use it both in the prover & node"

Copy link
Member

@preston-evans98 preston-evans98 left a comment

Choose a reason for hiding this comment

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

Looks amazing overall. Just two small things!

@bkolad bkolad merged commit 63ba774 into nightly Aug 7, 2023
@bkolad bkolad deleted the blaze/rollup_runner branch August 7, 2023 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants