Skip to content

Align minCompatibleTime settings across TestNetwork and Network #3842

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

michaelkaplan13
Copy link
Contributor

@michaelkaplan13 michaelkaplan13 commented Mar 26, 2025

Why this should be merged

Aligns TestNetwork compatibility with the Network created for full AvalancheGo nodes here. This should be updated in the future when required network upgrades are scheduled.

How this works

Passes the full UpgradeConfig to NewNetwork such that all callers (currently just node.go and test_network.go will use the same upgrade as the minimum compatible timestamp. This reduces the number of places where changes need to be made for each network upgrade in order to have Network instances be compatible.

It also results in the min compatible time of the TestNetwork being bumped to the FortunaTime.

How this was tested

N/A

Need to be documented in RELEASES.md?

No

Copy link
Contributor

@cam-schultz cam-schultz left a comment

Choose a reason for hiding this comment

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

Could we instead remove minCompatibilityTime from NewNetwork altogether, and use FortunaTime in all instances? That way the activation time used by the test network is covered by general Network upgrade tests (i.e. e2e tests that run full nodes).

@michaelkaplan13
Copy link
Contributor Author

Could we instead remove minCompatibilityTime from NewNetwork altogether, and use FortunaTime in all instances? That way the activation time used by the test network is covered by general Network upgrade tests (i.e. e2e tests that run full nodes).

I debated that, or adding the minCompatibleTime to the upgrade.Config somehow, so that nothing in the Network code needs to be changed for future network upgrades.

I think the minCompatibleTime can be defined as the time of the next scheduled network upgrade activation or, if there are no scheduled upgrades in the future, the time the last network upgrade activated.

Either way, I agree minimizing the number of places updates need to be made should be the goal in order to reduce the chance that any are missed in the future.

@michaelkaplan13
Copy link
Contributor Author

Could we instead remove minCompatibilityTime from NewNetwork altogether, and use FortunaTime in all instances? That way the activation time used by the test network is covered by general Network upgrade tests (i.e. e2e tests that run full nodes).

I updated the PR to this approach now. I agree it's less error prone since there's only one place where the minCompatibleTime is defined, and should be covered in the E2E tests. The downside is needing to pass the full upgrade.Config to NewNetwork, and the minCompatibleTime definition being embedded in the implementation is harder to find.

I'm pretty indifferent between the options myself really, open to everyone's input.

@@ -175,7 +176,7 @@ type network struct {
// NewNetwork returns a new Network implementation with the provided parameters.
func NewNetwork(
config *Config,
minCompatibleTime time.Time,
upgradeConfig upgrade.Config,
Copy link
Contributor

@joshua-kim joshua-kim Mar 27, 2025

Choose a reason for hiding this comment

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

This change in the to depend on upgrade looks unrelated to the intent of this PR to me... can we remove changes that aren't in test_network.go form the diff?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See Cam's comment above for the context here. We can do this just by updating test_network.go (as we had originally), but that would make it such that multiple places need to be updated for every network upgrade to ensure compatibility, which is more error prone. This approach makes it so that the minCompatibleTime only needs to be updated in a single place, but requires then passing the full upgrade.Config to NewNetwork.

Open to whichever is preferred on your side.

@michaelkaplan13 michaelkaplan13 changed the title Set TestNetwork minCompatibleTime to Fortuna Activation Align minCompatibleTime settings across TestNetwork and Network Apr 21, 2025
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