From 402c13a607b51a5e0cf4e4120c76769996afd312 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Mon, 9 Jan 2023 14:31:34 +0300 Subject: [PATCH] [TrueCloudLab#3] processing: Rename neofs to frostfs Signed-off-by: Denis Kirillov --- processing/config.yml | 2 +- processing/doc.go | 6 +++--- processing/processing_contract.go | 12 ++++++------ tests/processing_test.go | 10 +++++----- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/processing/config.yml b/processing/config.yml index dced52b..c540518 100644 --- a/processing/config.yml +++ b/processing/config.yml @@ -1,4 +1,4 @@ -name: "NeoFS Multi Signature Processing" +name: "FrostFS Multi Signature Processing" safemethods: ["verify", "version"] permissions: - methods: ["update"] diff --git a/processing/doc.go b/processing/doc.go index 5d21ea1..f6a4979 100644 --- a/processing/doc.go +++ b/processing/doc.go @@ -1,5 +1,5 @@ /* -Processing contract is a contract deployed in NeoFS mainchain. +Processing contract is a contract deployed in FrostFS mainchain. Processing contract pays for all multisignature transaction executions when notary service is enabled in the mainchain. Notary service prepares multisigned transactions, @@ -8,8 +8,8 @@ ask Alphabet nodes to pay for these transactions: nodes can change over time, some nodes will spend sidechain GAS faster. It leads to economic instability. Processing contract exists to solve this issue. At the Withdraw invocation of -NeoFS contract, a user pays fee directly to this contract. This fee is used to -pay for Cheque invocation of NeoFS contract that returns mainchain GAS back +FrostFS contract, a user pays fee directly to this contract. This fee is used to +pay for Cheque invocation of FrostFS contract that returns mainchain GAS back to the user. The address of the Processing contract is used as the first signer in the multisignature transaction. Therefore, NeoVM executes Verify method of the contract and if invocation is verified, Processing contract pays for the diff --git a/processing/processing_contract.go b/processing/processing_contract.go index 01cd74a..17b86e8 100644 --- a/processing/processing_contract.go +++ b/processing/processing_contract.go @@ -13,7 +13,7 @@ import ( ) const ( - neofsContractKey = "neofsScriptHash" + frostfsContractKey = "frostfsScriptHash" multiaddrMethod = "alphabetAddress" ) @@ -34,16 +34,16 @@ func _deploy(data interface{}, isUpdate bool) { } args := data.(struct { - addrNeoFS interop.Hash160 + addrFrostFS interop.Hash160 }) ctx := storage.GetContext() - if len(args.addrNeoFS) != interop.Hash160Len { + if len(args.addrFrostFS) != interop.Hash160Len { panic("incorrect length of contract script hash") } - storage.Put(ctx, neofsContractKey, args.addrNeoFS) + storage.Put(ctx, frostfsContractKey, args.addrFrostFS) runtime.Log("processing contract initialized") } @@ -68,8 +68,8 @@ func Update(script []byte, manifest []byte, data interface{}) { // Alphabet nodes of the Inner Ring. func Verify() bool { ctx := storage.GetContext() - neofsContractAddr := storage.Get(ctx, neofsContractKey).(interop.Hash160) - multiaddr := contract.Call(neofsContractAddr, multiaddrMethod, contract.ReadOnly).(interop.Hash160) + frostfsContractAddr := storage.Get(ctx, frostfsContractKey).(interop.Hash160) + multiaddr := contract.Call(frostfsContractAddr, multiaddrMethod, contract.ReadOnly).(interop.Hash160) return runtime.CheckWitness(multiaddr) } diff --git a/tests/processing_test.go b/tests/processing_test.go index 248eef8..ac6c4e9 100644 --- a/tests/processing_test.go +++ b/tests/processing_test.go @@ -11,21 +11,21 @@ import ( const processingPath = "../processing" -func deployProcessingContract(t *testing.T, e *neotest.Executor, addrNeoFS util.Uint160) util.Uint160 { +func deployProcessingContract(t *testing.T, e *neotest.Executor, addrFrostFS util.Uint160) util.Uint160 { c := neotest.CompileFile(t, e.CommitteeHash, processingPath, path.Join(processingPath, "config.yml")) args := make([]interface{}, 1) - args[0] = addrNeoFS + args[0] = addrFrostFS e.DeployContract(t, c, args) return c.Hash } func newProcessingInvoker(t *testing.T) (*neotest.ContractInvoker, neotest.Signer) { - neofsInvoker, irMultiAcc, _ := newNeoFSInvoker(t, 2) - hash := deployProcessingContract(t, neofsInvoker.Executor, neofsInvoker.Hash) + frostfsInvoker, irMultiAcc, _ := newFrostFSInvoker(t, 2) + hash := deployProcessingContract(t, frostfsInvoker.Executor, frostfsInvoker.Hash) - return neofsInvoker.CommitteeInvoker(hash), irMultiAcc + return frostfsInvoker.CommitteeInvoker(hash), irMultiAcc } func TestVerify_Processing(t *testing.T) {