Commit 669a0fb2 authored by smartcontracts's avatar smartcontracts Committed by GitHub

maint: no kontrol summaries in PRs (#11725)

Removes the need for kontrol summaries to be generated at PR time.
Summaries will now be generated during run-kontrol.sh instead.
parent 5b907dc8
...@@ -615,6 +615,11 @@ jobs: ...@@ -615,6 +615,11 @@ jobs:
command: | command: |
just snapshots-check || echo "export SNAPSHOTS_STATUS=1" >> "$BASH_ENV" just snapshots-check || echo "export SNAPSHOTS_STATUS=1" >> "$BASH_ENV"
working_directory: packages/contracts-bedrock working_directory: packages/contracts-bedrock
- run:
name: kontrol deployment
command: |
just kontrol-deployment-check || echo "export KONTROL_DEPLOYMENT_STATUS=1" >> "$BASH_ENV"
working_directory: packages/contracts-bedrock
- run: - run:
name: size check name: size check
command: | command: |
...@@ -653,6 +658,10 @@ jobs: ...@@ -653,6 +658,10 @@ jobs:
echo "Snapshots check failed, see job output for details." echo "Snapshots check failed, see job output for details."
FAILED=1 FAILED=1
fi fi
if [[ "$KONTROL_DEPLOYMENT_STATUS" -ne 0 ]]; then
echo "Kontrol deployment check failed, see job output for details."
FAILED=1
fi
if [[ "$SIZE_CHECK" -ne 0 ]]; then if [[ "$SIZE_CHECK" -ne 0 ]]; then
echo "Contract(s) exceed size limit, see job output for details." echo "Contract(s) exceed size limit, see job output for details."
FAILED=1 FAILED=1
......
...@@ -19,7 +19,11 @@ autogen-invariant-docs: ...@@ -19,7 +19,11 @@ autogen-invariant-docs:
test: build-go-ffi test: build-go-ffi
forge test forge test
test-kontrol: # Run Kontrol tests and build all dependencies.
test-kontrol: build-go-ffi build kontrol-summary-full test-kontrol-no-build
# Run Kontrol tests without dependencies.
test-kontrol-no-build:
./test/kontrol/scripts/run-kontrol.sh script ./test/kontrol/scripts/run-kontrol.sh script
test-rerun: build-go-ffi test-rerun: build-go-ffi
...@@ -48,18 +52,32 @@ gas-snapshot: build-go-ffi gas-snapshot-no-build ...@@ -48,18 +52,32 @@ gas-snapshot: build-go-ffi gas-snapshot-no-build
gas-snapshot-check: build-go-ffi gas-snapshot-check: build-go-ffi
forge snapshot --match-contract GasBenchMark --check forge snapshot --match-contract GasBenchMark --check
# Check that the Kontrol deployment script has not changed.
kontrol-deployment-check:
./scripts/checks/check-kontrol-deployment.sh
# Generates default Kontrol summary.
kontrol-summary: kontrol-summary:
./test/kontrol/scripts/make-summary-deployment.sh ./test/kontrol/scripts/make-summary-deployment.sh
# Generates fault proofs Kontrol summary.
kontrol-summary-fp: kontrol-summary-fp:
KONTROL_FP_DEPLOYMENT=true ./test/kontrol/scripts/make-summary-deployment.sh KONTROL_FP_DEPLOYMENT=true ./test/kontrol/scripts/make-summary-deployment.sh
# Generates all Kontrol summaries (default and FP).
kontrol-summary-full: kontrol-summary kontrol-summary-fp
# Generates ABI snapshots for contracts.
snapshots-abi-storage: snapshots-abi-storage:
go run ./scripts/autogen/generate-snapshots . go run ./scripts/autogen/generate-snapshots .
snapshots: build snapshots-no-build # Generates core snapshots without building contracts. Currently just an alias for
# snapshots-abi-storage because we no longer run Kontrol snapshots here. Run
# kontrol-summary-full to build the Kontrol summaries if necessary.
snapshots-no-build: snapshots-abi-storage
snapshots-no-build: snapshots-abi-storage kontrol-summary-fp kontrol-summary # Builds contracts and then generates core snapshots.
snapshots: build snapshots-no-build
snapshots-check: snapshots-check:
./scripts/checks/check-snapshots.sh ./scripts/checks/check-snapshots.sh
......
#!/usr/bin/env bash
set -euo pipefail
# This script checks if the KontrolDeployment.sol file has changed. Removal of
# the DeploymentSummary.t.sol test file means that our primary risk vector for
# KontrolDeployment.sol is an *accidental* change to the file. Changes must
# therefore be explicitly acknowledged by bumping the hash below.
# Get relevant directories
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
CONTRACTS_BASE=$(dirname "$(dirname "$SCRIPT_DIR")")
# Generate the SHA-512 hash using OpenSSL (very portable)
generated_hash=$(openssl dgst -sha512 "${CONTRACTS_BASE}/test/kontrol/deployment/KontrolDeployment.sol" | awk '{print $2}')
# Define the known hash
known_hash="1664d9c22266b55b43086fa03c0e9d0447b092abc86cba79b86ad36c49167062c2b58a78757a20a5fd257d307599edce8f8f604cc6b2ee86715144015a8c977d"
# Compare the generated hash with the known hash
if [ "$generated_hash" = "$known_hash" ]; then
echo "KontrolDeployment.sol matches the known hash."
else
echo "KontrolDeployment.sol does not match the known hash. Please update the known hash."
echo "Old hash: $known_hash"
echo "New hash: $generated_hash"
exit 1
fi
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
# Generate the snapshots # Generate the snapshots
just snapshots just snapshots
# Check if the generated `snapshots` or `test/kontrol` files are different from the committed versions # Check if the generated `snapshots` files are different from the committed versions
if git diff --exit-code snapshots test/kontrol > /dev/null; then if git diff --exit-code snapshots > /dev/null; then
[ -z "$(git ls-files --others --exclude-standard snapshots test/kontrol)" ] || exit 1 [ -z "$(git ls-files --others --exclude-standard snapshots)" ] || exit 1
else else
exit 1 exit 1
fi fi
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
// Libraries
import { Constants } from "src/libraries/Constants.sol";
import { Predeploys } from "src/libraries/Predeploys.sol";
// Target contract dependencies
import { DisputeGameFactory } from "src/dispute/DisputeGameFactory.sol";
import { SystemConfig } from "src/L1/SystemConfig.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
import { OptimismPortal2 } from "src/L1/OptimismPortal2.sol";
import { L1CrossDomainMessenger } from "src/L1/L1CrossDomainMessenger.sol";
import { DeploymentSummaryFaultProofs } from "../proofs/utils/DeploymentSummaryFaultProofs.sol";
import { L1ERC721Bridge } from "src/L1/L1ERC721Bridge.sol";
import { L1StandardBridge } from "src/L1/L1StandardBridge.sol";
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { LegacyMintableERC20 } from "src/legacy/LegacyMintableERC20.sol";
// Tests
import { L1CrossDomainMessenger_Test } from "test/L1/L1CrossDomainMessenger.t.sol";
import { OptimismPortal2_Test } from "test/L1/OptimismPortal2.t.sol";
import { L1ERC721Bridge_Test, TestERC721 } from "test/L1/L1ERC721Bridge.t.sol";
import {
L1StandardBridge_Getter_Test,
L1StandardBridge_Initialize_Test,
L1StandardBridge_Pause_Test
} from "test/L1/L1StandardBridge.t.sol";
/// @dev Contract testing the deployment summary correctness
contract DeploymentSummaryFaultProofs_TestOptimismPortal is DeploymentSummaryFaultProofs, OptimismPortal2_Test {
/// @notice super.setUp is not called on purpose
function setUp() public override {
// Recreate Deployment Summary state changes
DeploymentSummaryFaultProofs deploymentSummary = new DeploymentSummaryFaultProofs();
deploymentSummary.recreateDeployment();
// Set summary addresses
optimismPortal2 = OptimismPortal2(payable(optimismPortalProxyAddress));
superchainConfig = SuperchainConfig(superchainConfigProxyAddress);
disputeGameFactory = DisputeGameFactory(disputeGameFactoryProxyAddress);
systemConfig = SystemConfig(systemConfigProxyAddress);
// Set up utilized addresses
depositor = makeAddr("depositor");
alice = makeAddr("alice");
bob = makeAddr("bob");
vm.deal(alice, 10000 ether);
vm.deal(bob, 10000 ether);
}
/// @dev Skips the first line of `super.test_constructor_succeeds` because
/// we're not exercising the `Deploy` logic in these tests. However,
/// the remaining assertions of the test are important to check
function test_constructor_succeeds() external view override {
// OptimismPortal opImpl = OptimismPortal(payable(deploy.mustGetAddress("OptimismPortal")));
OptimismPortal2 opImpl = OptimismPortal2(payable(optimismPortal2Address));
assertEq(address(opImpl.disputeGameFactory()), address(0));
assertEq(address(opImpl.systemConfig()), address(0));
assertEq(address(opImpl.superchainConfig()), address(0));
assertEq(opImpl.l2Sender(), Constants.DEFAULT_L2_SENDER);
}
/// @dev Skips the first line of `super.test_initialize_succeeds` because
/// we're not exercising the `Deploy` logic in these tests. However,
/// the remaining assertions of the test are important to check
function test_initialize_succeeds() external view override {
// address guardian = deploy.cfg().superchainConfigGuardian();
address guardian = superchainConfig.guardian();
assertEq(address(optimismPortal2.disputeGameFactory()), address(disputeGameFactory));
assertEq(address(optimismPortal2.systemConfig()), address(systemConfig));
assertEq(optimismPortal2.guardian(), guardian);
assertEq(address(optimismPortal2.superchainConfig()), address(superchainConfig));
assertEq(optimismPortal2.l2Sender(), Constants.DEFAULT_L2_SENDER);
assertEq(optimismPortal2.paused(), false);
}
}
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