Skip to content

Commit 7947e09

Browse files
authored
Merge pull request #17 from syscoin/draft-v29
Draft v29
2 parents ced6f04 + f135233 commit 7947e09

22 files changed

+214
-1149
lines changed

.github/workflows/dead-links.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ jobs:
1919
- name: Find and check markdown files
2020
run: |
2121
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
22-
find . -type f -name "*.md" ! -path "*/node_modules/*" ! -path "*/openzeppelin*" ! -path "*/murky/*" -exec lychee --max-concurrency 1 --cache --retry-wait-time 10 --exclude-path .lycheeignore --github-token $GITHUB_TOKEN {} +
22+
find . -type f -name "*.md" ! -path "*/node_modules/*" ! -path "*/openzeppelin*" ! -path "*/murky/*" -exec lychee --accept 200,201,301,302,403,429 --max-retries 5 --max-concurrency 1 --cache --retry-wait-time 30 --exclude-path .lycheeignore --github-token "$GITHUB_TOKEN" {} +

.github/workflows/l1-contracts-foundry-ci.yaml

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,35 @@ jobs:
114114
# First we need to deploy the ecosystem contracts
115115
run: forge script ./deploy-scripts/DeployL1CoreContracts.s.sol --ffi --rpc-url $ANVIL_RPC_URL --broadcast --private-key $ANVIL_PRIVATE_KEY --skip '*/l1-contracts/contracts/*'
116116

117-
- name: Run DeployL1 script
117+
- name: Read bridgehub proxy address
118+
id: read-bridgehub
118119
working-directory: ./l1-contracts
119-
# l1-contracts are skipped because we don't want to recompile Bridgehub with a high optimizer-runs value.
120-
# Otherwise, the Bridgehub contract size would be too large.
121-
run: forge script ./deploy-scripts/DeployL1.s.sol --ffi --rpc-url $ANVIL_RPC_URL --broadcast --private-key $ANVIL_PRIVATE_KEY --skip '*/l1-contracts/contracts/*'
120+
run: |
121+
# Extract bridgehub_proxy_addr allowing leading whitespace
122+
BRIDGEHUB=$(
123+
sed -nE 's/^[[:space:]]*bridgehub_proxy_addr[[:space:]]*=[[:space:]]*"([^"]+)".*/\1/p' \
124+
./script-out/output-deploy-l1.toml | head -n1
125+
)
126+
127+
echo "Parsed bridgehub_proxy_addr: $BRIDGEHUB"
128+
129+
if [[ -z "$BRIDGEHUB" || ! "$BRIDGEHUB" =~ ^0x[0-9a-fA-F]{40}$ ]]; then
130+
echo "❌ Failed to parse a valid bridgehub address"
131+
exit 1
132+
fi
133+
134+
echo "BRIDGEHUB=$BRIDGEHUB" >> $GITHUB_ENV
135+
136+
- name: Run DeployCTM script with bridgehub
137+
working-directory: ./l1-contracts
138+
run: |
139+
forge script ./deploy-scripts/DeployCTM.s.sol \
140+
--ffi \
141+
--rpc-url $ANVIL_RPC_URL \
142+
--broadcast \
143+
--private-key $ANVIL_PRIVATE_KEY \
144+
--sig "runWithBridgehub(address,bool)" $BRIDGEHUB "false" \
145+
--skip '*/l1-contracts/contracts/*'
122146
123147
- name: Run DeployErc20 script
124148
working-directory: ./l1-contracts

.solhintignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ l1-contracts/node_modules
99
l1-contracts/contracts/dev-contracts
1010
l1-contracts/test
1111
l1-contracts/deploy-scripts
12-
!l1-contracts/deploy-scripts/DeployL1.s.sol
12+
!l1-contracts/deploy-scripts/DeployCTM.s.sol
1313
!l1-contracts/deploy-scripts/DeployUtils.s.sol
1414

1515
# l1-contracts-foundry

l1-contracts/deploy-scripts/DeployL1.s.sol renamed to l1-contracts/deploy-scripts/DeployCTM.s.sol

Lines changed: 72 additions & 181 deletions
Large diffs are not rendered by default.

l1-contracts/deploy-scripts/DeployL1CoreContracts.s.sol

Lines changed: 7 additions & 440 deletions
Large diffs are not rendered by default.

l1-contracts/deploy-scripts/DeployUtils.s.sol

Lines changed: 9 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import {Diamond} from "contracts/state-transition/libraries/Diamond.sol";
1212
import {InitializeDataNewChain as DiamondInitializeDataNewChain} from "contracts/state-transition/chain-interfaces/IDiamondInit.sol";
1313
import {FeeParams, PubdataPricingMode} from "contracts/state-transition/chain-deps/ZKChainStorage.sol";
1414
import {Create2AndTransfer} from "./Create2AndTransfer.sol";
15-
1615
import {Create2FactoryUtils} from "./Create2FactoryUtils.s.sol";
16+
import {L2ContractHelper} from "contracts/common/l2-helpers/L2ContractHelper.sol";
1717

1818
// solhint-disable-next-line gas-struct-packing
1919
struct DeployedAddresses {
@@ -188,67 +188,6 @@ abstract contract DeployUtils is Create2FactoryUtils {
188188
config.tokens.tokenWethAddress = toml.readAddress("$.tokens.token_weth_address");
189189
}
190190

191-
function initializeConfigIfEcosystemDeployedLocally(string memory configPath) internal virtual {
192-
string memory toml = vm.readFile(configPath);
193-
194-
// Bridgehub Related
195-
addresses.bridgehub.bridgehubImplementation = toml.readAddress(
196-
".deployed_addresses.bridgehub.bridgehub_implementation_addr"
197-
);
198-
addresses.bridgehub.bridgehubProxy = toml.readAddress(".deployed_addresses.bridgehub.bridgehub_proxy_addr");
199-
addresses.bridgehub.ctmDeploymentTrackerImplementation = toml.readAddress(
200-
".deployed_addresses.bridgehub.ctm_deployment_tracker_implementation_addr"
201-
);
202-
addresses.bridgehub.ctmDeploymentTrackerProxy = toml.readAddress(
203-
".deployed_addresses.bridgehub.ctm_deployment_tracker_proxy_addr"
204-
);
205-
addresses.bridgehub.chainAssetHandlerImplementation = toml.readAddress(
206-
".deployed_addresses.bridgehub.chain_asset_handler_implementation_addr"
207-
);
208-
addresses.bridgehub.chainAssetHandlerProxy = toml.readAddress(
209-
".deployed_addresses.bridgehub.chain_asset_handler_proxy_addr"
210-
);
211-
addresses.bridgehub.messageRootImplementation = toml.readAddress(
212-
".deployed_addresses.bridgehub.message_root_implementation_addr"
213-
);
214-
addresses.bridgehub.messageRootProxy = toml.readAddress(
215-
".deployed_addresses.bridgehub.message_root_proxy_addr"
216-
);
217-
218-
// Bridges
219-
addresses.bridges.erc20BridgeImplementation = toml.readAddress(
220-
".deployed_addresses.bridges.erc20_bridge_implementation_addr"
221-
);
222-
addresses.bridges.erc20BridgeProxy = toml.readAddress(".deployed_addresses.bridges.erc20_bridge_proxy_addr");
223-
addresses.bridges.l1NullifierImplementation = toml.readAddress(
224-
".deployed_addresses.bridges.l1_nullifier_implementation_addr"
225-
);
226-
addresses.bridges.l1NullifierProxy = toml.readAddress(".deployed_addresses.bridges.l1_nullifier_proxy_addr");
227-
addresses.bridges.l1AssetRouterImplementation = toml.readAddress(
228-
".deployed_addresses.bridges.shared_bridge_implementation_addr"
229-
);
230-
addresses.bridges.l1AssetRouterProxy = toml.readAddress(".deployed_addresses.bridges.shared_bridge_proxy_addr");
231-
232-
// Other Important Deployed Addresses
233-
addresses.governance = toml.readAddress(".deployed_addresses.governance_addr");
234-
addresses.transparentProxyAdmin = toml.readAddress(".deployed_addresses.transparent_proxy_admin_addr");
235-
addresses.chainAdmin = toml.readAddress(".deployed_addresses.chain_admin");
236-
addresses.daAddresses.rollupDAManager = toml.readAddress(".deployed_addresses.l1_rollup_da_manager");
237-
addresses.daAddresses.l1RollupDAValidator = toml.readAddress(".deployed_addresses.rollup_l1_da_validator_addr");
238-
addresses.daAddresses.noDAValidiumL1DAValidator = toml.readAddress(
239-
".deployed_addresses.no_da_validium_l1_validator_addr"
240-
);
241-
addresses.daAddresses.availL1DAValidator = toml.readAddress(".deployed_addresses.avail_l1_da_validator_addr");
242-
addresses.vaults.l1NativeTokenVaultProxy = toml.readAddress(".deployed_addresses.native_token_vault_addr");
243-
config.contracts.multicall3Addr = toml.readAddress(".multicall3_addr");
244-
245-
if (vm.keyExistsToml(toml, "$.deployed_addresses.state_transition.state_transition_proxy_addr")) {
246-
addresses.stateTransition.chainTypeManagerProxy = toml.readAddress(
247-
".deployed_addresses.state_transition.state_transition_proxy_addr"
248-
);
249-
}
250-
}
251-
252191
function deployStateTransitionDiamondFacets() internal {
253192
addresses.stateTransition.executorFacet = deploySimpleContract("ExecutorFacet", false);
254193
addresses.stateTransition.adminFacet = deploySimpleContract("AdminFacet", false);
@@ -519,6 +458,14 @@ abstract contract DeployUtils is Create2FactoryUtils {
519458
}
520459
}
521460

461+
function calculateExpectedL2Address(string memory contractName) internal returns (address) {
462+
return Utils.getL2AddressViaCreate2Factory(bytes32(0), getL2BytecodeHash(contractName), hex"");
463+
}
464+
465+
function getL2BytecodeHash(string memory contractName) public view virtual returns (bytes32) {
466+
return L2ContractHelper.hashL2Bytecode(getCreationCode(contractName, true));
467+
}
468+
522469
function getInitializeCalldata(
523470
string memory contractName,
524471
bool isZKBytecode

0 commit comments

Comments
 (0)