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

Use subnet public key diffs after Etna is activated #3502

Merged
merged 4 commits into from
Oct 29, 2024

Conversation

StephenButtolph
Copy link
Contributor

Why this should be merged

When existing networks upgrade from Pre-Etna to Post-Etna, the nodes in that network are only guaranteed to have populated the public key diffs for subnets after the transition.

This means that we can only safely use this new index after Etna has been activated.

However, we must use the new index after Etna is activated because the public keys are not guaranteed to be inherited from the primary network after Etna.

How this works

Uses the new public key diffs after Etna is activated (but not before).

How this was tested

Added multiple new unit tests.

Need to be documented in RELEASES.md?

There are no user facing changes.

@StephenButtolph StephenButtolph self-assigned this Oct 28, 2024
@StephenButtolph StephenButtolph added this to the v1.11.13 milestone Oct 28, 2024
Copy link
Contributor

@ceyonur ceyonur left a comment

Choose a reason for hiding this comment

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

just a nit

Comment on lines +2529 to +2531
if !s.upgrades.IsEtnaActivated(s.persistedTimestamp) && s.upgrades.IsEtnaActivated(s.timestamp) {
if err := database.PutUInt64(s.singletonDB, EtnaHeightKey, height); err != nil {
return fmt.Errorf("failed to write etna height: %w", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: should we check if we have already written it? In case where we can call the commit without advancing the chain (like disconnect?).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

persistedTimestamp is updated to equal timestamp immediately after this, and both of them are monotonically increasing. So this condition can only happen once.

vms/platformvm/state/state_interface_test.go Outdated Show resolved Hide resolved
@StephenButtolph StephenButtolph added this pull request to the merge queue Oct 29, 2024
Merged via the queue into master with commit f500dee Oct 29, 2024
23 checks passed
@StephenButtolph StephenButtolph deleted the use-subnet-public-key-diffs-after-etna branch October 29, 2024 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants