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 prompt for default values and remove prompt for remote gas token (adding a flag for it) #2048

Merged
merged 67 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
78aabee
add skel
felipemadero May 20, 2024
a2d0d6e
add missing files
felipemadero May 20, 2024
7781e62
check for forge to have been installed
felipemadero May 20, 2024
b098757
add comments
felipemadero May 20, 2024
9c2cb9c
start automating foundry install
felipemadero May 20, 2024
aceff27
added automated froundry install
felipemadero May 20, 2024
17e6c81
start working agains teleporter repo
felipemadero May 21, 2024
fe993a1
deploying contract given abi and bin files
felipemadero May 21, 2024
a158f30
adding destination deploy
felipemadero May 21, 2024
7adfec9
deploying the destination
felipemadero May 21, 2024
92e573c
ux design 2 for bridge deploy of fuji
felipemadero May 22, 2024
d37e5b9
add popular token info list
felipemadero May 23, 2024
04bd4eb
move to new file
felipemadero May 23, 2024
c836def
add blockchain alias to popular tokens json
felipemadero May 24, 2024
64c1eac
start using teleporter bridge deploy
felipemadero May 24, 2024
bfdc9ff
adddress suggestions
felipemadero May 24, 2024
1e0651f
fix recommended
felipemadero May 24, 2024
33dc80e
update to latest esp
felipemadero May 30, 2024
eb6ace3
integrate allow list stuff
felipemadero May 31, 2024
a5832b9
nit
felipemadero May 31, 2024
6622839
niy
felipemadero May 31, 2024
0f02278
VM option
felipemadero May 31, 2024
0ac2ab2
add version option
felipemadero May 31, 2024
b5f98fd
add gas fees stub
felipemadero May 31, 2024
1fe4ec6
add remaining prompts
felipemadero May 31, 2024
41776a0
address https://github.com/ava-labs/avalanche-cli/issues/1927
felipemadero Jun 12, 2024
cc495c5
Meag rewordings (#1978)
meaghanfitzgerald Jun 26, 2024
1efdd0a
[Subnet Create Explore] Rewording Martin (#2002)
martineckardt Jul 2, 2024
860cb66
genesis params start making more sense
felipemadero Jul 3, 2024
6a87d29
add useTeleporter
felipemadero Jul 3, 2024
5ba44c0
gas token prompt closed
felipemadero Jul 4, 2024
f44c98f
fee config ok
felipemadero Jul 4, 2024
1d119fc
add missing file
felipemadero Jul 4, 2024
014a1b2
vm type cleanup
felipemadero Jul 4, 2024
06a4955
more cleanup
felipemadero Jul 4, 2024
1791594
move all subnet evm prompts to the same file
felipemadero Jul 4, 2024
21ec0c1
nits
felipemadero Jul 4, 2024
8c2fe51
lint
felipemadero Jul 4, 2024
7a4efed
Merge branch 'main' into subnet-create-explore-ux
felipemadero Jul 5, 2024
0360aa9
nit
felipemadero Jul 5, 2024
59f1ef0
lint
felipemadero Jul 7, 2024
4733117
Merge branch 'main' into subnet-create-explore-ux
felipemadero Jul 10, 2024
dcec26c
move prompts to vm package
felipemadero Jul 10, 2024
9b9da4b
partial work
felipemadero Jul 11, 2024
a0792c2
added fee config
felipemadero Jul 12, 2024
e6f3a9a
added allocations and teleporter stuff
felipemadero Jul 12, 2024
d93bab6
added precompiles
felipemadero Jul 12, 2024
2c9f9bd
createEvm is ready
felipemadero Jul 12, 2024
bbe0aa4
start making sense
felipemadero Jul 12, 2024
098662a
add teleporter prompt to create custom
felipemadero Jul 12, 2024
5fe867a
add check for compatible subnet evm genesis when asking
felipemadero Jul 12, 2024
4f71105
add tokensymbol to custom vm
felipemadero Jul 12, 2024
6c0f2df
nit
felipemadero Jul 12, 2024
aa60c12
fix relayer conf for the moment
felipemadero Jul 12, 2024
3764c79
nits
felipemadero Jul 12, 2024
1e55584
lint
felipemadero Jul 12, 2024
21fd24c
unit test
felipemadero Jul 12, 2024
00c90dd
fix e2e
felipemadero Jul 12, 2024
4d284f7
fix flag exclusion for genesis agains tokenSymbol
felipemadero Jul 12, 2024
0d1c5b1
latest changes besides ux changes
felipemadero Jul 23, 2024
bd0b305
also include latest release download in defaults
felipemadero Jul 23, 2024
1341037
address PR comments
felipemadero Jul 24, 2024
cf8dd80
Update cmd/subnetcmd/upgradecmd/generate.go
felipemadero Jul 25, 2024
5e2b16c
address PR comments
felipemadero Jul 25, 2024
7e61813
Merge branch 'subnet-create-explore-ux' into subnet-create-explore-ux…
felipemadero Jul 25, 2024
1922c6a
Use avacloud gas limit settings + add dynamic fees/not dynamic fees o…
felipemadero Jul 25, 2024
d999da7
Merge branch 'main' into subnet-create-explore-ux-new-prompts
felipemadero Jul 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion cmd/subnetcmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type CreateFlags struct {
vmVersion string
useLatestReleasedVMVersion bool
useLatestPreReleasedVMVersion bool
useExternalGasToken bool
}

var (
Expand Down Expand Up @@ -96,6 +97,7 @@ configuration, pass the -f flag.`,
cmd.Flags().BoolVar(&useRepo, "from-github-repo", false, "generate custom VM binary from github repository")
cmd.Flags().BoolVar(&createFlags.useWarp, "warp", true, "generate a vm with warp support (needed for teleporter)")
cmd.Flags().BoolVar(&createFlags.useTeleporter, "teleporter", false, "interoperate with other blockchains using teleporter")
cmd.Flags().BoolVar(&createFlags.useExternalGasToken, "external-gas-token", false, "use a gas token from another blockchain")
return cmd
}

Expand Down Expand Up @@ -197,9 +199,17 @@ func createSubnetConfig(cmd *cobra.Command, args []string) error {
}

if vmType == models.SubnetEvm {
if genesisFile == "" {
// Default
createFlags.useDefaults, err = vm.PromptDefaults(app, createFlags.useDefaults)
if err != nil {
return err
}
}

// get vm version
vmVersion := createFlags.vmVersion
if createFlags.useLatestReleasedVMVersion {
if createFlags.useLatestReleasedVMVersion || createFlags.useDefaults {
vmVersion = latest
}
if createFlags.useLatestPreReleasedVMVersion {
Expand Down Expand Up @@ -244,6 +254,7 @@ func createSubnetConfig(cmd *cobra.Command, args []string) error {
useTeleporterFlag,
createFlags.useDefaults,
createFlags.useWarp,
createFlags.useExternalGasToken,
)
if err != nil {
return err
Expand Down
37 changes: 23 additions & 14 deletions cmd/subnetcmd/upgradecmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,10 +378,10 @@ func GetFeeConfig(config params.ChainConfig, useDefault bool) (
error,
) {
const (
useFast = "High disk use / High Throughput 5 mil gas/s"
useMedium = "Medium disk use / Medium Throughput 2 mil gas/s"
useSlow = "Low disk use / Low Throughput 1.5 mil gas/s (C-Chain's setting)"
customFee = "Customize fee config"
lowOption = "Low block size / Low Throughput 12 mil gas per block"
mediumOption = "Medium block size / Medium Throughput 15 mil gas per block (C-Chain's setting)"
highOption = "High block size / High Throughput 20 mil gas per block"
customFee = "Customize fee config"

setGasLimit = "Set gas limit"
setBlockRate = "Set target block rate"
Expand All @@ -396,11 +396,12 @@ func GetFeeConfig(config params.ChainConfig, useDefault bool) (
config.FeeConfig = vm.StarterFeeConfig

if useDefault {
config.FeeConfig.TargetGas = vm.LowTarget
config.FeeConfig.GasLimit = vm.LowGasLimit
config.FeeConfig.TargetGas = config.FeeConfig.TargetGas.Mul(config.FeeConfig.GasLimit, vm.NoDynamicFeesGasLimitToTargetGasFactor)
return config, nil
}

feeConfigOptions := []string{useSlow, useMedium, useFast, customFee}
feeConfigOptions := []string{lowOption, mediumOption, highOption, customFee}

feeDefault, err := app.Prompt.CaptureList(
"How would you like to set fees",
Expand All @@ -410,16 +411,24 @@ func GetFeeConfig(config params.ChainConfig, useDefault bool) (
return config, err
}

useDynamicFees := false
if feeDefault != customFee {
useDynamicFees, err = app.Prompt.CaptureYesNo("Do you want to enable dynamic fees?")
if err != nil {
return config, err
}
}

switch feeDefault {
case useFast:
config.FeeConfig.TargetGas = vm.HighTarget
return config, nil
case useMedium:
config.FeeConfig.TargetGas = vm.MediumTarget
return config, nil
case useSlow:
config.FeeConfig.TargetGas = vm.LowTarget
case lowOption:
vm.SetStandardGas(&config, vm.LowGasLimit, vm.LowTargetGas, useDynamicFees)
return config, nil
case mediumOption:
vm.SetStandardGas(&config, vm.MediumGasLimit, vm.MediumTargetGas, useDynamicFees)
return config, err
case highOption:
vm.SetStandardGas(&config, vm.HighGasLimit, vm.HighTargetGas, useDynamicFees)
return config, err
default:
ux.Logger.PrintToUser("Customizing fee config")
}
Expand Down
23 changes: 12 additions & 11 deletions pkg/vm/allocations.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,19 @@ func getAllocation(
subnetName string,
defaultAirdropAmount string,
multiplier *big.Int,
useExternalGasToken bool,
) (core.GenesisAlloc, error) {
if params.initialTokenAllocation.allocToNewKey {
return getNewAllocation(app, subnetName, defaultAirdropAmount)
}

if params.initialTokenAllocation.allocToEwoq {
return getEwoqAllocation(defaultAirdropAmount)
}

allocations := core.GenesisAlloc{}
amount := new(big.Int).SetUint64(params.initialTokenAllocation.customBalance)
amount = amount.Mul(amount, multiplier)
addAllocation(allocations, params.initialTokenAllocation.customAddress.Hex(), amount)
if !useExternalGasToken {
if params.initialTokenAllocation.allocToNewKey {
return getNewAllocation(app, subnetName, defaultAirdropAmount)
}
if params.initialTokenAllocation.allocToEwoq {
return getEwoqAllocation(defaultAirdropAmount)
}
amount := new(big.Int).SetUint64(params.initialTokenAllocation.customBalance)
amount = amount.Mul(amount, multiplier)
addAllocation(allocations, params.initialTokenAllocation.customAddress.Hex(), amount)
}
return allocations, nil
}
1 change: 1 addition & 0 deletions pkg/vm/createEvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ func CreateEvmGenesis(
subnetName,
defaultEvmAirdropAmount,
oneAvax,
params.UseExternalGasToken,
)
if err != nil {
return nil, err
Expand Down
Loading
Loading