Skip to content

Conversation

@fbac
Copy link
Collaborator

@fbac fbac commented Aug 28, 2025

Require the database to exist when the migration server is enabled by triggering namespace derivation and namespaced DB initialization in main.main

Update main.main to broaden the conditional that gates namespace derivation and database initialization to also include options.MigrationServer.Enable alongside the existing Replication, Sync, and Indexer checks in main.go.

📍Where to Start

Start at the conditional in main.main in main.go that gates namespace derivation and namespaced database initialization.

Changes since #1074 opened

  • Added required field validation for signer private key when migration server is enabled [2b93b22]

Macroscope summarized 2b93b22.

@fbac fbac requested a review from a team as a code owner August 28, 2025 11:14
@graphite-app
Copy link

graphite-app bot commented Aug 28, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • Queue - adds this PR to the back of the merge queue
  • Hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

}

if options.Replication.Enable || options.Sync.Enable || options.Indexer.Enable {
if options.Replication.Enable || options.Sync.Enable || options.Indexer.Enable ||
Copy link
Collaborator

Choose a reason for hiding this comment

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

this means that the migrator needs to have the Signer.PrivateKey of the node. Otherwise we will compute a different namespace. Do we want to pass this info around?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's needed, as the migrator has to sign envelopes PayerEnvelope and OriginatorEnvelope both.

Copy link
Collaborator

Choose a reason for hiding this comment

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

do we expect to have a separate payer key for this? Or are we reusing the node key?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Separate payer key, already set up in testnet. That way we can properly identify the migrator "payer" if needed.

Copy link
Collaborator

Choose a reason for hiding this comment

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

the migrator has to share the DB With the sync and API nodes, right?

			if namespace == "" {
				namespace = utils.BuildNamespace(
					options.Signer.PrivateKey,
					options.Contracts.SettlementChain.NodeRegistryAddress,
				)
			}

So, to correctly determine the DB to share, it must have the same options.Signer.PrivateKey as the other services.

I guess it's okay if we have to provide both the node key and the payer key to the migrator. It just needs to be configured in the infra.

Copy link
Collaborator

Choose a reason for hiding this comment

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

the signer.private key should be checked in validateMigrationOptions

Copy link
Collaborator Author

@fbac fbac Aug 28, 2025

Choose a reason for hiding this comment

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

Yes, that's done. Maybe I explained myself wrong.
The migrator has two keys:

  • Separate payer key, to properly identify the migrator as an unique payer. Signs PayerEnvelopes.
  • Node private key, which currently is the same as node 100. It's the same key where the payer runs, and the infra reflects this. Signs OriginatorEnvelopes.

Copy link
Collaborator

Choose a reason for hiding this comment

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

makes sense. Can you add these keys to validateMigrationOptions? Approving otherwise

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added.

@fbac fbac merged commit 382ce23 into main Aug 29, 2025
10 checks passed
@fbac fbac deleted the 08-28-require_db_if_migrator branch August 29, 2025 13:26
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