From 9fedfca5cdcd17c0fd9707797f7b720bf7aa8f21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camil=20B=C4=83ncioiu?= Date: Thu, 5 Oct 2023 10:47:26 +0300 Subject: [PATCH] Adjust answer-locals.wat and .wasm again --- test/contracts/answer-locals/answer-locals.wat | 8 +++++--- .../answer-locals/output/answer-locals.wasm | Bin 96 -> 109 bytes vmhost/hosttest/execution_test.go | 9 +++++---- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/test/contracts/answer-locals/answer-locals.wat b/test/contracts/answer-locals/answer-locals.wat index bce27995f..02ad07671 100644 --- a/test/contracts/answer-locals/answer-locals.wat +++ b/test/contracts/answer-locals/answer-locals.wat @@ -2,12 +2,14 @@ (type (;0;) (func (param i64))) (type (;1;) (func)) (import "env" "int64finish" (func (;0;) (type 0))) - (func (;1;) (type 1) - (local i64 i64 i64 i64 i64) + (func (;1;) (type 1)) + (func (;2;) (type 1) + (local i64 i64 i64 i64) i64.const 42 call 0) (table (;0;) 1 1 funcref) (memory (;0;) 2) (global (;0;) (mut i32) (i32.const 66560)) (export "memory" (memory 0)) - (export "init" (func 1))) + (export "init" (func 1)) + (export "answer" (func 2))) diff --git a/test/contracts/answer-locals/output/answer-locals.wasm b/test/contracts/answer-locals/output/answer-locals.wasm index 218810b1d91eb6b10f037a077fbddc6408b89b09..b6b8d92dcabed36ada05dad0956c9288a406b8b9 100644 GIT binary patch delta 74 zcmYeuouJ{$%*4pZ!pc~{$jHdb%*epR#=%(6=-AM~!p$zl%$A#)n_pDP#K4l7ms!HV d$d;H_T%KCQz{JJN#KgeO!N^kQq$R+>4FJ+_437W+ delta 61 zcmc~zn4n?7#K_3P%2>e2$jHjf$iT$L!C24e*wDek%`V8qmYbTJUsTD&z>=AlS;D}` Q#l^_M$Xe&5CBVQ904($g%>V!Z diff --git a/vmhost/hosttest/execution_test.go b/vmhost/hosttest/execution_test.go index cec126041..fc74f012f 100644 --- a/vmhost/hosttest/execution_test.go +++ b/vmhost/hosttest/execution_test.go @@ -3687,8 +3687,9 @@ func TestExecution_Mocked_OnSameFollowedByOnDest(t *testing.T) { // number of i64 locals it instantiates func makeBytecodeWithLocals(numLocals uint64) []byte { originalCode := test.GetTestSCCode("answer-locals", "../../") - firstSlice := originalCode[:0x59] - secondSlice := originalCode[0x5A:] + + firstSlice := originalCode[:0x66] + secondSlice := originalCode[0x67:] encodedNumLocals := vmhost.U64ToLEB128(numLocals) extraBytes := len(encodedNumLocals) - 1 @@ -3698,8 +3699,8 @@ func makeBytecodeWithLocals(numLocals uint64) []byte { result = append(result, encodedNumLocals...) result = append(result, secondSlice...) - result[0x55] = byte(int(result[0x55]) + extraBytes) - result[0x57] = byte(int(result[0x57]) + extraBytes) + result[0x5F] = byte(int(result[0x5F]) + extraBytes) + result[0x64] = byte(int(result[0x64]) + extraBytes) return result }