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(block): move da init to NewNode instead of NewManager #1332

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

Conversation

mtsitrin
Copy link
Contributor

This allows to spin up a lightweight block manager, without active SL client or DA client

@mtsitrin mtsitrin marked this pull request as ready for review January 14, 2025 18:23
@mtsitrin mtsitrin requested a review from a team as a code owner January 14, 2025 18:23
Copy link

codecov bot commented Jan 19, 2025

Codecov Report

Attention: Patch coverage is 47.82609% with 24 lines in your changes missing coverage. Please review.

Project coverage is 17.12%. Comparing base (ed72d9b) to head (eaf2be7).
Report is 50 commits behind head on main.

Files with missing lines Patch % Lines
node/node.go 40.00% 6 Missing and 3 partials ⚠️
types/rollapp_params.go 43.75% 6 Missing and 3 partials ⚠️
block/manager.go 57.14% 2 Missing and 1 partial ⚠️
da/stub/stub.go 0.00% 2 Missing ⚠️
types/state.go 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1332      +/-   ##
==========================================
- Coverage   17.72%   17.12%   -0.61%     
==========================================
  Files         187      203      +16     
  Lines       55555    60906    +5351     
==========================================
+ Hits         9849    10430     +581     
- Misses      44182    48870    +4688     
- Partials     1524     1606      +82     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mtsitrin mtsitrin requested a review from srene January 23, 2025 15:36
Copy link
Contributor

@srene srene left a comment

Choose a reason for hiding this comment

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

i think the current solution will not work since it loads the da type from genesis, and it may happen is not defined there (migrated rollapps) or it has changed since genesis definition. IMO there are three options to enable lightweight block manager, without active SL client or DA client.
1 - readd da type in config, and instead of instantiating the da from rollapp param, only validate the da created is the same as the rollapp param on blockmanager start(), and panic in case is not. this way da can be passed to the block manager.
2 - instead of creating the da in the NewManager() moving it to start() func. this way a lightweight block manager can be created without da.
3 - avoid that da init() creates any connection (e.g. with da light client), just reading config and init logic. this way it will not be a problem when creating lightweight block manager and it will not fail (it will just require valid config params, but could be default params).

dalcKV := store.NewPrefixKV(baseKV, dalcPrefix)
// Init the settlement layer client
/* ------------------------------ init DA layer ----------------------------- */
params, err := types.GetRollappParamsFromGenesis(genesis.AppState)
Copy link
Contributor

Choose a reason for hiding this comment

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

what if its a migrated rollapp, that does not have rollapp params defined in genesis? in that case i think it will fail to get rollapp params from genesis appstate

Copy link
Contributor

Choose a reason for hiding this comment

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

or also in case the da rollapp param is changed via gov proposal, the one defined in genesis wont be correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants