Skip to content

Commit

Permalink
update fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
iFrostizz committed Apr 26, 2024
1 parent ece7f6e commit b01177f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions x/programs/examples/counter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
func TestCounterProgram(t *testing.T) {
require := require.New(t)
db := newTestDB()
maxUnits := uint64(80000)
maxUnits := uint64(10000000)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

Expand Down Expand Up @@ -102,7 +102,7 @@ func TestCounterProgram(t *testing.T) {
require.NoError(err)

// define max units to transfer to second runtime
unitsTransfer := uint64(20000)
unitsTransfer := uint64(2000000)

// transfer the units from the original runtime to the new runtime before
// any calls are made.
Expand Down Expand Up @@ -180,7 +180,7 @@ func TestCounterProgram(t *testing.T) {
target, err := writeToMem(programID2, mem)
require.NoError(err)

maxUnitsProgramToProgram := int64(10000)
maxUnitsProgramToProgram := int64(1000000)
maxUnitsProgramToProgramPtr, err := writeToMem(maxUnitsProgramToProgram, mem)
require.NoError(err)

Expand Down
4 changes: 3 additions & 1 deletion x/programs/examples/imports/program/program.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package program
import (
"context"
"encoding/binary"
"errors"

"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/utils/logging"
Expand Down Expand Up @@ -143,7 +144,7 @@ func (i *Import) callProgramFn(callContext program.Context) func(*wasmtime.Calle
}
}()

argsBytes, err := program.SmartPtr(args).Bytes(memory)
argsBytes, err := memory.Range(uint32(argsPtr), uint32(argsLen))
if err != nil {
i.log.Error("failed to read program args from memory",
zap.Error(err),
Expand Down Expand Up @@ -218,6 +219,7 @@ func getProgramWasmBytes(log logging.Logger, db state.Immutable, idBytes []byte)
bytes, exists, err := storage.GetProgram(context.Background(), db, id)
if !exists {
log.Debug("key does not exist", zap.String("id", id.String()))
return nil, errors.New("unknown program")
}
if err != nil {
return nil, err
Expand Down
Binary file modified x/programs/tests/fixture/counter.wasm
Binary file not shown.

0 comments on commit b01177f

Please sign in to comment.