[#927] neofs-adm: provide container alias fee on deploy

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2021-10-18 15:01:38 +03:00 committed by Alex Vanin
parent 0866c1fb90
commit 26e11a732d
5 changed files with 56 additions and 45 deletions

View file

@ -42,6 +42,7 @@ network:
audit: 0 # network audit fee, for private installation consider 0 audit: 0 # network audit fee, for private installation consider 0
candidate: 0 # inner ring candidate registration 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: 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 withdraw: 0 # withdraw fee, for private installation consider 0
credentials: # passwords for consensus node / alphabet wallets credentials: # passwords for consensus node / alphabet wallets
az: password1 az: password1

View file

@ -15,16 +15,17 @@ import (
) )
type configTemplate struct { type configTemplate struct {
Endpoint string Endpoint string
AlphabetDir string AlphabetDir string
MaxObjectSize int MaxObjectSize int
EpochDuration int EpochDuration int
BasicIncomeRate int BasicIncomeRate int
AuditFee int AuditFee int
CandidateFee int CandidateFee int
ContainerFee int ContainerFee int
WithdrawFee int ContainerAliasFee int
Glagolitics []string WithdrawFee int
Glagolitics []string
} }
const configTxtTemplate = `rpc-endpoint: {{ .Endpoint}} const configTxtTemplate = `rpc-endpoint: {{ .Endpoint}}
@ -37,6 +38,7 @@ network:
audit: {{ .AuditFee}} audit: {{ .AuditFee}}
candidate: {{ .CandidateFee}} candidate: {{ .CandidateFee}}
container: {{ .ContainerFee}} container: {{ .ContainerFee}}
container_alias: {{ .ContainerAliasFee }}
withdraw: {{ .WithdrawFee}} withdraw: {{ .WithdrawFee}}
# if credentials section is omitted, then neofs-adm will require manual password input # if credentials section is omitted, then neofs-adm will require manual password input
credentials:{{ range.Glagolitics}} credentials:{{ range.Glagolitics}}
@ -104,15 +106,16 @@ func defaultConfigPath() (string, error) {
// some comments as well. // some comments as well.
func generateConfigExample(appDir string, credSize int) (string, error) { func generateConfigExample(appDir string, credSize int) (string, error) {
tmpl := configTemplate{ tmpl := configTemplate{
Endpoint: "https://neo.rpc.node:30333", Endpoint: "https://neo.rpc.node:30333",
MaxObjectSize: 67108864, // 64 MiB MaxObjectSize: 67108864, // 64 MiB
EpochDuration: 240, // 1 hour with 15s per block EpochDuration: 240, // 1 hour with 15s per block
BasicIncomeRate: 1_0000_0000, // 0.0001 GAS per GiB (Fixed12) BasicIncomeRate: 1_0000_0000, // 0.0001 GAS per GiB (Fixed12)
AuditFee: 1_0000, // 0.00000001 GAS per audit (Fixed12) AuditFee: 1_0000, // 0.00000001 GAS per audit (Fixed12)
CandidateFee: 100_0000_0000, // 100.0 GAS (Fixed8) CandidateFee: 100_0000_0000, // 100.0 GAS (Fixed8)
ContainerFee: 1000, // 0.000000001 * 7 GAS per container (Fixed12) ContainerFee: 1000, // 0.000000001 * 7 GAS per container (Fixed12)
WithdrawFee: 1_0000_0000, // 1.0 GAS (Fixed8) ContainerAliasFee: 500, // ContainerFee / 2
Glagolitics: make([]string, 0, credSize), WithdrawFee: 1_0000_0000, // 1.0 GAS (Fixed8)
Glagolitics: make([]string, 0, credSize),
} }
appDir, err := filepath.Abs(appDir) appDir, err := filepath.Abs(appDir)

View file

@ -149,7 +149,8 @@ func dumpNetworkConfig(cmd *cobra.Command, _ []string) error {
switch string(k) { switch string(k) {
case netmapAuditFeeKey, netmapBasicIncomeRateKey, case netmapAuditFeeKey, netmapBasicIncomeRateKey,
netmapContainerFeeKey, netmapEigenTrustIterationsKey, netmapContainerFeeKey, netmapContainerAliasFeeKey,
netmapEigenTrustIterationsKey,
netmapEpochKey, netmapInnerRingCandidateFeeKey, netmapEpochKey, netmapInnerRingCandidateFeeKey,
netmapMaxObjectSizeKey, netmapWithdrawFeeKey: netmapMaxObjectSizeKey, netmapWithdrawFeeKey:
nbuf := make([]byte, 8) nbuf := make([]byte, 8)

View file

@ -38,6 +38,7 @@ const (
netmapMaxObjectSizeKey = "MaxObjectSize" netmapMaxObjectSizeKey = "MaxObjectSize"
netmapAuditFeeKey = "AuditFee" netmapAuditFeeKey = "AuditFee"
netmapContainerFeeKey = "ContainerFee" netmapContainerFeeKey = "ContainerFee"
netmapContainerAliasFeeKey = "ContainerAliasFee"
netmapEigenTrustIterationsKey = "EigenTrustIterations" netmapEigenTrustIterationsKey = "EigenTrustIterations"
netmapEigenTrustAlphaKey = "EigenTrustAlpha" netmapEigenTrustAlphaKey = "EigenTrustAlpha"
netmapBasicIncomeRateKey = "BasicIncomeRate" netmapBasicIncomeRateKey = "BasicIncomeRate"
@ -339,6 +340,8 @@ func (c *initializeContext) getContractDeployData(ctrName string, keysParam []sm
{Type: smartcontract.IntegerType, Value: viper.GetInt64(auditFeeInitFlag)}, {Type: smartcontract.IntegerType, Value: viper.GetInt64(auditFeeInitFlag)},
{Type: smartcontract.StringType, Value: netmapContainerFeeKey}, {Type: smartcontract.StringType, Value: netmapContainerFeeKey},
{Type: smartcontract.IntegerType, Value: viper.GetInt64(containerFeeInitFlag)}, {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.StringType, Value: netmapEigenTrustIterationsKey},
{Type: smartcontract.IntegerType, Value: int64(defaultEigenTrustIterations)}, {Type: smartcontract.IntegerType, Value: int64(defaultEigenTrustIterations)},
{Type: smartcontract.StringType, Value: netmapEigenTrustAlphaKey}, {Type: smartcontract.StringType, Value: netmapEigenTrustAlphaKey},

View file

@ -6,31 +6,33 @@ import (
) )
const ( const (
alphabetWalletsFlag = "alphabet-wallets" alphabetWalletsFlag = "alphabet-wallets"
alphabetSizeFlag = "size" alphabetSizeFlag = "size"
endpointFlag = "rpc-endpoint" endpointFlag = "rpc-endpoint"
storageWalletFlag = "storage-wallet" storageWalletFlag = "storage-wallet"
storageGasCLIFlag = "initial-gas" storageGasCLIFlag = "initial-gas"
storageGasConfigFlag = "storage.initial_gas" storageGasConfigFlag = "storage.initial_gas"
contractsInitFlag = "contracts" contractsInitFlag = "contracts"
maxObjectSizeInitFlag = "network.max_object_size" maxObjectSizeInitFlag = "network.max_object_size"
maxObjectSizeCLIFlag = "max-object-size" maxObjectSizeCLIFlag = "max-object-size"
epochDurationInitFlag = "network.epoch_duration" epochDurationInitFlag = "network.epoch_duration"
epochDurationCLIFlag = "epoch-duration" epochDurationCLIFlag = "epoch-duration"
incomeRateInitFlag = "network.basic_income_rate" incomeRateInitFlag = "network.basic_income_rate"
incomeRateCLIFlag = "basic-income-rate" incomeRateCLIFlag = "basic-income-rate"
auditFeeInitFlag = "network.fee.audit" auditFeeInitFlag = "network.fee.audit"
auditFeeCLIFlag = "audit-fee" auditFeeCLIFlag = "audit-fee"
containerFeeInitFlag = "network.fee.container" containerFeeInitFlag = "network.fee.container"
containerFeeCLIFlag = "container-fee" containerAliasFeeInitFlag = "network.fee.container_alias"
candidateFeeInitFlag = "network.fee.candidate" containerFeeCLIFlag = "container-fee"
candidateFeeCLIFlag = "candidate-fee" containerAliasFeeCLIFlag = "container-alias-fee"
withdrawFeeInitFlag = "network.fee.withdraw" candidateFeeInitFlag = "network.fee.candidate"
withdrawFeeCLIFlag = "withdraw-fee" candidateFeeCLIFlag = "candidate-fee"
containerDumpFlag = "dump" withdrawFeeInitFlag = "network.fee.withdraw"
containerContractFlag = "container-contract" withdrawFeeCLIFlag = "withdraw-fee"
containerIDsFlag = "cid" containerDumpFlag = "dump"
refillGasAmountFlag = "gas" containerContractFlag = "container-contract"
containerIDsFlag = "cid"
refillGasAmountFlag = "gas"
) )
var ( var (
@ -62,6 +64,7 @@ var (
_ = viper.BindPFlag(auditFeeInitFlag, cmd.Flags().Lookup(auditFeeCLIFlag)) _ = viper.BindPFlag(auditFeeInitFlag, cmd.Flags().Lookup(auditFeeCLIFlag))
_ = viper.BindPFlag(candidateFeeInitFlag, cmd.Flags().Lookup(candidateFeeCLIFlag)) _ = viper.BindPFlag(candidateFeeInitFlag, cmd.Flags().Lookup(candidateFeeCLIFlag))
_ = viper.BindPFlag(containerFeeInitFlag, cmd.Flags().Lookup(containerFeeCLIFlag)) _ = viper.BindPFlag(containerFeeInitFlag, cmd.Flags().Lookup(containerFeeCLIFlag))
_ = viper.BindPFlag(containerAliasFeeInitFlag, cmd.Flags().Lookup(containerAliasFeeCLIFlag))
_ = viper.BindPFlag(withdrawFeeInitFlag, cmd.Flags().Lookup(withdrawFeeCLIFlag)) _ = viper.BindPFlag(withdrawFeeInitFlag, cmd.Flags().Lookup(withdrawFeeCLIFlag))
}, },
RunE: initializeSideChainCmd, RunE: initializeSideChainCmd,