Skip to content

Conversation

@RodrigoVillar
Copy link
Contributor

@RodrigoVillar RodrigoVillar commented Dec 17, 2025

Why this should be merged

A prerequiste of #4695 is that we need to create a Coreth instance to read the last accepted block. We can do this with newCChainMainnetVM(), but this is currently unexported and lives in the reexecute/c package.

How this works

Exports NewMainnetCChainVM() and moves it to reexecute for usage by reexecute/c and the future reexecute/chaos packages.

How this was tested

CI

Need to be documented in RELEASES.md?

No

@RodrigoVillar RodrigoVillar self-assigned this Dec 17, 2025
@RodrigoVillar RodrigoVillar marked this pull request as ready for review December 17, 2025 15:42
@RodrigoVillar RodrigoVillar requested a review from a team as a code owner December 17, 2025 15:42
Copilot AI review requested due to automatic review settings December 17, 2025 15:42
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the NewMainnetCChainVM() function by moving it from tests/reexecute/c/vm_reexecute.go to tests/reexecute/vm.go and exporting it. This enables the function to be reused by both the existing reexecute/c package and a future reexecute/chaos package as part of the work for #4695.

Key changes:

  • Exported newMainnetCChainVM() as NewMainnetCChainVM() and relocated it to the parent reexecute package
  • Updated the call site in tests/reexecute/c/vm_reexecute.go to use the newly exported function
  • Removed unused imports from tests/reexecute/c/vm_reexecute.go following the function relocation

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tests/reexecute/vm.go New file containing the exported NewMainnetCChainVM() function with all necessary imports and mainnet chain ID constants
tests/reexecute/c/vm_reexecute.go Updated to call reexecute.NewMainnetCChainVM() instead of the local newMainnetCChainVM(), removed the now-redundant function definition and associated imports

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}
}

func newMainnetCChainVM(
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does this have to move to be exported?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This function lives in an executable package (main) - functions in executable packages can't be exported for reuse:

// Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package main

@maru-ava maru-ava added this pull request to the merge queue Dec 17, 2025
Merged via the queue into master with commit bb163bc Dec 17, 2025
52 checks passed
@maru-ava maru-ava deleted the rodrigo/export-new-mainnet-c-chain-vm branch December 17, 2025 18:09
@github-project-automation github-project-automation bot moved this to Done 🎉 in avalanchego Dec 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants