Commit 842af2ea authored by mergify[bot]'s avatar mergify[bot] Committed by GitHub

Merge branch 'develop' into e2e-test-withdrawal-time-bug

parents fb07bf0c be461bd0
...@@ -382,10 +382,10 @@ jobs: ...@@ -382,10 +382,10 @@ jobs:
pnpm lint:check || echo "export LINT_STATUS=1" >> "$BASH_ENV" pnpm lint:check || echo "export LINT_STATUS=1" >> "$BASH_ENV"
working_directory: packages/contracts-bedrock working_directory: packages/contracts-bedrock
- run: - run:
name: gas lock name: gas snapshot
command: | command: |
forge --version forge --version
pnpm gas-lock --check || echo "export GAS_LOCK_STATUS=1" >> "$BASH_ENV" pnpm gas-snapshot --check || echo "export GAS_SNAPSHOT_STATUS=1" >> "$BASH_ENV"
environment: environment:
FOUNDRY_PROFILE: ci FOUNDRY_PROFILE: ci
working_directory: packages/contracts-bedrock working_directory: packages/contracts-bedrock
...@@ -398,10 +398,10 @@ jobs: ...@@ -398,10 +398,10 @@ jobs:
FOUNDRY_PROFILE: ci FOUNDRY_PROFILE: ci
working_directory: packages/contracts-bedrock working_directory: packages/contracts-bedrock
- run: - run:
name: storage lock name: storage snapshot
command: | command: |
pnpm storage-lock pnpm storage-snapshot
git diff --exit-code locks/storage-lock || echo "export STORAGE_LOCK_STATUS=1" >> "$BASH_ENV" git diff --exit-code .storage-layout || echo "export STORAGE_SNAPSHOT_STATUS=1" >> "$BASH_ENV"
working_directory: packages/contracts-bedrock working_directory: packages/contracts-bedrock
- run: - run:
name: semver lock name: semver lock
...@@ -422,16 +422,16 @@ jobs: ...@@ -422,16 +422,16 @@ jobs:
FAILED=1 FAILED=1
echo "Linting failed, see job output for details." echo "Linting failed, see job output for details."
fi fi
if [[ "$GAS_LOCK_STATUS" -ne 0 ]]; then if [[ "$GAS_SNAPSHOT_STATUS" -ne 0 ]]; then
FAILED=1 FAILED=1
echo "Gas lock failed, see job output for details." echo "Gas snapshot failed, see job output for details."
fi fi
if [[ "$DEPLOY_CONFIG_STATUS" -ne 0 ]]; then if [[ "$DEPLOY_CONFIG_STATUS" -ne 0 ]]; then
FAILED=1 FAILED=1
echo "Deploy configs invalid, see job output for details." echo "Deploy configs invalid, see job output for details."
fi fi
if [[ "$STORAGE_LOCK_STATUS" -ne 0 ]]; then if [[ "$STORAGE_SNAPSHOT_STATUS" -ne 0 ]]; then
echo "Storage lock failed, see job output for details." echo "Storage snapshot failed, see job output for details."
FAILED=1 FAILED=1
fi fi
if [[ "$INVARIANT_DOCS_STATUS" -ne 0 ]]; then if [[ "$INVARIANT_DOCS_STATUS" -ne 0 ]]; then
...@@ -524,7 +524,7 @@ jobs: ...@@ -524,7 +524,7 @@ jobs:
op-bindings-build: op-bindings-build:
docker: docker:
- image: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:latest - image: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:latest
resource_class: medium resource_class: large
steps: steps:
- checkout - checkout
- run: - run:
...@@ -885,6 +885,7 @@ jobs: ...@@ -885,6 +885,7 @@ jobs:
docker: docker:
- image: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:latest - image: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:latest
- image: cimg/postgres:14.1 - image: cimg/postgres:14.1
resource_class: large
steps: steps:
- checkout - checkout
- check-changed: - check-changed:
...@@ -911,7 +912,7 @@ jobs: ...@@ -911,7 +912,7 @@ jobs:
name: Test name: Test
command: | command: |
mkdir -p /test-results mkdir -p /test-results
DB_USER=postgres gotestsum --junitfile /test-results/tests.xml DB_USER=postgres gotestsum --junitfile /test-results/tests.xml -- -parallel=4 ./...
working_directory: indexer working_directory: indexer
- run: - run:
name: Build name: Build
......
...@@ -112,9 +112,17 @@ func NewEVMEnv(contracts *Contracts, addrs *Addresses) (*vm.EVM, *state.StateDB) ...@@ -112,9 +112,17 @@ func NewEVMEnv(contracts *Contracts, addrs *Addresses) (*vm.EVM, *state.StateDB)
env := vm.NewEVM(blockContext, vm.TxContext{}, state, chainCfg, vmCfg) env := vm.NewEVM(blockContext, vm.TxContext{}, state, chainCfg, vmCfg)
// pre-deploy the contracts // pre-deploy the contracts
env.StateDB.SetCode(addrs.MIPS, contracts.MIPS.DeployedBytecode.Object)
env.StateDB.SetCode(addrs.Oracle, contracts.Oracle.DeployedBytecode.Object) env.StateDB.SetCode(addrs.Oracle, contracts.Oracle.DeployedBytecode.Object)
env.StateDB.SetState(addrs.MIPS, common.Hash{}, addrs.Oracle.Hash())
var mipsCtorArgs [32]byte
copy(mipsCtorArgs[12:], addrs.Oracle[:])
mipsDeploy := append(hexutil.MustDecode(bindings.MIPSMetaData.Bin), mipsCtorArgs[:]...)
startingGas := uint64(30_000_000)
_, deployedMipsAddr, leftOverGas, err := env.Create(vm.AccountRef(addrs.Sender), mipsDeploy, startingGas, big.NewInt(0))
if err != nil {
panic(fmt.Errorf("failed to deploy MIPS contract: %w. took %d gas", err, startingGas-leftOverGas))
}
addrs.MIPS = deployedMipsAddr
rules := env.ChainConfig().Rules(header.Number, true, header.Time) rules := env.ChainConfig().Rules(header.Number, true, header.Time)
env.StateDB.Prepare(rules, addrs.Sender, addrs.FeeRecipient, &addrs.MIPS, vm.ActivePrecompiles(rules), nil) env.StateDB.Prepare(rules, addrs.Sender, addrs.FeeRecipient, &addrs.MIPS, vm.ActivePrecompiles(rules), nil)
......
...@@ -226,6 +226,8 @@ func (s *channelManager) processBlocks() error { ...@@ -226,6 +226,8 @@ func (s *channelManager) processBlocks() error {
} else if err != nil { } else if err != nil {
return fmt.Errorf("adding block[%d] to channel builder: %w", i, err) return fmt.Errorf("adding block[%d] to channel builder: %w", i, err)
} }
s.log.Debug("Added block to channel", "channel", s.currentChannel.ID(), "block", block)
blocksAdded += 1 blocksAdded += 1
latestL2ref = l2BlockRefFromBlockAndL1Info(block, l1info) latestL2ref = l2BlockRefFromBlockAndL1Info(block, l1info)
s.metr.RecordL2BlockInChannel(block) s.metr.RecordL2BlockInChannel(block)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -347,7 +347,7 @@ MIPS_Test:test_multu_succeeds() (gas: 121698) ...@@ -347,7 +347,7 @@ MIPS_Test:test_multu_succeeds() (gas: 121698)
MIPS_Test:test_nor_succeeds() (gas: 121739) MIPS_Test:test_nor_succeeds() (gas: 121739)
MIPS_Test:test_or_succeeds() (gas: 121635) MIPS_Test:test_or_succeeds() (gas: 121635)
MIPS_Test:test_ori_succeeds() (gas: 121865) MIPS_Test:test_ori_succeeds() (gas: 121865)
MIPS_Test:test_preimage_read_succeeds() (gas: 235922) MIPS_Test:test_preimage_read_succeeds() (gas: 233825)
MIPS_Test:test_preimage_write_succeeds() (gas: 126473) MIPS_Test:test_preimage_write_succeeds() (gas: 126473)
MIPS_Test:test_prestate_exited_succeeds() (gas: 112970) MIPS_Test:test_prestate_exited_succeeds() (gas: 112970)
MIPS_Test:test_sb_succeeds() (gas: 159993) MIPS_Test:test_sb_succeeds() (gas: 159993)
......
======================= =======================
👁👁 STORAGE LAYOUT LOCK 👁👁 👁👁 STORAGE LAYOUT snapshot 👁👁
======================= =======================
======================= =======================
......
...@@ -37,5 +37,6 @@ ...@@ -37,5 +37,6 @@
"l2GenesisBlockBaseFeePerGas": "0x3b9aca00", "l2GenesisBlockBaseFeePerGas": "0x3b9aca00",
"eip1559Denominator": 50, "eip1559Denominator": 50,
"eip1559Elasticity": 6, "eip1559Elasticity": 6,
"l2GenesisRegolithTimeOffset": "0x0" "l2GenesisRegolithTimeOffset": "0x0",
"systemConfigStartBlock": 0
} }
...@@ -20,14 +20,14 @@ ...@@ -20,14 +20,14 @@
"test": "pnpm build:differential && pnpm build:fuzz && forge test", "test": "pnpm build:differential && pnpm build:fuzz && forge test",
"coverage": "pnpm build:differential && pnpm build:fuzz && forge coverage", "coverage": "pnpm build:differential && pnpm build:fuzz && forge coverage",
"coverage:lcov": "pnpm build:differential && pnpm build:fuzz && forge coverage --report lcov", "coverage:lcov": "pnpm build:differential && pnpm build:fuzz && forge coverage --report lcov",
"gas-lock": "pnpm build:differential && pnpm build:fuzz && forge snapshot --snap locks/gas-lock --no-match-test 'testDiff|testFuzz|invariant|generateArtifact'", "gas-snapshot": "pnpm build:differential && pnpm build:fuzz && forge snapshot --no-match-test 'testDiff|testFuzz|invariant|generateArtifact'",
"storage-lock": "./scripts/storage-lock.sh", "storage-snapshot": "./scripts/storage-snapshot.sh",
"semver-lock": "forge script scripts/SemverLock.s.sol", "semver-lock": "forge script scripts/SemverLock.s.sol",
"validate-deploy-configs": "./scripts/validate-deploy-configs.sh", "validate-deploy-configs": "./scripts/validate-deploy-configs.sh",
"validate-spacers": "pnpm build && npx ts-node scripts/validate-spacers.ts", "validate-spacers": "pnpm build && npx ts-node scripts/validate-spacers.ts",
"slither": "./scripts/slither.sh", "slither": "./scripts/slither.sh",
"slither:triage": "TRIAGE_MODE=1 ./scripts/slither.sh", "slither:triage": "TRIAGE_MODE=1 ./scripts/slither.sh",
"clean": "rm -rf ./artifacts ./forge-artifacts ./cache ./tsconfig.tsbuildinfo ./tsconfig.build.tsbuildinfo ./test-case-generator/fuzz ./scripts/differential-testing", "clean": "rm -rf ./artifacts ./forge-artifacts ./cache ./tsconfig.tsbuildinfo ./tsconfig.build.tsbuildinfo ./test-case-generator/fuzz ./scripts/differential-testing/differential-testing",
"preinstall": "npx only-allow pnpm", "preinstall": "npx only-allow pnpm",
"lint:ts:check": "eslint . --max-warnings=0", "lint:ts:check": "eslint . --max-warnings=0",
"lint:forge-tests:check": "ts-node scripts/forge-test-names.ts", "lint:forge-tests:check": "ts-node scripts/forge-test-names.ts",
......
...@@ -395,7 +395,6 @@ contract Deploy is Deployer { ...@@ -395,7 +395,6 @@ contract Deploy is Deployer {
/// @notice Deploy the SystemConfig /// @notice Deploy the SystemConfig
function deploySystemConfig() public broadcast returns (address addr_) { function deploySystemConfig() public broadcast returns (address addr_) {
SystemConfig config = new SystemConfig(); SystemConfig config = new SystemConfig();
bytes32 batcherHash = bytes32(uint256(uint160(cfg.batchSenderAddress())));
require(config.owner() == address(0xdEaD)); require(config.owner() == address(0xdEaD));
require(config.overhead() == 0); require(config.overhead() == 0);
...@@ -418,7 +417,7 @@ contract Deploy is Deployer { ...@@ -418,7 +417,7 @@ contract Deploy is Deployer {
require(config.optimismPortal() == address(0)); require(config.optimismPortal() == address(0));
require(config.l1CrossDomainMessenger() == address(0)); require(config.l1CrossDomainMessenger() == address(0));
require(config.optimismMintableERC20Factory() == address(0)); require(config.optimismMintableERC20Factory() == address(0));
require(config.startBlock() == 0); require(config.startBlock() == type(uint256).max);
save("SystemConfig", address(config)); save("SystemConfig", address(config));
console.log("SystemConfig deployed at %s", address(config)); console.log("SystemConfig deployed at %s", address(config));
...@@ -490,6 +489,7 @@ contract Deploy is Deployer { ...@@ -490,6 +489,7 @@ contract Deploy is Deployer {
address systemConfig = mustGetAddress("SystemConfig"); address systemConfig = mustGetAddress("SystemConfig");
bytes32 batcherHash = bytes32(uint256(uint160(cfg.batchSenderAddress()))); bytes32 batcherHash = bytes32(uint256(uint160(cfg.batchSenderAddress())));
uint256 startBlock = cfg.systemConfigStartBlock();
proxyAdmin.upgradeAndCall({ proxyAdmin.upgradeAndCall({
_proxy: payable(systemConfigProxy), _proxy: payable(systemConfigProxy),
...@@ -504,7 +504,7 @@ contract Deploy is Deployer { ...@@ -504,7 +504,7 @@ contract Deploy is Deployer {
uint64(cfg.l2GenesisBlockGasLimit()), uint64(cfg.l2GenesisBlockGasLimit()),
cfg.p2pSequencerAddress(), cfg.p2pSequencerAddress(),
Constants.DEFAULT_RESOURCE_CONFIG(), Constants.DEFAULT_RESOURCE_CONFIG(),
cfg.systemConfigStartBlock(), startBlock,
cfg.batchInboxAddress(), cfg.batchInboxAddress(),
SystemConfig.Addresses({ SystemConfig.Addresses({
l1CrossDomainMessenger: mustGetAddress("L1CrossDomainMessengerProxy"), l1CrossDomainMessenger: mustGetAddress("L1CrossDomainMessengerProxy"),
...@@ -542,7 +542,13 @@ contract Deploy is Deployer { ...@@ -542,7 +542,13 @@ contract Deploy is Deployer {
require(config.l2OutputOracle() == mustGetAddress("L2OutputOracleProxy")); require(config.l2OutputOracle() == mustGetAddress("L2OutputOracleProxy"));
require(config.optimismPortal() == mustGetAddress("OptimismPortalProxy")); require(config.optimismPortal() == mustGetAddress("OptimismPortalProxy"));
require(config.l1CrossDomainMessenger() == mustGetAddress("L1CrossDomainMessengerProxy")); require(config.l1CrossDomainMessenger() == mustGetAddress("L1CrossDomainMessengerProxy"));
require(config.startBlock() == cfg.systemConfigStartBlock());
// A non zero start block is an override
if (startBlock != 0) {
require(config.startBlock() == startBlock);
} else {
require(config.startBlock() == block.number);
}
} }
/// @notice Initialize the L1StandardBridge /// @notice Initialize the L1StandardBridge
......
...@@ -38,15 +38,15 @@ dir=$(dirname "$0") ...@@ -38,15 +38,15 @@ dir=$(dirname "$0")
echo "Creating storage layout diagrams.." echo "Creating storage layout diagrams.."
echo "=======================" > $dir/../locks/storage-lock echo "=======================" > $dir/../.storage-layout
echo "👁👁 STORAGE LAYOUT LOCK 👁👁" >> $dir/../locks/storage-lock echo "👁👁 STORAGE LAYOUT snapshot 👁👁" >> $dir/../.storage-layout
echo "=======================" >> $dir/../locks/storage-lock echo "=======================" >> $dir/../.storage-layout
for contract in ${contracts[@]} for contract in ${contracts[@]}
do do
echo -e "\n=======================" >> $dir/../locks/storage-lock echo -e "\n=======================" >> $dir/../.storage-layout
echo "➡ $contract">> $dir/../locks/storage-lock echo "➡ $contract">> $dir/../.storage-layout
echo -e "=======================\n" >> $dir/../locks/storage-lock echo -e "=======================\n" >> $dir/../.storage-layout
forge inspect --pretty $contract storageLayout >> $dir/../locks/storage-lock forge inspect --pretty $contract storage-layout >> $dir/../.storage-layout
done done
echo "Storage layout lock stored at $dir/../locks/storage-lock" echo "Storage layout snapshot stored at $dir/../.storage-layout"
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"src/L1/L1StandardBridge.sol": "0xbd7b303cefe46bc14bf1a2b81e5702ff45ce9c5257524e59778e11c75f7f5bdc", "src/L1/L1StandardBridge.sol": "0xbd7b303cefe46bc14bf1a2b81e5702ff45ce9c5257524e59778e11c75f7f5bdc",
"src/L1/L2OutputOracle.sol": "0x05ea17a834563ffa50cade81189b120b6f0805ba316d6a9893c8cf8b231e57e3", "src/L1/L2OutputOracle.sol": "0x05ea17a834563ffa50cade81189b120b6f0805ba316d6a9893c8cf8b231e57e3",
"src/L1/OptimismPortal.sol": "0xeefcc16d30e14ed7ce9970f3aeaf1d5668324b3fc1ddb4790da5804cfdd78980", "src/L1/OptimismPortal.sol": "0xeefcc16d30e14ed7ce9970f3aeaf1d5668324b3fc1ddb4790da5804cfdd78980",
"src/L1/SystemConfig.sol": "0x932c896b1bc2a32227bfe30aa66e1e6d17f057cc9a2562876bf7730858041895", "src/L1/SystemConfig.sol": "0x29beec0a03b9602a53e3ceaec2354972d917f8b80f1b3a8f03f4fb7a67753fce",
"src/L2/BaseFeeVault.sol": "0xd8df28898799b80c370e77e9aad09f79235dfda2bf13e56daf21997cfe54200d", "src/L2/BaseFeeVault.sol": "0xd8df28898799b80c370e77e9aad09f79235dfda2bf13e56daf21997cfe54200d",
"src/L2/GasPriceOracle.sol": "0xb7d8c4f3ea8db31900125e341aae42a862a2b7d3f1c1aa60c97dc2d0e022b7ba", "src/L2/GasPriceOracle.sol": "0xb7d8c4f3ea8db31900125e341aae42a862a2b7d3f1c1aa60c97dc2d0e022b7ba",
"src/L2/L1Block.sol": "0x38ea78a9611656a60ae4d58db75e96413a638e3ccb2e935052441f98a1fd3105", "src/L2/L1Block.sol": "0x38ea78a9611656a60ae4d58db75e96413a638e3ccb2e935052441f98a1fd3105",
......
...@@ -4,7 +4,6 @@ pragma solidity 0.8.19; ...@@ -4,7 +4,6 @@ pragma solidity 0.8.19;
import { EIP712 } from "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol"; import { EIP712 } from "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
import { ECDSA } from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import { ECDSA } from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
// prettier-ignore
import { import {
AttestationRequest, AttestationRequest,
AttestationRequestData, AttestationRequestData,
......
...@@ -98,11 +98,11 @@ contract SystemConfig is OwnableUpgradeable, Semver { ...@@ -98,11 +98,11 @@ contract SystemConfig is OwnableUpgradeable, Semver {
/// @notice The block at which the op-node can start searching for logs from. /// @notice The block at which the op-node can start searching for logs from.
uint256 public startBlock; uint256 public startBlock;
/// @custom:semver 1.4.1 /// @custom:semver 1.5.0
/// @notice Constructs the SystemConfig contract. Cannot set /// @notice Constructs the SystemConfig contract. Cannot set
/// the owner to `address(0)` due to the Ownable contract's /// the owner to `address(0)` due to the Ownable contract's
/// implementation, so set it to `address(0xdEaD)` /// implementation, so set it to `address(0xdEaD)`
constructor() Semver(1, 4, 1) { constructor() Semver(1, 5, 0) {
initialize({ initialize({
_owner: address(0xdEaD), _owner: address(0xdEaD),
_overhead: 0, _overhead: 0,
...@@ -118,7 +118,7 @@ contract SystemConfig is OwnableUpgradeable, Semver { ...@@ -118,7 +118,7 @@ contract SystemConfig is OwnableUpgradeable, Semver {
systemTxMaxGas: 0, systemTxMaxGas: 0,
maximumBaseFee: 0 maximumBaseFee: 0
}), }),
_startBlock: 0, _startBlock: type(uint256).max,
_batchInbox: address(0), _batchInbox: address(0),
_addresses: SystemConfig.Addresses({ _addresses: SystemConfig.Addresses({
l1CrossDomainMessenger: address(0), l1CrossDomainMessenger: address(0),
......
...@@ -53,11 +53,17 @@ contract MIPS { ...@@ -53,11 +53,17 @@ contract MIPS {
uint32 constant EINVAL = 0x16; uint32 constant EINVAL = 0x16;
/// @notice The preimage oracle contract. /// @notice The preimage oracle contract.
IPreimageOracle public oracle; IPreimageOracle internal immutable ORACLE;
/// @param _oracle The address of the preimage oracle contract. /// @param _oracle The address of the preimage oracle contract.
constructor(IPreimageOracle _oracle) { constructor(IPreimageOracle _oracle) {
oracle = _oracle; ORACLE = _oracle;
}
/// @notice Getter for the pre-image oracle contract.
/// @return oracle_ The IPreimageOracle contract.
function oracle() external view returns (IPreimageOracle oracle_) {
oracle_ = ORACLE;
} }
/// @notice Extends the value leftwards with its most significant bit (sign extension). /// @notice Extends the value leftwards with its most significant bit (sign extension).
...@@ -179,7 +185,7 @@ contract MIPS { ...@@ -179,7 +185,7 @@ contract MIPS {
if (uint8(preimageKey[0]) == 1) { if (uint8(preimageKey[0]) == 1) {
preimageKey = PreimageKeyLib.localize(preimageKey); preimageKey = PreimageKeyLib.localize(preimageKey);
} }
(bytes32 dat, uint256 datLen) = oracle.readPreimage(preimageKey, state.preimageOffset); (bytes32 dat, uint256 datLen) = ORACLE.readPreimage(preimageKey, state.preimageOffset);
// Transform data for writing to memory // Transform data for writing to memory
// We use assembly for more precise ops, and no var count limit // We use assembly for more precise ops, and no var count limit
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment