From 2da0ff57500bbaed3dfd306a6f518797c4523d39 Mon Sep 17 00:00:00 2001 From: Anton Nikiforov Date: Thu, 1 Jun 2023 14:08:21 +0300 Subject: [PATCH] [#27] Add public key as argument for container_contract.Delete() method Signed-off-by: Anton Nikiforov --- container/container_contract.go | 2 +- tests/container_test.go | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/container/container_contract.go b/container/container_contract.go index 34c24ff..154c1f1 100644 --- a/container/container_contract.go +++ b/container/container_contract.go @@ -310,7 +310,7 @@ func checkNiceNameAvailable(nnsContractAddr interop.Hash160, domain string) bool // API. // // If the container doesn't exist, it panics with NotFoundError. -func Delete(containerID []byte, signature interop.Signature, token []byte) { +func Delete(containerID []byte, signature interop.Signature, publicKey interop.PublicKey, token []byte) { ctx := storage.GetContext() ownerID := getOwnerByID(ctx, containerID) diff --git a/tests/container_test.go b/tests/container_test.go index 2da778e..9fe8431 100644 --- a/tests/container_test.go +++ b/tests/container_test.go @@ -105,15 +105,15 @@ func TestContainerCount(t *testing.T) { c.Invoke(t, stackitem.Null{}, "put", cnt3.value, cnt3.sig, cnt3.pub, cnt3.token) checkContainerList(t, c, [][]byte{cnt1.id[:], cnt2.id[:], cnt3.id[:]}) - c.Invoke(t, stackitem.Null{}, "delete", cnt1.id[:], cnt1.sig, cnt1.token) + c.Invoke(t, stackitem.Null{}, "delete", cnt1.id[:], cnt1.sig, cnt1.pub, cnt1.token) checkCount(t, 2) checkContainerList(t, c, [][]byte{cnt2.id[:], cnt3.id[:]}) - c.Invoke(t, stackitem.Null{}, "delete", cnt2.id[:], cnt2.sig, cnt2.token) + c.Invoke(t, stackitem.Null{}, "delete", cnt2.id[:], cnt2.sig, cnt2.pub, cnt2.token) checkCount(t, 1) checkContainerList(t, c, [][]byte{cnt3.id[:]}) - c.Invoke(t, stackitem.Null{}, "delete", cnt3.id[:], cnt3.sig, cnt3.token) + c.Invoke(t, stackitem.Null{}, "delete", cnt3.id[:], cnt3.sig, cnt3.pub, cnt3.token) checkCount(t, 0) checkContainerList(t, c, [][]byte{}) } @@ -201,7 +201,7 @@ func TestContainerPut(t *testing.T) { c.InvokeFail(t, "name is already taken", "putNamed", putArgs...) }) - c.Invoke(t, stackitem.Null{}, "delete", cnt.id[:], cnt.sig, cnt.token) + c.Invoke(t, stackitem.Null{}, "delete", cnt.id[:], cnt.sig, cnt.pub, cnt.token) cNNS.Invoke(t, stackitem.Null{}, "resolve", "mycnt.frostfs", int64(nns.TXT)) t.Run("register in advance", func(t *testing.T) { @@ -244,14 +244,14 @@ func TestContainerDelete(t *testing.T) { acc, cnt := addContainer(t, c, cBal) cAcc := c.WithSigners(acc) cAcc.InvokeFail(t, common.ErrAlphabetWitnessFailed, "delete", - cnt.id[:], cnt.sig, cnt.token) + cnt.id[:], cnt.sig, cnt.pub, cnt.token) - c.Invoke(t, stackitem.Null{}, "delete", cnt.id[:], cnt.sig, cnt.token) + c.Invoke(t, stackitem.Null{}, "delete", cnt.id[:], cnt.sig, cnt.pub, cnt.token) t.Run("missing container", func(t *testing.T) { id := cnt.id id[0] ^= 0xFF - c.Invoke(t, stackitem.Null{}, "delete", cnt.id[:], cnt.sig, cnt.token) + c.Invoke(t, stackitem.Null{}, "delete", cnt.id[:], cnt.sig, cnt.pub, cnt.token) }) c.InvokeFail(t, container.NotFoundError, "get", cnt.id[:])