Add public key as argument for container_contract.Delete() method #28
2 changed files with 8 additions and 8 deletions
|
@ -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)
|
||||
|
|
|
@ -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[:])
|
||||
|
|
Loading…
Add table
Reference in a new issue
It should break compatibility with current version of the node. For the Neo VM
Delete()
with 3 arguments andDelete()
with 4 arguments are completely different methods.I suggest to add one more method and reuse the code of
Delete()
method. SeePut()
andPutNamed()
methods. So newer versions of node will use new method and older versions stick with currentDelete()
method.However, if we don't care about compatibility there for some reason, this is okay.
We can mark it as deprecated and use https://github.com/nspcc-dev/neo-go/blob/master/docs/compiler.md#Overloads .
We can mark it as deprecated and use https://github.com/nspcc-dev/neo-go/blob/master/docs/compiler.md#Overloads .
Let's break compatibility because we don't have any public networks to be compatible with.