Skip to content

update flake #311

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: 3.x
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions .github/workflows/manual-sol-artifacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ on:
- sepolia
- songbird
- linea
- bera
- sonic

jobs:
deploy:
Expand Down
67 changes: 33 additions & 34 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ libs = ['lib']
# See more config options https://github.com/foundry-rs/foundry/tree/master/config

solc = "0.8.25"
evm_version = "paris"

# Try to make sure the optimizer doesn't touch the output in a way that can break
# source maps for debugging.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
pragma solidity =0.8.25;

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

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

/// @dev The function pointers for the integrity check fns.
bytes constant INTEGRITY_FUNCTION_POINTERS =
Expand Down
3 changes: 1 addition & 2 deletions src/lib/op/bitwise/LibOpShiftBitsLeftNP.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ library LibOpShiftBitsLeftNP {

if (
// Shift amount must not result in the output always being 0.
shiftAmount > uint256(type(uint8).max)
// Shift amount must not result in a noop.
|| shiftAmount == 0
shiftAmount > uint256(type(uint8).max) || shiftAmount == 0
) {
revert UnsupportedBitwiseShiftAmount(shiftAmount);
}
Expand Down
3 changes: 1 addition & 2 deletions src/lib/op/bitwise/LibOpShiftBitsRightNP.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ library LibOpShiftBitsRightNP {

if (
// Shift amount must not result in the output always being 0.
shiftAmount > type(uint8).max
// Shift amount must not result in a noop.
|| shiftAmount == 0
shiftAmount > type(uint8).max || shiftAmount == 0
) {
revert UnsupportedBitwiseShiftAmount(shiftAmount);
}
Expand Down
27 changes: 26 additions & 1 deletion test/abstract/OpTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,38 @@ abstract contract OpTest is RainterpreterExpressionDeployerNPE2DeploymentTest {
}

function opReferenceCheck(
InterpreterStateNP memory state,
Operand operand,
function(InterpreterStateNP memory, Operand, uint256[] memory) view returns (uint256[] memory) referenceFn,
function(IntegrityCheckStateNP memory, Operand) view returns (uint256, uint256) integrityFn,
function(InterpreterStateNP memory, Operand, Pointer) view returns (Pointer) runFn,
uint256[] memory inputs
) internal view {
uint256 referenceFnPtr;
uint256 integrityFnPtr;
uint256 runFnPtr;
assembly ("memory-safe") {
referenceFnPtr := referenceFn
integrityFnPtr := integrityFn
runFnPtr := runFn
}
this.opReferenceCheckExternal(
operand,
referenceFnPtr,
integrityFnPtr,
runFnPtr,
inputs
);
}

function opReferenceCheckExternal(
Operand operand,
uint256 referenceFn,
uint256 integrityFn,
uint256 runFn,
uint256[] memory inputs
) external view {
InterpreterStateNP memory state = opTestDefaultInterpreterState();

uint256 calcOutputs = opReferenceCheckIntegrity(integrityFn, operand, state.constants, inputs);
ReferenceCheckPointers memory pointers = opReferenceCheckPointers(inputs, calcOutputs);

Expand Down
2 changes: 0 additions & 2 deletions test/src/lib/op/00/LibOpConstantNP.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,13 @@ contract LibOpConstantNPTest is OpTest {
/// Directly test the runtime logic of LibOpConstantNP. This tests that the
/// operand always puts a single value on the stack.
function testOpConstantNPRun(uint256[] memory constants, uint16 constantIndex) external view {
InterpreterStateNP memory state = opTestDefaultInterpreterState();
state.constants = constants;
vm.assume(state.constants.length > 0);
vm.assume(state.constants.length <= type(uint16).max);
constantIndex = uint16(bound(constantIndex, 0, uint16(state.constants.length - 1)));

uint256[] memory inputs = new uint256[](0);
opReferenceCheck(
state,
LibOperand.build(0, 1, constantIndex),
LibOpConstantNP.referenceFn,
LibOpConstantNP.integrity,
Expand Down
6 changes: 3 additions & 3 deletions test/src/lib/op/00/LibOpContextNP.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ contract LibOpContextNPTest is OpTest {
j = bound(j, 0, state.context[i].length - 1);
Operand operand = LibOperand.build(0, 1, uint16(uint256(i) | uint256(j) << 8));
uint256[] memory inputs = new uint256[](0);
opReferenceCheck(
this.opReferenceCheck(
state, operand, LibOpContextNP.referenceFn, LibOpContextNP.integrity, LibOpContextNP.run, inputs
);
}
Expand All @@ -62,7 +62,7 @@ contract LibOpContextNPTest is OpTest {
Operand operand = LibOperand.build(0, 1, uint16(uint256(i) | uint256(j) << 8));
uint256[] memory inputs = new uint256[](0);
vm.expectRevert(stdError.indexOOBError);
opReferenceCheck(
this.opReferenceCheck(
state, operand, LibOpContextNP.referenceFn, LibOpContextNP.integrity, LibOpContextNP.run, inputs
);
}
Expand All @@ -80,7 +80,7 @@ contract LibOpContextNPTest is OpTest {
Operand operand = LibOperand.build(0, 1, uint16(uint256(i) | uint256(j) << 8));
uint256[] memory inputs = new uint256[](0);
vm.expectRevert(stdError.indexOOBError);
opReferenceCheck(
this.opReferenceCheck(
state, operand, LibOpContextNP.referenceFn, LibOpContextNP.integrity, LibOpContextNP.run, inputs
);
}
Expand Down
2 changes: 1 addition & 1 deletion test/src/lib/op/00/LibOpExternNP.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ contract LibOpExternNPTest is OpTest {
address(extern), abi.encodeWithSelector(IInterpreterExternV3.extern.selector, externDispatch, inputs), 2
);

opReferenceCheck(state, operand, LibOpExternNP.referenceFn, LibOpExternNP.integrity, LibOpExternNP.run, inputs);
this.opReferenceCheck(state, operand, LibOpExternNP.referenceFn, LibOpExternNP.integrity, LibOpExternNP.run, inputs);
}

/// Test the eval of extern parsed from a string.
Expand Down
2 changes: 1 addition & 1 deletion test/src/lib/op/bitwise/LibOpBitwiseAndNP.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ contract LibOpBitwiseAndNPTest is OpTest {
inputs[0] = x;
inputs[1] = y;
Operand operand = LibOperand.build(2, 1, 0);
opReferenceCheck(
this.opReferenceCheck(
state, operand, LibOpBitwiseAndNP.referenceFn, LibOpBitwiseAndNP.integrity, LibOpBitwiseAndNP.run, inputs
);
}
Expand Down
2 changes: 1 addition & 1 deletion test/src/lib/op/bitwise/LibOpBitwiseOrNP.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ contract LibOpBitwiseOrNPTest is OpTest {
inputs[0] = x;
inputs[1] = y;
Operand operand = LibOperand.build(2, 1, 0);
opReferenceCheck(
this.opReferenceCheck(
state, operand, LibOpBitwiseOrNP.referenceFn, LibOpBitwiseOrNP.integrity, LibOpBitwiseOrNP.run, inputs
);
}
Expand Down
2 changes: 1 addition & 1 deletion test/src/lib/op/bitwise/LibOpCtPopNP.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ contract LibOpCtPopNPTest is OpTest {
uint256[] memory inputs = new uint256[](1);
inputs[0] = x;
Operand operand = LibOperand.build(1, 1, 0);
opReferenceCheck(state, operand, LibOpCtPopNP.referenceFn, LibOpCtPopNP.integrity, LibOpCtPopNP.run, inputs);
this.opReferenceCheck(state, operand, LibOpCtPopNP.referenceFn, LibOpCtPopNP.integrity, LibOpCtPopNP.run, inputs);
}

/// Test the eval of a ct pop opcode parsed from a string.
Expand Down
2 changes: 1 addition & 1 deletion test/src/lib/op/bitwise/LibOpDecodeBitsNP.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ contract LibOpDecodeBitsNPTest is OpTest {
uint256[] memory inputs = new uint256[](1);
inputs[0] = value;
InterpreterStateNP memory state = opTestDefaultInterpreterState();
opReferenceCheck(
this.opReferenceCheck(
state, operand, LibOpDecodeBitsNP.referenceFn, LibOpDecodeBitsNP.integrity, LibOpDecodeBitsNP.run, inputs
);
}
Expand Down
2 changes: 1 addition & 1 deletion test/src/lib/op/bitwise/LibOpEncodeBitsNP.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ contract LibOpEncodeBitsNPTest is OpTest {
inputs[0] = source;
inputs[1] = target;
InterpreterStateNP memory state = opTestDefaultInterpreterState();
opReferenceCheck(
this.opReferenceCheck(
state, operand, LibOpEncodeBitsNP.referenceFn, LibOpEncodeBitsNP.integrity, LibOpEncodeBitsNP.run, inputs
);
}
Expand Down
2 changes: 1 addition & 1 deletion test/src/lib/op/bitwise/LibOpShiftBitsLeftNP.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ contract LibOpShiftBitsLeftNPTest is OpTest {
uint256[] memory inputs = new uint256[](1);
inputs[0] = x;
Operand operand = LibOperand.build(1, 1, shiftAmount);
opReferenceCheck(
this.opReferenceCheck(
state,
operand,
LibOpShiftBitsLeftNP.referenceFn,
Expand Down
2 changes: 1 addition & 1 deletion test/src/lib/op/bitwise/LibOpShiftBitsRightNP.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ contract LibOpShiftBitsRightNPTest is OpTest {
uint256[] memory inputs = new uint256[](1);
inputs[0] = x;
Operand operand = LibOperand.build(uint8(inputs.length), 1, shiftAmount);
opReferenceCheck(
this.opReferenceCheck(
state,
operand,
LibOpShiftBitsRightNP.referenceFn,
Expand Down
2 changes: 1 addition & 1 deletion test/src/lib/op/crypto/LibOpHashNP.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ contract LibOpHashNPTest is OpTest {
vm.assume(inputs.length <= 0x0F);
InterpreterStateNP memory state = opTestDefaultInterpreterState();
Operand operand = LibOperand.build(uint8(inputs.length), 1, 0);
opReferenceCheck(state, operand, LibOpHashNP.referenceFn, LibOpHashNP.integrity, LibOpHashNP.run, inputs);
this.opReferenceCheck(state, operand, LibOpHashNP.referenceFn, LibOpHashNP.integrity, LibOpHashNP.run, inputs);
}

/// Test the eval of a hash opcode parsed from a string. Tests 0 inputs.
Expand Down
2 changes: 1 addition & 1 deletion test/src/lib/op/erc20/LibOpERC20Allowance.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ contract LibOpERC20AllowanceTest is OpTest {

vm.mockCall(token, abi.encodeWithSelector(IERC20Metadata.decimals.selector), abi.encode(decimals));

opReferenceCheck(
this.opReferenceCheck(
opTestDefaultInterpreterState(),
operand,
LibOpERC20Allowance.referenceFn,
Expand Down
Loading
Loading