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

ACP 77 #2140

Merged
merged 103 commits into from
Nov 23, 2024
Merged

ACP 77 #2140

Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
2a942dd
acp-77
sukantoraymond Sep 9, 2024
e304324
fix lint
sukantoraymond Sep 9, 2024
c28aecb
address comments
sukantoraymond Sep 9, 2024
5cc880c
fix test
sukantoraymond Sep 9, 2024
858c394
make pos coming soon
sukantoraymond Sep 19, 2024
3f51e72
update test
sukantoraymond Sep 19, 2024
efa257c
Merge branch 'main' into acp-77
sukantoraymond Sep 19, 2024
2138a5a
Merge branch 'main' into acp-77
sukantoraymond Sep 20, 2024
467cf26
Prompts for Subnet create acp77 (#2150)
sukantoraymond Sep 23, 2024
4cb24a3
Merge branch 'main' into acp-77
sukantoraymond Sep 23, 2024
0713f2d
Validator prompt acp77 (#2152)
sukantoraymond Sep 23, 2024
cd9402e
Merge branch 'main' into acp-77
sukantoraymond Sep 24, 2024
654a3e4
Genesis icm (#2154)
felipemadero Sep 26, 2024
5bd6762
lint
felipemadero Sep 26, 2024
ad16a88
Merge branch 'main' into acp-77
felipemadero Sep 26, 2024
93b24c2
Genesis poa (#2164)
felipemadero Sep 26, 2024
5957c63
Merge branch 'main' into acp-77
sukantoraymond Sep 30, 2024
1b0d42c
Signature aggregator sdk (#2149)
arturrez Sep 30, 2024
58fdeb2
Fix acp 77 ci (#2204)
felipemadero Oct 1, 2024
3dbca8b
ACP 77 new commands (#2172)
sukantoraymond Oct 8, 2024
f7d8a40
Merge branch 'main' into acp-77
sukantoraymond Oct 8, 2024
2e4df61
fix merge
sukantoraymond Oct 8, 2024
f46593f
Merge branch 'main' into acp-77
sukantoraymond Oct 8, 2024
064d1f1
Track subnet refactor (#2228)
sukantoraymond Oct 9, 2024
b2d4e4d
Fix generate new node id and bls info (#2237)
sukantoraymond Oct 11, 2024
4f797cb
assume blockchain endpoint only for cli managed node sync (#2241)
felipemadero Oct 14, 2024
c53301a
Merge branch 'main' into acp-77
sukantoraymond Oct 16, 2024
7733ee6
fix merge
sukantoraymond Oct 16, 2024
25f7fe9
node local PoC (#2216)
arturrez Oct 16, 2024
8888202
go 1.22.8 for dockerfile
arturrez Oct 16, 2024
93ba0c6
Node local status (#2261)
arturrez Oct 16, 2024
662105f
fix lint
arturrez Oct 16, 2024
4a0eb07
Merge branch 'main' into acp-77
sukantoraymond Oct 17, 2024
dc51ea7
fix merge
sukantoraymond Oct 17, 2024
93ad04d
Register validator local (#2247)
felipemadero Oct 17, 2024
2c4bc46
Merge branch 'acp-77' of https://github.com/ava-labs/avalanche-cli in…
felipemadero Oct 17, 2024
4a5e292
fix lint
sukantoraymond Oct 17, 2024
569e1da
Merge branch 'main' into acp-77
sukantoraymond Oct 17, 2024
191f129
lint
felipemadero Oct 17, 2024
d517e5f
Validator removal (#2267)
felipemadero Oct 17, 2024
851d576
lint
felipemadero Oct 17, 2024
e1caf35
make sure that we return empty clusterconf if cluster not found (#2269)
arturrez Oct 17, 2024
3b6c74a
Fix case where node is not generated before calling subnet deploy (#2…
sukantoraymond Oct 17, 2024
b714322
Use existing cluster deploy (#2271)
sukantoraymond Oct 17, 2024
a24d214
Acp77 remote etna devnet (#2233)
arturrez Oct 18, 2024
2d46470
properly create nodes dir and cluster config file (#2273)
felipemadero Oct 18, 2024
494545b
Merge branch 'main' into acp-77
sukantoraymond Oct 18, 2024
d0edb1c
Acp use etna devnet (#2275)
arturrez Oct 18, 2024
2566d08
Cleanup AddValidator command (#2276)
sukantoraymond Oct 18, 2024
f75c230
fix lint (#2277)
felipemadero Oct 18, 2024
2318608
fix err msg
sukantoraymond Oct 18, 2024
1e7e91e
print all errors (#2279)
sukantoraymond Oct 18, 2024
4708121
Check max balance on add validator (#2278)
felipemadero Oct 18, 2024
02d803e
Continue on error remove validator (#2280)
felipemadero Oct 18, 2024
68237be
Merge branch 'main' into acp-77
felipemadero Oct 22, 2024
5c86d7c
Acp77 remote enta cluster fixes (#2281)
arturrez Oct 22, 2024
b51f15c
Merge branch 'main' into acp-77
sukantoraymond Oct 23, 2024
a6b6e1c
fix merge
sukantoraymond Oct 23, 2024
5ceeabb
update avalanche go tag
sukantoraymond Oct 24, 2024
026e94d
remove dummy txs
sukantoraymond Oct 24, 2024
8526840
remove dummy txs
sukantoraymond Oct 24, 2024
5a13a5f
Acp77 e2e (#2287)
sukantoraymond Oct 25, 2024
77e7386
fix lint
sukantoraymond Oct 25, 2024
0ed6685
Merge branch 'main' into acp-77
sukantoraymond Oct 25, 2024
71a53a3
integrate main change
sukantoraymond Oct 25, 2024
4b76b44
Fix lint
sukantoraymond Oct 25, 2024
cf3d4a8
update binary for test
sukantoraymond Oct 25, 2024
2dfe5c5
add node configs to local cluster (#2296)
felipemadero Oct 28, 2024
fb10008
Acp 77 fix (#2284)
felipemadero Oct 28, 2024
d6c5705
Node local status more info (#2288)
arturrez Oct 30, 2024
e215c14
Merge branch 'main' into acp-77
sukantoraymond Oct 31, 2024
49a8b1d
Validator Manager SDK (#2297)
sukantoraymond Oct 31, 2024
f8632c8
increase health timeout after network restart (#2299)
felipemadero Oct 31, 2024
50bdcc2
Merge branch 'main' into acp-77
sukantoraymond Nov 1, 2024
43dafd9
Merge branch 'main' into acp-77
sukantoraymond Nov 5, 2024
ff4e381
use latest relayer dep (#2315)
felipemadero Nov 5, 2024
ea37fed
Use network name instead of cluster name on sidecar (#2303)
sukantoraymond Nov 13, 2024
ed04296
Merge branch 'main' into acp-77
sukantoraymond Nov 14, 2024
035151c
fix conflict
sukantoraymond Nov 14, 2024
aebdeec
fix lint
sukantoraymond Nov 14, 2024
96f015c
fuji local clusters (#2309)
felipemadero Nov 14, 2024
92f4ad9
Update tag (#2332)
sukantoraymond Nov 15, 2024
1967a2c
no op
sukantoraymond Nov 19, 2024
55a94e8
no op
sukantoraymond Nov 19, 2024
c7834c1
Update e2e avago (#2342)
felipemadero Nov 20, 2024
776c9b2
Acp 77 PoS using sdk/validatorManager (#2308)
arturrez Nov 20, 2024
9a79fc8
e2e - disable PoS non-bootstrap validator removal
arturrez Nov 20, 2024
f3eb113
add mainnet check (#2346)
sukantoraymond Nov 20, 2024
53e9b50
disable change owner for sov (#2347)
sukantoraymond Nov 20, 2024
b376101
Use v1.12.0 fuji on e2e (#2344)
felipemadero Nov 21, 2024
bcf5d60
Acp7 change owner single prompt (#2350)
arturrez Nov 21, 2024
68ec83a
Acp77 init validator manager (#2349)
arturrez Nov 21, 2024
162edf1
remove flag (#2345)
sukantoraymond Nov 21, 2024
da7e287
Fix local status (#2353)
arturrez Nov 22, 2024
4978276
filter network options to deployed networks
sukantoraymond Nov 22, 2024
df62f2f
Revert "filter network options to deployed networks"
sukantoraymond Nov 22, 2024
ee1871b
Fix acp77 e2e (#2358)
felipemadero Nov 22, 2024
2c2b457
Filter network (#2356)
sukantoraymond Nov 22, 2024
34ca662
Install binary for avalanchego instead of providing local path (#2351)
sukantoraymond Nov 22, 2024
270c480
fix e2e public
sukantoraymond Nov 22, 2024
4c8bed0
update deploy
sukantoraymond Nov 23, 2024
e180d96
lint
sukantoraymond Nov 23, 2024
e7396c8
fix e2e
sukantoraymond Nov 23, 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
60 changes: 57 additions & 3 deletions cmd/blockchaincmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (
"strings"
"unicode"

"github.com/ava-labs/avalanche-cli/pkg/application"

"github.com/ava-labs/avalanche-cli/cmd/flags"
"github.com/ava-labs/avalanche-cli/pkg/cobrautils"
"github.com/ava-labs/avalanche-cli/pkg/constants"
Expand Down Expand Up @@ -45,6 +47,8 @@ type CreateFlags struct {
useLatestReleasedVMVersion bool
useLatestPreReleasedVMVersion bool
useExternalGasToken bool
proofOfStake bool
proofOfAuthority bool
}

var (
Expand All @@ -56,8 +60,9 @@ var (

errIllegalNameCharacter = errors.New(
"illegal name character: only letters, no special characters allowed")
errMutuallyExlusiveVersionOptions = errors.New("version flags --latest,--pre-release,vm-version are mutually exclusive")
errMutuallyExclusiveVMConfigOptions = errors.New("--genesis flag disables --evm-chain-id,--evm-defaults,--production-defaults,--test-defaults")
errMutuallyExlusiveVersionOptions = errors.New("version flags --latest,--pre-release,vm-version are mutually exclusive")
errMutuallyExclusiveVMConfigOptions = errors.New("--genesis flag disables --evm-chain-id,--evm-defaults,--production-defaults,--test-defaults")
errMutuallyExlusiveValidatorManagementOptions = errors.New("validator management type flags --proof-of-authority,--proof-of-stake are mutually exclusive")
)

// avalanche blockchain create
Expand Down Expand Up @@ -101,6 +106,8 @@ configuration, pass the -f flag.`,
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")
cmd.Flags().BoolVar(&createFlags.proofOfAuthority, "proof-of-authority", false, "use proof of authority for validator management")
felipemadero marked this conversation as resolved.
Show resolved Hide resolved
cmd.Flags().BoolVar(&createFlags.proofOfStake, "proof-of-stake", false, "(coming soon) use proof of stake for validator management")
return cmd
}

Expand Down Expand Up @@ -185,6 +192,11 @@ func createBlockchainConfig(cmd *cobra.Command, args []string) error {
return errors.New("flags --evm,--custom are mutually exclusive")
}

// validator management type exclusiveness
if !flags.EnsureMutuallyExclusive([]bool{createFlags.proofOfAuthority, createFlags.proofOfStake}) {
return errMutuallyExlusiveValidatorManagementOptions
}

// get vm kind
vmType, err := vm.PromptVMType(app, createFlags.useSubnetEvm, createFlags.useCustomVM)
if err != nil {
Expand Down Expand Up @@ -343,7 +355,9 @@ func createBlockchainConfig(cmd *cobra.Command, args []string) error {
}
}
}

if err = promptValidatorManagementType(app, sc); err != nil {
return err
}
if err = app.WriteGenesisFile(blockchainName, genesisBytes); err != nil {
return err
}
Expand Down Expand Up @@ -422,3 +436,43 @@ func checkInvalidSubnetNames(name string) error {
}
return nil
}

// TODO: add explain the difference for different validator management type
func promptValidatorManagementType(
app *application.Avalanche,
sidecar *models.Sidecar,
) error {
proofOfAuthorityOption := "Proof of Authority"
felipemadero marked this conversation as resolved.
Show resolved Hide resolved
proofOfStakeOption := "Proof of Stake"
felipemadero marked this conversation as resolved.
Show resolved Hide resolved
explainOption := "Explain the difference"
if createFlags.proofOfStake {
sidecar.ValidatorManagement = models.ValidatorManagementTypeFromString(proofOfStakeOption)
felipemadero marked this conversation as resolved.
Show resolved Hide resolved
return nil
}
if createFlags.proofOfAuthority {
sidecar.ValidatorManagement = models.ValidatorManagementTypeFromString(proofOfAuthorityOption)
felipemadero marked this conversation as resolved.
Show resolved Hide resolved
return nil
}
options := []string{proofOfAuthorityOption, proofOfStakeOption, explainOption}
felipemadero marked this conversation as resolved.
Show resolved Hide resolved
var subnetTypeStr string
for {
option, err := app.Prompt.CaptureList(
"Which validator management protocol would you like to use in your blockchain?",
options,
)
if err != nil {
return err
}
switch option {
case proofOfAuthorityOption:
subnetTypeStr = models.ProofOfAuthority
case proofOfStakeOption:
subnetTypeStr = models.ProofOfStake
case explainOption:
continue
}
break
}
sidecar.ValidatorManagement = models.ValidatorManagementTypeFromString(subnetTypeStr)
return nil
}
1 change: 1 addition & 0 deletions pkg/models/sidecar.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type Sidecar struct {
RunRelayer bool
// SubnetEVM based VM's only
SubnetEVMMainnetChainID uint
ValidatorManagement ValidatorManagementType
felipemadero marked this conversation as resolved.
Show resolved Hide resolved
}

func (sc Sidecar) GetVMID() (string, error) {
Expand Down
22 changes: 22 additions & 0 deletions pkg/models/validator_management.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (C) 2022, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package models

type ValidatorManagementType string

const (
ProofOfStake = "Proof Of Stake (Coming Soon)"
ProofOfAuthority = "Proof Of Authority"
UndefinedValidatorManagement = "Undefined Validator Management"
)

func ValidatorManagementTypeFromString(s string) ValidatorManagementType {
felipemadero marked this conversation as resolved.
Show resolved Hide resolved
switch s {
case ProofOfStake:
return ProofOfStake
case ProofOfAuthority:
return ProofOfAuthority
default:
return UndefinedValidatorManagement
}
}
2 changes: 2 additions & 0 deletions tests/e2e/commands/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func CreateSubnetEvmConfigWithVersion(subnetName string, genesisPath string, ver
genesisPath,
"--evm",
subnetName,
"--proof-of-authority",
"--" + constants.SkipUpdateFlag,
"--teleporter=false",
"--evm-token",
Expand Down Expand Up @@ -122,6 +123,7 @@ func CreateCustomVMConfig(subnetName string, genesisPath string, vmPath string)
"create",
"--genesis",
genesisPath,
"--proof-of-authority",
"--custom",
subnetName,
"--custom-vm-path",
Expand Down
5 changes: 0 additions & 5 deletions tests/e2e/testcases/subnet/local/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ const (
subnetName = "e2eSubnetTest"
secondSubnetName = "e2eSecondSubnetTest"
confPath = "tests/e2e/assets/test_avalanche-cli.json"
stakeAmount = "2000"
felipemadero marked this conversation as resolved.
Show resolved Hide resolved
stakeDuration = "337h"
delegateAmount = "25"
delegateDuration = "336h"
localNetwork = "Local Network"
)

var (
Expand Down
Loading