Skip to content

Commit c75a612

Browse files
authored
Merge pull request #1 from SyndicateProtocol/merge-sequencing-chains
Merge sequencing-chains repository into metabased-contracts
2 parents c0e9e67 + 19230cc commit c75a612

File tree

95 files changed

+26390
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+26390
-0
lines changed

metabased-contracts/.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "contracts/lib/forge-std"]
2+
path = contracts/lib/forge-std
3+
url = https://github.com/foundry-rs/forge-std
4+
[submodule "contracts/lib/openzeppelin-contracts"]
5+
path = contracts/lib/openzeppelin-contracts
6+
url = https://github.com/OpenZeppelin/openzeppelin-contracts

metabased-contracts/Makefile

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Heavily inspired by Reth's Makefile: https://github.com/paradigmxyz/reth/blob/main/Makefile
2+
.DEFAULT_GOAL := help
3+
4+
BIN_DIR = "dist/bin"
5+
6+
BUILD_PATH = "target"
7+
8+
# List of features to use when building. Can be overridden via the environment.
9+
# No jemalloc on Windows
10+
# ifeq ($(OS),Windows_NT)
11+
FEATURES ?=
12+
# else
13+
# FEATURES ?= jemalloc asm-keccak
14+
# endif
15+
16+
# Cargo profile for builds. Default is for local builds, CI uses an override.
17+
PROFILE ?= release
18+
19+
# Extra flags for Cargo
20+
CARGO_INSTALL_EXTRA_FLAGS ?=
21+
22+
# Features in reth/op-reth binary crate other than "ethereum" and "optimism"
23+
BIN_OTHER_FEATURES := asm-keccak jemalloc jemalloc-prof min-error-logs min-warn-logs min-info-logs min-debug-logs min-trace-logs
24+
25+
##@ Help
26+
27+
.PHONY: help
28+
help: ## Display this help.
29+
@awk 'BEGIN {FS = ":.*##"; printf "Usage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
30+
31+
##@ Build
32+
33+
.PHONY: install-foundry
34+
install-foundry: ## Install Foundry if the forge command is not found or is corrupted.
35+
@if [ -z "$$(which forge)" ]; then \
36+
echo "Forge not found. Installing Foundry..."; \
37+
curl -L https://foundry.paradigm.xyz | bash && bash -c "source ~/.bashrc && foundryup"; \
38+
fi
39+
@forge build --help > /dev/null 2>&1 || (echo "Forge is corrupted. Reinstalling Foundry..." && curl -L https://foundry.paradigm.xyz | bash && bash -c "source ~/.bashrc && foundryup")
40+
@echo "Foundry is installed and ready to use."
41+
42+
.PHONY: build-op-reth-syn
43+
build-op-reth-syn: ## Build and install the op-reth binary under `~/.cargo/bin`.
44+
cd ./reth-and-exexs && cargo install --path . --bin op-reth-syn --force --locked \
45+
--features "$(FEATURES)" \
46+
--profile "$(PROFILE)" \
47+
$(CARGO_INSTALL_EXTRA_FLAGS)
48+
49+
.PHONY: build-contracts
50+
build-contracts: install-foundry ## Build contracts using forge.
51+
cd ./contracts && forge build
52+
@echo "Contract compilation complete"
53+
54+
.PHONY: test
55+
test: build-contracts ## Run tests after building the contracts.
56+
cd ./reth-and-exexs && cargo test --all
57+
@echo "Tests complete"
58+
59+
##@ Custom Build
60+
61+
.PHONY: install
62+
install: build-contracts build-op-reth-syn ## Run build steps.
63+
@echo "Install complete. You can now run op-reth-syn from your terminal."
File renamed without changes.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CONTRACT_ADDRESS=0x66F9664f97f2B50F62d13EA064982F936de76657
2+
3+
ENGINE_API_URL=http://localhost:3000
4+
5+
JWT_SECRET=1a81b8d6100c07b9a5ab1c9c0a469661f262067ba002649b22c9621585bf502a
6+
7+
METABASED_TESTNET_RPC_URL=
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: test
2+
3+
on: workflow_dispatch
4+
5+
env:
6+
FOUNDRY_PROFILE: ci
7+
8+
jobs:
9+
check:
10+
strategy:
11+
fail-fast: true
12+
13+
name: Foundry project
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
submodules: recursive
19+
20+
- name: Install Foundry
21+
uses: foundry-rs/foundry-toolchain@v1
22+
with:
23+
version: nightly
24+
25+
- name: Run Forge build
26+
run: |
27+
forge --version
28+
forge build --sizes
29+
id: build
30+
31+
- name: Run Forge tests
32+
run: |
33+
forge test -vvv
34+
id: test
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Compiler files
2+
cache/
3+
out/
4+
5+
# Ignores development broadcast logs
6+
!/broadcast
7+
/broadcast/*/31337/
8+
/broadcast/**/dry-run/
9+
10+
# Docs
11+
docs/
12+
13+
# Dotenv file
14+
.env
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# include .env file and export its env vars
2+
# (-include to ignore error if it does not exist)
3+
# Note that any unset variables here will wipe the variables if they are set in
4+
# .zshrc or .bashrc. Make sure that the variables are set in .env, especially if
5+
# you're running into issues with fork tests
6+
-include .env
7+
8+
# deploy DeployMetabasedSequencerChain to Base Sepolia
9+
deploy-metabased-sequencerchain :; forge script script/DeployContractsForSequencerChain.s.sol:DeployMetabasedSequencerChain --rpc-url base_sepolia --private-key ${ETH_PRIVATE_KEY} --broadcast -vv
10+
11+
# deploy DeployMetabasedSequencerChainForTestnet to Metabased Testnet
12+
deploy-metabased-sequencerchain-testnet :; forge script script/DeployContractsForSequencerChain.s.sol:DeployMetabasedSequencerChainForTestnet --rpc-url metabased_testnet --private-key ${ETH_PRIVATE_KEY} --broadcast -vv
13+
14+
# run AddModuleToMetabasedSequencerChain script on Base Sepolia
15+
add-module-to-metabased-sequencerchain :; forge script script/DeployContractsForSequencerChain.s.sol:AddModuleToMetabasedSequencerChain --rpc-url base_sepolia --private-key ${ETH_PRIVATE_KEY} --broadcast -vv
16+
17+
# deploy DeploySealedBidAuctionSequencingModule to Base Sepolia
18+
deploy-sealed-bid-auction-sequencing-module :; forge script script/DeployContractsForSequencerChain.s.sol:DeploySealedBidAuctionSequencingModule --rpc-url base_sepolia --private-key ${ETH_PRIVATE_KEY} --broadcast -vv
19+
20+
# deploy DeployTokenBalanceSequencingModule to Base Sepolia
21+
deploy-token-balance-sequencing-module :; forge script script/DeployContractsForSequencerChain.s.sol:DeployTokenBalanceSequencingModule --rpc-url base_sepolia --private-key ${ETH_PRIVATE_KEY} --broadcast -vv
22+
23+
# deploy DeployAllowlistSequencingModule to Base Sepolia
24+
deploy-allowlist-sequencing-module :; forge script script/DeployContractsForSequencerChain.s.sol:DeployAllowlistSequencingModule --rpc-url base_sepolia --private-key ${ETH_PRIVATE_KEY} --broadcast -vv
25+
26+
# deploy DeployAlwaysAllowedModule to Base Sepolia
27+
deploy-always-allowed-module :; forge script script/DeployContractsForSequencerChain.s.sol:DeployAlwaysAllowedModule --rpc-url base_sepolia --private-key ${ETH_PRIVATE_KEY} --broadcast -vv
28+
29+
# run AddBatchTransactionsToMetabasedSequencerChainContract script on Base Sepolia
30+
add-batch-transactions-to-metabased-sequencerchain :; forge script script/AddBatchTransactionsToMetabasedSequencerChainContract.s.sol:AddBatchTransactionsToMetabasedSequencerChainContract --rpc-url base_sepolia --private-key ${ETH_PRIVATE_KEY} --broadcast -vv
31+
32+
# run AddBatchTransactionsToMetabasedSequencerChainContract script on localhost
33+
add-batch-transactions-to-metabased-sequencerchain-localhost :; forge script script/AddBatchTransactionsToMetabasedSequencerChainContract.s.sol:AddBatchTransactionsToMetabasedSequencerChainContract --rpc-url localhost --private-key ${ETH_PRIVATE_KEY} --broadcast -vv
34+
35+
# run tx limit test against OP Mainnet or Base Sepolia
36+
# and save output to file
37+
# need to change target network in the test file
38+
test-tx-limit :; forge test --match-contract MetabaseSequencerChainIntegrationTest -vv > test/integration/metabase-tx-limit-data/optimism_test_output_$(date +%Y%m%d_%H%M%S).log 2>&1
39+
40+
test-tx-limit :; forge test --match-contract MetabaseSequencerChainIntegrationTest -vv > test/integration/metabase-tx-limit-data/optimism_test_output_$(date +%Y%m%d_%H%M%S).md 2>&1
41+
42+
test-events-limit :; forge test --match-contract MetabaseSequencerChainEventLimitTest -vv > test/integration/metabase-events-limit-data/base_sepolia_test_output_$(date +%Y%m%d_%H%M%S).md 2>&1
43+
44+
# deploy L3BackfillData to Metabased Testnet
45+
deploy-l3-backfill-data :; forge create --rpc-url metabased_testnet --private-key ${ETH_PRIVATE_KEY} src/backfill/L3BackfillData.sol:L3BackfillData --constructor-args ${ADMIN} ${MANAGER}
46+
47+
deploy-l3-backfill-storage :; forge create --rpc-url metabased_testnet --private-key ${ETH_PRIVATE_KEY} src/backfill/L3BackfillStorage.sol:L3BackfillStorage --constructor-args ${ADMIN} ${MANAGER}
48+
49+
deploy-l3-backfill-mapper :; forge create --rpc-url metabased_testnet --private-key ${ETH_PRIVATE_KEY} src/backfill/L3BackfillMapper.sol:L3BackfillMapper --constructor-args ${ADMIN} ${MANAGER}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
## Base Sequencer Chain Contracts
2+
3+
### Build
4+
5+
```shell
6+
$ forge build
7+
```
8+
9+
### Test
10+
11+
```shell
12+
$ forge test
13+
```
14+
15+
### Deploy
16+
17+
Look at Makefile for more details.
18+
19+
Example:
20+
21+
```shell
22+
$ make deploy-based-sequencerchain-frame
23+
```
24+
25+
### Deployed Contracts
26+
27+
#### Syndicate Frame Chain
28+
29+
| Contract Name | Address |
30+
| ------------------------- | ------------------------------------------ |
31+
| BasedSequencerChain | 0x8430FDed8bb66c6EA2f1f966E2abF9D481eEF418 |
32+
| AllowlistSequencingModule | 0xA3d1304Afff72a8aD77F7c6A7B0c18d63629062d |
33+
34+
#### Base Sepolia
35+
36+
| Contract Name | Address |
37+
| ----------------------- | ------------------------------------------ |
38+
| MetabasedSequencerChain | 0x0E3E7d53c6451D62CE9f86201743587419Dc88Be |
39+
| AlwaysAllowedModule | 0x33aB24E0a47A7aAe869755420950A6326e3CB9F3 |
40+
41+
#### Optimism
42+
43+
| Contract Name | Address |
44+
| ----------------------- | ------------------------------------------ |
45+
| MetabasedSequencerChain | 0x7DEdabB3Db89310B316bA49D96Aa6517aFC44294 |
46+
| AlwaysAllowedModule | 0x21e1C6bE46E53693381Cef9BECD3B0A947A590e4 |
47+
48+
#### Metabased Testnet
49+
50+
| Contract Name | Address |
51+
| ----------------------- | ------------------------------------------ |
52+
| MetabasedSequencerChain | 0xcFc46cEBB3eAEc9b5776e3FDe5879125B8BBA05d |
53+
| AlwaysAllowedModule | 0x471584f0B8e35faEB2a618BD58A62316D8882d63 |
54+
| L3BackfillData | 0xA67d13E3227B68bFc96DB9f5AFe7197ca32F0033 |
55+
| L3BackfillStorage | 0x0E15475575E06461e376a9954F4cb54fC61bC1a5 |
56+
| L3BackfillMapper | 0x609272C1D46E652aaf095a4F7F2eCC208C61c7F5 |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{
2+
"transactions": [
3+
{
4+
"hash": "0x1d654344b2de8f22f1ecff0fb36b545113bf69057c4ef204d972df83d27ce313",
5+
"transactionType": "CALL",
6+
"contractName": null,
7+
"contractAddress": "0x73ba7d784d13ec0070a4ea6f49ff57dc007bb48d",
8+
"function": "processBulkTransactions(bytes[])",
9+
"arguments": [
10+
"[0x00000000000000000000000073ba7d784d13ec0070a4ea6f49ff57dc007bb48d0000000000000000000000000000000000000000000000000000000000000001, 0x00000000000000000000000073ba7d784d13ec0070a4ea6f49ff57dc007bb48d0000000000000000000000000000000000000000000000000000000000000002]"
11+
],
12+
"transaction": {
13+
"from": "0x45d6450fc59a6f8d9c753126ce1eff6fa4d7e0fb",
14+
"to": "0x73ba7d784d13ec0070a4ea6f49ff57dc007bb48d",
15+
"gas": "0x10ce5",
16+
"value": "0x0",
17+
"input": "0x0b83249d00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000073ba7d784d13ec0070a4ea6f49ff57dc007bb48d0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000004000000000000000000000000073ba7d784d13ec0070a4ea6f49ff57dc007bb48d0000000000000000000000000000000000000000000000000000000000000002",
18+
"nonce": "0x13",
19+
"chainId": "0x14a34"
20+
},
21+
"additionalContracts": [],
22+
"isFixedGasLimit": false
23+
}
24+
],
25+
"receipts": [
26+
{
27+
"status": "0x1",
28+
"cumulativeGasUsed": "0x1c8737",
29+
"logs": [
30+
{
31+
"address": "0x73ba7d784d13ec0070a4ea6f49ff57dc007bb48d",
32+
"topics": [
33+
"0x83363b78bdfbb23e2a61db7accc3c01fda29c5c5ec81888003cb962912618a7f",
34+
"0x00000000000000000000000045d6450fc59a6f8d9c753126ce1eff6fa4d7e0fb"
35+
],
36+
"data": "0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004000000000000000000000000073ba7d784d13ec0070a4ea6f49ff57dc007bb48d0000000000000000000000000000000000000000000000000000000000000001",
37+
"blockHash": "0xcd33982b6ce5e63a4ba22f5c8e08ecadcf21eab43aa8b226dd6e7494cf86f8a9",
38+
"blockNumber": "0xde9787",
39+
"transactionHash": "0x1d654344b2de8f22f1ecff0fb36b545113bf69057c4ef204d972df83d27ce313",
40+
"transactionIndex": "0x9",
41+
"logIndex": "0x27",
42+
"removed": false
43+
},
44+
{
45+
"address": "0x73ba7d784d13ec0070a4ea6f49ff57dc007bb48d",
46+
"topics": [
47+
"0x83363b78bdfbb23e2a61db7accc3c01fda29c5c5ec81888003cb962912618a7f",
48+
"0x00000000000000000000000045d6450fc59a6f8d9c753126ce1eff6fa4d7e0fb"
49+
],
50+
"data": "0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004000000000000000000000000073ba7d784d13ec0070a4ea6f49ff57dc007bb48d0000000000000000000000000000000000000000000000000000000000000002",
51+
"blockHash": "0xcd33982b6ce5e63a4ba22f5c8e08ecadcf21eab43aa8b226dd6e7494cf86f8a9",
52+
"blockNumber": "0xde9787",
53+
"transactionHash": "0x1d654344b2de8f22f1ecff0fb36b545113bf69057c4ef204d972df83d27ce313",
54+
"transactionIndex": "0x9",
55+
"logIndex": "0x28",
56+
"removed": false
57+
}
58+
],
59+
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000020000400000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000400",
60+
"type": "0x2",
61+
"transactionHash": "0x1d654344b2de8f22f1ecff0fb36b545113bf69057c4ef204d972df83d27ce313",
62+
"transactionIndex": "0x9",
63+
"blockHash": "0xcd33982b6ce5e63a4ba22f5c8e08ecadcf21eab43aa8b226dd6e7494cf86f8a9",
64+
"blockNumber": "0xde9787",
65+
"gasUsed": "0xc2ae",
66+
"effectiveGasPrice": "0xf0929",
67+
"from": "0x45d6450fc59a6f8d9c753126ce1eff6fa4d7e0fb",
68+
"to": "0x73ba7d784d13ec0070a4ea6f49ff57dc007bb48d",
69+
"contractAddress": null,
70+
"l1BaseFeeScalar": "0x44d",
71+
"l1BlobBaseFee": "0xb9942c91c7",
72+
"l1BlobBaseFeeScalar": "0xa118b",
73+
"l1Fee": "0x321f7e44de21",
74+
"l1GasPrice": "0x9ccde0bd1",
75+
"l1GasUsed": "0x68a"
76+
}
77+
],
78+
"libraries": [],
79+
"pending": [],
80+
"returns": {},
81+
"timestamp": 1724943858,
82+
"chain": 84532,
83+
"commit": "a4713a8"
84+
}

0 commit comments

Comments
 (0)