Skip to content

Sync coreth test cleanup v2 #1623

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 19 commits into
base: master
Choose a base branch
from

Conversation

JonathanOppenheimer
Copy link
Member

@JonathanOppenheimer JonathanOppenheimer commented Jul 9, 2025

Largely mirrors ava-labs/coreth#950, but this time I don't make mistakes 😎

Do note that this PR goes beyond a simple drop in and replace in from ava-labs/coreth#950 as the testing framework upgrade had implications for tests and functionality not included in coreth (which is why I messed up on first revision)

No breaking changes

Does not require release notes

@JonathanOppenheimer JonathanOppenheimer requested a review from a team as a code owner July 9, 2025 14:19
@JonathanOppenheimer JonathanOppenheimer added DO NOT MERGE This PR is not meant to be merged in its current state coreth sync labels Jul 9, 2025
@@ -38,7 +39,13 @@ var (
}

TestChainConfig = &ChainConfig{
AvalancheContext: AvalancheContext{SnowCtx: utils.TestSnowContext()},
AvalancheContext: AvalancheContext{
Copy link
Member Author

@JonathanOppenheimer JonathanOppenheimer Jul 9, 2025

Choose a reason for hiding this comment

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

If someone with additional context could explain why this is necessary here, but was able to be removed in https://github.com/ava-labs/coreth/pull/950/files#r2080300565, that would be appreciated. Did I miss something?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the only difference is in Verify() where we pass c.SnowCtx.NetworkUpgrades. I think we should explicitly handle that in tests.

Copy link
Member Author

Choose a reason for hiding this comment

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

Can you expand upon what you mean by this - I see now why we do need the context as the verifyNetworkUpgrades method needs to compare configured timestamps against the expected defaults from the Avalanche config.

require.NoError(t, err)
require.EqualValues(t, feeConfig, testHighFeeConfig)
require.Zero(t, restartedVM.blockChain.CurrentBlock().Number.Cmp(lastChangedAt))
require.EqualValues(t, restartedVM.blockChain.CurrentBlock().Number, lastChangedAt)
Copy link
Member Author

Choose a reason for hiding this comment

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

I do not know why this changed or why it worked before. Again would appreciate another set of eyes and brain!

Copy link
Member Author

Choose a reason for hiding this comment

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

These two lines are functionally identical except that EqualValues assumes type compatibility?? Really lost as to why this worked.

@JonathanOppenheimer JonathanOppenheimer removed the DO NOT MERGE This PR is not meant to be merged in its current state label Jul 9, 2025
Copy link
Collaborator

@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.

I frankly don't know why tests are broken and why it does not show anything. but it looks like something is broken in plugin/evm/ tests

@@ -38,7 +39,13 @@ var (
}

TestChainConfig = &ChainConfig{
AvalancheContext: AvalancheContext{SnowCtx: utils.TestSnowContext()},
AvalancheContext: AvalancheContext{
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the only difference is in Verify() where we pass c.SnowCtx.NetworkUpgrades. I think we should explicitly handle that in tests.

func setupGenesis(
t *testing.T,
fork upgradetest.Fork,
fallbackGenesisJSON string,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I feel like we should not need that and just use genesisJson option in newVM

Copy link
Member Author

@JonathanOppenheimer JonathanOppenheimer Jul 10, 2025

Choose a reason for hiding this comment

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

Even if this would diverge further from coreth? Unless you're asking about the argument - not sure what you mean

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm talking about the argument, we should not need fallbackGenesisJSON.

Copy link
Member Author

@JonathanOppenheimer JonathanOppenheimer Jul 11, 2025

Choose a reason for hiding this comment

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

How do you propose getting it alternatively? SubnetEVM and presubnetEVM are not available through the fork/upgradetest module and there are many instances where these, or custom JSONs are passed and need to be set.

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.

3 participants