Skip to content

Commit

Permalink
Update .gitignore, modify mock time format, and enhance host function…
Browse files Browse the repository at this point in the history
… parameter handling
  • Loading branch information
faddat committed Dec 26, 2024
1 parent ccc48d7 commit 4309b4e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
/demo
tmp
a.out
assistant*
libwasmvm/target/**

# macOS
.DS_Store
2 changes: 1 addition & 1 deletion internal/api/mocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func MockEnv() types.Env {
return types.Env{
Block: types.BlockInfo{
Height: 123,
Time: types.Uint64(1578939743),
Time: types.Uint64(1578939743_987654321),
ChainID: "foobar",
},
Transaction: &types.TransactionInfo{
Expand Down
5 changes: 4 additions & 1 deletion internal/runtime/hostfunctions.go
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,10 @@ func RegisterHostFunctions(runtime wazero.Runtime, env *RuntimeEnvironment) (waz
builder.NewFunctionBuilder().
WithFunc(func(ctx context.Context, m api.Module, iterID uint32) uint32 {
ctx = context.WithValue(ctx, envKey, env)
ptr, _, _ := hostNextValue(ctx, m, uint64(iterID), 0)
// Extract call_id and iter_id from the packed uint32
callID := uint64(iterID >> 16)
actualIterID := uint64(iterID & 0xFFFF)
ptr, _, _ := hostNextValue(ctx, m, callID, actualIterID)
return ptr
}).
WithParameterNames("iter_id").
Expand Down

0 comments on commit 4309b4e

Please sign in to comment.