Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
476 changes: 249 additions & 227 deletions .gas-snapshot

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/generated/Rainterpreter.pointers.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
pragma solidity =0.8.25;

/// @dev Hash of the known bytecode.
bytes32 constant BYTECODE_HASH = bytes32(0xf600fb5624e0091521818a502a7278ee518b7fb7c350b53b9f3b77aaf46bdb0b);
bytes32 constant BYTECODE_HASH = bytes32(0xf09dd191531ee0069e04762263165ea01d561d261cb3b1cadf92004524818224);

/// @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"077507a707cb09570a200a320a440a5d0a810ab50ac60ad70b790b980c560d060d8a0ecc0fff0c5610f811aa124c12c412d512e612e612f71384139d13b113ca13f5140e1421148314d1151f1550159e15ec163a1721";
hex"077e07b007d409600a290a3b0a4d0a660a8a0abe0acf0ae00b820ba10c5f0d0f0d930ed510080c5f110111b3125512cd12de12ef12ef1300138d13a613ba13d313fe1417142a148c14da1528157615a715f5164316911778";
6 changes: 3 additions & 3 deletions src/generated/RainterpreterExpressionDeployer.pointers.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
pragma solidity =0.8.25;

/// @dev Hash of the known bytecode.
bytes32 constant BYTECODE_HASH = bytes32(0x04e7730820de63ed51e17b1f09e390559332982ffd0f2782db71f340592774ac);
bytes32 constant BYTECODE_HASH = bytes32(0xce632fd9c0b6f1bc6ec0187dc34a82890cda5054c0f2faa9a2ad631668aa0553);

/// @dev The hash of the meta that describes the contract.
bytes32 constant DESCRIBED_BY_META_HASH = bytes32(0xfc12f7a5af034243bd61d42d021d000dc40c7c1c8a059b9973ec70cbff9f5fe3);
bytes32 constant DESCRIBED_BY_META_HASH = bytes32(0x9913ced3ebacf8ef3d859004e3e324fa78cd0a6651a00395a8ab23f8652eeef3);

/// @dev The function pointers for the integrity check fns.
bytes constant INTEGRITY_FUNCTION_POINTERS =
hex"0e100e8e0ef2106c107610761080108910a4114a114a11a6121e122b10761080122b107610801076107610761080106c106c106c106c123510761076107610801076106c123f1267123f106c123f1267126710801235";
hex"0e180e960efa1074107e107e1088109110ac1152115211ae12261233107e10881233107e1088107e107e107e10881074107410741074123d107e107e107e1088107e107412471247126f124710741247126f126f1088123d";
8 changes: 4 additions & 4 deletions src/generated/RainterpreterParser.pointers.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
pragma solidity =0.8.25;

/// @dev Hash of the known bytecode.
bytes32 constant BYTECODE_HASH = bytes32(0x74d90562fe80acca7dc3ccd293ed98a0a51ec14dc39ea9c0a5d01ec43d4b3423);
bytes32 constant BYTECODE_HASH = bytes32(0x2900f79bc97792788345da165dc96c373effb756617809d2dc9c179487a4b70c);

/// @dev The parse meta that is used to lookup word definitions.
/// The structure of the parse meta is:
Expand All @@ -29,7 +29,7 @@ bytes32 constant BYTECODE_HASH = bytes32(0x74d90562fe80acca7dc3ccd293ed98a0a51ec
/// 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"0178a8806000299010000908a00a30484001280030060000180000000cc2200408a00c95d8382948145c2a34b3f325d587e204afc8f01d95a26007b9a51f0d5e6f2803ce312215fae0a1118cfd53051c784d1681ac9620ac6dfc26a4e5e91e5fc32a0e92b2401cbbd837100ef76b00cd8814229714ec133135921ff880501427634f0f23b4970ac0e53d0b895f991ac908be0983724f12c080bc279d7b7d235c0ab5086d2a7b19bcb24402af7d4506414b8117b04fb31bb2182f18ef532921c301e328fa5d8001336a5924ab2461";
hex"0178a8806000299010800908a00a30484001280030060000180000000cc2200408a00c95d8382a48145c2b34b3f326d587e204afc8f01d95a26007b9a51f0d5e6f2803ce312215fae0a1118cfd53051c784d1681ac9620ac6dfc27a4e5e91e5fc32a0e92b2401cbbd837100ef76b00cd8814239714ec133135921ff880501427634f0f23b4970ac0e53d0b895f991ac908be0983724f12c080bc289d7b7d226f62e0245c0ab5086d2a7b19bcb24402af7d4506414b8117b04fb31bb2182f18ef532921c301e329fa5d8001336a5925ab2461";

/// @dev The build depth of the parser meta.

Expand All @@ -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"19f319f319f31ac81bdf1bdf1bdf1ac81ac819f319f319f31bdf1bdf1bdf1bdf1bdf1bdf1bdf1bdf1bdf1bdf1bdf1bdf1bdf1bdf1bdf1bdf1bdf1bdf1bdf1bdf1bdf1bdf1bdf1bdf1bdf1bdf1bdf1bdf19f31bdf1bdf";
hex"19fb19fb19fb1ad01be71be71be71ad01ad019fb19fb19fb1be71be71be71be71be71be71be71be71be71be71be71be71be71be71be71be71be71be71be71be71be71be71be71be71be71be71be71be71be719fb1be71be7";

/// @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"153b176d17b0184e";
bytes constant LITERAL_PARSER_FUNCTION_POINTERS = hex"1543177517b81856";
18 changes: 9 additions & 9 deletions src/lib/op/LibAllStandardOps.sol
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,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 = 43;
uint256 constant ALL_STANDARD_OPS_LENGTH = 44;

/// @title LibAllStandardOps
/// @notice Every opcode available from the core repository laid out as a single
Expand Down Expand Up @@ -242,10 +242,10 @@ library LibAllStandardOps {
// "Calculates a linear growth curve as `base + (rate * t)` where `base` is the initial value, `rate` is the rate of growth and `t` is units of time. Inputs in order are `base`, `rate`, and `t` respectively."
// ),
AuthoringMetaV2("uint256-max-value", "The maximum possible unsigned integer value (all binary bits are 1)."),
// AuthoringMetaV2(
// "uint256-div",
// "Divides the first input by all other inputs as uint256 values. Errors if any divisor is zero. Rounds down."
// ),
AuthoringMetaV2(
"uint256-div",
"Divides the first input by all other inputs as uint256 values. Errors if any divisor is zero. Rounds down."
),
// AuthoringMetaV2(
// "uint256-mul",
// "Multiplies all inputs together as uint256 values. Errors if the multiplication exceeds `max-value()`."
Expand Down Expand Up @@ -451,8 +451,8 @@ library LibAllStandardOps {
// LibParseOperand.handleOperandDisallowed,
// uint256-max-value
LibParseOperand.handleOperandDisallowed,
// // uint256-div
// LibParseOperand.handleOperandDisallowed,
// uint256-div
LibParseOperand.handleOperandDisallowed,
// // uint256-mul
// LibParseOperand.handleOperandDisallowed,
// // uint256-power
Expand Down Expand Up @@ -594,7 +594,7 @@ library LibAllStandardOps {
// LibOpExponentialGrowth.integrity,
// LibOpLinearGrowth.integrity,
LibOpMaxUint256.integrity,
// LibOpUint256Div.integrity,
LibOpUint256Div.integrity,
// LibOpUint256Mul.integrity,
// LibOpUint256Pow.integrity,
LibOpAdd.integrity,
Expand Down Expand Up @@ -707,7 +707,7 @@ library LibAllStandardOps {
// LibOpExponentialGrowth.run,
// LibOpLinearGrowth.run,
LibOpMaxUint256.run,
// LibOpUint256Div.run,
LibOpUint256Div.run,
// LibOpUint256Mul.run,
// LibOpUint256Pow.run,
LibOpAdd.run,
Expand Down
13 changes: 7 additions & 6 deletions src/lib/op/math/uint256/LibOpUint256Div.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {OperandV2} from "rain.interpreter.interface/interface/unstable/IInterpre
import {Pointer} from "rain.solmem/lib/LibPointer.sol";
import {IntegrityCheckState} from "../../../integrity/LibIntegrityCheck.sol";
import {InterpreterState} from "../../../state/LibInterpreterState.sol";
import {StackItem} from "rain.interpreter.interface/interface/unstable/IInterpreterV4.sol";

/// @title LibOpUint256Div
/// @notice Opcode to divide N integers. Errors on divide by zero. Truncates
Expand Down Expand Up @@ -52,20 +53,20 @@ library LibOpUint256Div {
}

/// Gas intensive reference implementation of division 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 /= inputs[i];
acc /= uint256(StackItem.unwrap(inputs[i]));
}
outputs = new uint256[](1);
outputs[0] = acc;
outputs = new StackItem[](1);
outputs[0] = StackItem.wrap(bytes32(acc));
}
}
}
Loading
Loading