From a21630c1d7ffe15fb77fc29978420ff0a869d5c5 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Wed, 11 Jan 2023 10:33:14 +0300 Subject: [PATCH] [TrueCloudLab#3] neofsid: Rename contract to frostfsid Signed-off-by: Denis Kirillov --- Makefile | 2 +- {neofsid => frostfsid}/config.yml | 2 +- frostfsid/doc.go | 20 +++++++++++++++++++ .../frostfsid_contract.go | 8 ++++---- neofsid/doc.go | 20 ------------------- tests/{neofsid_test.go => frostfsid_test.go} | 14 ++++++------- 6 files changed, 33 insertions(+), 33 deletions(-) rename {neofsid => frostfsid}/config.yml (78%) create mode 100644 frostfsid/doc.go rename neofsid/neofsid_contract.go => frostfsid/frostfsid_contract.go (97%) delete mode 100644 neofsid/doc.go rename tests/{neofsid_test.go => frostfsid_test.go} (87%) diff --git a/Makefile b/Makefile index 121fb74..309aa4e 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ all: sidechain mainnet sidechain: alphabet morph nns alphabet_sc = alphabet -morph_sc = audit balance container neofsid netmap proxy reputation subnet +morph_sc = audit balance container frostfsid netmap proxy reputation subnet mainnet_sc = frostfs processing nns_sc = nns diff --git a/neofsid/config.yml b/frostfsid/config.yml similarity index 78% rename from neofsid/config.yml rename to frostfsid/config.yml index b3b7e2c..f06256e 100644 --- a/neofsid/config.yml +++ b/frostfsid/config.yml @@ -1,4 +1,4 @@ -name: "NeoFS ID" +name: "FrostFS ID" safemethods: ["key", "version"] permissions: - methods: ["update"] diff --git a/frostfsid/doc.go b/frostfsid/doc.go new file mode 100644 index 0000000..e15832d --- /dev/null +++ b/frostfsid/doc.go @@ -0,0 +1,20 @@ +/* +FrostFSID contract is a contract deployed in FrostFS sidechain. + +FrostFSID contract is used to store connection between an OwnerID and its public keys. +OwnerID is a 25-byte N3 wallet address that can be produced from a public key. +It is one-way conversion. In simple cases, FrostFS verifies ownership by checking +signature and relation between a public key and an OwnerID. + +In more complex cases, a user can use public keys unrelated to the OwnerID to maintain +secure access to the data. FrostFSID contract stores relation between an OwnerID and +arbitrary public keys. Data owner can bind a public key with its account or unbind it +by invoking Bind or Unbind methods of FrostFS contract in the mainchain. After that, +Alphabet nodes produce multisigned AddKey and RemoveKey invocations of FrostFSID +contract. + +# Contract notifications + +FrostFSID contract does not produce notifications to process. +*/ +package frostfsid diff --git a/neofsid/neofsid_contract.go b/frostfsid/frostfsid_contract.go similarity index 97% rename from neofsid/neofsid_contract.go rename to frostfsid/frostfsid_contract.go index 4db3548..e3694ec 100644 --- a/neofsid/neofsid_contract.go +++ b/frostfsid/frostfsid_contract.go @@ -1,4 +1,4 @@ -package neofsid +package frostfsid import ( "github.com/TrueCloudLab/frostfs-contract/common" @@ -54,10 +54,10 @@ func _deploy(data interface{}, isUpdate bool) { storage.Put(ctx, notaryDisabledKey, args.notaryDisabled) if args.notaryDisabled { common.InitVote(ctx) - runtime.Log("neofsid contract notary disabled") + runtime.Log("frostfsid contract notary disabled") } - runtime.Log("neofsid contract initialized") + runtime.Log("frostfsid contract initialized") } // Update method updates contract source code and manifest. It can be invoked @@ -69,7 +69,7 @@ func Update(script []byte, manifest []byte, data interface{}) { contract.Call(interop.Hash160(management.Hash), "update", contract.All, script, manifest, common.AppendVersion(data)) - runtime.Log("neofsid contract updated") + runtime.Log("frostfsid contract updated") } // AddKey binds a list of the provided public keys to the OwnerID. It can be invoked only by diff --git a/neofsid/doc.go b/neofsid/doc.go deleted file mode 100644 index 012b4f7..0000000 --- a/neofsid/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -NeoFSID contract is a contract deployed in NeoFS sidechain. - -NeoFSID contract is used to store connection between an OwnerID and its public keys. -OwnerID is a 25-byte N3 wallet address that can be produced from a public key. -It is one-way conversion. In simple cases, NeoFS verifies ownership by checking -signature and relation between a public key and an OwnerID. - -In more complex cases, a user can use public keys unrelated to the OwnerID to maintain -secure access to the data. NeoFSID contract stores relation between an OwnerID and -arbitrary public keys. Data owner can bind a public key with its account or unbind it -by invoking Bind or Unbind methods of NeoFS contract in the mainchain. After that, -Alphabet nodes produce multisigned AddKey and RemoveKey invocations of NeoFSID -contract. - -# Contract notifications - -NeoFSID contract does not produce notifications to process. -*/ -package neofsid diff --git a/tests/neofsid_test.go b/tests/frostfsid_test.go similarity index 87% rename from tests/neofsid_test.go rename to tests/frostfsid_test.go index 72661dc..1657fca 100644 --- a/tests/neofsid_test.go +++ b/tests/frostfsid_test.go @@ -16,20 +16,20 @@ import ( "github.com/stretchr/testify/require" ) -const neofsidPath = "../neofsid" +const frostfsidPath = "../frostfsid" -func deployNeoFSIDContract(t *testing.T, e *neotest.Executor, addrNetmap, addrContainer util.Uint160) util.Uint160 { +func deployFrostFSIDContract(t *testing.T, e *neotest.Executor, addrNetmap, addrContainer util.Uint160) util.Uint160 { args := make([]interface{}, 5) args[0] = false args[1] = addrNetmap args[2] = addrContainer - c := neotest.CompileFile(t, e.CommitteeHash, neofsidPath, path.Join(neofsidPath, "config.yml")) + c := neotest.CompileFile(t, e.CommitteeHash, frostfsidPath, path.Join(frostfsidPath, "config.yml")) e.DeployContract(t, c, args) return c.Hash } -func newNeoFSIDInvoker(t *testing.T) *neotest.ContractInvoker { +func newFrostFSIDInvoker(t *testing.T) *neotest.ContractInvoker { e := newExecutor(t) ctrNNS := neotest.CompileFile(t, e.CommitteeHash, nnsPath, path.Join(nnsPath, "config.yml")) @@ -43,12 +43,12 @@ func newNeoFSIDInvoker(t *testing.T) *neotest.ContractInvoker { container.AliasFeeKey, int64(containerAliasFee)) deployBalanceContract(t, e, ctrNetmap.Hash, ctrContainer.Hash) deployContainerContract(t, e, ctrNetmap.Hash, ctrBalance.Hash, ctrNNS.Hash) - h := deployNeoFSIDContract(t, e, ctrNetmap.Hash, ctrContainer.Hash) + h := deployFrostFSIDContract(t, e, ctrNetmap.Hash, ctrContainer.Hash) return e.CommitteeInvoker(h) } -func TestNeoFSID_AddKey(t *testing.T) { - e := newNeoFSIDInvoker(t) +func TestFrostFSID_AddKey(t *testing.T) { + e := newFrostFSIDInvoker(t) pubs := make([][]byte, 6) for i := range pubs {