From efec0c8a4ccf5e7acfcb3774f6f8132d85ef8579 Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Thu, 17 Jul 2025 22:25:34 +0400 Subject: [PATCH 1/5] pow uint256 --- .gas-snapshot | 191 +++---- src/generated/Rainterpreter.pointers.sol | 4 +- ...interpreterExpressionDeployer.pointers.sol | 6 +- .../RainterpreterParser.pointers.sol | 8 +- src/lib/op/LibAllStandardOps.sol | 18 +- src/lib/op/math/uint256/LibOpUint256Pow.sol | 13 +- .../lib/op/math/uint256/LibOpUint256Pow.t.sol | 471 +++++++++--------- 7 files changed, 368 insertions(+), 343 deletions(-) diff --git a/.gas-snapshot b/.gas-snapshot index e4740a487..9fb735dfa 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -1,9 +1,9 @@ BaseRainterpreterExternNPE2IERC165Test:testRainterpreterExternNPE2IERC165(bytes4) (runs: 2056, μ: 320946, ~: 320946) BaseRainterpreterSubParserNPE2IERC165Test:testRainterpreterSubParserNPE2IERC165(uint32) (runs: 2056, μ: 678755, ~: 678755) -LibAllStandardOpsTest:testIntegrityAndOpcodeFunctionPointersLength() (gas: 55576) -LibAllStandardOpsTest:testIntegrityFunctionPointersLength() (gas: 8827) -LibAllStandardOpsTest:testOpcodeFunctionPointersLength() (gas: 8812) -LibEvalFBoundsTest:testEvalNPFBoundsModConstant(bytes32) (runs: 2056, μ: 84685, ~: 84685) +LibAllStandardOpsTest:testIntegrityAndOpcodeFunctionPointersLength() (gas: 56819) +LibAllStandardOpsTest:testIntegrityFunctionPointersLength() (gas: 8939) +LibAllStandardOpsTest:testOpcodeFunctionPointersLength() (gas: 8924) +LibEvalFBoundsTest:testEvalNPFBoundsModConstant(bytes32) (runs: 2056, μ: 84797, ~: 84797) LibExternCodecTest:testLibExternCodecEncodeExternCall(uint256,bytes32) (runs: 2056, μ: 9770, ~: 10284) LibExternCodecTest:testLibExternCodecEncodeExternDispatch(uint256,bytes32) (runs: 2056, μ: 8887, ~: 9401) LibInterpreterStateStackTraceTest:testStackTraceCall(uint256,uint256,uint256[]) (runs: 2056, μ: 43052, ~: 42630) @@ -19,10 +19,10 @@ LibOpAddTest:testOpAddEvalOperandDisallowed() (gas: 91501) LibOpAddTest:testOpAddEvalTwoOutput() (gas: 43976) LibOpAddTest:testOpAddEvalZeroInputs() (gas: 30212) LibOpAddTest:testOpAddEvalZeroOutputs() (gas: 42994) -LibOpAddTest:testOpAddIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint16) (runs: 2056, μ: 18198, ~: 18422) +LibOpAddTest:testOpAddIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint16) (runs: 2056, μ: 18196, ~: 18365) LibOpAddTest:testOpAddIntegrityUnhappyOneInput((uint256,uint256,uint256,bytes32[],uint256,bytes)) (runs: 2056, μ: 13867, ~: 13733) LibOpAddTest:testOpAddIntegrityUnhappyZeroInputs((uint256,uint256,uint256,bytes32[],uint256,bytes)) (runs: 2056, μ: 13864, ~: 13730) -LibOpAddTest:testOpAddRun(bytes32[]) (runs: 2050, μ: 52163, ~: 51964) +LibOpAddTest:testOpAddRun(bytes32[]) (runs: 2050, μ: 52047, ~: 51930) LibOpBinaryEqualToTest:testOpBinaryEqualToEval2() (gas: 207750) LibOpBinaryEqualToTest:testOpBinaryEqualToEval2InputsBothOne() (gas: 57822) LibOpBinaryEqualToTest:testOpBinaryEqualToEval2InputsFirstOneSecondZero() (gas: 58551) @@ -31,7 +31,7 @@ LibOpBinaryEqualToTest:testOpBinaryEqualToEval2ZeroInputs() (gas: 57867) LibOpBinaryEqualToTest:testOpBinaryEqualToEvalFail0Inputs() (gas: 30615) LibOpBinaryEqualToTest:testOpBinaryEqualToEvalFail1Input() (gas: 34935) LibOpBinaryEqualToTest:testOpBinaryEqualToEvalFail3Inputs() (gas: 43434) -LibOpBinaryEqualToTest:testOpBinaryEqualToIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint16) (runs: 2056, μ: 19691, ~: 19928) +LibOpBinaryEqualToTest:testOpBinaryEqualToIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint16) (runs: 2056, μ: 19690, ~: 19928) LibOpBinaryEqualToTest:testOpBinaryEqualToRun(bytes32,bytes32) (runs: 2056, μ: 16674, ~: 16674) LibOpBinaryEqualToTest:testOpBinaryEqualToTwoOutputs() (gas: 41593) LibOpBinaryEqualToTest:testOpBinaryEqualToZeroOutputs() (gas: 40524) @@ -53,33 +53,33 @@ LibOpBitwiseOrNPTest:testOpBitwiseORNPEvalZeroInputs() (gas: 30668) LibOpBitwiseOrNPTest:testOpBitwiseORNPEvalZeroOutputs() (gas: 40237) LibOpBitwiseOrNPTest:testOpBitwiseORNPIntegrity((uint256,uint256,uint256,bytes32[],uint256,bytes),bytes32) (runs: 2056, μ: 13746, ~: 13660) LibOpBitwiseOrNPTest:testOpBitwiseORNPRun(bytes32,bytes32) (runs: 2056, μ: 16628, ~: 16628) -LibOpBlockNumberTest:testOpBlockNumberEval(uint256) (runs: 2056, μ: 50955, ~: 50726) +LibOpBlockNumberTest:testOpBlockNumberEval(uint256) (runs: 2056, μ: 50948, ~: 50726) LibOpBlockNumberTest:testOpBlockNumberEvalOneInput() (gas: 35162) LibOpBlockNumberTest:testOpBlockNumberEvalTwoOutputs() (gas: 31463) LibOpBlockNumberTest:testOpBlockNumberEvalZeroOutputs() (gas: 30454) -LibOpBlockNumberTest:testOpBlockNumberIntegrity((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint16) (runs: 2056, μ: 19647, ~: 19877) +LibOpBlockNumberTest:testOpBlockNumberIntegrity((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint16) (runs: 2056, μ: 19654, ~: 19877) LibOpBlockNumberTest:testOpBlockNumberRun(uint256,uint16) (runs: 2056, μ: 20850, ~: 21044) LibOpCallTest:testCallTraceInnerOnly() (gas: 62979) LibOpCallTest:testCallTraceOuterOnly() (gas: 45549) -LibOpCallTest:testOpCallNPIntegrityIO((uint256,uint256,uint256,bytes32[],uint256,bytes),uint256,uint256,uint8,bytes32) (runs: 2053, μ: 39871, ~: 38479) -LibOpCallTest:testOpCallNPIntegritySourceIndexOutOfBounds((uint256,uint256,uint256,bytes32[],uint256,bytes),uint256,uint256,uint256,uint256,bytes32) (runs: 2056, μ: 59499, ~: 59021) -LibOpCallTest:testOpCallNPIntegrityTooManyOutputs((uint256,uint256,uint256,bytes32[],uint256,bytes),uint256,uint256,uint8,bytes32) (runs: 2049, μ: 58958, ~: 59689) +LibOpCallTest:testOpCallNPIntegrityIO((uint256,uint256,uint256,bytes32[],uint256,bytes),uint256,uint256,uint8,bytes32) (runs: 2055, μ: 39979, ~: 38553) +LibOpCallTest:testOpCallNPIntegritySourceIndexOutOfBounds((uint256,uint256,uint256,bytes32[],uint256,bytes),uint256,uint256,uint256,uint256,bytes32) (runs: 2056, μ: 59223, ~: 59108) +LibOpCallTest:testOpCallNPIntegrityTooManyOutputs((uint256,uint256,uint256,bytes32[],uint256,bytes),uint256,uint256,uint8,bytes32) (runs: 2051, μ: 58975, ~: 59518) LibOpCallTest:testOpCallNPRunInputsMismatch() (gas: 71893) LibOpCallTest:testOpCallNPRunOutputsMismatch() (gas: 65508) LibOpCallTest:testOpCallNPRunSourceDoesNotExist() (gas: 350425) LibOpChainIdTest:testOpChainIDEval(uint64) (runs: 2056, μ: 47017, ~: 47017) -LibOpChainIdTest:testOpChainIDIntegrity((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint16) (runs: 2056, μ: 19678, ~: 19944) +LibOpChainIdTest:testOpChainIDIntegrity((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint16) (runs: 2056, μ: 19676, ~: 19886) LibOpChainIdTest:testOpChainIdEvalFail() (gas: 34336) LibOpChainIdTest:testOpChainIdRun(uint64,uint16) (runs: 2056, μ: 17123, ~: 17123) LibOpChainIdTest:testOpChainIdTwoOutputs() (gas: 31140) LibOpChainIdTest:testOpChainIdZeroOutputs() (gas: 30089) LibOpConstantTest:testOpConstantEvalNPE2E() (gas: 56065) LibOpConstantTest:testOpConstantEvalZeroConstants() (gas: 41509) -LibOpConstantTest:testOpConstantNPIntegrity((uint256,uint256,uint256,bytes32[],uint256,bytes),bytes32) (runs: 2056, μ: 19196, ~: 19098) -LibOpConstantTest:testOpConstantNPIntegrityOOBConstants((uint256,uint256,uint256,bytes32[],uint256,bytes),bytes32) (runs: 2056, μ: 40151, ~: 39809) +LibOpConstantTest:testOpConstantNPIntegrity((uint256,uint256,uint256,bytes32[],uint256,bytes),bytes32) (runs: 2056, μ: 19195, ~: 19098) +LibOpConstantTest:testOpConstantNPIntegrityOOBConstants((uint256,uint256,uint256,bytes32[],uint256,bytes),bytes32) (runs: 2056, μ: 40163, ~: 39805) LibOpConstantTest:testOpConstantNPMultipleOutputErrorSugared() (gas: 31648) LibOpConstantTest:testOpConstantNPMultipleOutputErrorUnsugared() (gas: 41588) -LibOpConstantTest:testOpConstantNPRun(bytes32[],uint16) (runs: 2056, μ: 52455, ~: 51854) +LibOpConstantTest:testOpConstantNPRun(bytes32[],uint16) (runs: 2056, μ: 52448, ~: 51854) LibOpConstantTest:testOpConstantNPZeroOutputErrorSugared() (gas: 30264) LibOpConstantTest:testOpConstantNPZeroOutputErrorUnsugared() (gas: 40216) LibOpContextNPTest:testOpContextNPEval00(bytes32[][]) (runs: 108, μ: 6495316, ~: 5266230) @@ -90,13 +90,13 @@ LibOpContextNPTest:testOpContextNPEvalOOBi(bytes32[]) (runs: 108, μ: 75053, ~: LibOpContextNPTest:testOpContextNPEvalOOBj(bytes32) (runs: 2056, μ: 48210, ~: 48210) LibOpContextNPTest:testOpContextNPIntegrity((uint256,uint256,uint256,bytes32[],uint256,bytes),bytes32) (runs: 2056, μ: 14498, ~: 14412) LibOpContextNPTest:testOpContextNPOneInput() (gas: 41587) -LibOpContextNPTest:testOpContextNPRun(bytes32[][],uint256,uint256) (runs: 108, μ: 10222916, ~: 7383211) -LibOpContextNPTest:testOpContextNPRunOOBi(bytes32[][],uint256,uint256) (runs: 108, μ: 10571990, ~: 7923969) -LibOpContextNPTest:testOpContextNPRunOOBj(bytes32[][],uint256,uint256) (runs: 108, μ: 10581006, ~: 7924884) +LibOpContextNPTest:testOpContextNPRun(bytes32[][],uint256,uint256) (runs: 108, μ: 10222915, ~: 7383135) +LibOpContextNPTest:testOpContextNPRunOOBi(bytes32[][],uint256,uint256) (runs: 108, μ: 10571998, ~: 7923969) +LibOpContextNPTest:testOpContextNPRunOOBj(bytes32[][],uint256,uint256) (runs: 108, μ: 10581009, ~: 7924884) LibOpContextNPTest:testOpContextNPTwoInputs() (gas: 46451) LibOpContextNPTest:testOpContextNPTwoOutputs() (gas: 37255) LibOpContextNPTest:testOpContextNPZeroOutputs() (gas: 36203) -LibOpCtPopNPTest:testOpCtPopNPEval(bytes32) (runs: 2056, μ: 74483, ~: 85264) +LibOpCtPopNPTest:testOpCtPopNPEval(bytes32) (runs: 2056, μ: 74567, ~: 85264) LibOpCtPopNPTest:testOpCtPopNPIntegrity((uint256,uint256,uint256,bytes32[],uint256,bytes),bytes32) (runs: 2056, μ: 13745, ~: 13659) LibOpCtPopNPTest:testOpCtPopNPRun(bytes32) (runs: 2056, μ: 16698, ~: 16698) LibOpCtPopNPTest:testOpCtPopNPTwoInputs() (gas: 41134) @@ -108,10 +108,10 @@ LibOpDecodeBitsNPTest:testOpDecodeBitsNPEvalTwoInputs() (gas: 46963) LibOpDecodeBitsNPTest:testOpDecodeBitsNPEvalTwoOutputs() (gas: 42815) LibOpDecodeBitsNPTest:testOpDecodeBitsNPEvalZeroInputs() (gas: 37145) LibOpDecodeBitsNPTest:testOpDecodeBitsNPEvalZeroOutputs() (gas: 41762) -LibOpDecodeBitsNPTest:testOpDecodeBitsNPIntegrity((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint8,uint8) (runs: 2056, μ: 22123, ~: 22224) -LibOpDecodeBitsNPTest:testOpDecodeBitsNPIntegrityFail((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8) (runs: 2056, μ: 41490, ~: 41545) +LibOpDecodeBitsNPTest:testOpDecodeBitsNPIntegrity((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint8,uint8) (runs: 2056, μ: 22125, ~: 22237) +LibOpDecodeBitsNPTest:testOpDecodeBitsNPIntegrityFail((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8) (runs: 2056, μ: 41489, ~: 41536) LibOpDecodeBitsNPTest:testOpDecodeBitsNPIntegrityFailZeroLength((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8) (runs: 2056, μ: 35684, ~: 35423) -LibOpDecodeBitsNPTest:testOpDecodeBitsNPRun(bytes32,uint8,uint8) (runs: 2056, μ: 20996, ~: 20814) +LibOpDecodeBitsNPTest:testOpDecodeBitsNPRun(bytes32,uint8,uint8) (runs: 2056, μ: 21003, ~: 20814) LibOpDivTest:testDebugOpDivRun() (gas: 13482) LibOpDivTest:testOpDivEvalOneInput() (gas: 126303) LibOpDivTest:testOpDivEvalOperandsDisallowed() (gas: 91477) @@ -124,12 +124,12 @@ LibOpDivTest:testOpDivEvalTwoInputsUnhappyOverflow() (gas: 56399) LibOpDivTest:testOpDivEvalTwoOutputs() (gas: 41216) LibOpDivTest:testOpDivEvalZeroInputs() (gas: 30168) LibOpDivTest:testOpDivEvalZeroOutputs() (gas: 40212) -LibOpDivTest:testOpDivIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint16) (runs: 2056, μ: 18249, ~: 18479) +LibOpDivTest:testOpDivIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint16) (runs: 2056, μ: 18248, ~: 18486) LibOpDivTest:testOpDivIntegrityUnhappyOneInput((uint256,uint256,uint256,bytes32[],uint256,bytes)) (runs: 2056, μ: 13820, ~: 13686) LibOpDivTest:testOpDivIntegrityUnhappyZeroInputs((uint256,uint256,uint256,bytes32[],uint256,bytes)) (runs: 2056, μ: 13843, ~: 13709) -LibOpDivTest:testOpDivRun(bytes32[]) (runs: 2050, μ: 37539, ~: 33548) +LibOpDivTest:testOpDivRun(bytes32[]) (runs: 2050, μ: 37491, ~: 33511) LibOpERC20AllowanceTest:testOpERC20AllowanceEvalFourInputs() (gas: 55846) -LibOpERC20AllowanceTest:testOpERC20AllowanceEvalHappy(uint256,uint8) (runs: 2056, μ: 72137, ~: 72039) +LibOpERC20AllowanceTest:testOpERC20AllowanceEvalHappy(uint256,uint8) (runs: 2056, μ: 72130, ~: 72039) LibOpERC20AllowanceTest:testOpERC20AllowanceEvalOneInput() (gas: 37102) LibOpERC20AllowanceTest:testOpERC20AllowanceEvalOperandDisallowed() (gas: 18606) LibOpERC20AllowanceTest:testOpERC20AllowanceEvalTwoInputs() (gas: 43633) @@ -137,7 +137,7 @@ LibOpERC20AllowanceTest:testOpERC20AllowanceEvalTwoOutputs() (gas: 50665) LibOpERC20AllowanceTest:testOpERC20AllowanceEvalZeroInputs() (gas: 31108) LibOpERC20AllowanceTest:testOpERC20AllowanceEvalZeroOutputs() (gas: 49641) LibOpERC20AllowanceTest:testOpERC20AllowanceIntegrity((uint256,uint256,uint256,bytes32[],uint256,bytes),bytes32) (runs: 2056, μ: 13709, ~: 13623) -LibOpERC20AllowanceTest:testOpERC20AllowanceRun(address,address,address,uint256,uint8) (runs: 2055, μ: 27667, ~: 27579) +LibOpERC20AllowanceTest:testOpERC20AllowanceRun(address,address,address,uint256,uint8) (runs: 2055, μ: 27668, ~: 27579) LibOpERC20BalanceOfTest:testOpERC20BalanceOfEvalHappy(uint256,uint8) (runs: 2053, μ: 66052, ~: 66052) LibOpERC20BalanceOfTest:testOpERC20BalanceOfEvalOneInput() (gas: 37207) LibOpERC20BalanceOfTest:testOpERC20BalanceOfEvalOperandDisallowed() (gas: 18664) @@ -148,7 +148,7 @@ LibOpERC20BalanceOfTest:testOpERC20BalanceOfEvalZeroInputs() (gas: 31167) LibOpERC20BalanceOfTest:testOpERC20BalanceOfEvalZeroOutputs() (gas: 43335) LibOpERC20BalanceOfTest:testOpERC20BalanceOfIntegrity((uint256,uint256,uint256,bytes32[],uint256,bytes),bytes32) (runs: 2056, μ: 13688, ~: 13602) LibOpERC20BalanceOfTest:testOpERC20BalanceOfRun(address,address,uint256,uint16,uint8) (runs: 2055, μ: 28009, ~: 28009) -LibOpERC20TotalSupplyTest:testOpERC20TotalSupplyEvalHappy(uint256,uint8) (runs: 2051, μ: 59221, ~: 59221) +LibOpERC20TotalSupplyTest:testOpERC20TotalSupplyEvalHappy(uint256,uint8) (runs: 2053, μ: 59221, ~: 59221) LibOpERC20TotalSupplyTest:testOpERC20TotalSupplyEvalOperandDisallowed() (gas: 18827) LibOpERC20TotalSupplyTest:testOpERC20TotalSupplyEvalOverflow(uint256,uint8) (runs: 2049, μ: 55461, ~: 55461) LibOpERC20TotalSupplyTest:testOpERC20TotalSupplyEvalTwoInputs() (gas: 43855) @@ -164,15 +164,15 @@ LibOpERC5313OwnerTest:testOpERC5313OwnerEvalTwoOutputs() (gas: 37654) LibOpERC5313OwnerTest:testOpERC5313OwnerEvalZeroInputs() (gas: 30944) LibOpERC5313OwnerTest:testOpERC5313OwnerEvalZeroOutputs() (gas: 36625) LibOpERC5313OwnerTest:testOpERC5313OwnerOfIntegrity((uint256,uint256,uint256,bytes32[],uint256,bytes),bytes32) (runs: 2056, μ: 13749, ~: 13663) -LibOpERC5313OwnerTest:testOpERC5313OwnerOfRun(address,address,uint16) (runs: 2055, μ: 23615, ~: 23615) -LibOpERC721BalanceOfTest:testOpERC721BalanceOfEvalHappy(address,address,uint256) (runs: 2054, μ: 611804, ~: 105463) -LibOpERC721BalanceOfTest:testOpERC721BalanceOfIntegrity((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint16) (runs: 2056, μ: 19666, ~: 19906) +LibOpERC5313OwnerTest:testOpERC5313OwnerOfRun(address,address,uint16) (runs: 2056, μ: 23615, ~: 23615) +LibOpERC721BalanceOfTest:testOpERC721BalanceOfEvalHappy(address,address,uint256) (runs: 2055, μ: 105319, ~: 105489) +LibOpERC721BalanceOfTest:testOpERC721BalanceOfIntegrity((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint16) (runs: 2056, μ: 19663, ~: 19911) LibOpERC721BalanceOfTest:testOpERC721BalanceOfIntegrityFail0() (gas: 30811) LibOpERC721BalanceOfTest:testOpERC721BalanceOfIntegrityFail1() (gas: 35101) LibOpERC721BalanceOfTest:testOpERC721BalanceOfIntegrityFail3() (gas: 44535) LibOpERC721BalanceOfTest:testOpERC721BalanceOfIntegrityFailOperand() (gas: 21548) LibOpERC721BalanceOfTest:testOpERC721BalanceOfOneInput() (gas: 35568) -LibOpERC721BalanceOfTest:testOpERC721BalanceOfRun(address,address,uint256,uint16) (runs: 2054, μ: 26008, ~: 26008) +LibOpERC721BalanceOfTest:testOpERC721BalanceOfRun(address,address,uint256,uint16) (runs: 2055, μ: 26008, ~: 26008) LibOpERC721BalanceOfTest:testOpERC721BalanceOfThreeInputs() (gas: 45055) LibOpERC721BalanceOfTest:testOpERC721BalanceOfTwoOutputs() (gas: 41062) LibOpERC721BalanceOfTest:testOpERC721BalanceOfZeroInputs() (gas: 31245) @@ -181,13 +181,13 @@ LibOpERC721OwnerOfTest:testOpERC721OwnerOfNPEvalFail0() (gas: 30694) LibOpERC721OwnerOfTest:testOpERC721OwnerOfNPEvalFail1() (gas: 34982) LibOpERC721OwnerOfTest:testOpERC721OwnerOfNPEvalFail3() (gas: 44471) LibOpERC721OwnerOfTest:testOpERC721OwnerOfNPEvalFailOperand() (gas: 18197) -LibOpERC721OwnerOfTest:testOpERC721OwnerOfNPEvalHappy(address,uint256,address) (runs: 2056, μ: 96502, ~: 92464) +LibOpERC721OwnerOfTest:testOpERC721OwnerOfNPEvalHappy(address,uint256,address) (runs: 2055, μ: 96521, ~: 92477) LibOpERC721OwnerOfTest:testOpERC721OwnerOfNPEvalOneInput() (gas: 35440) LibOpERC721OwnerOfTest:testOpERC721OwnerOfNPEvalThreeInputs() (gas: 44936) LibOpERC721OwnerOfTest:testOpERC721OwnerOfNPEvalZeroInputs() (gas: 31141) LibOpERC721OwnerOfTest:testOpERC721OwnerOfNPEvalZeroOutputs() (gas: 39730) LibOpERC721OwnerOfTest:testOpERC721OwnerOfNPIntegrity((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8) (runs: 2056, μ: 13762, ~: 13698) -LibOpERC721OwnerOfTest:testOpERC721OwnerOfNPRun(address,bytes32,address,uint16) (runs: 2056, μ: 24201, ~: 24201) +LibOpERC721OwnerOfTest:testOpERC721OwnerOfNPRun(address,bytes32,address,uint16) (runs: 2055, μ: 24201, ~: 24201) LibOpERC721OwnerOfTest:testOpERC721OwnerOfNPTwoOutputs() (gas: 40776) LibOpEncodeBitsNPTest:testOpEncodeBitsNPEvalHappy() (gas: 832520) LibOpEncodeBitsNPTest:testOpEncodeBitsNPEvalOneInput() (gas: 42038) @@ -195,10 +195,10 @@ LibOpEncodeBitsNPTest:testOpEncodeBitsNPEvalThreeInputs() (gas: 51785) LibOpEncodeBitsNPTest:testOpEncodeBitsNPEvalTwoOutputs() (gas: 47611) LibOpEncodeBitsNPTest:testOpEncodeBitsNPEvalZeroInputs() (gas: 37059) LibOpEncodeBitsNPTest:testOpEncodeBitsNPEvalZeroOutputs() (gas: 46607) -LibOpEncodeBitsNPTest:testOpEncodeBitsNPIntegrity((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8) (runs: 2056, μ: 18138, ~: 18137) -LibOpEncodeBitsNPTest:testOpEncodeBitsNPIntegrityFail((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8) (runs: 2056, μ: 41703, ~: 41753) +LibOpEncodeBitsNPTest:testOpEncodeBitsNPIntegrity((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8) (runs: 2056, μ: 18145, ~: 18144) +LibOpEncodeBitsNPTest:testOpEncodeBitsNPIntegrityFail((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8) (runs: 2056, μ: 41695, ~: 41753) LibOpEncodeBitsNPTest:testOpEncodeBitsNPIntegrityFailZeroLength((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8) (runs: 2056, μ: 35813, ~: 35552) -LibOpEncodeBitsNPTest:testOpEncodeBitsNPRun(bytes32,bytes32,uint8,uint8) (runs: 2056, μ: 21406, ~: 21212) +LibOpEncodeBitsNPTest:testOpEncodeBitsNPRun(bytes32,bytes32,uint8,uint8) (runs: 2056, μ: 21402, ~: 21212) LibOpEnsureTest:testOpEnsureEvalBadOutputs() (gas: 34422) LibOpEnsureTest:testOpEnsureEvalBadOutputs2() (gas: 33947) LibOpEnsureTest:testOpEnsureEvalHappy() (gas: 166193) @@ -207,7 +207,7 @@ LibOpEnsureTest:testOpEnsureEvalThree() (gas: 45346) LibOpEnsureTest:testOpEnsureEvalUnhappy() (gas: 111833) LibOpEnsureTest:testOpEnsureEvalUnhappyOperand() (gas: 17047) LibOpEnsureTest:testOpEnsureEvalZero() (gas: 29624) -LibOpEnsureTest:testOpEnsureIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint16) (runs: 2056, μ: 19718, ~: 19960) +LibOpEnsureTest:testOpEnsureIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint16) (runs: 2056, μ: 19717, ~: 19989) LibOpEnsureTest:testOpEnsureIntegrityUnhappy((uint256,uint256,uint256,bytes32[],uint256,bytes)) (runs: 2056, μ: 13811, ~: 13677) LibOpEnsureTest:testOpEnsureOneOutput() (gas: 39583) LibOpEnsureTest:testOpEnsureRun(bytes32,string) (runs: 2052, μ: 18144, ~: 18151) @@ -219,15 +219,15 @@ LibOpEqualToNPTest:testOpEqualToEval2ZeroInputs() (gas: 57657) LibOpEqualToNPTest:testOpEqualToEvalFail0Inputs() (gas: 30048) LibOpEqualToNPTest:testOpEqualToEvalFail1Input() (gas: 34359) LibOpEqualToNPTest:testOpEqualToEvalFail3Inputs() (gas: 42783) -LibOpEqualToNPTest:testOpEqualToIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint16) (runs: 2056, μ: 19666, ~: 19903) +LibOpEqualToNPTest:testOpEqualToIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint16) (runs: 2056, μ: 19668, ~: 19873) LibOpEqualToNPTest:testOpEqualToRun(bytes32,bytes32) (runs: 2056, μ: 17543, ~: 17466) LibOpEqualToNPTest:testOpEqualToTwoOutputs() (gas: 41048) LibOpEqualToNPTest:testOpEqualToZeroOutputs() (gas: 39957) LibOpExternNPTest:testOpExternNPEvalHappy() (gas: 99749) LibOpExternNPTest:testOpExternNPEvalMultipleInputsOutputsHappy() (gas: 115319) -LibOpExternNPTest:testOpExternNPIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),address,uint16,uint8,uint8) (runs: 2056, μ: 34971, ~: 34950) -LibOpExternNPTest:testOpExternNPIntegrityNotAnExternContract((uint256,uint256,uint256,bytes32[],uint256,bytes),address,uint16,uint8,uint8) (runs: 2056, μ: 53495, ~: 53633) -LibOpExternNPTest:testOpExternNPRunHappy(address,bytes32[],uint16,bytes32[],bytes32[]) (runs: 2056, μ: 117873, ~: 117777) +LibOpExternNPTest:testOpExternNPIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),address,uint16,uint8,uint8) (runs: 2055, μ: 34995, ~: 34982) +LibOpExternNPTest:testOpExternNPIntegrityNotAnExternContract((uint256,uint256,uint256,bytes32[],uint256,bytes),address,uint16,uint8,uint8) (runs: 2055, μ: 53558, ~: 53773) +LibOpExternNPTest:testOpExternNPRunHappy(address,bytes32[],uint16,bytes32[],bytes32[]) (runs: 2055, μ: 117729, ~: 117621) LibOpGetTest:testLibOpGetEvalKeyNotSet() (gas: 308623) LibOpGetTest:testLibOpGetEvalOperandDisallowed() (gas: 57488) LibOpGetTest:testLibOpGetEvalSetThenGet() (gas: 522490) @@ -238,12 +238,12 @@ LibOpGetTest:testLibOpGetEvalTwoInputs() (gas: 39742) LibOpGetTest:testLibOpGetEvalTwoOutputs() (gas: 35334) LibOpGetTest:testLibOpGetEvalZeroInputs() (gas: 29757) LibOpGetTest:testLibOpGetEvalZeroOutputs() (gas: 34304) -LibOpGetTest:testLibOpGetIntegrity((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint16) (runs: 2056, μ: 20564, ~: 20794) +LibOpGetTest:testLibOpGetIntegrity((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint16) (runs: 2056, μ: 20559, ~: 20809) LibOpGetTest:testLibOpGetRunState(bytes32,bytes32,uint16) (runs: 2056, μ: 19634, ~: 19638) LibOpGetTest:testLibOpGetRunStateAndStore(bytes32,bytes32,bytes32,uint16) (runs: 2056, μ: 47596, ~: 47610) LibOpGetTest:testLibOpGetRunStore(bytes32,bytes32,uint16) (runs: 2056, μ: 49831, ~: 49835) LibOpGetTest:testLibOpGetRunStoreDifferentNamespace(bytes32,bytes32,uint16) (runs: 2056, μ: 51423, ~: 51427) -LibOpGetTest:testLibOpGetRunUnset(bytes32,uint16) (runs: 2056, μ: 24664, ~: 24668) +LibOpGetTest:testLibOpGetRunUnset(bytes32,uint16) (runs: 2056, μ: 24663, ~: 24668) LibOpGreaterThanTest:testOpGreaterThanEval1_0Gt1() (gas: 58568) LibOpGreaterThanTest:testOpGreaterThanEval1_1Gt1_2() (gas: 61169) LibOpGreaterThanTest:testOpGreaterThanEval2InputsBothOne() (gas: 57883) @@ -255,8 +255,8 @@ LibOpGreaterThanTest:testOpGreaterThanEvalFail1Input() (gas: 34737) LibOpGreaterThanTest:testOpGreaterThanEvalFail3Inputs() (gas: 43078) LibOpGreaterThanTest:testOpGreaterThanEvalNeg1Gt0() (gas: 58666) LibOpGreaterThanTest:testOpGreaterThanEvalNeg1_1GtNeg1_2() (gas: 61370) -LibOpGreaterThanTest:testOpGreaterThanIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint16) (runs: 2056, μ: 19681, ~: 19920) -LibOpGreaterThanTest:testOpGreaterThanRun(bytes32,bytes32) (runs: 2056, μ: 17419, ~: 17347) +LibOpGreaterThanTest:testOpGreaterThanIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint16) (runs: 2056, μ: 19688, ~: 19951) +LibOpGreaterThanTest:testOpGreaterThanRun(bytes32,bytes32) (runs: 2056, μ: 17417, ~: 17347) LibOpGreaterThanTest:testOpGreaterThanTwoOutputs() (gas: 41835) LibOpGreaterThanTest:testOpGreaterThanZeroOutputs() (gas: 40787) LibOpHashNPTest:testOpHashNPEval0Inputs() (gas: 46285) @@ -264,7 +264,7 @@ LibOpHashNPTest:testOpHashNPEval1Input() (gas: 54893) LibOpHashNPTest:testOpHashNPEval2Inputs() (gas: 63237) LibOpHashNPTest:testOpHashNPEval2InputsDifferent() (gas: 63910) LibOpHashNPTest:testOpHashNPEval2InputsOtherStack() (gas: 78464) -LibOpHashNPTest:testOpHashNPIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint16) (runs: 2056, μ: 19715, ~: 19941) +LibOpHashNPTest:testOpHashNPIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint16) (runs: 2056, μ: 19703, ~: 19941) LibOpHashNPTest:testOpHashNPRun(bytes32[]) (runs: 2050, μ: 19460, ~: 19563) LibOpHashNPTest:testOpHashNPTwoOutputs() (gas: 30825) LibOpHashNPTest:testOpHashNPZeroOutputs() (gas: 29451) @@ -273,13 +273,13 @@ LibOpIsZeroTest:testOpIsZeroEval1NonZeroInput() (gas: 52289) LibOpIsZeroTest:testOpIsZeroEval1ZeroInput() (gas: 52026) LibOpIsZeroTest:testOpIsZeroEvalFail0Inputs() (gas: 29957) LibOpIsZeroTest:testOpIsZeroEvalFail2Inputs() (gas: 38516) -LibOpIsZeroTest:testOpIsZeroNPIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint16) (runs: 2056, μ: 19787, ~: 20065) +LibOpIsZeroTest:testOpIsZeroNPIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint16) (runs: 2056, μ: 19779, ~: 20050) LibOpIsZeroTest:testOpIsZeroRun(bytes32) (runs: 2056, μ: 16420, ~: 16421) LibOpIsZeroTest:testOpIsZeroTwoOutputs() (gas: 36351) LibOpIsZeroTest:testOpIsZeroZeroOutputs() (gas: 35057) LibOpLessThanTest:testOpLessThanEval2InputsFirstZeroSecondOne() (gas: 58390) LibOpLessThanTest:testOpLessThanEval2ZeroInputs() (gas: 57639) -LibOpLessThanTest:testOpLessThanIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint16) (runs: 2056, μ: 19696, ~: 19947) +LibOpLessThanTest:testOpLessThanIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint16) (runs: 2056, μ: 19692, ~: 19966) LibOpLessThanTest:testOpLessThanNP1_0Lt1() (gas: 58392) LibOpLessThanTest:testOpLessThanNP1_1Lt1_2() (gas: 60882) LibOpLessThanTest:testOpLessThanNPEval2InputsBothOne() (gas: 57663) @@ -288,7 +288,7 @@ LibOpLessThanTest:testOpLessThanNPMinus1Lt0() (gas: 58445) LibOpLessThanTest:testOpLessThanNPMinus1_1LtMinus1_2() (gas: 61106) LibOpLessThanTest:testOpLessThanNPTwoOutputs() (gas: 41921) LibOpLessThanTest:testOpLessThanNPZeroOutputs() (gas: 40036) -LibOpLessThanTest:testOpLessThanRun(bytes32,bytes32) (runs: 2056, μ: 17424, ~: 17353) +LibOpLessThanTest:testOpLessThanRun(bytes32,bytes32) (runs: 2056, μ: 17422, ~: 17353) LibOpLessThanTest:testOpLessThanToNPEvalFail0Inputs() (gas: 30151) LibOpLessThanTest:testOpLessThanToNPEvalFail1Input() (gas: 34441) LibOpLessThanTest:testOpLessThanToNPEvalFail3Inputs() (gas: 42821) @@ -298,19 +298,19 @@ LibOpMaxTest:testOpMaxEvalOneInput() (gas: 129040) LibOpMaxTest:testOpMaxEvalOperandDisallowed() (gas: 58885) LibOpMaxTest:testOpMaxEvalTwoOutputs() (gas: 40731) LibOpMaxTest:testOpMaxEvalZeroInputs() (gas: 30170) -LibOpMaxTest:testOpMaxIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint16) (runs: 2056, μ: 18201, ~: 18435) +LibOpMaxTest:testOpMaxIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint16) (runs: 2056, μ: 18197, ~: 18408) LibOpMaxTest:testOpMaxIntegrityUnhappyOneInput((uint256,uint256,uint256,bytes32[],uint256,bytes)) (runs: 2056, μ: 13821, ~: 13687) LibOpMaxTest:testOpMaxIntegrityUnhappyZeroInputs((uint256,uint256,uint256,bytes32[],uint256,bytes)) (runs: 2056, μ: 13843, ~: 13709) -LibOpMaxTest:testOpMaxRun(bytes32[]) (runs: 2050, μ: 26618, ~: 26367) +LibOpMaxTest:testOpMaxRun(bytes32[]) (runs: 2050, μ: 26607, ~: 26367) LibOpMaxUint256Test:testOpMaxUint256Eval() (gas: 47280) LibOpMaxUint256Test:testOpMaxUint256EvalFail() (gas: 35109) -LibOpMaxUint256Test:testOpMaxUint256Integrity((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint16) (runs: 2056, μ: 19657, ~: 19880) +LibOpMaxUint256Test:testOpMaxUint256Integrity((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint16) (runs: 2056, μ: 19657, ~: 19919) LibOpMaxUint256Test:testOpMaxUint256Run() (gas: 15997) LibOpMaxUint256Test:testOpMaxUint256TwoOutputs() (gas: 31892) LibOpMaxUint256Test:testOpMaxUint256ZeroOutputs() (gas: 30797) LibOpMaxValueTest:testOpMaxValueEval() (gas: 46896) LibOpMaxValueTest:testOpMaxValueEvalFail() (gas: 34417) -LibOpMaxValueTest:testOpMaxValueIntegrity((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint16) (runs: 2056, μ: 19653, ~: 19892) +LibOpMaxValueTest:testOpMaxValueIntegrity((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint16) (runs: 2056, μ: 19648, ~: 19902) LibOpMaxValueTest:testOpMaxValueRun() (gas: 16217) LibOpMaxValueTest:testOpMaxValueTwoOutputs() (gas: 31266) LibOpMaxValueTest:testOpMaxValueZeroOutputs() (gas: 30171) @@ -319,7 +319,7 @@ LibOpMinTest:testOpMinEval3InputsHappy() (gas: 3458613) LibOpMinTest:testOpMinEvalOneInput() (gas: 126204) LibOpMinTest:testOpMinEvalOperandDisallowed() (gas: 58908) LibOpMinTest:testOpMinEvalZeroInputs() (gas: 30150) -LibOpMinTest:testOpMinIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint16) (runs: 2056, μ: 18279, ~: 18482) +LibOpMinTest:testOpMinIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint16) (runs: 2056, μ: 18276, ~: 18512) LibOpMinTest:testOpMinIntegrityUnhappyOneInput((uint256,uint256,uint256,bytes32[],uint256,bytes)) (runs: 2056, μ: 13844, ~: 13710) LibOpMinTest:testOpMinIntegrityUnhappyZeroInputs((uint256,uint256,uint256,bytes32[],uint256,bytes)) (runs: 2056, μ: 13821, ~: 13687) LibOpMinTest:testOpMinRun(bytes32[],uint16) (runs: 2050, μ: 26543, ~: 26653) @@ -331,9 +331,9 @@ LibOpMulTest:testOpMulEvalThreeInputsUnhappyOverflow() (gas: 60803) LibOpMulTest:testOpMulEvalTwoInputsHappy() (gas: 522883) LibOpMulTest:testOpMulEvalTwoInputsUnhappyOverflow() (gas: 54354) LibOpMulTest:testOpMulEvalZeroInputs() (gas: 30213) -LibOpMulTest:testOpMulIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint16) (runs: 2056, μ: 18240, ~: 18473) +LibOpMulTest:testOpMulIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint16) (runs: 2056, μ: 18235, ~: 18443) LibOpMulTest:testOpMulIntegrityUnhappyZeroInputs((uint256,uint256,uint256,bytes32[],uint256,bytes)) (runs: 2056, μ: 13865, ~: 13731) -LibOpMulTest:testOpMulRun(bytes32[]) (runs: 2050, μ: 28917, ~: 26565) +LibOpMulTest:testOpMulRun(bytes32[]) (runs: 2050, μ: 28960, ~: 26565) LibOpMulTest:testOpMulTwoOutputs() (gas: 40752) LibOpMulTest:testOpMulZeroOutputs() (gas: 39706) LibOpSetTest:testLibOpSet(bytes32,bytes32) (runs: 2056, μ: 17660, ~: 17665) @@ -345,22 +345,22 @@ LibOpSetTest:testLibOpSetEvalThreeInputs() (gas: 44625) LibOpSetTest:testLibOpSetEvalTwoInputs() (gas: 258452) LibOpSetTest:testLibOpSetEvalTwoOutputs() (gas: 40451) LibOpSetTest:testLibOpSetEvalZeroInputs() (gas: 29372) -LibOpSetTest:testLibOpSetIntegrity((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint16) (runs: 2056, μ: 20434, ~: 20691) +LibOpSetTest:testLibOpSetIntegrity((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint16) (runs: 2056, μ: 20433, ~: 20653) LibOpShiftBitsLeftNPTest:testOpShiftBitsLeftNPEval() (gas: 878842) LibOpShiftBitsLeftNPTest:testOpShiftBitsLeftNPIntegrityFailBadShiftAmount() (gas: 128113) LibOpShiftBitsLeftNPTest:testOpShiftBitsLeftNPIntegrityFailTwoInputs() (gas: 44447) LibOpShiftBitsLeftNPTest:testOpShiftBitsLeftNPIntegrityFailTwoOutputs() (gas: 40331) LibOpShiftBitsLeftNPTest:testOpShiftBitsLeftNPIntegrityFailZeroInputs() (gas: 34606) LibOpShiftBitsLeftNPTest:testOpShiftBitsLeftNPIntegrityFailZeroOutputs() (gas: 39256) -LibOpShiftBitsLeftNPTest:testOpShiftBitsLeftNPIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint8) (runs: 2055, μ: 19771, ~: 19728) +LibOpShiftBitsLeftNPTest:testOpShiftBitsLeftNPIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint8) (runs: 2055, μ: 19765, ~: 19760) LibOpShiftBitsLeftNPTest:testOpShiftBitsLeftNPIntegrityNoop((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8) (runs: 2056, μ: 35779, ~: 35518) -LibOpShiftBitsLeftNPTest:testOpShiftBitsLeftNPIntegrityZero((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint16) (runs: 2056, μ: 41983, ~: 42651) +LibOpShiftBitsLeftNPTest:testOpShiftBitsLeftNPIntegrityZero((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint16) (runs: 2056, μ: 41975, ~: 42447) LibOpShiftBitsLeftNPTest:testOpShiftBitsLeftNPRun(bytes32,uint8) (runs: 2056, μ: 16833, ~: 16833) LibOpShiftBitsRightNPTest:testOpShiftBitsRightNPEval() (gas: 1053755) LibOpShiftBitsRightNPTest:testOpShiftBitsRightNPIntegrityFailBadShiftAmount() (gas: 128703) -LibOpShiftBitsRightNPTest:testOpShiftBitsRightNPIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint8) (runs: 107, μ: 19624, ~: 19254) +LibOpShiftBitsRightNPTest:testOpShiftBitsRightNPIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint8) (runs: 107, μ: 19635, ~: 19131) LibOpShiftBitsRightNPTest:testOpShiftBitsRightNPIntegrityNoop((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8) (runs: 108, μ: 36628, ~: 36899) -LibOpShiftBitsRightNPTest:testOpShiftBitsRightNPIntegrityZero((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint16) (runs: 108, μ: 40444, ~: 40926) +LibOpShiftBitsRightNPTest:testOpShiftBitsRightNPIntegrityZero((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint16) (runs: 108, μ: 40453, ~: 40926) LibOpShiftBitsRightNPTest:testOpShiftBitsRightNPRun(bytes32,uint8) (runs: 2056, μ: 16836, ~: 16836) LibOpShiftBitsRightNPTest:testOpShiftBitsRightNPTwoInputs() (gas: 44571) LibOpShiftBitsRightNPTest:testOpShiftBitsRightNPTwoOutputs() (gas: 40391) @@ -368,25 +368,25 @@ LibOpShiftBitsRightNPTest:testOpShiftBitsRightNPZeroInputs() (gas: 34665) LibOpShiftBitsRightNPTest:testOpShiftBitsRightNPZeroOutputs() (gas: 39340) LibOpStackNPTest:testOpStackEval() (gas: 65313) LibOpStackNPTest:testOpStackEvalSeveral() (gas: 87151) -LibOpStackNPTest:testOpStackNPIntegrity(bytes,uint256,bytes32[],bytes32) (runs: 2056, μ: 18885, ~: 18652) -LibOpStackNPTest:testOpStackNPIntegrityOOBStack(bytes,uint16,bytes32[],uint16,uint256) (runs: 2056, μ: 41413, ~: 41563) +LibOpStackNPTest:testOpStackNPIntegrity(bytes,uint256,bytes32[],bytes32) (runs: 2056, μ: 18896, ~: 18657) +LibOpStackNPTest:testOpStackNPIntegrityOOBStack(bytes,uint16,bytes32[],uint16,uint256) (runs: 2056, μ: 41419, ~: 41563) LibOpStackNPTest:testOpStackNPMultipleOutputErrorSugared() (gas: 39336) LibOpStackNPTest:testOpStackNPMultipleOutputErrorUnsugared() (gas: 42996) -LibOpStackNPTest:testOpStackNPRun(bytes32[][],uint256) (runs: 108, μ: 2064571, ~: 1852966) +LibOpStackNPTest:testOpStackNPRun(bytes32[][],uint256) (runs: 108, μ: 2064572, ~: 1852966) LibOpStackNPTest:testOpStackNPZeroOutputErrorSugared() (gas: 37881) LibOpStackNPTest:testOpStackNPZeroOutputErrorUnsugared() (gas: 41506) LibOpSubTest:testOpSubEvalOneInput() (gas: 128861) LibOpSubTest:testOpSubEvalThreeInputs() (gas: 226150) LibOpSubTest:testOpSubEvalTwoInputs() (gas: 342286) LibOpSubTest:testOpSubEvalZeroInputs() (gas: 30131) -LibOpSubTest:testOpSubIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint16) (runs: 2056, μ: 18240, ~: 18469) +LibOpSubTest:testOpSubIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint16) (runs: 2056, μ: 18242, ~: 18469) LibOpSubTest:testOpSubIntegrityUnhappyOneInput((uint256,uint256,uint256,bytes32[],uint256,bytes)) (runs: 2056, μ: 13821, ~: 13687) LibOpSubTest:testOpSubIntegrityUnhappyZeroInputs((uint256,uint256,uint256,bytes32[],uint256,bytes)) (runs: 2056, μ: 13822, ~: 13688) -LibOpSubTest:testOpSubRun(bytes32[]) (runs: 2050, μ: 55812, ~: 55367) +LibOpSubTest:testOpSubRun(bytes32[]) (runs: 2050, μ: 55883, ~: 55355) LibOpTimestampTest:testOpBlockTimestampNPEvalFail() (gas: 65815) LibOpTimestampTest:testOpBlockTimestampNPTwoOutputs() (gas: 58732) LibOpTimestampTest:testOpBlockTimestampNPZeroOutputs() (gas: 56607) -LibOpTimestampTest:testOpTimestampEval(uint256) (runs: 2056, μ: 84985, ~: 84663) +LibOpTimestampTest:testOpTimestampEval(uint256) (runs: 2056, μ: 84986, ~: 84663) LibOpTimestampTest:testOpTimestampIntegrity((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint16) (runs: 2056, μ: 19671, ~: 19929) LibOpTimestampTest:testOpTimestampRun(uint256) (runs: 2056, μ: 20589, ~: 20364) LibOpUint256AddTest:testOpUint256AddEvalOneInput() (gas: 128271) @@ -397,10 +397,10 @@ LibOpUint256AddTest:testOpUint256AddEvalTwoInputsHappy() (gas: 280090) LibOpUint256AddTest:testOpUint256AddEvalTwoOutputs() (gas: 41422) LibOpUint256AddTest:testOpUint256AddEvalZeroInputs() (gas: 30839) LibOpUint256AddTest:testOpUint256AddEvalZeroOutputs() (gas: 40353) -LibOpUint256AddTest:testOpUint256AddIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint16) (runs: 2056, μ: 18245, ~: 18445) +LibOpUint256AddTest:testOpUint256AddIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint16) (runs: 2056, μ: 18245, ~: 18478) LibOpUint256AddTest:testOpUint256AddIntegrityUnhappyOneInput((uint256,uint256,uint256,bytes32[],uint256,bytes)) (runs: 2056, μ: 13823, ~: 13689) LibOpUint256AddTest:testOpUint256AddIntegrityUnhappyZeroInputs((uint256,uint256,uint256,bytes32[],uint256,bytes)) (runs: 2056, μ: 13821, ~: 13687) -LibOpUint256AddTest:testOpUint256AddRun(bytes32[]) (runs: 2050, μ: 20069, ~: 19501) +LibOpUint256AddTest:testOpUint256AddRun(bytes32[]) (runs: 2050, μ: 19993, ~: 19501) LibOpUint256DivTest:testOpUint256DivEval2InputsHappy() (gas: 770716) LibOpUint256DivTest:testOpUint256DivEval2InputsUnhappy() (gas: 143501) LibOpUint256DivTest:testOpUint256DivEval3InputsHappy() (gas: 1406661) @@ -410,7 +410,7 @@ LibOpUint256DivTest:testOpUint256DivEvalOperandDisallowed() (gas: 61456) LibOpUint256DivTest:testOpUint256DivEvalTwoOutputs() (gas: 41423) LibOpUint256DivTest:testOpUint256DivEvalZeroInputs() (gas: 30840) LibOpUint256DivTest:testOpUint256DivEvalZeroOutputs() (gas: 40331) -LibOpUint256DivTest:testOpUint256DivIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint16) (runs: 2056, μ: 18265, ~: 18424) +LibOpUint256DivTest:testOpUint256DivIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint16) (runs: 2056, μ: 18261, ~: 18467) LibOpUint256DivTest:testOpUint256DivIntegrityUnhappyOneInput((uint256,uint256,uint256,bytes32[],uint256,bytes)) (runs: 2056, μ: 13843, ~: 13709) LibOpUint256DivTest:testOpUint256DivIntegrityUnhappyZeroInputs((uint256,uint256,uint256,bytes32[],uint256,bytes)) (runs: 2056, μ: 13823, ~: 13689) LibOpUint256DivTest:testOpUint256DivRun(bytes32[]) (runs: 2050, μ: 24850, ~: 25168) @@ -441,8 +441,8 @@ LibOpUint256ERC20TotalSupplyTest:testOpERC20TotalSupplyEvalZeroInputs() (gas: 32 LibOpUint256ERC20TotalSupplyTest:testOpERC20TotalSupplyEvalZeroOutputs() (gas: 37804) LibOpUint256ERC20TotalSupplyTest:testOpERC20TotalSupplyIntegrity((uint256,uint256,uint256,bytes32[],uint256,bytes),bytes32) (runs: 2056, μ: 13792, ~: 13706) LibOpUint256ERC20TotalSupplyTest:testOpERC20TotalSupplyRun(address,uint256,uint16) (runs: 2055, μ: 23332, ~: 23332) -LibOpUint256ERC721BalanceOfTest:testOpERC721BalanceOfEvalHappy(address,address,uint256) (runs: 2056, μ: 610678, ~: 104853) -LibOpUint256ERC721BalanceOfTest:testOpERC721BalanceOfIntegrity((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint16) (runs: 2056, μ: 19675, ~: 19912) +LibOpUint256ERC721BalanceOfTest:testOpERC721BalanceOfEvalHappy(address,address,uint256) (runs: 2056, μ: 104689, ~: 104853) +LibOpUint256ERC721BalanceOfTest:testOpERC721BalanceOfIntegrity((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint8,uint16) (runs: 2056, μ: 19672, ~: 19936) LibOpUint256ERC721BalanceOfTest:testOpERC721BalanceOfIntegrityFail0() (gas: 31459) LibOpUint256ERC721BalanceOfTest:testOpERC721BalanceOfIntegrityFail1() (gas: 35844) LibOpUint256ERC721BalanceOfTest:testOpERC721BalanceOfIntegrityFail3() (gas: 45183) @@ -465,7 +465,20 @@ LibOpUint256MulTest:testOpUint256MulEvalZeroOutputs() (gas: 40366) LibOpUint256MulTest:testOpUint256MulIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint16) (runs: 2056, μ: 18196, ~: 18359) LibOpUint256MulTest:testOpUint256MulIntegrityUnhappyOneInput((uint256,uint256,uint256,bytes32[],uint256,bytes)) (runs: 2056, μ: 13865, ~: 13731) LibOpUint256MulTest:testOpUint256MulIntegrityUnhappyZeroInputs((uint256,uint256,uint256,bytes32[],uint256,bytes)) (runs: 2056, μ: 13822, ~: 13688) -LibOpUint256MulTest:testOpUint256MulRun(bytes32[]) (runs: 2050, μ: 18817, ~: 19078) +LibOpUint256MulTest:testOpUint256MulRun(bytes32[]) (runs: 2050, μ: 18883, ~: 19078) +LibOpUint256PowTest:testOpUint256ExpIntegrityHappy((uint256,uint256,uint256,bytes32[],uint256,bytes),uint8,uint16) (runs: 2056, μ: 18218, ~: 18387) +LibOpUint256PowTest:testOpUint256PowEval2InputsHappy() (gas: 871553) +LibOpUint256PowTest:testOpUint256PowEval2InputsUnhappy() (gas: 145660) +LibOpUint256PowTest:testOpUint256PowEval3InputsHappy() (gas: 1978684) +LibOpUint256PowTest:testOpUint256PowEval3InputsUnhappy() (gas: 633271) +LibOpUint256PowTest:testOpUint256PowEvalOneInput() (gas: 132280) +LibOpUint256PowTest:testOpUint256PowEvalOperandDisallowed() (gas: 62148) +LibOpUint256PowTest:testOpUint256PowEvalTwoOutputs() (gas: 41552) +LibOpUint256PowTest:testOpUint256PowEvalZeroInputs() (gas: 31032) +LibOpUint256PowTest:testOpUint256PowEvalZeroOutputs() (gas: 40484) +LibOpUint256PowTest:testOpUint256PowIntegrityUnhappyOneInput((uint256,uint256,uint256,bytes32[],uint256,bytes)) (runs: 2056, μ: 13845, ~: 13711) +LibOpUint256PowTest:testOpUint256PowIntegrityUnhappyZeroInputs((uint256,uint256,uint256,bytes32[],uint256,bytes)) (runs: 2056, μ: 13822, ~: 13688) +LibOpUint256PowTest:testOpUint256PowRun(bytes32[]) (runs: 2050, μ: 19410, ~: 19309) LibParseCommentsTest:testParseCommentAfterSources() (gas: 69689) LibParseCommentsTest:testParseCommentBetweenSources() (gas: 69745) LibParseCommentsTest:testParseCommentInIgnoredLHS() (gas: 46231) @@ -824,19 +837,19 @@ LibParseUnexpectedRightParenTest:testParseUnexpectedRightParen() (gas: 50722) LibParseUnexpectedRightParenTest:testParseUnexpectedRightParenNested() (gas: 56990) LibSubParseSubParserExternTest:testLibSubParseSubParserExtern(address,uint8,uint8,uint8,uint16,uint8) (runs: 2056, μ: 13231, ~: 13163) LibSubParseSubParserExternTest:testLibSubParseSubParserExternConstantsHeightOverflow(address,uint256,uint8,uint8,uint16,uint8) (runs: 2056, μ: 11433, ~: 11167) -RainterpreterExpressionDeployerDeployCheckTest:testRainterpreterExpressionDeployerDeployNoEIP1820() (gas: 7668347) -RainterpreterExpressionDeployerDescribedByMetaV1Test:testRainterpreterExpressionDeployerDescribedByMetaV1Happy() (gas: 7678840) -RainterpreterExpressionDeployerIERC165Test:testRainterpreterExpressionDeployerIERC165(bytes4) (runs: 2056, μ: 7675788, ~: 7675788) +RainterpreterExpressionDeployerDeployCheckTest:testRainterpreterExpressionDeployerDeployNoEIP1820() (gas: 7739077) +RainterpreterExpressionDeployerDescribedByMetaV1Test:testRainterpreterExpressionDeployerDescribedByMetaV1Happy() (gas: 7749657) +RainterpreterExpressionDeployerIERC165Test:testRainterpreterExpressionDeployerIERC165(bytes4) (runs: 2056, μ: 7746518, ~: 7746518) RainterpreterExpressionDeployerMetaTest:testRainterpreterExpressionDeployerExpectedConstructionMetaHash() (gas: 6221) -RainterpreterIERC165Test:testRainterpreterIERC165(bytes4) (runs: 2056, μ: 2567316, ~: 2567316) -RainterpreterParserIERC165Test:testRainterpreterParserIERC165(bytes4) (runs: 2056, μ: 3470200, ~: 3470200) -RainterpreterParserParserPragma:testParsePragmaNoPragma() (gas: 17333413) -RainterpreterParserParserPragma:testParsePragmaSinglePragma() (gas: 10451762) -RainterpreterParserParserPragma:testParsePragmaWithInterstitial() (gas: 10455054) -RainterpreterParserPointersTest:testLiteralParserFunctionPointers() (gas: 3469206) -RainterpreterParserPointersTest:testOperandHandlerFunctionPointers() (gas: 3474580) -RainterpreterParserPointersTest:testParserParseMeta() (gas: 1680360) -RainterpreterPointersTest:testOpcodeFunctionPointers() (gas: 2571667) +RainterpreterIERC165Test:testRainterpreterIERC165(bytes4) (runs: 2056, μ: 2633268, ~: 2633268) +RainterpreterParserIERC165Test:testRainterpreterParserIERC165(bytes4) (runs: 2056, μ: 3473016, ~: 3473016) +RainterpreterParserParserPragma:testParsePragmaNoPragma() (gas: 17347474) +RainterpreterParserParserPragma:testParsePragmaSinglePragma() (gas: 10460200) +RainterpreterParserParserPragma:testParsePragmaWithInterstitial() (gas: 10463492) +RainterpreterParserPointersTest:testLiteralParserFunctionPointers() (gas: 3472022) +RainterpreterParserPointersTest:testOperandHandlerFunctionPointers() (gas: 3477508) +RainterpreterParserPointersTest:testParserParseMeta() (gas: 1716192) +RainterpreterPointersTest:testOpcodeFunctionPointers() (gas: 2637731) RainterpreterReferenceExternContextRainlenTest:testRainterpreterReferenceExterNPE2ContextRainlenHappy() (gas: 2160048) RainterpreterReferenceExternContextSenderTest:testRainterpreterReferenceExterNPE2ContextContractHappy() (gas: 2159634) RainterpreterReferenceExternContextSenderTest:testRainterpreterReferenceExterNPE2ContextSenderHappy() (gas: 2158330) @@ -845,8 +858,8 @@ RainterpreterReferenceExternIERC165Test:testRainterpreterReferenceExternIERC165( RainterpreterReferenceExternIntIncTest:testRainterpreterReferenceExternIntIncHappySugared() (gas: 2183789) RainterpreterReferenceExternIntIncTest:testRainterpreterReferenceExternIntIncHappyUnsugared() (gas: 2178028) RainterpreterReferenceExternIntIncTest:testRainterpreterReferenceExternIntIncIntegrity(bytes32,uint256,uint256) (runs: 108, μ: 3597, ~: 3597) -RainterpreterReferenceExternIntIncTest:testRainterpreterReferenceExternIntIncRun(bytes32,bytes32[]) (runs: 108, μ: 749903, ~: 759639) -RainterpreterReferenceExternIntIncTest:testRainterpreterReferenceExternIntIncSubParseKnownWord(uint16,bytes1) (runs: 108, μ: 2095490, ~: 2095759) +RainterpreterReferenceExternIntIncTest:testRainterpreterReferenceExternIntIncRun(bytes32,bytes32[]) (runs: 108, μ: 749649, ~: 757835) +RainterpreterReferenceExternIntIncTest:testRainterpreterReferenceExternIntIncSubParseKnownWord(uint16,bytes1) (runs: 108, μ: 2095509, ~: 2095759) RainterpreterReferenceExternIntIncTest:testRainterpreterReferenceExternIntIncSubParseUnknownWord(uint16,bytes1,bytes) (runs: 100, μ: 2091863, ~: 2091662) RainterpreterReferenceExternPointersTest:testIntegrityFunctionPointers() (gas: 2081736) RainterpreterReferenceExternPointersTest:testOpcodeFunctionPointers() (gas: 2081779) @@ -855,7 +868,7 @@ RainterpreterReferenceExternPointersTest:testSubParserLiteralParsers() (gas: 208 RainterpreterReferenceExternPointersTest:testSubParserOperandParsers() (gas: 2082229) RainterpreterReferenceExternPointersTest:testSubParserParseMeta() (gas: 22017) RainterpreterReferenceExternRepeatTest:testRainterpreterReferenceExternRepeatHappy() (gas: 2212950) -RainterpreterReferenceExternStackOperandTest:testRainterpreterReferenceExternStackOperandSingle(uint256) (runs: 2056, μ: 2167492, ~: 2167581) +RainterpreterReferenceExternStackOperandTest:testRainterpreterReferenceExternStackOperandSingle(uint256) (runs: 2056, μ: 2167504, ~: 2167922) RainterpreterReferenceExternUnknownWordTest:testRainterpreterReferenceExternUnknownWord() (gas: 2128684) RainterpreterStateOverlayTest:testStateOverlayGet() (gas: 52336) RainterpreterStateOverlayTest:testStateOverlaySet() (gas: 83065) diff --git a/src/generated/Rainterpreter.pointers.sol b/src/generated/Rainterpreter.pointers.sol index 349a2a1ce..e907295da 100644 --- a/src/generated/Rainterpreter.pointers.sol +++ b/src/generated/Rainterpreter.pointers.sol @@ -10,11 +10,11 @@ pragma solidity =0.8.25; /// @dev Hash of the known bytecode. -bytes32 constant BYTECODE_HASH = bytes32(0x3db5cfbcb9ad0dd3cc33ee09e4f1309faa2bbf562ddc57b6a4dcc62325b2e209); +bytes32 constant BYTECODE_HASH = bytes32(0xdbfb04be9b33b729e9a1c8c42acd254c16172112a29b6ab00c99b303db736e91); /// @dev The function pointers known to the interpreter for dynamic dispatch. /// By setting these as a constant they can be inlined into the interpreter /// and loaded at eval time for very low gas (~100) due to the compiler /// optimising it to a single `codecopy` to build the in memory bytes array. bytes constant OPCODE_FUNCTION_POINTERS = - hex"079007c207e609720a3b0a4d0a5f0a780a9c0ad00ae10af20b940bb30c710d210da50ee7101a0c71111311c5126712df12f0130113011312139f13b813cc13e514101429143c149e14ec153a158815d61624165516a316f1173f1826"; + hex"079907cb07ef097b0a440a560a680a810aa50ad90aea0afb0b9d0bbc0c7a0d2a0dae0ef010230c7a111c11ce127012e812f9130a130a131b13a813c113d513ee14191432144514a714f51543159115df162d167b16ac16fa17481796187d"; diff --git a/src/generated/RainterpreterExpressionDeployer.pointers.sol b/src/generated/RainterpreterExpressionDeployer.pointers.sol index c3c70584f..cba28e8d8 100644 --- a/src/generated/RainterpreterExpressionDeployer.pointers.sol +++ b/src/generated/RainterpreterExpressionDeployer.pointers.sol @@ -10,11 +10,11 @@ pragma solidity =0.8.25; /// @dev Hash of the known bytecode. -bytes32 constant BYTECODE_HASH = bytes32(0x72e78c0ca3db61b0a73b6ac1ae38ed6a8d0e8aaf893bd80ad712162a5cf60c8a); +bytes32 constant BYTECODE_HASH = bytes32(0x32ac723929981ff250b5fadcf3a20ceffbc8fb62b0e940bc58d136fef34525f5); /// @dev The hash of the meta that describes the contract. -bytes32 constant DESCRIBED_BY_META_HASH = bytes32(0xac0c58895a552204b6292ed73c883031abcb0f2abd1dca4296411e4777ffe4ec); +bytes32 constant DESCRIBED_BY_META_HASH = bytes32(0xac3b6bee9ceb4e62a12d26c66af916180e4b8e2576895cf158cd6c5a7afd4632); /// @dev The function pointers for the integrity check fns. bytes constant INTEGRITY_FUNCTION_POINTERS = - hex"0e280ea60f0a1084108e108e109810a110bc1162116211be12361243108e10981243108e1098108e108e108e10981084108410841084124d108e108e108e1098108e10841257125712571257127f125710841257127f127f1098124d"; + hex"0e300eae0f12108c1096109610a010a910c4116a116a11c6123e124b109610a0124b109610a010961096109610a0108c108c108c108c125510961096109610a01096108c125f125f125f125f125f1287125f108c125f1287128710a01255"; diff --git a/src/generated/RainterpreterParser.pointers.sol b/src/generated/RainterpreterParser.pointers.sol index 59140132b..3e5b9bb8c 100644 --- a/src/generated/RainterpreterParser.pointers.sol +++ b/src/generated/RainterpreterParser.pointers.sol @@ -10,7 +10,7 @@ pragma solidity =0.8.25; /// @dev Hash of the known bytecode. -bytes32 constant BYTECODE_HASH = bytes32(0x0ee59330d72b8567d54f0abcd8bb957afb26c9cf14d8bdbf3fc57258de6c1c1d); +bytes32 constant BYTECODE_HASH = bytes32(0x997dbf087134e1d4290dfafe72a41f97386899bc6da8be5ef0d93a3498a6d606); /// @dev The parse meta that is used to lookup word definitions. /// The structure of the parse meta is: @@ -29,7 +29,7 @@ bytes32 constant BYTECODE_HASH = bytes32(0x0ee59330d72b8567d54f0abcd8bb957afb26c /// bit count of the previous bloom filter. If we reach the end of the bloom /// filters then we have a miss. bytes constant PARSE_META = - hex"0178a8806000299010800908a00a30484001280030060100180000200cc2200408a00c95d8382c48145c2d34b3f328d587e204afc8f01d95a26007b9a51f0d5e6f2803ce312215fae0a1241233de118cfd53051c784d22a55ade1681ac9620ac6dfc29a4e5e91e5fc32a0e92b2401cbbd837100ef76b00cd8814259714ec133135921ff880501427634f0f23b4970ac0e53d0b895f991ac908be0983724f12c080bc2a9d7b7d236f62e0265c0ab5086d2a7b19bcb24402af7d4506414b8117b04fb31bb2182f18ef532921c301e32bfa5d8001336a5927ab2461"; + hex"0178a8806000299010810908a00a30484001280030060100180000200cc2200408a00c95d8382d48145c2e34b3f329d587e204afc8f01d95a26007b9a51f0d5e6f2803ce312215fae0a1241233de118cfd53051c784d22a55ade1681ac9620ac6dfc2aa4e5e91e5fc32a0e92b2401cbbd837100ef76b00cd8814269714ec133135921ff880501427634f0f23b4970ac0e53d0b895f991ac908be0983724f12c080bc2b9d7b7d25757aea236f62e0275c0ab5086d2a7b19bcb24402af7d4506414b8117b04fb31bb2182f18ef532921c301e32cfa5d8001336a5928ab2461"; /// @dev The build depth of the parser meta. @@ -39,11 +39,11 @@ uint8 constant PARSE_META_BUILD_DEPTH = 2; /// These positional indexes all map to the same indexes looked up in the parse /// meta. bytes constant OPERAND_HANDLER_FUNCTION_POINTERS = - hex"1a0b1a0b1a0b1ae01bf71bf71bf71ae01ae01a0b1a0b1a0b1bf71bf71bf71bf71bf71bf71bf71bf71bf71bf71bf71bf71bf71bf71bf71bf71bf71bf71bf71bf71bf71bf71bf71bf71bf71bf71bf71bf71bf71bf71bf71a0b1bf71bf7"; + hex"1a131a131a131ae81bff1bff1bff1ae81ae81a131a131a131bff1bff1bff1bff1bff1bff1bff1bff1bff1bff1bff1bff1bff1bff1bff1bff1bff1bff1bff1bff1bff1bff1bff1bff1bff1bff1bff1bff1bff1bff1bff1bff1a131bff1bff"; /// @dev Every two bytes is a function pointer for a literal parser. /// Literal dispatches are determined by the first byte(s) of the literal /// rather than a full word lookup, and are done with simple conditional /// jumps as the possibilities are limited compared to the number of words we /// have. -bytes constant LITERAL_PARSER_FUNCTION_POINTERS = hex"1553178517c81866"; +bytes constant LITERAL_PARSER_FUNCTION_POINTERS = hex"155b178d17d0186e"; diff --git a/src/lib/op/LibAllStandardOps.sol b/src/lib/op/LibAllStandardOps.sol index 9f5fb3049..bea3538a7 100644 --- a/src/lib/op/LibAllStandardOps.sol +++ b/src/lib/op/LibAllStandardOps.sol @@ -107,7 +107,7 @@ import {LibParseLiteralHex} from "../parse/literal/LibParseLiteralHex.sol"; import {LibParseLiteralSubParseable} from "../parse/literal/LibParseLiteralSubParseable.sol"; /// @dev Number of ops currently provided by `AllStandardOps`. -uint256 constant ALL_STANDARD_OPS_LENGTH = 46; +uint256 constant ALL_STANDARD_OPS_LENGTH = 47; /// @title LibAllStandardOps /// @notice Every opcode available from the core repository laid out as a single @@ -255,10 +255,10 @@ library LibAllStandardOps { "uint256-mul", "Multiplies all inputs together as uint256 values. Errors if the multiplication exceeds `uint256-max-value()`." ), - // AuthoringMetaV2( - // "uint256-power", - // "Raises the first input to the power of all other inputs as uint256 values. Errors if the exponentiation exceeds `max-value()`." - // ), + AuthoringMetaV2( + "uint256-power", + "Raises the first input to the power of all other inputs as uint256 values. Errors if the exponentiation exceeds `uint256-max-value()`." + ), AuthoringMetaV2("add", "Adds all numbers together."), // AuthoringMetaV2("avg", "Arithmetic average (mean) of two numbers."), // AuthoringMetaV2("ceil", "Ceiling of a number."), @@ -462,8 +462,8 @@ library LibAllStandardOps { LibParseOperand.handleOperandDisallowed, // uint256-mul LibParseOperand.handleOperandDisallowed, - // // uint256-power - // LibParseOperand.handleOperandDisallowed, + // uint256-power + LibParseOperand.handleOperandDisallowed, // add LibParseOperand.handleOperandDisallowed, // // avg @@ -604,7 +604,7 @@ library LibAllStandardOps { LibOpUint256Add.integrity, LibOpUint256Div.integrity, LibOpUint256Mul.integrity, - // LibOpUint256Pow.integrity, + LibOpUint256Pow.integrity, LibOpAdd.integrity, // LibOpAvg.integrity, // LibOpCeil.integrity, @@ -718,7 +718,7 @@ library LibAllStandardOps { LibOpUint256Add.run, LibOpUint256Div.run, LibOpUint256Mul.run, - // LibOpUint256Pow.run, + LibOpUint256Pow.run, LibOpAdd.run, // LibOpAvg.run, // LibOpCeil.run, diff --git a/src/lib/op/math/uint256/LibOpUint256Pow.sol b/src/lib/op/math/uint256/LibOpUint256Pow.sol index 88b56bd5d..d1b948f45 100644 --- a/src/lib/op/math/uint256/LibOpUint256Pow.sol +++ b/src/lib/op/math/uint256/LibOpUint256Pow.sol @@ -5,6 +5,7 @@ import {OperandV2} from "rain.interpreter.interface/interface/unstable/IInterpre import {Pointer} from "rain.solmem/lib/LibPointer.sol"; import {InterpreterState} from "../../../state/LibInterpreterState.sol"; import {IntegrityCheckState} from "../../../integrity/LibIntegrityCheck.sol"; +import {StackItem} from "rain.interpreter.interface/interface/unstable/IInterpreterV4.sol"; /// @title LibOpUint256Pow /// @notice Opcode to raise x successively to N integers. Errors on overflow. @@ -51,20 +52,20 @@ library LibOpUint256Pow { } /// Gas intensive reference implementation of exponentiation for testing. - function referenceFn(InterpreterState memory, OperandV2, uint256[] memory inputs) + function referenceFn(InterpreterState memory, OperandV2, StackItem[] memory inputs) internal pure - returns (uint256[] memory outputs) + returns (StackItem[] memory outputs) { // Unchecked so that when we assert that an overflow error is thrown, we // see the revert from the real function and not the reference function. unchecked { - uint256 acc = inputs[0]; + uint256 acc = uint256(StackItem.unwrap(inputs[0])); for (uint256 i = 1; i < inputs.length; i++) { - acc = acc ** inputs[i]; + acc = acc ** uint256(StackItem.unwrap(inputs[i])); } - outputs = new uint256[](1); - outputs[0] = acc; + outputs = new StackItem[](1); + outputs[0] = StackItem.wrap(bytes32(acc)); } } } diff --git a/test/src/lib/op/math/uint256/LibOpUint256Pow.t.sol b/test/src/lib/op/math/uint256/LibOpUint256Pow.t.sol index 09f884a65..86385bc5a 100644 --- a/test/src/lib/op/math/uint256/LibOpUint256Pow.t.sol +++ b/test/src/lib/op/math/uint256/LibOpUint256Pow.t.sol @@ -1,238 +1,249 @@ // SPDX-License-Identifier: CAL pragma solidity =0.8.25; -// import {stdError} from "forge-std/Test.sol"; +import {stdError} from "forge-std/Test.sol"; // import {LibUint256Array} from "rain.solmem/lib/LibUint256Array.sol"; -// import {OpTest} from "test/abstract/OpTest.sol"; +import {OpTest} from "test/abstract/OpTest.sol"; // import {LibContext} from "rain.interpreter.interface/lib/caller/LibContext.sol"; // import {UnexpectedOperand} from "src/error/ErrParse.sol"; -// import {LibOpUint256Pow} from "src/lib/op/math/uint256/LibOpUint256Pow.sol"; -// import {IntegrityCheckState} from "src/lib/integrity/LibIntegrityCheck.sol"; -// import {InterpreterState} from "src/lib/state/LibInterpreterState.sol"; -// import {OperandV2} from "rain.interpreter.interface/interface/unstable/IInterpreterV4.sol"; -// import {LibOperand} from "test/lib/operand/LibOperand.sol"; - -// contract LibOpUint256PowTest is OpTest { -// using LibUint256Array for uint256[]; - -// /// Directly test the integrity logic of LibOpUint256Exp. This tests the happy -// /// path where the inputs input and calc match. -// function testOpUint256ExpIntegrityHappy(IntegrityCheckState memory state, uint8 inputs, uint16 operandData) -// external -// pure -// { -// inputs = uint8(bound(inputs, 2, 0x0F)); -// (uint256 calcInputs, uint256 calcOutputs) = -// LibOpUint256Pow.integrity(state, LibOperand.build(inputs, 1, operandData)); - -// assertEq(calcInputs, inputs); -// assertEq(calcOutputs, 1); -// } - -// /// Directly test the integrity logic of LibOpUint256Pow. This tests the unhappy -// /// path where the operand is invalid due to 0 inputs. -// function testOpUint256PowIntegrityUnhappyZeroInputs(IntegrityCheckState memory state) external pure { -// (uint256 calcInputs, uint256 calcOutputs) = LibOpUint256Pow.integrity(state, Operand.wrap(0)); -// // Calc inputs will be minimum 2. -// assertEq(calcInputs, 2); -// assertEq(calcOutputs, 1); -// } - -// /// Directly test the integrity logic of LibOpUint256Pow. This tests the unhappy -// /// path where the operand is invalid due to 1 inputs. -// function testOpUint256PowIntegrityUnhappyOneInput(IntegrityCheckState memory state) external pure { -// (uint256 calcInputs, uint256 calcOutputs) = LibOpUint256Pow.integrity(state, Operand.wrap(0x010000)); -// // Calc inputs will be minimum 2. -// assertEq(calcInputs, 2); -// assertEq(calcOutputs, 1); -// } - -// /// Directly test the runtime logic of LibOpUint256Pow. -// function testOpUint256PowRun(uint256[] memory inputs) external { -// InterpreterState memory state = opTestDefaultInterpreterState(); -// vm.assume(inputs.length >= 2); -// vm.assume(inputs.length <= 0x0F); -// Operand operand = LibOperand.build(uint8(inputs.length), 1, 0); -// uint256 overflows = 0; -// unchecked { -// uint256 a = inputs[0]; -// for (uint256 i = 1; i < inputs.length; i++) { -// uint256 b = inputs[i]; -// if (b == 0) { -// a = 1; -// continue; -// } else if (b == 1 || a == 0) { -// continue; -// } else { -// uint256 c = a; -// for (uint256 j = 1; j < b; j++) { -// uint256 d = a * c; -// if (d / c != a) { -// overflows++; -// break; -// } -// if (d == a) { -// break; -// } -// a = d; -// } -// } -// } -// } -// if (overflows > 0) { -// vm.expectRevert(stdError.arithmeticError); -// } -// opReferenceCheck( -// state, operand, LibOpUint256Pow.referenceFn, LibOpUint256Pow.integrity, LibOpUint256Pow.run, inputs -// ); -// } - -// /// Test the eval of `uint256-power` opcode parsed from a string. Tests zero inputs. -// function testOpUint256PowEvalZeroInputs() external { -// checkBadInputs("_: uint256-power();", 0, 2, 0); -// } - -// /// Test the eval of `uint256-power` opcode parsed from a string. Tests one input. -// function testOpUint256PowEvalOneInput() external { -// checkBadInputs("_: uint256-power(5e-18);", 1, 2, 1); -// checkBadInputs("_: uint256-power(0);", 1, 2, 1); -// checkBadInputs("_: uint256-power(1e-18);", 1, 2, 1); -// checkBadInputs("_: uint256-power(max-value());", 1, 2, 1); -// } - -// function testOpUint256PowEvalZeroOutputs() external { -// checkBadOutputs(": uint256-power(0 0);", 2, 1, 0); -// } - -// function testOpUint256PowEvalTwoOutputs() external { -// checkBadOutputs("_ _: uint256-power(0 0);", 2, 1, 2); -// } - -// /// Test the eval of `uint256-power` opcode parsed from a string. Tests two inputs. -// /// Tests the happy path where we do not overflow. -// function testOpUint256PowEval2InputsHappy() external view { -// // Anything exp 0 is 1. -// checkHappy("_: uint256-power(0 0);", 1, "0 ** 0"); -// checkHappy("_: uint256-power(1e-18 0);", 1, "1 ** 0"); -// checkHappy("_: uint256-power(max-value() 0);", 1, "max-value() ** 0"); - -// // 1 exp anything is 1. -// checkHappy("_: uint256-power(1e-18 0);", 1, "1 ** 0"); -// checkHappy("_: uint256-power(1e-18 1e-18);", 1, "1 ** 1"); -// checkHappy("_: uint256-power(1e-18 2e-18);", 1, "1 ** 2"); -// checkHappy("_: uint256-power(1e-18 3e-18);", 1, "1 ** 3"); -// checkHappy("_: uint256-power(1e-18 max-value());", 1, "1 ** max-value()"); - -// // Anything exp 1 is itself. -// checkHappy("_: uint256-power(0 1e-18);", 0, "0 ** 1"); -// checkHappy("_: uint256-power(1e-18 1e-18);", 1, "1 ** 1"); -// checkHappy("_: uint256-power(max-value() 1e-18);", type(uint256).max, "max-value() ** 1"); - -// // Anything exp 2 is itself squared. -// checkHappy("_: uint256-power(0 2e-18);", 0, "0 ** 2"); -// checkHappy("_: uint256-power(1e-18 2e-18);", 1, "1 ** 2"); -// checkHappy("_: uint256-power(2e-18 2e-18);", 4, "2 ** 2"); -// checkHappy("_: uint256-power(3e-18 2e-18);", 9, "3 ** 2"); - -// // Anything exp 3 is itself cubed. -// checkHappy("_: uint256-power(0 3e-18);", 0, "0 ** 3"); -// checkHappy("_: uint256-power(1e-18 3e-18);", 1, "1 ** 3"); -// checkHappy("_: uint256-power(2e-18 3e-18);", 8, "2 ** 3"); -// checkHappy("_: uint256-power(3e-18 3e-18);", 27, "3 ** 3"); -// } - -// /// Test the eval of `uint256-power` opcode parsed from a string. Tests two inputs. -// /// Tests the unhappy path where we overflow. -// function testOpUint256PowEval2InputsUnhappy() external { -// checkUnhappyOverflow("_: uint256-power(2e-18 max-value());"); -// checkUnhappyOverflow("_: uint256-power(3e-18 max-value());"); -// checkUnhappyOverflow("_: uint256-power(max-value() max-value());"); -// } - -// /// Test the eval of `uint256-power` opcode parsed from a string. Tests three inputs. -// /// Tests the happy path where we do not divide by zero. -// function testOpUint256PowEval3InputsHappy() external view { -// // Anything exp 0 is 1. -// checkHappy("_: uint256-power(0 0 0);", 1, "0 ** 0 ** 0"); -// checkHappy("_: uint256-power(1e-18 0 0);", 1, "1 ** 0 ** 0"); -// checkHappy("_: uint256-power(max-value() 0 0);", 1, "max-value() ** 0 ** 0"); -// checkHappy("_: uint256-power(0 1e-18 0);", 1, "0 ** 1 ** 0"); -// checkHappy("_: uint256-power(1e-18 1e-18 0);", 1, "1 ** 1 ** 0"); -// checkHappy("_: uint256-power(0 0 1e-18);", 1, "0 ** 0 ** 1"); -// checkHappy("_: uint256-power(1e-18 0 1e-18);", 1, "1 ** 0 ** 1"); -// checkHappy("_: uint256-power(max-value() 0 1e-18);", 1, "max-value() ** 0 ** 1"); - -// // 1 exp anything is 1. -// checkHappy("_: uint256-power(1e-18 0 0);", 1, "1 ** 0 ** 0"); -// checkHappy("_: uint256-power(1e-18 0 1e-18);", 1, "1 ** 0 ** 1"); -// checkHappy("_: uint256-power(1e-18 1e-18 0);", 1, "1 ** 1 ** 0"); -// checkHappy("_: uint256-power(1e-18 1e-18 1e-18);", 1, "1 ** 1 ** 1"); -// checkHappy("_: uint256-power(1e-18 2e-18 0);", 1, "1 ** 2 ** 0"); -// checkHappy("_: uint256-power(1e-18 2e-18 1e-18);", 1, "1 ** 2 ** 1"); -// checkHappy("_: uint256-power(1e-18 2e-18 2e-18);", 1, "1 ** 2 ** 2"); -// checkHappy("_: uint256-power(1e-18 3e-18 0);", 1, "1 ** 3 ** 0"); - -// // Anything exp 1 is itself. -// checkHappy("_: uint256-power(0 1e-18 1e-18);", 0, "0 ** 1 ** 1"); -// checkHappy("_: uint256-power(1e-18 1e-18 1e-18);", 1, "1 ** 1 ** 1"); -// checkHappy("_: uint256-power(max-value() 1e-18 1e-18);", type(uint256).max, "max-value() ** 1 ** 1"); - -// // Anything exp 2 1 is itself squared. -// checkHappy("_: uint256-power(0 2e-18 1e-18);", 0, "0 ** 2 ** 0"); -// checkHappy("_: uint256-power(1e-18 2e-18 1e-18);", 1, "1 ** 2 ** 0"); -// checkHappy("_: uint256-power(2e-18 2e-18 1e-18);", 4, "2 ** 2 ** 0"); -// checkHappy("_: uint256-power(3e-18 2e-18 1e-18);", 9, "3 ** 2 ** 0"); - -// // Anything exp 2 2 is itself squared squared. -// checkHappy("_: uint256-power(0 2e-18 2e-18);", 0, "0 ** 2 ** 2"); -// checkHappy("_: uint256-power(1e-18 2e-18 2e-18);", 1, "1 ** 2 ** 2"); -// checkHappy("_: uint256-power(2e-18 2e-18 2e-18);", 16, "2 ** 2 ** 2"); -// checkHappy("_: uint256-power(3e-18 2e-18 2e-18);", 81, "3 ** 2 ** 2"); - -// // Anything exp 3 1 is itself cubed. -// checkHappy("_: uint256-power(0 3e-18 1e-18);", 0, "0 ** 3 ** 0"); -// checkHappy("_: uint256-power(1e-18 3e-18 1e-18);", 1, "1 ** 3 ** 0"); -// checkHappy("_: uint256-power(2e-18 3e-18 1e-18);", 8, "2 ** 3 ** 0"); -// checkHappy("_: uint256-power(3e-18 3e-18 1e-18);", 27, "3 ** 3 ** 0"); - -// // Anything exp 3 2 is itself cubed squared. -// checkHappy("_: uint256-power(0 3e-18 2e-18);", 0, "0 ** 3 ** 2"); -// checkHappy("_: uint256-power(1e-18 3e-18 2e-18);", 1, "1 ** 3 ** 2"); -// checkHappy("_: uint256-power(2e-18 3e-18 2e-18);", 64, "2 ** 3 ** 2"); -// checkHappy("_: uint256-power(3e-18 3e-18 2e-18);", 729, "3 ** 3 ** 2"); - -// // Anything exp 3 3 is itself cubed cubed. -// checkHappy("_: uint256-power(0 3e-18 3e-18);", 0, "0 ** 3 ** 3"); -// checkHappy("_: uint256-power(1e-18 3e-18 3e-18);", 1, "1 ** 3 ** 3"); -// checkHappy("_: uint256-power(2e-18 3e-18 3e-18);", 512, "2 ** 3 ** 3"); -// checkHappy("_: uint256-power(3e-18 3e-18 3e-18);", 19683, "3 ** 3 ** 3"); -// } - -// /// Test the eval of `uint256-power` opcode parsed from a string. Tests three inputs. -// /// Tests the unhappy path where we overflow. -// function testOpUint256PowEval3InputsUnhappy() external { -// checkUnhappyOverflow("_: uint256-power(2e-18 max-value() 0);"); -// checkUnhappyOverflow("_: uint256-power(3e-18 max-value() 0);"); -// checkUnhappyOverflow("_: uint256-power(max-value() max-value() 0);"); -// checkUnhappyOverflow("_: uint256-power(2e-18 max-value() 1e-18);"); -// checkUnhappyOverflow("_: uint256-power(3e-18 max-value() 1e-18);"); -// checkUnhappyOverflow("_: uint256-power(max-value() max-value() 1e-18);"); -// checkUnhappyOverflow("_: uint256-power(2e-18 max-value() 2e-18);"); -// checkUnhappyOverflow("_: uint256-power(3e-18 max-value() 2e-18);"); -// checkUnhappyOverflow("_: uint256-power(max-value() max-value() 2e-18);"); -// checkUnhappyOverflow("_: uint256-power(2e-18 max-value() 3e-18);"); -// checkUnhappyOverflow("_: uint256-power(3e-18 max-value() 3e-18);"); -// checkUnhappyOverflow("_: uint256-power(max-value() max-value() 3e-18);"); -// } - -// /// Test the eval of `uint256-power` opcode parsed from a string. -// /// Tests that operands are disallowed. -// function testOpUint256PowEvalOperandDisallowed() external { -// checkDisallowedOperand("_: uint256-power<0>(0 0 0);"); -// checkDisallowedOperand("_: uint256-power<1>(0 0 0);"); -// checkDisallowedOperand("_: uint256-power<2>(0 0 0);"); -// checkDisallowedOperand("_: uint256-power<3 1>(0 0 0);"); -// } -// } +import {LibOpUint256Pow} from "src/lib/op/math/uint256/LibOpUint256Pow.sol"; +import {IntegrityCheckState} from "src/lib/integrity/LibIntegrityCheck.sol"; +import {InterpreterState} from "src/lib/state/LibInterpreterState.sol"; +import {StackItem, OperandV2} from "rain.interpreter.interface/interface/unstable/IInterpreterV4.sol"; +import {LibOperand} from "test/lib/operand/LibOperand.sol"; + +contract LibOpUint256PowTest is OpTest { + // using LibUint256Array for uint256[]; + + /// Directly test the integrity logic of LibOpUint256Exp. This tests the happy + /// path where the inputs input and calc match. + function testOpUint256ExpIntegrityHappy(IntegrityCheckState memory state, uint8 inputs, uint16 operandData) + external + pure + { + inputs = uint8(bound(inputs, 2, 0x0F)); + (uint256 calcInputs, uint256 calcOutputs) = + LibOpUint256Pow.integrity(state, LibOperand.build(inputs, 1, operandData)); + + assertEq(calcInputs, inputs); + assertEq(calcOutputs, 1); + } + + /// Directly test the integrity logic of LibOpUint256Pow. This tests the unhappy + /// path where the operand is invalid due to 0 inputs. + function testOpUint256PowIntegrityUnhappyZeroInputs(IntegrityCheckState memory state) external pure { + (uint256 calcInputs, uint256 calcOutputs) = LibOpUint256Pow.integrity(state, OperandV2.wrap(0)); + // Calc inputs will be minimum 2. + assertEq(calcInputs, 2); + assertEq(calcOutputs, 1); + } + + /// Directly test the integrity logic of LibOpUint256Pow. This tests the unhappy + /// path where the operand is invalid due to 1 inputs. + function testOpUint256PowIntegrityUnhappyOneInput(IntegrityCheckState memory state) external pure { + (uint256 calcInputs, uint256 calcOutputs) = + LibOpUint256Pow.integrity(state, OperandV2.wrap(bytes32(uint256(0x010000)))); + // Calc inputs will be minimum 2. + assertEq(calcInputs, 2); + assertEq(calcOutputs, 1); + } + + function _testOpUint256PowRun(OperandV2 operand, StackItem[] memory inputs) external view { + InterpreterState memory state = opTestDefaultInterpreterState(); + opReferenceCheck( + state, operand, LibOpUint256Pow.referenceFn, LibOpUint256Pow.integrity, LibOpUint256Pow.run, inputs + ); + } + + /// Directly test the runtime logic of LibOpUint256Pow. + function testOpUint256PowRun(StackItem[] memory inputs) external { + vm.assume(inputs.length >= 2); + vm.assume(inputs.length <= 0x0F); + OperandV2 operand = LibOperand.build(uint8(inputs.length), 1, 0); + uint256 overflows = 0; + unchecked { + uint256 a = uint256(StackItem.unwrap(inputs[0])); + for (uint256 i = 1; i < inputs.length; i++) { + uint256 b = uint256(StackItem.unwrap(inputs[i])); + if (b == 0) { + a = 1; + continue; + } else if (b == 1 || a == 0) { + continue; + } else { + uint256 c = a; + for (uint256 j = 1; j < b; j++) { + uint256 d = a * c; + if (d / c != a) { + overflows++; + break; + } + if (d == a) { + break; + } + a = d; + } + } + } + } + if (overflows > 0) { + vm.expectRevert(stdError.arithmeticError); + } + this._testOpUint256PowRun(operand, inputs); + } + + /// Test the eval of `uint256-power` opcode parsed from a string. Tests zero inputs. + function testOpUint256PowEvalZeroInputs() external { + checkBadInputs("_: uint256-power();", 0, 2, 0); + } + + /// Test the eval of `uint256-power` opcode parsed from a string. Tests one input. + function testOpUint256PowEvalOneInput() external { + checkBadInputs("_: uint256-power(5e-18);", 1, 2, 1); + checkBadInputs("_: uint256-power(0);", 1, 2, 1); + checkBadInputs("_: uint256-power(1e-18);", 1, 2, 1); + checkBadInputs("_: uint256-power(max-value());", 1, 2, 1); + } + + function testOpUint256PowEvalZeroOutputs() external { + checkBadOutputs(": uint256-power(0 0);", 2, 1, 0); + } + + function testOpUint256PowEvalTwoOutputs() external { + checkBadOutputs("_ _: uint256-power(0 0);", 2, 1, 2); + } + + /// Test the eval of `uint256-power` opcode parsed from a string. Tests two inputs. + /// Tests the happy path where we do not overflow. + function testOpUint256PowEval2InputsHappy() external view { + // Anything exp 0 is 1. + checkHappy("_: uint256-power(0 0);", bytes32(uint256(1)), "0 ** 0"); + checkHappy("_: uint256-power(0x01 0);", bytes32(uint256(1)), "1 ** 0"); + checkHappy("_: uint256-power(uint256-max-value() 0);", bytes32(uint256(1)), "uint256-max-value() ** 0"); + + // 1 exp anything is 1. + checkHappy("_: uint256-power(0x01 0);", bytes32(uint256(1)), "1 ** 0"); + checkHappy("_: uint256-power(0x01 0x01);", bytes32(uint256(1)), "1 ** 1"); + checkHappy("_: uint256-power(0x01 0x02);", bytes32(uint256(1)), "1 ** 2"); + checkHappy("_: uint256-power(0x01 0x03);", bytes32(uint256(1)), "1 ** 3"); + checkHappy("_: uint256-power(0x01 uint256-max-value());", bytes32(uint256(1)), "1 ** max-value()"); + + // Anything exp 1 is itself. + checkHappy("_: uint256-power(0 1);", 0, "0 ** 1"); + checkHappy("_: uint256-power(1 1);", bytes32(uint256(1)), "1 ** 1"); + checkHappy( + "_: uint256-power(uint256-max-value() 0x01);", bytes32(type(uint256).max), "uint256-max-value() ** 1" + ); + + // Anything exp 2 is itself squared. + checkHappy("_: uint256-power(0 0x02);", 0, "0 ** 2"); + checkHappy("_: uint256-power(0x01 0x02);", bytes32(uint256(1)), "1 ** 2"); + checkHappy("_: uint256-power(0x02 0x02);", bytes32(uint256(4)), "2 ** 2"); + checkHappy("_: uint256-power(0x03 0x02);", bytes32(uint256(9)), "3 ** 2"); + + // Anything exp 3 is itself cubed. + checkHappy("_: uint256-power(0 0x03);", 0, "0 ** 3"); + checkHappy("_: uint256-power(0x01 0x03);", bytes32(uint256(1)), "1 ** 3"); + checkHappy("_: uint256-power(0x02 0x03);", bytes32(uint256(8)), "2 ** 3"); + checkHappy("_: uint256-power(0x03 0x03);", bytes32(uint256(27)), "3 ** 3"); + } + + /// Test the eval of `uint256-power` opcode parsed from a string. Tests two inputs. + /// Tests the unhappy path where we overflow. + function testOpUint256PowEval2InputsUnhappy() external { + checkUnhappy("_: uint256-power(0x02 uint256-max-value());", stdError.arithmeticError); + checkUnhappy("_: uint256-power(0x03 uint256-max-value());", stdError.arithmeticError); + checkUnhappy("_: uint256-power(uint256-max-value() uint256-max-value());", stdError.arithmeticError); + } + + /// Test the eval of `uint256-power` opcode parsed from a string. Tests three inputs. + /// Tests the happy path where we do not divide by zero. + function testOpUint256PowEval3InputsHappy() external view { + // Anything exp 0 is 1. + checkHappy("_: uint256-power(0 0 0);", bytes32(uint256(1)), "0 ** 0 ** 0"); + checkHappy("_: uint256-power(0x01 0 0);", bytes32(uint256(1)), "1 ** 0 ** 0"); + checkHappy("_: uint256-power(uint256-max-value() 0 0);", bytes32(uint256(1)), "uint256-max-value() ** 0 ** 0"); + checkHappy("_: uint256-power(0 0x01 0);", bytes32(uint256(1)), "0 ** 1 ** 0"); + checkHappy("_: uint256-power(0x01 0x01 0);", bytes32(uint256(1)), "1 ** 1 ** 0"); + checkHappy("_: uint256-power(0 0 0x01);", bytes32(uint256(1)), "0 ** 0 ** 1"); + checkHappy("_: uint256-power(0x01 0 0x01);", bytes32(uint256(1)), "1 ** 0 ** 1"); + checkHappy( + "_: uint256-power(uint256-max-value() 0 0x01);", bytes32(uint256(1)), "uint256-max-value() ** 0 ** 1" + ); + + // 1 exp anything is 1. + checkHappy("_: uint256-power(0x01 0 0);", bytes32(uint256(1)), "1 ** 0 ** 0"); + checkHappy("_: uint256-power(0x01 0 0x01);", bytes32(uint256(1)), "1 ** 0 ** 1"); + checkHappy("_: uint256-power(0x01 0x01 0);", bytes32(uint256(1)), "1 ** 1 ** 0"); + checkHappy("_: uint256-power(0x01 0x01 0x01);", bytes32(uint256(1)), "1 ** 1 ** 1"); + checkHappy("_: uint256-power(0x01 0x02 0);", bytes32(uint256(1)), "1 ** 2 ** 0"); + checkHappy("_: uint256-power(0x01 0x02 0x01);", bytes32(uint256(1)), "1 ** 2 ** 1"); + checkHappy("_: uint256-power(0x01 0x02 0x02);", bytes32(uint256(1)), "1 ** 2 ** 2"); + checkHappy("_: uint256-power(0x01 0x03 0);", bytes32(uint256(1)), "1 ** 3 ** 0"); + + // Anything exp 1 is itself. + checkHappy("_: uint256-power(0 0x01 0x01);", 0, "0 ** 1 ** 1"); + checkHappy("_: uint256-power(0x01 0x01 0x01);", bytes32(uint256(1)), "1 ** 1 ** 1"); + checkHappy( + "_: uint256-power(uint256-max-value() 0x01 0x01);", bytes32(type(uint256).max), "max-value() ** 1 ** 1" + ); + + // Anything exp 2 1 is itself squared. + checkHappy("_: uint256-power(0 0x02 0x01);", 0, "0 ** 2 ** 0"); + checkHappy("_: uint256-power(0x01 0x02 0x01);", bytes32(uint256(1)), "1 ** 2 ** 0"); + checkHappy("_: uint256-power(0x02 0x02 0x01);", bytes32(uint256(4)), "2 ** 2 ** 0"); + checkHappy("_: uint256-power(0x03 0x02 0x01);", bytes32(uint256(9)), "3 ** 2 ** 0"); + + // Anything exp 2 2 is itself squared squared. + checkHappy("_: uint256-power(0 0x02 0x02);", 0, "0 ** 2 ** 2"); + checkHappy("_: uint256-power(0x01 0x02 0x02);", bytes32(uint256(1)), "1 ** 2 ** 2"); + checkHappy("_: uint256-power(0x02 0x02 0x02);", bytes32(uint256(16)), "2 ** 2 ** 2"); + checkHappy("_: uint256-power(0x03 0x02 0x02);", bytes32(uint256(81)), "3 ** 2 ** 2"); + + // Anything exp 3 1 is itself cubed. + checkHappy("_: uint256-power(0 0x03 0x01);", 0, "0 ** 3 ** 0"); + checkHappy("_: uint256-power(0x01 0x03 0x01);", bytes32(uint256(1)), "1 ** 3 ** 0"); + checkHappy("_: uint256-power(0x02 0x03 0x01);", bytes32(uint256(8)), "2 ** 3 ** 0"); + checkHappy("_: uint256-power(0x03 0x03 0x01);", bytes32(uint256(27)), "3 ** 3 ** 0"); + + // Anything exp 3 2 is itself cubed squared. + checkHappy("_: uint256-power(0 0x03 0x02);", 0, "0 ** 3 ** 2"); + checkHappy("_: uint256-power(0x01 0x03 0x02);", bytes32(uint256(1)), "1 ** 3 ** 2"); + checkHappy("_: uint256-power(0x02 0x03 0x02);", bytes32(uint256(64)), "2 ** 3 ** 2"); + checkHappy("_: uint256-power(0x03 0x03 0x02);", bytes32(uint256(729)), "3 ** 3 ** 2"); + + // Anything exp 3 3 is itself cubed cubed. + checkHappy("_: uint256-power(0 0x03 0x03);", 0, "0 ** 3 ** 3"); + checkHappy("_: uint256-power(0x01 0x03 0x03);", bytes32(uint256(1)), "1 ** 3 ** 3"); + checkHappy("_: uint256-power(0x02 0x03 0x03);", bytes32(uint256(512)), "2 ** 3 ** 3"); + checkHappy("_: uint256-power(0x03 0x03 0x03);", bytes32(uint256(19683)), "3 ** 3 ** 3"); + } + + /// Test the eval of `uint256-power` opcode parsed from a string. Tests three inputs. + /// Tests the unhappy path where we overflow. + function testOpUint256PowEval3InputsUnhappy() external { + checkUnhappy("_: uint256-power(0x02 uint256-max-value() 0);", stdError.arithmeticError); + checkUnhappy("_: uint256-power(0x03 uint256-max-value() 0);", stdError.arithmeticError); + checkUnhappy("_: uint256-power(uint256-max-value() uint256-max-value() 0);", stdError.arithmeticError); + checkUnhappy("_: uint256-power(0x02 uint256-max-value() 0x01);", stdError.arithmeticError); + checkUnhappy("_: uint256-power(0x03 uint256-max-value() 0x01);", stdError.arithmeticError); + checkUnhappy("_: uint256-power(uint256-max-value() uint256-max-value() 0x01);", stdError.arithmeticError); + checkUnhappy("_: uint256-power(0x02 uint256-max-value() 0x02);", stdError.arithmeticError); + checkUnhappy("_: uint256-power(0x03 uint256-max-value() 0x02);", stdError.arithmeticError); + checkUnhappy("_: uint256-power(uint256-max-value() uint256-max-value() 0x02);", stdError.arithmeticError); + checkUnhappy("_: uint256-power(0x02 uint256-max-value() 0x03);", stdError.arithmeticError); + checkUnhappy("_: uint256-power(0x03 uint256-max-value() 0x03);", stdError.arithmeticError); + checkUnhappy("_: uint256-power(uint256-max-value() uint256-max-value() 0x03);", stdError.arithmeticError); + } + + /// Test the eval of `uint256-power` opcode parsed from a string. + /// Tests that operands are disallowed. + function testOpUint256PowEvalOperandDisallowed() external { + checkDisallowedOperand("_: uint256-power<0>(0 0 0);"); + checkDisallowedOperand("_: uint256-power<1>(0 0 0);"); + checkDisallowedOperand("_: uint256-power<2>(0 0 0);"); + checkDisallowedOperand("_: uint256-power<3 1>(0 0 0);"); + } +} From 090eafb962de6ff437b5a8d8f329cb9581038673 Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Thu, 17 Jul 2025 22:25:58 +0400 Subject: [PATCH 2/5] lint --- test/src/lib/op/math/uint256/LibOpUint256Pow.t.sol | 7 ------- 1 file changed, 7 deletions(-) diff --git a/test/src/lib/op/math/uint256/LibOpUint256Pow.t.sol b/test/src/lib/op/math/uint256/LibOpUint256Pow.t.sol index 86385bc5a..2da5bc785 100644 --- a/test/src/lib/op/math/uint256/LibOpUint256Pow.t.sol +++ b/test/src/lib/op/math/uint256/LibOpUint256Pow.t.sol @@ -2,12 +2,7 @@ pragma solidity =0.8.25; import {stdError} from "forge-std/Test.sol"; - -// import {LibUint256Array} from "rain.solmem/lib/LibUint256Array.sol"; - import {OpTest} from "test/abstract/OpTest.sol"; -// import {LibContext} from "rain.interpreter.interface/lib/caller/LibContext.sol"; -// import {UnexpectedOperand} from "src/error/ErrParse.sol"; import {LibOpUint256Pow} from "src/lib/op/math/uint256/LibOpUint256Pow.sol"; import {IntegrityCheckState} from "src/lib/integrity/LibIntegrityCheck.sol"; import {InterpreterState} from "src/lib/state/LibInterpreterState.sol"; @@ -15,8 +10,6 @@ import {StackItem, OperandV2} from "rain.interpreter.interface/interface/unstabl import {LibOperand} from "test/lib/operand/LibOperand.sol"; contract LibOpUint256PowTest is OpTest { - // using LibUint256Array for uint256[]; - /// Directly test the integrity logic of LibOpUint256Exp. This tests the happy /// path where the inputs input and calc match. function testOpUint256ExpIntegrityHappy(IntegrityCheckState memory state, uint8 inputs, uint16 operandData) From 8dca34dc48a6f45eae64dac0cce8f5ec956f3714 Mon Sep 17 00:00:00 2001 From: David Meister Date: Thu, 17 Jul 2025 23:10:48 +0400 Subject: [PATCH 3/5] Update test/src/lib/op/math/uint256/LibOpUint256Pow.t.sol Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- test/src/lib/op/math/uint256/LibOpUint256Pow.t.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/src/lib/op/math/uint256/LibOpUint256Pow.t.sol b/test/src/lib/op/math/uint256/LibOpUint256Pow.t.sol index 2da5bc785..fd2c7f198 100644 --- a/test/src/lib/op/math/uint256/LibOpUint256Pow.t.sol +++ b/test/src/lib/op/math/uint256/LibOpUint256Pow.t.sol @@ -10,7 +10,7 @@ import {StackItem, OperandV2} from "rain.interpreter.interface/interface/unstabl import {LibOperand} from "test/lib/operand/LibOperand.sol"; contract LibOpUint256PowTest is OpTest { - /// Directly test the integrity logic of LibOpUint256Exp. This tests the happy + /// Directly test the integrity logic of LibOpUint256Pow. This tests the happy /// path where the inputs input and calc match. function testOpUint256ExpIntegrityHappy(IntegrityCheckState memory state, uint8 inputs, uint16 operandData) external From 7e166f556a6e409033c9d126a7c56b3216c63a31 Mon Sep 17 00:00:00 2001 From: David Meister Date: Thu, 17 Jul 2025 23:41:27 +0400 Subject: [PATCH 4/5] Update test/src/lib/op/math/uint256/LibOpUint256Pow.t.sol Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- test/src/lib/op/math/uint256/LibOpUint256Pow.t.sol | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/src/lib/op/math/uint256/LibOpUint256Pow.t.sol b/test/src/lib/op/math/uint256/LibOpUint256Pow.t.sol index fd2c7f198..211367782 100644 --- a/test/src/lib/op/math/uint256/LibOpUint256Pow.t.sol +++ b/test/src/lib/op/math/uint256/LibOpUint256Pow.t.sol @@ -196,10 +196,10 @@ contract LibOpUint256PowTest is OpTest { checkHappy("_: uint256-power(0x03 0x02 0x02);", bytes32(uint256(81)), "3 ** 2 ** 2"); // Anything exp 3 1 is itself cubed. - checkHappy("_: uint256-power(0 0x03 0x01);", 0, "0 ** 3 ** 0"); - checkHappy("_: uint256-power(0x01 0x03 0x01);", bytes32(uint256(1)), "1 ** 3 ** 0"); - checkHappy("_: uint256-power(0x02 0x03 0x01);", bytes32(uint256(8)), "2 ** 3 ** 0"); - checkHappy("_: uint256-power(0x03 0x03 0x01);", bytes32(uint256(27)), "3 ** 3 ** 0"); + checkHappy("_: uint256-power(0 0x03 0x01);", 0, "0 ** 3 ** 1"); + checkHappy("_: uint256-power(0x01 0x03 0x01);", bytes32(uint256(1)), "1 ** 3 ** 1"); + checkHappy("_: uint256-power(0x02 0x03 0x01);", bytes32(uint256(8)), "2 ** 3 ** 1"); + checkHappy("_: uint256-power(0x03 0x03 0x01);", bytes32(uint256(27)), "3 ** 3 ** 1"); // Anything exp 3 2 is itself cubed squared. checkHappy("_: uint256-power(0 0x03 0x02);", 0, "0 ** 3 ** 2"); From 806e6b0e3d761fc30f7ae993b7ad1b3b2bd4ccbc Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Thu, 17 Jul 2025 23:54:31 +0400 Subject: [PATCH 5/5] pointers --- src/generated/RainterpreterExpressionDeployer.pointers.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/generated/RainterpreterExpressionDeployer.pointers.sol b/src/generated/RainterpreterExpressionDeployer.pointers.sol index cba28e8d8..9a35f598d 100644 --- a/src/generated/RainterpreterExpressionDeployer.pointers.sol +++ b/src/generated/RainterpreterExpressionDeployer.pointers.sol @@ -10,7 +10,7 @@ pragma solidity =0.8.25; /// @dev Hash of the known bytecode. -bytes32 constant BYTECODE_HASH = bytes32(0x32ac723929981ff250b5fadcf3a20ceffbc8fb62b0e940bc58d136fef34525f5); +bytes32 constant BYTECODE_HASH = bytes32(0xcc6a77c3b0935f48d13585035787d28a470eee410f037d38eff0bbe7e01b840f); /// @dev The hash of the meta that describes the contract. bytes32 constant DESCRIBED_BY_META_HASH = bytes32(0xac3b6bee9ceb4e62a12d26c66af916180e4b8e2576895cf158cd6c5a7afd4632);