Skip to content

Commit

Permalink
test: Fix cluster test testOffledgerRequest900KB
Browse files Browse the repository at this point in the history
  • Loading branch information
howjmay committed Sep 9, 2023
1 parent 1eaa00f commit ca039c5
Show file tree
Hide file tree
Showing 3 changed files with 325,433 additions and 3 deletions.
25 changes: 25 additions & 0 deletions packages/vm/core/testcore/blob_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package testcore

import (
"crypto/rand"
"fmt"
"testing"

Expand All @@ -12,6 +13,7 @@ import (
"github.com/iotaledger/wasp/packages/kv/codec"
"github.com/iotaledger/wasp/packages/solo"
"github.com/iotaledger/wasp/packages/vm/core/blob"
"github.com/iotaledger/wasp/packages/vm/gas"
)

const (
Expand All @@ -32,6 +34,29 @@ func TestUploadBlob(t *testing.T) {
_, ok := ch.GetBlobInfo(h)
require.True(t, ok)
})
t.Run("huge", func(t *testing.T) {
env := solo.New(t)
ch := env.NewChain()

err := ch.DepositBaseTokensToL2(1_000_000, nil)
require.NoError(t, err)

limits := *gas.LimitsDefault
limits.MaxGasPerRequest = 10 * limits.MaxGasPerRequest
limits.MaxGasExternalViewCall = 10 * limits.MaxGasExternalViewCall
ch.SetGasLimits(nil, &limits)
ch.WaitForRequestsMark()

size := int64(1 * 900 * 1024) // 900 KB
randomData := make([]byte, size+1)
_, err = rand.Read(randomData)
require.NoError(t, err)
h, err := ch.UploadBlob(nil, "field", randomData)
require.NoError(t, err)

_, ok := ch.GetBlobInfo(h)
require.True(t, ok)
})
t.Run("from file", func(t *testing.T) {
env := solo.New(t)
ch := env.NewChain()
Expand Down
Loading

0 comments on commit ca039c5

Please sign in to comment.