From ab0a899a283566dbb65751e62ff0df36a9870bfb Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 5 Oct 2023 14:42:54 +0300 Subject: [PATCH] [#42] container: Add failing tests for different epoch deletion Signed-off-by: Evgenii Stratonikov --- tests/container_test.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/container_test.go b/tests/container_test.go index aa98f13..2f5d9d5 100644 --- a/tests/container_test.go +++ b/tests/container_test.go @@ -282,6 +282,32 @@ func TestContainerDelete(t *testing.T) { c.InvokeFail(t, container.NotFoundError, "deletionInfo", id[:]) }) + t.Run("gas costs are the same for different epochs", func(t *testing.T) { + t.Skip() + + _, cnt2 := addContainer(t, c, cBal) + args := []interface{}{cnt2.id[:], cnt2.sig, cnt2.pub, cnt2.token} + + tx := c.PrepareInvoke(t, "delete", args...) + for _, e := range []int{126, 127, 128, 129, 65536} { + cNm.Invoke(t, stackitem.Null{}, "newEpoch", e) + + // Sanity check. + s, err := cNm.TestInvoke(t, "epoch") + require.NoError(t, err) + require.Equal(t, big.NewInt(int64(e)), s.Top().BigInt()) + + tx2 := c.PrepareInvoke(t, "delete", args...) + require.Equal(t, tx.Size(), tx2.Size()) + require.Equal(t, tx.SystemFee, tx2.SystemFee) + require.Equal(t, tx.NetworkFee, tx2.NetworkFee) + } + + // Another sanity check: we want to test successful invocations, + // bad ones can trivially be equal. + c.Invoke(t, stackitem.Null{}, "delete", args...) + }) + c.InvokeFail(t, container.NotFoundError, "get", cnt.id[:]) }