From 79c8b3bd6d108280e5f08055c6fd12c50b167d00 Mon Sep 17 00:00:00 2001 From: navelbuffle Date: Sat, 4 Jan 2025 16:27:21 +0300 Subject: [PATCH] add bool stack into adapter --- onchain/src/Push3IntAdapter.sol | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/onchain/src/Push3IntAdapter.sol b/onchain/src/Push3IntAdapter.sol index 394d485..5929de7 100644 --- a/onchain/src/Push3IntAdapter.sol +++ b/onchain/src/Push3IntAdapter.sol @@ -69,9 +69,12 @@ contract Push3IntAdapter { int256[] memory initIntStack = new int256[](1); initIntStack[0] = in1; + // No bool stack + bool[] memory initBoolStack = new bool[](0); + // 4) Run (, , int256[] memory finalIntStack,) = - interpreter.runInterpreter(code, initCodeStack, initExecStack, initIntStack); + interpreter.runInterpreter(code, initCodeStack, initExecStack, initIntStack, initBoolStack); // 5) Return top of final int stack require(finalIntStack.length > 0, "No integer output produced"); @@ -96,8 +99,10 @@ contract Push3IntAdapter { initIntStack[0] = in1; initIntStack[1] = in2; + bool[] memory initBoolStack = new bool[](0); + (, , int256[] memory finalIntStack,) = - interpreter.runInterpreter(code, initCodeStack, initExecStack, initIntStack); + interpreter.runInterpreter(code, initCodeStack, initExecStack, initIntStack, initBoolStack); require(finalIntStack.length > 0, "No integer output"); @@ -121,8 +126,10 @@ contract Push3IntAdapter { int256[] memory initIntStack = new int256[](1); initIntStack[0] = in1; + bool[] memory initBoolStack = new bool[](0); + (, , int256[] memory finalIntStack,) = - interpreter.runInterpreter(code, initCodeStack, initExecStack, initIntStack); + interpreter.runInterpreter(code, initCodeStack, initExecStack, initIntStack, initBoolStack); require(finalIntStack.length >= 2, "Not enough outputs"); out1 = finalIntStack[finalIntStack.length - 1]; @@ -143,9 +150,10 @@ contract Push3IntAdapter { uint256[] memory initCodeStack = new uint256[](0); int256[] memory initIntStack = new int256[](0); + bool[] memory initBoolStack = new bool[](0); (, , int256[] memory finalIntStack,) = - interpreter.runInterpreter(code, initCodeStack, initExecStack, initIntStack); + interpreter.runInterpreter(code, initCodeStack, initExecStack, initIntStack, initBoolStack); return finalIntStack; }