Как создавать контейнеры, если ContainerFee > 0? #2

Open
opened 2024-09-17 15:21:35 +00:00 by potyarkin · 1 comment
Owner

ContainerFee

По умолчанию в frostfs-dev-env установлено ContainerFee = 0, поэтому для создания контейнеров не требуется GAS.

Когда я поднимал morph+ir с более-менее дефолтными настройками, выставилось ContainerFee = 1000. В результате я не мог создать контейнер:

$ bin/frostfs-cli-v0.42.9 container create --wallet morph/wallet/subject.json --rpc-endpoint 127.0.0.202:8802 --basic-acl 0 --await --name mycontainer --policy 'REP 1' -vvvvvv                                
Parsed QL encoded policy                                                                                                                                                                                       
Using default wallet address                                                                                                                                                                                   
Enter password >                                                                                                                                                                                               
Set request timeout to 15s.                                                                                                                                                                                    
Reading container session...                                                                                                                                                                                   
Session not provided.                                                                                                                                                                                          
put container rpc error: status: code = 1024 message = frostfs error: chain/client: contract execution finished with state FAULT; exception: at instruction 1667 (THROW): unhandled exception: "insufficient balance to create container"                                                                                                                                                                                     
Exit code: 1  

На стороне NeoVM баланс кошелька выглядел пустым:

"len(alphabet) = 1"                                    
"containerFee = 1000"                                  
"balance = 0"
"ownerID.base64 = NUU8hAXqymNyP3fBNKacHS2DR5t1TbYM4g=="
"ownerID.base58 = NSE4JhRrhc1BhoMdSV3AYpzaYzXJGTf9jF"  

Хотя кошелек упоминается верный:

$ bin/neo-go-v0.104.0 wallet dump-keys -w morph/wallet/subject.json 
NSE4JhRrhc1BhoMdSV3AYpzaYzXJGTf9jF (simple signature contract):
03ae5d3106bfd846b0400f8a94ad6e9b4a796f75ca15f89d0726ec78b5f819e47a

С ненулевым балансом:

$ bin/neo-go-v0.104.0 wallet nep17 balance -w morph/wallet/subject.json -r http://127.0.0.200:30333
Account NSE4JhRrhc1BhoMdSV3AYpzaYzXJGTf9jF
GAS: GasToken (d2a4cff31913016155e38e474a2c06d08be276cf)
        Amount : 10000
        Updated: 116

Смотрел состояние NeoVM подредактированным контрактом:

diff --git a/common/version.go b/common/version.go
index c12832c..7cbbb4c 100644
--- a/common/version.go
+++ b/common/version.go
@@ -4,7 +4,7 @@ import "github.com/nspcc-dev/neo-go/pkg/interop/native/std"
 
 const (
     major = 0
-    minor = 19
+    minor = 21
     patch = 4
 
     // Versions from which an update should be performed.
diff --git a/container/container_contract.go b/container/container_contract.go
index 7946923..5374d89 100644
--- a/container/container_contract.go
+++ b/container/container_contract.go
@@ -202,6 +202,11 @@ func PutNamed(container []byte, signature interop.Signature,
         aliasFee := contract.Call(netmapContractAddr, "config", contract.ReadOnly, AliasFeeKey).(int)
         containerFee += aliasFee
     }
+    runtime.Log("len(alphabet) = " + std.Itoa10(len(alphabet)))
+    runtime.Log("containerFee = " + std.Itoa10(containerFee))
+    runtime.Log("balance = " + std.Itoa10(balance))
+    runtime.Log("ownerID.base64 = " + std.Base64Encode(ownerID))
+    runtime.Log("ownerID.base58 = " + std.Base58Encode(ownerID))
 
     if balance < containerFee*len(alphabet) {
         panic("insufficient balance to create container")

Пока отключу и у себя ContainerFee, потом надо разобраться, как работать при ненулевых значениях.

## ContainerFee По умолчанию в frostfs-dev-env установлено `ContainerFee = 0`, поэтому для создания контейнеров не требуется GAS. Когда я поднимал morph+ir с более-менее дефолтными настройками, выставилось `ContainerFee = 1000`. В результате я не мог создать контейнер: ```console $ bin/frostfs-cli-v0.42.9 container create --wallet morph/wallet/subject.json --rpc-endpoint 127.0.0.202:8802 --basic-acl 0 --await --name mycontainer --policy 'REP 1' -vvvvvv Parsed QL encoded policy Using default wallet address Enter password > Set request timeout to 15s. Reading container session... Session not provided. put container rpc error: status: code = 1024 message = frostfs error: chain/client: contract execution finished with state FAULT; exception: at instruction 1667 (THROW): unhandled exception: "insufficient balance to create container" Exit code: 1 ``` На стороне NeoVM баланс кошелька выглядел пустым: ``` "len(alphabet) = 1" "containerFee = 1000" "balance = 0" "ownerID.base64 = NUU8hAXqymNyP3fBNKacHS2DR5t1TbYM4g==" "ownerID.base58 = NSE4JhRrhc1BhoMdSV3AYpzaYzXJGTf9jF" ``` Хотя кошелек упоминается верный: ``` $ bin/neo-go-v0.104.0 wallet dump-keys -w morph/wallet/subject.json NSE4JhRrhc1BhoMdSV3AYpzaYzXJGTf9jF (simple signature contract): 03ae5d3106bfd846b0400f8a94ad6e9b4a796f75ca15f89d0726ec78b5f819e47a ``` С ненулевым балансом: ```console $ bin/neo-go-v0.104.0 wallet nep17 balance -w morph/wallet/subject.json -r http://127.0.0.200:30333 Account NSE4JhRrhc1BhoMdSV3AYpzaYzXJGTf9jF GAS: GasToken (d2a4cff31913016155e38e474a2c06d08be276cf) Amount : 10000 Updated: 116 ``` Смотрел состояние NeoVM подредактированным контрактом: ```diff diff --git a/common/version.go b/common/version.go index c12832c..7cbbb4c 100644 --- a/common/version.go +++ b/common/version.go @@ -4,7 +4,7 @@ import "github.com/nspcc-dev/neo-go/pkg/interop/native/std" const ( major = 0 - minor = 19 + minor = 21 patch = 4 // Versions from which an update should be performed. diff --git a/container/container_contract.go b/container/container_contract.go index 7946923..5374d89 100644 --- a/container/container_contract.go +++ b/container/container_contract.go @@ -202,6 +202,11 @@ func PutNamed(container []byte, signature interop.Signature, aliasFee := contract.Call(netmapContractAddr, "config", contract.ReadOnly, AliasFeeKey).(int) containerFee += aliasFee } + runtime.Log("len(alphabet) = " + std.Itoa10(len(alphabet))) + runtime.Log("containerFee = " + std.Itoa10(containerFee)) + runtime.Log("balance = " + std.Itoa10(balance)) + runtime.Log("ownerID.base64 = " + std.Base64Encode(ownerID)) + runtime.Log("ownerID.base58 = " + std.Base58Encode(ownerID)) if balance < containerFee*len(alphabet) { panic("insufficient balance to create container") ``` Пока отключу и у себя ContainerFee, потом надо разобраться, как работать при ненулевых значениях.
Author
Owner
Reported upstream: https://git.frostfs.info/TrueCloudLab/frostfs-contract/issues/115
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: potyarkin/bringup#2
No description provided.