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

Add HyperSDK Functionality to CLI #2369

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open

Add HyperSDK Functionality to CLI #2369

wants to merge 15 commits into from

Conversation

RodrigoVillar
Copy link
Collaborator

@RodrigoVillar RodrigoVillar commented Nov 25, 2024

Why this should be merged

With the HyperSDK maturing, we would like to make it a first-class citizen (i.e. the same level of support as Subnet-EVM). By doing this, HyperSDK developers benefit from the following:

  • Fast Deployments: by being able to use the Avalanche-CLI, developers no longer have to start up their VM via integration/e2e tests
  • Learning: using the Avalanche-CLI is a lower barrier-of-entry for potential HyperSDK developers than the current test framework

How this works

This PR separates HyperVMs (VMs built with HyperSDK) from the custom VM group and makes it a group of its own. Therefore, we now have three types of VMs in the CLI:

  • SubnetEVM
  • HyperVMs
  • Custom VMs

The biggest change is in the avalanche blockchain create command, where users are now able to select the option of creating a HyperVM. When selecting this option, the control flow is similar to that of Subnet-EVM, with the exception of the genesis.

In addition to being able to provide a genesis.json file and being able to use the default HyperSDK genesis, users can also use their VM binary to create the VM genesis on their behalf.

How this was tested

How is this documented

We plan on adding documentation for this feature in the HyperSDK docs.

cc: @felipemadero @aaronbuchwald

@RodrigoVillar RodrigoVillar requested a review from a team as a code owner November 25, 2024 18:35
return err
}
switch option {
case providePath:
Copy link
Collaborator

Choose a reason for hiding this comment

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

no need to add another prompt to ask for path. better UX is to just ask user to provide path to genesis right away and use it after checking if file exists. So this case branch is not needed here and can be moved up to How would you like to provide the genesis file? prompt

return nil, nil
}

func getChainID(app *application.Avalanche) (ids.ID, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: better name promptChainID

return json.Marshal(genesis)
}

func getPreallocations(app *application.Avalanche) ([]*genesis.CustomAllocation, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: better name promptPreallocations

Copy link
Collaborator

@arturrez arturrez left a comment

Choose a reason for hiding this comment

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

commented on the code

@arturrez
Copy link
Collaborator

arturrez commented Dec 18, 2024

looking into the code it's not clear for me what the difference between customVM and hypersdk VM option.
I guess the only difference is ability to create a genesis data by running a command or internally in the code.
Is my understanding correct?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog 🗄️
Development

Successfully merging this pull request may close these issues.

3 participants