Skip to content

Commit

Permalink
Merge branch 'main' into feat/husky-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
kyzooghost authored Dec 20, 2024
2 parents 3b3dd33 + ea79b2d commit 919b326
Show file tree
Hide file tree
Showing 258 changed files with 5,253 additions and 2,105 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ on:
# '!**.md' will not work by itself to exclude *.md files. See https://github.com/orgs/community/discussions/25369
- '**'
- '!**.md'
- '!**.mdx'
- '!**/docs/**'
- '!docs/**'

jobs:
analyze:
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/coordinator-build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ concurrency:

jobs:
build-and-publish:
runs-on: [self-hosted, ubuntu-20.04, X64, small]
runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-med
name: Coordinator build
env:
COMMIT_TAG: ${{ inputs.commit_tag }}
Expand All @@ -68,12 +68,14 @@ jobs:
echo "TAGS=${{ env.IMAGE_NAME }}:${{ env.COMMIT_TAG }},${{ env.IMAGE_NAME }}:${{ env.DEVELOP_TAG }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-java@v4
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b #v4.5.0
with:
distribution: temurin
java-version: 21
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
# Configure Gradle for optimal use in GiHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
uses: gradle/actions/setup-gradle@cc4fc85e6b35bafd578d5ffbc76a5518407e1af0 #v4.2.1
- name: Build dist
run: |
./gradlew coordinator:app:installDist --no-daemon
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/coordinator-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,19 @@ jobs:
GITHUB_TOKEN: ${{ secrets._GITHUB_TOKEN_RELEASE_ACCESS }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
runs-on: [self-hosted, ubuntu-22.04, X64, medium]
runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-large
name: Coordinator tests
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-java@v4
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b #v4.5.0
with:
distribution: temurin
java-version: 21
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
# Configure Gradle for optimal use in GiHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
uses: gradle/actions/setup-gradle@cc4fc85e6b35bafd578d5ffbc76a5518407e1af0 #v4.2.1
- name: Restore cached images
id: restore-cached-images
uses: actions/cache/restore@v4.0.2
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ jobs:
filters: |
has-changes-requiring-build:
- '!**/*.md'
- '!**/*.mdx'
- '!**/docs/**'
- '!docs/**'
# Enables us to exclude changes in multiple file types if required
predicate-quantifier: 'every'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/maven-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:

jobs:
release:
runs-on: [self-hosted, ubuntu-20.04, X64, small]
runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-med
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ on:
jobs:

build-linux:
runs-on: [self-hosted, ubuntu-20.04, X64, small]
runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-small
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down Expand Up @@ -56,7 +56,7 @@ jobs:
path: ./prover/target

build-linux-arm64:
runs-on: [self-hosted, ubuntu-20.04, ARM64, small]
runs-on: gha-runner-scale-set-ubuntu-22.04-arm64-small
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down Expand Up @@ -128,7 +128,7 @@ jobs:
release_artefacts:
name: Release artefacts
needs: [ build-linux, build-linux-arm64, build-mac-os]
runs-on: [self-hosted, ubuntu-20.04, ARM64, small]
runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-small
steps:
- name: Load cached binaries
uses: actions/download-artifact@v4
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/reuse-run-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
outputs:
tests_outcome: ${{ steps.run_e2e_tests.outcome }}
runs-on: [self-hosted, ubuntu-20.04, X64, large]
runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-large
steps:
- name: Setup upterm session
if: ${{ inputs.e2e-tests-with-ssh }}
Expand Down Expand Up @@ -116,13 +116,16 @@ jobs:
make pull-images-external-to-monorepo
- name: Download local docker image artifacts
uses: actions/download-artifact@v4
with:
pattern: linea-*
- name: Load Docker images
run: |
gunzip -c /runner/_work/linea-monorepo/linea-monorepo/linea-coordinator/linea-coordinator-docker-image.tar.gz | docker load &&
gunzip -c /runner/_work/linea-monorepo/linea-monorepo/linea-postman/linea-postman-docker-image.tar.gz | docker load &&
gunzip -c /runner/_work/linea-monorepo/linea-monorepo/linea-prover/linea-prover-docker-image.tar.gz | docker load &&
gunzip -c /runner/_work/linea-monorepo/linea-monorepo/linea-traces-api-facade/linea-traces-api-facade-docker-image.tar.gz | docker load &&
gunzip -c /runner/_work/linea-monorepo/linea-monorepo/linea-transaction-exclusion-api/linea-transaction-exclusion-api-docker-image.tar.gz | docker load
pwd && ls -la && echo "GITHUB_WORKSPACE=$GITHUB_WORKSPACE" &&
gunzip -c $GITHUB_WORKSPACE/linea-coordinator/linea-coordinator-docker-image.tar.gz | docker load &&
gunzip -c $GITHUB_WORKSPACE/linea-postman/linea-postman-docker-image.tar.gz | docker load &&
gunzip -c $GITHUB_WORKSPACE/linea-prover/linea-prover-docker-image.tar.gz | docker load &&
gunzip -c $GITHUB_WORKSPACE/linea-traces-api-facade/linea-traces-api-facade-docker-image.tar.gz | docker load &&
gunzip -c $GITHUB_WORKSPACE/linea-transaction-exclusion-api/linea-transaction-exclusion-api-docker-image.tar.gz | docker load
shell: bash
- name: Spin up fresh environment with geth tracing with retry
if: ${{ inputs.tracing-engine == 'geth' }}
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/run-smc-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ on:
- 'testdata/**'
- 'prover/**'
- '!contracts/**/*.md'
- '!contracts/**/*.mdx'
- '!testdata/**/*.md'
- '!prover/**/*.md'
- '!**/docs/**'
push:
branches:
- main
Expand All @@ -17,8 +19,10 @@ on:
- 'testdata/**'
- 'prover/**'
- '!contracts/**/*.md'
- '!contracts/**/*.mdx'
- '!testdata/**/*.md'
- '!prover/**/*.md'
- '!**/docs/**'

env:
GOPROXY: "https://proxy.golang.org"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/traces-api-facade-build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ concurrency:

jobs:
build-and-publish:
runs-on: [self-hosted, ubuntu-20.04, X64, small]
runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-med
name: Traces api facade build
env:
COMMIT_TAG: ${{ inputs.commit_tag }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ concurrency:

jobs:
build-and-publish:
runs-on: [self-hosted, ubuntu-20.04, X64, small]
runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-med
name: Transaction exclusion api build
env:
COMMIT_TAG: ${{ inputs.commit_tag }}
Expand Down
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,22 @@ deploy-l2-test-erc20:
TEST_ERC20_INITIAL_SUPPLY=100000 \
npx ts-node local-deployments-artifacts/deployTestERC20.ts

deploy-l2-evm-opcode-tester:
# WARNING: FOR LOCAL DEV ONLY - DO NOT REUSE THESE KEYS ELSEWHERE
cd contracts/; \
PRIVATE_KEY=0x1dd171cec7e2995408b5513004e8207fe88d6820aeff0d82463b3e41df251aae \
RPC_URL=http:\\localhost:8545/ \
npx ts-node local-deployments-artifacts/deployLondonEvmTestingFramework.ts

execute-all-opcodes:
# WARNING: FOR LOCAL DEV ONLY - DO NOT REUSE THESE KEYS ELSEWHERE
cd contracts/; \
OPCODE_TEST_CONTRACT_ADDRESS=0x997FC3aF1F193Cbdc013060076c67A13e218980e \
NUMBER_OF_RUNS=3 \
PRIVATE_KEY=0x1dd171cec7e2995408b5513004e8207fe88d6820aeff0d82463b3e41df251aae \
RPC_URL=http:\\localhost:8545/ \
npx ts-node local-deployments-artifacts/executeAllOpcodes.ts

fresh-start-l2-blockchain-only:
make clean-environment
make start-l2-blockchain-only
Expand Down
2 changes: 1 addition & 1 deletion config/coordinator/coordinator-docker.config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ polling-interval="PT1S"
traces-file-creation-wait-timeout="PT2M"

[state-manager]
version="2.2.0"
version="2.3.0"
endpoints=["http://shomei:8888/"]
request-limit-per-endpoint=2
request-retry.backoff-delay="PT2S"
Expand Down
2 changes: 1 addition & 1 deletion constraints
3 changes: 2 additions & 1 deletion contracts/.solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"reason-string": "off",
"check-send-result": "off",
"no-unused-import": ["error"],
"gas-custom-errors": "off"
"gas-custom-errors": "off",
"no-complex-fallback": "off"
}
}
4 changes: 3 additions & 1 deletion contracts/.solhintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
node_modules
lib/forge-std
contracts/test-contracts
test/foundry
test/foundry
/contracts/proxies
/contracts/tokenBridge/mocks
21 changes: 19 additions & 2 deletions contracts/common/helpers/deployments.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ethers, AbstractSigner, Interface, InterfaceAbi } from "ethers";
import { ethers, AbstractSigner, Interface, InterfaceAbi, BaseContract } from "ethers";

export function getInitializerData(contractAbi: InterfaceAbi, initializerFunctionName: string, args: unknown[]) {
const contractInterface = new Interface(contractAbi);
Expand All @@ -12,6 +12,7 @@ export function getInitializerData(contractAbi: InterfaceAbi, initializerFunctio
}

export async function deployContractFromArtifacts(
contractName: string,
abi: ethers.InterfaceAbi,
bytecode: ethers.BytesLike,
wallet: AbstractSigner,
Expand All @@ -20,5 +21,21 @@ export async function deployContractFromArtifacts(
) {
const factory = new ethers.ContractFactory(abi, bytecode, wallet);
const contract = await factory.deploy(...args);
return contract.waitForDeployment();

await LogContractDeployment(contractName, contract);

return contract;
}

export async function LogContractDeployment(contractName: string, contract: BaseContract) {
const txReceipt = await contract.deploymentTransaction()?.wait();
if (!txReceipt) {
throw "Deployment transaction not found.";
}

const contractAddress = await contract.getAddress();
const chainId = (await contract.deploymentTransaction()!.provider.getNetwork()).chainId;
console.log(
`contract=${contractName} deployed: address=${contractAddress} blockNumber=${txReceipt.blockNumber} chainId=${chainId}`,
);
}
10 changes: 7 additions & 3 deletions contracts/contracts/lib/CallForwardingProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,25 @@ pragma solidity 0.8.26;
*/
contract CallForwardingProxy {
/// @notice The underlying target address that is called.
address public immutable target;
address public immutable TARGET;

constructor(address _target) {
target = _target;
TARGET = _target;
}

/**
* @notice Defaults to, and forwards all calls to the target address.
*/
fallback() external payable {
(bool success, bytes memory data) = target.call{ value: msg.value }(msg.data);
(bool success, bytes memory data) = TARGET.call{ value: msg.value }(msg.data);
require(success, "Call failed");

assembly {
return(add(data, 0x20), mload(data))
}
}

receive() external payable {
revert("ETH not accepted");
}
}
6 changes: 3 additions & 3 deletions contracts/contracts/lib/SparseMerkleProof.sol
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ library SparseMerkleProof {
/**
* @notice Hash a value using MIMC hash
* @param _input Value to hash
* @return {bytes32} Mimc hash
* @return bytes32 Mimc hash
*/
function mimcHash(bytes calldata _input) external pure returns (bytes32) {
return Mimc.hash(_input);
Expand All @@ -106,7 +106,7 @@ library SparseMerkleProof {
/**
* @notice Hash account value
* @param _value Encoded account value bytes (nonce, balance, storageRoot, mimcCodeHash, keccakCodeHash, codeSize)
* @return {bytes32} Account value hash
* @return bytes32 Account value hash
*/
function hashAccountValue(bytes calldata _value) external pure returns (bytes32) {
Account memory account = _parseAccount(_value);
Expand All @@ -128,7 +128,7 @@ library SparseMerkleProof {
/**
* @notice Hash storage value
* @param _value Encoded storage value bytes
* @return {bytes32} Storage value hash
* @return bytes32 Storage value hash
*/
function hashStorageValue(bytes32 _value) external pure returns (bytes32) {
(bytes32 msb, bytes32 lsb) = _splitBytes32(_value);
Expand Down
12 changes: 12 additions & 0 deletions contracts/contracts/test-contracts/ErrorAndDestructionTesting.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.19;

contract ErrorAndDestructionTesting {
function externalRevert() external pure {
revert("OPCODE FD");
}

function callmeToSelfDestruct() external {
selfdestruct(payable(address(0)));
}
}
Loading

0 comments on commit 919b326

Please sign in to comment.