Commit bb02d4b0 authored by clabby's avatar clabby Committed by GitHub

feat(ctb): Vendor `RISCV.sol` (#12994)

* feat(ctb): `RISCV.sol`

semver-lock
Co-Authored-By: default avatarMinhyuk Kim <kimminhyuk1004@gmail.com>
Co-Authored-By: default avatarTaem Park <wwwee98@gmail.com>
Co-Authored-By: default avatarPark Changwan <pcw109550@gmail.com>
Co-Authored-By: default avatarprotolambda <proto@protolambda.com>

* snapshots

* diff with remote in CI

* schedule diff job

* Update .circleci/config.yml
Co-authored-by: default avatarMatt Solomon <matt@mattsolomon.dev>

* remove check changed

---------
Co-authored-by: default avatarMinhyuk Kim <kimminhyuk1004@gmail.com>
Co-authored-by: default avatarTaem Park <wwwee98@gmail.com>
Co-authored-by: default avatarPark Changwan <pcw109550@gmail.com>
Co-authored-by: default avatarprotolambda <proto@protolambda.com>
Co-authored-by: default avatarMatt Solomon <matt@mattsolomon.dev>
parent cccbc2de
......@@ -26,6 +26,9 @@ parameters:
reproducibility_dispatch:
type: boolean
default: false
diff_asterisc_bytecode_dispatch:
type: boolean
default: false
kontrol_dispatch:
type: boolean
default: false
......@@ -242,6 +245,43 @@ jobs:
command: python3 maketests.py && git diff --exit-code
working_directory: cannon/mipsevm/tests/open_mips_tests
diff-asterisc-bytecode:
docker:
- image: <<pipeline.parameters.ci_builder_image>>
resource_class: medium
steps:
- checkout
- run:
name: Check `RISCV.sol` bytecode
working_directory: packages/contracts-bedrock
command: |
# Clone asterisc @ the pinned version to fetch remote `RISCV.sol`
ASTERISC_REV="$(cat ../../versions.json | jq -r .asterisc)"
REMOTE_ASTERISC_PATH="./src/asterisc/RISCV_Remote.sol"
git clone https://github.com/ethereum-optimism/asterisc \
-b $ASTERISC_REV && \
cp ./asterisc/rvsol/src/RISCV.sol $REMOTE_ASTERISC_PATH
# Replace import paths
sed -i -e 's/@optimism\///' $REMOTE_ASTERISC_PATH
# Replace contract name
sed -i -e 's/contract RISCV/contract RISCV_Remote/' $REMOTE_ASTERISC_PATH
# Install deps
forge install
# Diff bytecode, with both contracts compiled in the local environment.
REMOTE_ASTERISC_CODE="$(forge inspect RISCV_Remote bytecode | tr -d '\n')"
LOCAL_ASTERISC_CODE="$(forge inspect RISCV bytecode | tr -d '\n')"
if [ "$REMOTE_ASTERISC_CODE" != "$LOCAL_ASTERISC_CODE" ]; then
echo "Asterisc bytecode mismatch. Local version does not match remote. Diff:"
diff <(echo "$REMOTE_ASTERISC_CODE") <(echo "$LOCAL_ASTERISC_CODE")
else
echo "Asterisc version up to date."
fi
- notify-failures-on-develop:
mentions: "@clabby @proofs-team"
contracts-bedrock-build:
machine: true
resource_class: ethereum-optimism/latitude-1
......@@ -1702,6 +1742,17 @@ workflows:
- oplabs-gcr
- slack
scheduled-diff-asterisc-bytecode:
when:
or:
- equal: [build_daily, <<pipeline.schedule.name>>]
# Trigger on manual triggers if explicitly requested
- equal: [true, <<pipeline.parameters.diff_asterisc_bytecode_dispatch>>]
jobs:
- diff-asterisc-bytecode:
context:
- slack
scheduled-preimage-reproducibility:
when:
or:
......
[
{
"inputs": [
{
"internalType": "contract IPreimageOracle",
"name": "_oracle",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "oracle",
"outputs": [
{
"internalType": "contract IPreimageOracle",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes",
"name": "_stateData",
"type": "bytes"
},
{
"internalType": "bytes",
"name": "_proof",
"type": "bytes"
},
{
"internalType": "bytes32",
"name": "_localContext",
"type": "bytes32"
}
],
"name": "step",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "version",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
}
]
\ No newline at end of file
......@@ -135,6 +135,10 @@
"initCodeHash": "0x17ea1b1c5d5a622d51c2961fde886a5498de63584e654ed1d69ee80dddbe0b17",
"sourceCodeHash": "0x0fa0633a769e73f5937514c0003ba7947a1c275bbe5b85d78879c42f0ed8895b"
},
"src/asterisc/RISCV.sol": {
"initCodeHash": "0xb3f9c337d694b62704b63d86d7d412a661925f254e7af376a5e02717a455487e",
"sourceCodeHash": "0x92a8689e26a736868f90c6c208ef01782c3d9ce196fcef0a85aef4da936c6339"
},
"src/cannon/MIPS.sol": {
"initCodeHash": "0xa3cbf121bad13c00227ea4fef128853d9a86b7ec9158de894f99b58d38d7630a",
"sourceCodeHash": "0xd8467700c80b3e62fa37193dc6513bac35282094b686b50e162e157f704dde00"
......
[
{
"bytes": "20",
"label": "oracle",
"offset": 0,
"slot": "0",
"type": "contract IPreimageOracle"
}
]
\ No newline at end of file
This diff is collapsed.
......@@ -10,5 +10,6 @@
"kontrol": "1.0.53",
"just": "1.34.0",
"binary_signer": "1.0.4",
"semgrep": "1.90.0"
"semgrep": "1.90.0",
"asterisc": "cl/contract-updates"
}
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