Make container.Delete() GAS cost more predictable #42

Merged
fyrchik merged 3 commits from fyrchik/frostfs-contract:fixed-marshal into support/v0.18 2024-09-04 19:51:17 +00:00
Showing only changes of commit 5066d645a0 - Show all commits

View file

@ -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[:])
}