Skip to content

Commit

Permalink
Merge branch 'main' into improve-change-weight
Browse files Browse the repository at this point in the history
  • Loading branch information
felipemadero authored Jan 14, 2025
2 parents 9e30764 + 943efa3 commit 5828a43
Show file tree
Hide file tree
Showing 9 changed files with 115 additions and 113 deletions.
55 changes: 32 additions & 23 deletions cmd/blockchaincmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,29 +260,8 @@ func createBlockchainConfig(cmd *cobra.Command, args []string) error {

if vmType == models.SubnetEvm {
if sovereign {
// if validatorManagerOwner flag is used, we get the C Chain address of the key used
if createFlags.validatorManagerOwner != "" {
if err = validateValidatorManagerOwnerFlag(createFlags.validatorManagerOwner); err != nil {
return err
}
}
if createFlags.validatorManagerOwner == "" {
createFlags.validatorManagerOwner, err = getValidatorContractManagerAddr()
if err != nil {
return err
}
}
sc.ValidatorManagerOwner = createFlags.validatorManagerOwner
ux.Logger.GreenCheckmarkToUser("Validator Manager Contract owner address %s", createFlags.validatorManagerOwner)

// use the validator manager owner as the transparent proxy contract owner unless specified via cmd flag
if createFlags.proxyContractOwner != "" {
if err = validateValidatorManagerOwnerFlag(createFlags.proxyContractOwner); err != nil {
return err
}
sc.ProxyContractOwner = createFlags.proxyContractOwner
} else {
sc.ProxyContractOwner = sc.ValidatorManagerOwner
if err := setSidecarValidatorManageOwner(sc, createFlags); err != nil {
return err
}
}

Expand Down Expand Up @@ -385,6 +364,11 @@ func createBlockchainConfig(cmd *cobra.Command, args []string) error {
}
var tokenSymbol string
if evmCompatibleGenesis := utils.ByteSliceIsSubnetEvmGenesis(genesisBytes); evmCompatibleGenesis {
if sovereign {
if err := setSidecarValidatorManageOwner(sc, createFlags); err != nil {
return err
}
}
tokenSymbol, err = vm.PromptTokenSymbol(app, createFlags.tokenSymbol)
if err != nil {
return err
Expand Down Expand Up @@ -558,3 +542,28 @@ func checkInvalidSubnetNames(name string) error {
}
return nil
}

func setSidecarValidatorManageOwner(sc *models.Sidecar, createFlags CreateFlags) error {
var err error
if createFlags.validatorManagerOwner == "" {
createFlags.validatorManagerOwner, err = getValidatorContractManagerAddr()
if err != nil {
return err
}
}
if err := validateValidatorManagerOwnerFlag(createFlags.validatorManagerOwner); err != nil {
return err
}
sc.ValidatorManagerOwner = createFlags.validatorManagerOwner
ux.Logger.GreenCheckmarkToUser("Validator Manager Contract owner address %s", createFlags.validatorManagerOwner)
// use the validator manager owner as the transparent proxy contract owner unless specified via cmd flag
if createFlags.proxyContractOwner != "" {
if err = validateValidatorManagerOwnerFlag(createFlags.proxyContractOwner); err != nil {
return err
}
sc.ProxyContractOwner = createFlags.proxyContractOwner
} else {
sc.ProxyContractOwner = sc.ValidatorManagerOwner
}
return nil
}
30 changes: 15 additions & 15 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ require (
github.com/ava-labs/coreth v0.13.9-rc.1
github.com/ava-labs/icm-services v1.4.1-0.20250102154147-7d1e095dc849
github.com/ava-labs/subnet-evm v0.6.13-0.20241205165027-6c98da796f35
github.com/aws/aws-sdk-go-v2 v1.32.7
github.com/aws/aws-sdk-go-v2/config v1.28.7
github.com/aws/aws-sdk-go-v2 v1.32.8
github.com/aws/aws-sdk-go-v2/config v1.28.10
github.com/aws/aws-sdk-go-v2/service/ec2 v1.198.1
github.com/cavaliergopher/grab/v3 v3.0.1
github.com/chelnak/ysmrr v0.5.0
Expand All @@ -35,7 +35,7 @@ require (
github.com/prometheus/client_golang v1.20.5
github.com/schollz/progressbar/v3 v3.17.1
github.com/shirou/gopsutil v3.21.11+incompatible
github.com/spf13/afero v1.11.0
github.com/spf13/afero v1.12.0
github.com/spf13/cobra v1.8.1
github.com/spf13/viper v1.19.0
github.com/stretchr/testify v1.10.0
Expand All @@ -48,7 +48,7 @@ require (
golang.org/x/oauth2 v0.25.0
golang.org/x/sync v0.10.0
golang.org/x/text v0.21.0
google.golang.org/api v0.215.0
google.golang.org/api v0.216.0
google.golang.org/protobuf v1.36.2
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1
Expand All @@ -69,17 +69,17 @@ require (
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be // indirect
github.com/ava-labs/icm-contracts v1.0.9-0.20241231155804-0845b3c9fd39 // indirect
github.com/ava-labs/ledger-avalanche/go v0.0.0-20241009183145-e6f90a8a1a60 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.17.48 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.22 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.26 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.26 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.17.51 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.23 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.27 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.27 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.7 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.8 // indirect
github.com/aws/aws-sdk-go-v2/service/kms v1.37.8 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.24.8 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.7 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.33.3 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.24.9 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.8 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.33.6 // indirect
github.com/aws/smithy-go v1.22.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.10.0 // indirect
Expand Down Expand Up @@ -173,7 +173,7 @@ require (
github.com/pires/go-proxyproto v0.6.2 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pkg/sftp v1.13.6 // indirect
github.com/pkg/sftp v1.13.7 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.55.0 // indirect
Expand Down Expand Up @@ -218,11 +218,11 @@ require (
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/sys v0.29.0 // indirect
golang.org/x/term v0.28.0 // indirect
golang.org/x/time v0.8.0 // indirect
golang.org/x/time v0.9.0 // indirect
golang.org/x/tools v0.28.0 // indirect
gonum.org/v1/gonum v0.11.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250102185135-69823020774d // indirect
google.golang.org/grpc v1.69.2 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
Expand Down
Loading

0 comments on commit 5828a43

Please sign in to comment.