From 08953a2f94ecb50ff8b006d25ac34b4b2c623418 Mon Sep 17 00:00:00 2001 From: Alexander Chuprov Date: Thu, 11 Jul 2024 18:28:14 +0300 Subject: [PATCH] [#1239] adm/morph: Fix transfer GAS to alphabet nodes Signed-off-by: Alexander Chuprov --- .../modules/morph/initialize/initialize_transfer.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/frostfs-adm/internal/modules/morph/initialize/initialize_transfer.go b/cmd/frostfs-adm/internal/modules/morph/initialize/initialize_transfer.go index 8bcd7eb5..b7102fa1 100644 --- a/cmd/frostfs-adm/internal/modules/morph/initialize/initialize_transfer.go +++ b/cmd/frostfs-adm/internal/modules/morph/initialize/initialize_transfer.go @@ -26,6 +26,10 @@ const ( initialAlphabetGASAmount = 10_000 * native.GASFactor // initialProxyGASAmount represents the amount of GAS given to a proxy contract. initialProxyGASAmount = 50_000 * native.GASFactor + // alphabetGasRatio is a coefficient that defines the threshold below which + // the balance of the alphabet node is considered not replenished. The value + // of this coefficient is determined empirically. + alphabetGasRatio = 5 ) func transferFunds(c *helper.InitializeContext) error { @@ -80,7 +84,7 @@ func transferFundsFinished(c *helper.InitializeContext) (bool, error) { r := nep17.NewReader(c.ReadOnlyInvoker, gas.Hash) res, err := r.BalanceOf(acc.Contract.ScriptHash()) - return res.Cmp(big.NewInt(initialAlphabetGASAmount/2)) == 1, err + return res.Cmp(big.NewInt(alphabetGasRatio*native.GASFactor)) == 1, err } func transferGASToProxy(c *helper.InitializeContext) error {