From 26e11a732dfd09ca43bbb94ffc4783c4e446344a Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 18 Oct 2021 15:01:38 +0300 Subject: [PATCH] [#927] neofs-adm: provide container alias fee on deploy Signed-off-by: Evgenii Stratonikov --- cmd/neofs-adm/README.md | 1 + .../internal/modules/config/config.go | 41 +++++++------- cmd/neofs-adm/internal/modules/morph/dump.go | 3 +- .../modules/morph/initialize_deploy.go | 3 ++ cmd/neofs-adm/internal/modules/morph/root.go | 53 ++++++++++--------- 5 files changed, 56 insertions(+), 45 deletions(-) diff --git a/cmd/neofs-adm/README.md b/cmd/neofs-adm/README.md index e26cf8a9c..d2c133235 100644 --- a/cmd/neofs-adm/README.md +++ b/cmd/neofs-adm/README.md @@ -42,6 +42,7 @@ network: audit: 0 # network audit fee, for private installation consider 0 candidate: 0 # inner ring candidate registration fee, for private installation consider 0 container: 0 # container creation fee, for private installation consider 0 + container_alias: 0 # container nice-name registration fee, for private installation consider 0 withdraw: 0 # withdraw fee, for private installation consider 0 credentials: # passwords for consensus node / alphabet wallets az: password1 diff --git a/cmd/neofs-adm/internal/modules/config/config.go b/cmd/neofs-adm/internal/modules/config/config.go index bba9e5257..438a112ad 100644 --- a/cmd/neofs-adm/internal/modules/config/config.go +++ b/cmd/neofs-adm/internal/modules/config/config.go @@ -15,16 +15,17 @@ import ( ) type configTemplate struct { - Endpoint string - AlphabetDir string - MaxObjectSize int - EpochDuration int - BasicIncomeRate int - AuditFee int - CandidateFee int - ContainerFee int - WithdrawFee int - Glagolitics []string + Endpoint string + AlphabetDir string + MaxObjectSize int + EpochDuration int + BasicIncomeRate int + AuditFee int + CandidateFee int + ContainerFee int + ContainerAliasFee int + WithdrawFee int + Glagolitics []string } const configTxtTemplate = `rpc-endpoint: {{ .Endpoint}} @@ -37,6 +38,7 @@ network: audit: {{ .AuditFee}} candidate: {{ .CandidateFee}} container: {{ .ContainerFee}} + container_alias: {{ .ContainerAliasFee }} withdraw: {{ .WithdrawFee}} # if credentials section is omitted, then neofs-adm will require manual password input credentials:{{ range.Glagolitics}} @@ -104,15 +106,16 @@ func defaultConfigPath() (string, error) { // some comments as well. func generateConfigExample(appDir string, credSize int) (string, error) { tmpl := configTemplate{ - Endpoint: "https://neo.rpc.node:30333", - MaxObjectSize: 67108864, // 64 MiB - EpochDuration: 240, // 1 hour with 15s per block - BasicIncomeRate: 1_0000_0000, // 0.0001 GAS per GiB (Fixed12) - AuditFee: 1_0000, // 0.00000001 GAS per audit (Fixed12) - CandidateFee: 100_0000_0000, // 100.0 GAS (Fixed8) - ContainerFee: 1000, // 0.000000001 * 7 GAS per container (Fixed12) - WithdrawFee: 1_0000_0000, // 1.0 GAS (Fixed8) - Glagolitics: make([]string, 0, credSize), + Endpoint: "https://neo.rpc.node:30333", + MaxObjectSize: 67108864, // 64 MiB + EpochDuration: 240, // 1 hour with 15s per block + BasicIncomeRate: 1_0000_0000, // 0.0001 GAS per GiB (Fixed12) + AuditFee: 1_0000, // 0.00000001 GAS per audit (Fixed12) + CandidateFee: 100_0000_0000, // 100.0 GAS (Fixed8) + ContainerFee: 1000, // 0.000000001 * 7 GAS per container (Fixed12) + ContainerAliasFee: 500, // ContainerFee / 2 + WithdrawFee: 1_0000_0000, // 1.0 GAS (Fixed8) + Glagolitics: make([]string, 0, credSize), } appDir, err := filepath.Abs(appDir) diff --git a/cmd/neofs-adm/internal/modules/morph/dump.go b/cmd/neofs-adm/internal/modules/morph/dump.go index 8f88beed3..2bb204c23 100644 --- a/cmd/neofs-adm/internal/modules/morph/dump.go +++ b/cmd/neofs-adm/internal/modules/morph/dump.go @@ -149,7 +149,8 @@ func dumpNetworkConfig(cmd *cobra.Command, _ []string) error { switch string(k) { case netmapAuditFeeKey, netmapBasicIncomeRateKey, - netmapContainerFeeKey, netmapEigenTrustIterationsKey, + netmapContainerFeeKey, netmapContainerAliasFeeKey, + netmapEigenTrustIterationsKey, netmapEpochKey, netmapInnerRingCandidateFeeKey, netmapMaxObjectSizeKey, netmapWithdrawFeeKey: nbuf := make([]byte, 8) diff --git a/cmd/neofs-adm/internal/modules/morph/initialize_deploy.go b/cmd/neofs-adm/internal/modules/morph/initialize_deploy.go index 8579455ac..f09d8a6df 100644 --- a/cmd/neofs-adm/internal/modules/morph/initialize_deploy.go +++ b/cmd/neofs-adm/internal/modules/morph/initialize_deploy.go @@ -38,6 +38,7 @@ const ( netmapMaxObjectSizeKey = "MaxObjectSize" netmapAuditFeeKey = "AuditFee" netmapContainerFeeKey = "ContainerFee" + netmapContainerAliasFeeKey = "ContainerAliasFee" netmapEigenTrustIterationsKey = "EigenTrustIterations" netmapEigenTrustAlphaKey = "EigenTrustAlpha" netmapBasicIncomeRateKey = "BasicIncomeRate" @@ -339,6 +340,8 @@ func (c *initializeContext) getContractDeployData(ctrName string, keysParam []sm {Type: smartcontract.IntegerType, Value: viper.GetInt64(auditFeeInitFlag)}, {Type: smartcontract.StringType, Value: netmapContainerFeeKey}, {Type: smartcontract.IntegerType, Value: viper.GetInt64(containerFeeInitFlag)}, + {Type: smartcontract.StringType, Value: netmapContainerAliasFeeKey}, + {Type: smartcontract.IntegerType, Value: viper.GetInt64(containerAliasFeeInitFlag)}, {Type: smartcontract.StringType, Value: netmapEigenTrustIterationsKey}, {Type: smartcontract.IntegerType, Value: int64(defaultEigenTrustIterations)}, {Type: smartcontract.StringType, Value: netmapEigenTrustAlphaKey}, diff --git a/cmd/neofs-adm/internal/modules/morph/root.go b/cmd/neofs-adm/internal/modules/morph/root.go index b671166cb..e6cfff5f5 100644 --- a/cmd/neofs-adm/internal/modules/morph/root.go +++ b/cmd/neofs-adm/internal/modules/morph/root.go @@ -6,31 +6,33 @@ import ( ) const ( - alphabetWalletsFlag = "alphabet-wallets" - alphabetSizeFlag = "size" - endpointFlag = "rpc-endpoint" - storageWalletFlag = "storage-wallet" - storageGasCLIFlag = "initial-gas" - storageGasConfigFlag = "storage.initial_gas" - contractsInitFlag = "contracts" - maxObjectSizeInitFlag = "network.max_object_size" - maxObjectSizeCLIFlag = "max-object-size" - epochDurationInitFlag = "network.epoch_duration" - epochDurationCLIFlag = "epoch-duration" - incomeRateInitFlag = "network.basic_income_rate" - incomeRateCLIFlag = "basic-income-rate" - auditFeeInitFlag = "network.fee.audit" - auditFeeCLIFlag = "audit-fee" - containerFeeInitFlag = "network.fee.container" - containerFeeCLIFlag = "container-fee" - candidateFeeInitFlag = "network.fee.candidate" - candidateFeeCLIFlag = "candidate-fee" - withdrawFeeInitFlag = "network.fee.withdraw" - withdrawFeeCLIFlag = "withdraw-fee" - containerDumpFlag = "dump" - containerContractFlag = "container-contract" - containerIDsFlag = "cid" - refillGasAmountFlag = "gas" + alphabetWalletsFlag = "alphabet-wallets" + alphabetSizeFlag = "size" + endpointFlag = "rpc-endpoint" + storageWalletFlag = "storage-wallet" + storageGasCLIFlag = "initial-gas" + storageGasConfigFlag = "storage.initial_gas" + contractsInitFlag = "contracts" + maxObjectSizeInitFlag = "network.max_object_size" + maxObjectSizeCLIFlag = "max-object-size" + epochDurationInitFlag = "network.epoch_duration" + epochDurationCLIFlag = "epoch-duration" + incomeRateInitFlag = "network.basic_income_rate" + incomeRateCLIFlag = "basic-income-rate" + auditFeeInitFlag = "network.fee.audit" + auditFeeCLIFlag = "audit-fee" + containerFeeInitFlag = "network.fee.container" + containerAliasFeeInitFlag = "network.fee.container_alias" + containerFeeCLIFlag = "container-fee" + containerAliasFeeCLIFlag = "container-alias-fee" + candidateFeeInitFlag = "network.fee.candidate" + candidateFeeCLIFlag = "candidate-fee" + withdrawFeeInitFlag = "network.fee.withdraw" + withdrawFeeCLIFlag = "withdraw-fee" + containerDumpFlag = "dump" + containerContractFlag = "container-contract" + containerIDsFlag = "cid" + refillGasAmountFlag = "gas" ) var ( @@ -62,6 +64,7 @@ var ( _ = viper.BindPFlag(auditFeeInitFlag, cmd.Flags().Lookup(auditFeeCLIFlag)) _ = viper.BindPFlag(candidateFeeInitFlag, cmd.Flags().Lookup(candidateFeeCLIFlag)) _ = viper.BindPFlag(containerFeeInitFlag, cmd.Flags().Lookup(containerFeeCLIFlag)) + _ = viper.BindPFlag(containerAliasFeeInitFlag, cmd.Flags().Lookup(containerAliasFeeCLIFlag)) _ = viper.BindPFlag(withdrawFeeInitFlag, cmd.Flags().Lookup(withdrawFeeCLIFlag)) }, RunE: initializeSideChainCmd,