Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
a89eeaa
L2 allocation generation by itself
pahor167 Jan 23, 2025
a5a2b23
Readme added
pahor167 Jan 23, 2025
f5ca74b
update of readme
pahor167 Jan 23, 2025
7b4eb14
AbstractFeeCurrency
pahor167 Jan 27, 2025
c01ce26
Celo smart contracts
pahor167 Jan 27, 2025
7094022
added deploy of celo contracts to devnet
pahor167 Jan 28, 2025
20e4ed9
working without preInitializeOptimismPortalBalance
pahor167 Jan 29, 2025
b87f3ac
CustomGasToken L1 working
pahor167 Jan 29, 2025
f845b89
REVERT LATER - just for testing
pahor167 Jan 29, 2025
10af11b
fix of solidity version
pahor167 Jan 29, 2025
a55e256
Update interface solidity version
jcortejoso Jan 29, 2025
1921e6c
Pahor/genesis generation working deploy from celo2 (#307)
pahor167 Feb 5, 2025
6dbdbad
[Contract Deployment] Split fault proof deployment (#308)
jcortejoso Feb 5, 2025
7800fc0
Celo token permit
pahor167 Feb 6, 2025
780b28f
Dual Guardian mechanism (#302)
m-chrzan Feb 6, 2025
dc37df4
ICeloSuperchainConfig ignored
pahor167 Feb 7, 2025
9526db5
Remove debugging function (#313)
m-chrzan Feb 7, 2025
443e715
Fix Initializable test (#312)
m-chrzan Feb 7, 2025
9c2d99a
Always deal eth to precompiles (#314)
m-chrzan Feb 7, 2025
a5c8cd7
removal of ethereum-optimism/latitude-1
pahor167 Feb 13, 2025
0fee8a7
lint
pahor167 Feb 13, 2025
16389ed
unused import removal
pahor167 Feb 13, 2025
6ae80f5
Snapshots update
pahor167 Feb 13, 2025
17586f9
semver lock
pahor167 Feb 13, 2025
ccefbef
gas tests fixes
pahor167 Feb 13, 2025
49b2f3c
move of semver diff to celo-contracts/v1.8.0
pahor167 Feb 13, 2025
52097b8
removal of debug prints
pahor167 Feb 13, 2025
92817c6
Test cimg base image for fuzz-golang
jcortejoso Feb 13, 2025
f1e399c
Install parallel
jcortejoso Feb 13, 2025
b260a60
Update kona-fpp image
jcortejoso Feb 13, 2025
0bbace5
revert of deal EthToPrecompiles
pahor167 Feb 13, 2025
2fd3968
Merge branch 'pahor/genesisGeneration' of https://github.com/celo-org…
pahor167 Feb 13, 2025
a237bb4
unit test fix
pahor167 Feb 14, 2025
92de609
CeloSuperchainConfig adjustements (#323)
m-chrzan Feb 18, 2025
e18141b
Minor audit fixes (#325)
pahor167 Feb 19, 2025
0687b5a
interfaces check fix
pahor167 Feb 19, 2025
bc26f21
lint fixes
pahor167 Feb 19, 2025
3e62ce5
Implement CeloSuperchainConfig standalone, without inheritance (#326)
m-chrzan Feb 19, 2025
35e362e
Use CeloSuperchainConfig in DelayedWETH (#329)
m-chrzan Feb 19, 2025
99968a4
build fix
pahor167 Feb 19, 2025
73d169c
Remove usage of stateful pause check (#332)
m-chrzan Feb 20, 2025
ddf1848
Celo readme
pahor167 Feb 21, 2025
6c77c72
Merge branch 'pahor/genesisGeneration' of https://github.com/celo-org…
pahor167 Feb 21, 2025
d35e019
readme fix
pahor167 Feb 21, 2025
1e15ed5
removed virtual tag from paused function (#335)
soloseng Feb 25, 2025
71b1419
Move constants inside contracts (#336)
m-chrzan Feb 27, 2025
694b08e
Add ProxyAdmin owner verification to deploy/genesis scripts (#345)
m-chrzan Mar 7, 2025
12ee711
Provide external SuperchainConfig in deploy config (#352)
m-chrzan Mar 12, 2025
cec853b
Update CeloTokenL1.sol
martinvol Mar 13, 2025
d46f994
Rolled back change by accident
martinvol Mar 13, 2025
d8c2369
Fix Celo token (#358)
martinvol Mar 13, 2025
b73cab5
L1 verification
pahor167 Mar 25, 2025
0eaeae4
ignore immurable values
pahor167 Mar 26, 2025
97d131d
immutables fix
pahor167 Mar 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 20 additions & 18 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ commands:

jobs:
cannon-go-lint-and-test:
machine: true
resource_class: ethereum-optimism/latitude-1
docker:
- image: <<pipeline.parameters.ci_builder_image>>
parameters:
skip_slow_tests:
type: boolean
Expand Down Expand Up @@ -240,8 +240,8 @@ jobs:
working_directory: cannon/mipsevm/tests/open_mips_tests

contracts-bedrock-build:
machine: true
resource_class: ethereum-optimism/latitude-1
docker:
- image: <<pipeline.parameters.ci_builder_image>>
parameters:
skip_pattern:
description: Glob pattern of tests to skip
Expand Down Expand Up @@ -751,23 +751,29 @@ jobs:
description: should load in foundry artifacts
type: boolean
default: false
machine: true
resource_class: ethereum-optimism/latitude-1
docker:
- image: <<pipeline.parameters.ci_builder_image>>
steps:
- checkout
- check-changed:
patterns: "<<parameters.package_name>>"
- attach_workspace:
at: "."
if: ${{ uses_artifacts }}
- run:
name: Install dependencies
command: |
apt update
apt install -y parallel
working_directory: .
- run:
name: Fuzz
command: make fuzz
working_directory: "<<parameters.package_name>>"

go-lint:
machine: true
resource_class: ethereum-optimism/latitude-1
docker:
- image: <<pipeline.parameters.ci_builder_image>>
steps:
- checkout
- run:
Expand Down Expand Up @@ -834,8 +840,8 @@ jobs:
when: always

go-test:
machine: true
resource_class: ethereum-optimism/latitude-1
docker:
- image: <<pipeline.parameters.ci_builder_image>>
steps:
- checkout
- attach_workspace:
Expand Down Expand Up @@ -893,16 +899,12 @@ jobs:
description: Slack user or group to mention when notifying of failures
type: string
default: ""
resource_class:
description: Machine resource class
type: string
default: ethereum-optimism/latitude-1
skip_slow_tests:
description: Indicates that slow tests should be skipped
type: boolean
default: false
machine: true
resource_class: <<parameters.resource_class>>
docker:
- image: <<pipeline.parameters.ci_builder_image>>
steps:
- checkout
- attach_workspace:
Expand Down Expand Up @@ -949,8 +951,8 @@ jobs:
mentions: "<<parameters.mentions>>"

cannon-prestate:
machine: true
resource_class: ethereum-optimism/latitude-1
docker:
- image: <<pipeline.parameters.ci_builder_image>>
steps:
- checkout
- run:
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include celo.mk

COMPOSEFLAGS=-d
ITESTS_L2_HOST=http://localhost:9545
BEDROCK_TAGS_REMOTE?=origin
Expand Down
73 changes: 73 additions & 0 deletions README_CELO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Celo devnet + mainnet deployment scripts

## Generate Devnet L1 and L2 Allocations

1. Run
```bash
make devnet-clean && DEVNET_CELO=true SAFE_AS_OWNER=true make devnet-up
```
This will generate and run full devnet in local docker
2. Copy `.devnet/genesis-L1.json`, `.devnet/genesis-L2.json`, and `.devnet/rollup.json` to the `.devnet` folder in other branch
3. Run on other branch
```bash
DEVNET_CELO=true SAFE_AS_OWNER=true make devnet-up
```
4. To double check that everything is working correctly, search for

``` L1 genesis already generated.```

``` L2 genesis and rollup configs already generated.```

in logs


## Generate L2 Allocations for real network (Alfajores, Baklava, Mainnet)

### Environment Variables

- `CELO_MONOREPO_DIR`
Root directory of the monorepo. Defaults to current directory.

- **Directory Paths**
- `CELO_OP_NODE_DIR`: `$(CELO_MONOREPO_DIR)/op-node`
- `CELO_DEVNET_CONFIG_PATH`: `packages/contracts-bedrock/deploy-config/devnetL1.json`
- `CELO_L2_ALLOCS_PATH`: `packages/contracts-bedrock/.devnet/allocs-l2.json`
- `CELO_ADDRESSES_JSON_PATH`: `packages/contracts-bedrock/.devnet/addresses.json`
- `CELO_GENESIS_L2_PATH`: `packages/contracts-bedrock/.devnet/genesis-l2.json`
- `CELO_ROLLUP_CONFIG_PATH`: `packages/contracts-bedrock/.devnet/rollup.json`
- `CELO_CONTRACTS_BEDROCK_DIR`: `packages/contracts-bedrock`

- **RPC**
- `CELO_L1_RPC_URL`: `http://localhost:8545`

- **Deployment**
- `CELO_DEPLOYMENT_CONTEXT` (default: `devnetL1`)
- `CELO_L1_CHAIN_ID` (default: `1`)

- **Derived Paths**
- `CELO_DEPLOY_CONFIG_PATH`: `deploy-config/$(CELO_DEPLOYMENT_CONTEXT).json`
- `CELO_STATE_DUMP_PATH`: `deployments/l2-allocs.json`
- `CELO_CONTRACT_ADDRESSES_PATH`: `deployments/$(CELO_L1_CHAIN_ID)-deploy.json`

## Makefile Targets

- **generate_l2_allocs**
- Runs Forge script `L2Genesis` with necessary paths
- Generates and saves l2 allocations to `$(CELO_STATE_DUMP_PATH)`

## Usage

1. **Create L1 deploy script**
It is necessary to add L1 deployment file into `deployments` directory with the name convetion `$(CELO_L1_CHAIN_ID)-deploy.json` eg `1-deploy.json` (example of such file https://storage.googleapis.com/cel2-rollup-files/baklava/deployment-l1.json)
1. **Set Environment Variables**

```bash
export CELO_MONOREPO_DIR=/path/to/monorepo
export CELO_DEPLOYMENT_CONTEXT=devnetL1
export CELO_L1_CHAIN_ID=1
```
1. **Generate L2 Allocations**

```bash
make generate_l2_allocs
```
11 changes: 10 additions & 1 deletion bedrock-devnet/devnet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
DEVNET_L2OO = os.getenv('DEVNET_L2OO') == "true"
DEVNET_ALTDA = os.getenv('DEVNET_ALTDA') == "true"
GENERIC_ALTDA = os.getenv('GENERIC_ALTDA') == "true"

DEVNET_CELO = os.getenv('DEVNET_CELO') == "true"
class Bunch:
def __init__(self, **kwds):
self.__dict__.update(kwds)
Expand Down Expand Up @@ -129,6 +129,15 @@ def init_devnet_l1_deploy_config(paths, update_timestamp=False):
deploy_config['useAltDA'] = True
if GENERIC_ALTDA:
deploy_config['daCommitmentType'] = "GenericCommitment"
if DEVNET_CELO:
deploy_config['useFaultProofs'] = True
deploy_config['useCustomGasToken'] = True
deploy_config['gasPriceOracleBlobBaseFeeScalar'] = 0
deploy_config['gasPriceOracleBaseFeeScalar'] = 0
deploy_config['deployCeloContracts'] = True
# Usage of the zero address in combination of the useCustomGasToken == True
# will deploy a new contract
deploy_config['customGasTokenAddress'] = "0x0000000000000000000000000000000000000000"
write_json(paths.devnet_config_path, deploy_config)

def devnet_l1_allocs(paths):
Expand Down
62 changes: 62 additions & 0 deletions celo.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# ================================
# Variables Configuration
# ================================

# Default to current directory if CELO_MONOREPO_DIR is not set
CELO_MONOREPO_DIR ?= $(shell pwd)

# Directory Paths
CELO_OP_NODE_DIR := $(CELO_MONOREPO_DIR)/op-node
CELO_DEVNET_CONFIG_PATH := $(CELO_MONOREPO_DIR)/packages/contracts-bedrock/deploy-config/devnetL1.json
CELO_L2_ALLOCS_PATH := $(CELO_MONOREPO_DIR)/packages/contracts-bedrock/.devnet/allocs-l2.json
CELO_ADDRESSES_JSON_PATH := $(CELO_MONOREPO_DIR)/packages/contracts-bedrock/.devnet/addresses.json
CELO_GENESIS_L2_PATH := $(CELO_MONOREPO_DIR)/packages/contracts-bedrock/.devnet/genesis-l2.json
CELO_ROLLUP_CONFIG_PATH := $(CELO_MONOREPO_DIR)/packages/contracts-bedrock/.devnet/rollup.json
CELO_CONTRACTS_BEDROCK_DIR := $(CELO_MONOREPO_DIR)/packages/contracts-bedrock

# RPC Configuration
CELO_L1_RPC_URL := http://localhost:8545

# Deployment Configuration
CELO_DEPLOYMENT_CONTEXT ?= devnetL1
CELO_L1_CHAIN_ID ?= 1

# Derived Paths based on Deployment Context and Chain ID
CELO_DEPLOY_CONFIG_PATH := $(CELO_CONTRACTS_BEDROCK_DIR)/deploy-config/$(CELO_DEPLOYMENT_CONTEXT).json
CELO_STATE_DUMP_PATH := $(CELO_CONTRACTS_BEDROCK_DIR)/deployments/l2-allocs.json
CELO_CONTRACT_ADDRESSES_PATH := $(CELO_CONTRACTS_BEDROCK_DIR)/deployments/$(CELO_L1_CHAIN_ID)-deploy.json

# ================================
# Phony Targets
# ================================
.PHONY: run_Genesis generate_l2_allocs deploy clean help

# ================================
# generate_l2_allocs Target
# ================================
generate_l2_allocs:
@# Validate Environment Variables
@if [ -z "$(CELO_DEPLOYMENT_CONTEXT)" ]; then \
echo "Error: CELO_DEPLOYMENT_CONTEXT is not set."; \
echo "Set it using 'make deploy CELO_DEPLOYMENT_CONTEXT=<context>' or export it as an environment variable."; \
exit 1; \
fi
@if [ -z "$(CELO_L1_CHAIN_ID)" ]; then \
echo "Error: CELO_L1_CHAIN_ID is not set."; \
echo "Set it using 'make deploy CELO_L1_CHAIN_ID=<chain_id>' or export it as an environment variable."; \
exit 1; \
fi

@echo "Running Forge Deployment Script..."

# Ensure deployment directory exists
@mkdir -p $(CELO_CONTRACTS_BEDROCK_DIR)/deployments

# Run Forge script with absolute paths
@cd $(CELO_CONTRACTS_BEDROCK_DIR) && \
DEPLOY_CONFIG_PATH=$(CELO_DEPLOY_CONFIG_PATH) \
STATE_DUMP_PATH=$(CELO_STATE_DUMP_PATH) \
CONTRACT_ADDRESSES_PATH=$(CELO_CONTRACT_ADDRESSES_PATH) \
forge script scripts/L2Genesis.s.sol:L2Genesis --sig 'runWithStateDump()'

@echo "Saved L2 allocations to $(CELO_STATE_DUMP_PATH)"
17 changes: 14 additions & 3 deletions op-chain-ops/genesis/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,11 @@ var _ ConfigChecker = (*GasTokenDeployConfig)(nil)

func (d *GasTokenDeployConfig) Check(log log.Logger) error {
if d.UseCustomGasToken {
if d.CustomGasTokenAddress == (common.Address{}) {
return fmt.Errorf("%w: CustomGasTokenAddress cannot be address(0)", ErrInvalidDeployConfig)
}
// NOTE: we are using the address(0) as an instruction to deploy the L1 token,
// so this deploy-config validation has to be disabled
// if d.CustomGasTokenAddress == (common.Address{}) {
// return fmt.Errorf("%w: CustomGasTokenAddress cannot be address(0)", ErrInvalidDeployConfig)
// }
log.Info("Using custom gas token", "address", d.CustomGasTokenAddress)
}
return nil
Expand Down Expand Up @@ -905,6 +907,15 @@ type DeployConfig struct {

// Legacy, ignored, here for strict-JSON decoding to be accepted.
LegacyDeployConfig `evm:"-"`

// DeployCeloContracts indicates whether to deploy Celo contracts.
DeployCeloContracts bool `json:"deployCeloContracts"`

// Address of the external SuperchainConfig that CeloSuperchainConfig should point to.
ExternalSuperchainConfig common.Address `json:"externalSuperchainConfig"`

// Used to validate the ProxyAdmin owner address.
ProxyAdminOwnerIsMultisig bool `json:"proxyAdminOwnerIsMultisig"`
}

// Copy will deeply copy the DeployConfig. This does a JSON roundtrip to copy
Expand Down
2 changes: 1 addition & 1 deletion ops/docker/proofs-tools/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ARG CHALLENGER_VERSION
ARG KONA_VERSION

FROM --platform=$BUILDPLATFORM us-docker.pkg.dev/oplabs-tools-artifacts/images/op-challenger:$CHALLENGER_VERSION AS challenger
FROM --platform=$BUILDPLATFORM ghcr.io/anton-rs/kona/kona-fpp-asterisc:$KONA_VERSION AS kona
FROM --platform=$BUILDPLATFORM ghcr.io/op-rs/kona/kona-fpp-asterisc:$KONA_VERSION AS kona

FROM --platform=$BUILDPLATFORM ubuntu:22.04 AS proofs-tools
RUN apt-get update && apt-get install -y --no-install-recommends musl openssl ca-certificates
Expand Down
10 changes: 5 additions & 5 deletions packages/contracts-bedrock/.gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ GasBenchMark_L1Block_SetValuesEcotone:test_setL1BlockValuesEcotone_benchmark() (
GasBenchMark_L1Block_SetValuesEcotone_Warm:test_setL1BlockValuesEcotone_benchmark() (gas: 7597)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 369280)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_1() (gas: 2967420)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_0() (gas: 564398)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_1() (gas: 4076613)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_0() (gas: 564413)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_1() (gas: 4076628)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_0() (gas: 467098)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_1() (gas: 3512802)
GasBenchMark_L1StandardBridge_Finalize:test_finalizeETHWithdrawal_benchmark() (gas: 72664)
GasBenchMark_L2OutputOracle:test_proposeL2Output_benchmark() (gas: 92973)
GasBenchMark_L1StandardBridge_Finalize:test_finalizeETHWithdrawal_benchmark() (gas: 85481)
GasBenchMark_L2OutputOracle:test_proposeL2Output_benchmark() (gas: 92997)
GasBenchMark_OptimismPortal:test_depositTransaction_benchmark() (gas: 68422)
GasBenchMark_OptimismPortal:test_depositTransaction_benchmark_1() (gas: 68986)
GasBenchMark_OptimismPortal:test_proveWithdrawalTransaction_benchmark() (gas: 155610)
GasBenchMark_OptimismPortal:test_proveWithdrawalTransaction_benchmark() (gas: 169989)
25 changes: 25 additions & 0 deletions packages/contracts-bedrock/Celo.README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Celo Diff

- Since we are using the CustomGasFeature (which is currently being deprecated from OP), we cannot use the OP Deployer to deploy contracts. Instead, we need to deploy contracts using the `Deploy.s.sol` script.
- The `Deploy.s.sol` script is not from the original 1.8.0 smart contract branch, as it was likely never used for testnet deployment (due to the use of Anvil cheat codes). We ported the `Deploy.s.sol` script from our Celo client branch, specifically based on version 1.9.3.

## L1 Deploy Script Notes (`Deploy.s.sol`)
- `CeloTokenL1` is deployed with a balance of 1 billion CELO and is used as the Custom Gas token.
- Due to FaultProofs, we are using `OptimismPortal2` rather than `OptimismPortal`.
- Since we are using the Custom Gas Token feature with a preexisting balance, we use a storage setter design pattern (deploying a different implementation to the OptimismPortal proxy during the transition period), which allows us to set a specific storage slot to the desired value.

## L2 Deploy Script Notes (`L2Genesis.s.sol`)
- The required Celo core contracts were added to `L2Genesis.s.sol` for devnet deployment. For mainnet, this step is skipped, and we instead rely on the blockchain migration tool for the entire blockchain state.

## CeloSuperchainConfig
- The Superchain has the power to pause/unpause the Celo network. To enable us to unpause the network when necessary, we introduced `CeloSuperchainConfig`, which adds a Guardian account with the same permissions as the Superchain. This allows us to pause/unpause the network in case of an emergency.

## AbstractFeeCurrency
- We added `AbstractFeeCurrency` to the bridged ERC20 token (specifically, `OptimismMintableERC20.sol`), which implements credit and debit functions. This enhancement allows us to whitelist and use any natively bridged token as the native fee currency.

# Release Mainnet Process

1. L1 smart contracts are deployed using the `Deploy.s.sol` script.
2. The L2 Genesis is created either by running `make generate_l2_allocs` or by manually using the `L2Genesis.s.sol` script (which creates the L2 allocs file).
3. The L2 allocs file is fed into the blockchain migration tool.
4. The sequencer and nodes are started.
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,7 @@
"daChallengeWindow": 16,
"daResolveWindow": 16,
"daBondSize": 1000000,
"daResolverRefundPercentage": 0
"daResolverRefundPercentage": 0,
"proxyAdminOwnerIsMultisig": false,
"externalSuperchainConfig": "0x0000000000000000000000000000000000000000"
}
3 changes: 2 additions & 1 deletion packages/contracts-bedrock/deploy-config/hardhat.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,6 @@
"daChallengeWindow": 100,
"daResolveWindow": 100,
"daBondSize": 1000,
"daResolverRefundPercentage": 50
"daResolverRefundPercentage": 50,
"proxyAdminOwnerIsMultisig": false
}
Loading