-
Notifications
You must be signed in to change notification settings - Fork 2
feat: Allow fetching rollkitmngr state in rollkit-migrate
command for attester sets
#175
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: julienrbrt <[email protected]>
… and validation Co-authored-by: julienrbrt <[email protected]>
Co-authored-by: julienrbrt <[email protected]>
rollkit-migrate
commandrollkit-migrate
command for attester sets
server/migration_cmd.go
Outdated
// Set up encoding config | ||
encCfg := testutil.MakeTestEncodingConfig(rollkitmngr.AppModuleBasic{}) | ||
|
||
// Try multiple key formats to find the sequencer data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is far too hacky. recreate the collections and use the store.
then use that collections to query the state.
the collections definition is defined in the keeper.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced the hacky multiple key format attempts with proper collections framework usage. The implementation now recreates the collections schema as defined in keeper.go and uses sequencerCollection.Get(ctx)
to query the state properly. Commit c0a9468
rollkit-migrate
command for attester setsrollkit-migrate
command for attester sets
…ollkitmngr state querying Co-authored-by: julienrbrt <[email protected]>
server/migration_cmd.go
Outdated
return nil, fmt.Errorf("sequencer not found in rollkitmngr state") | ||
} | ||
|
||
// Store it in the context's store so collections can find it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider the store is read only. DO NOT CHANGE THE APP STORE. you should solely get info from it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Removed the store modification and now only read from the database directly using the collections key format. The store remains read-only throughout the process. Commit 4aa5521
…itmngr state Co-authored-by: julienrbrt <[email protected]>
sequencerAddr = cometBFTState.LastValidators.Validators[0].Address.Bytes() | ||
sequencerPubKey = cometBFTState.LastValidators.Validators[0].PubKey | ||
// If the cometbft validators are > 0, fetch the rollkitmngr state to get the sequencer | ||
if len(cometBFTState.LastValidators.Validators) > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we error joins those errors? as it will be lost otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Now using errors.Join to properly combine the validator count error with the rollkitmngr state error, preserving the error chain for better debugging. Commit 229d533
Co-authored-by: julienrbrt <[email protected]>
The
rollkit-migrate
command previously assumed single validator setups and used the first validator as the sequencer. This failed for chains using attester sets where the first validator may not be the actual sequencer.Problem
When using an attester set (multiple validators), the migration command would fail with:
This occurred because the command couldn't determine which validator was the actual sequencer from the CometBFT validator set alone.
Solution
Enhanced the migration command to fetch sequencer information from the rollkitmngr module state when multiple validators are present:
Key Changes
createRollkitMigrationGenesis()
: Added conditional logic to query rollkitmngr state for multiple validatorsgetSequencerFromRollkitMngrState()
: Handles database access and sequencer extraction with multiple key format strategiesExample Usage
The implementation maintains full backward compatibility while enabling migration for chains using attester sets.
Fixes #164.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.