Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(shared bridge): preparation for shared bridge migration (server) #1012

Merged
merged 43 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
ea0b15a
Diff reducing commit
ly0va Jan 23, 2024
6c1e433
Merge branch 'main' into lyova-reduce-kl-diff
ly0va Jan 23, 2024
e4d9888
Fixes
ly0va Jan 23, 2024
613987e
Add dummy configs
ly0va Jan 24, 2024
1d835be
Fix tests
ly0va Jan 24, 2024
bd49a6b
Spelling
ly0va Jan 24, 2024
bb7c070
Integrate new validator timelock
ly0va Jan 24, 2024
78467e0
Apply some review suggestions
ly0va Jan 25, 2024
591308f
Fix
ly0va Jan 25, 2024
2e922be
More improvements
ly0va Jan 25, 2024
150499a
Fix tests
ly0va Jan 30, 2024
aca3788
Merge remote-tracking branch 'origin/main' into lyova-reduce-kl-diff
ly0va Jan 30, 2024
6775a93
Fix compilation
ly0va Jan 30, 2024
b78178e
Fix protobuf configs
ly0va Jan 30, 2024
467a758
Fix protobuf
ly0va Jan 30, 2024
3793f78
Merge remote-tracking branch 'origin/main' into lyova-reduce-kl-diff
ly0va Jan 31, 2024
4104ab4
Fix upgrade test
ly0va Feb 1, 2024
6867f55
Add unit test
ly0va Feb 1, 2024
e49efae
Review suggestions
ly0va Feb 1, 2024
c278885
More fixes
ly0va Feb 1, 2024
4deaead
More comments
ly0va Feb 2, 2024
288b569
Fix EN backward-compatibility
ly0va Feb 5, 2024
674d101
Minor fixes
ly0va Feb 8, 2024
b04051f
Refactor eth_watch a bit
ly0va Feb 8, 2024
966283c
Wait for setChainId during genesis
ly0va Feb 9, 2024
d0356a2
Fix eth-watch test
ly0va Feb 9, 2024
3eeb4ef
Merge remote-tracking branch 'origin/main' into lyova-reduce-kl-diff
ly0va Feb 9, 2024
01d3ebf
Fix sqlx
ly0va Feb 9, 2024
98f63c4
Fix after merge
ly0va Feb 9, 2024
6dc68f1
cargo-deny fix
ly0va Feb 9, 2024
c30bb70
Fix nits
ly0va Feb 9, 2024
16936ad
Fix more nits
ly0va Feb 9, 2024
3aeeb91
Revert "Refactor eth_watch a bit"
ly0va Feb 9, 2024
e6569e5
Refactor set_chain_id event processing
ly0va Feb 9, 2024
5915873
Revert eth_watch tests
ly0va Feb 9, 2024
1782671
Remove extra argument in eth_watch client
ly0va Feb 9, 2024
edc5be5
Merge branch 'main' into lyova-reduce-kl-diff
benceharomi Feb 12, 2024
527f040
get_transaction_param_type function
benceharomi Feb 12, 2024
d606c93
Merge branch 'main' into lyova-reduce-kl-diff
benceharomi Feb 16, 2024
834d22e
nit: batch number added to log messages
benceharomi Feb 16, 2024
0640d4b
nit: anyhow::ensure instead of assert_eq
benceharomi Feb 16, 2024
7f896c7
lint fix
benceharomi Feb 16, 2024
f61c596
Resolve remaining nits
ly0va Feb 20, 2024
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
4 changes: 4 additions & 0 deletions checks-config/era.dic
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,10 @@ prode
StorageBatchInfo
CommitBatchInfo
IExecutor
SetChainId
setChainId
SetChainIdUpgrade
state_transition_manager_contract

// Names
Vyper
Expand Down
5 changes: 5 additions & 0 deletions core/bin/external_node/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const BYTES_IN_MEGABYTE: usize = 1_024 * 1_024;
/// This part of the external node config is fetched directly from the main node.
#[derive(Debug, Deserialize, Clone, PartialEq)]
pub struct RemoteENConfig {
pub bridgehub_proxy_addr: Option<Address>,
pub diamond_proxy_addr: Address,
pub l1_erc20_bridge_proxy_addr: Address,
pub l2_erc20_bridge_addr: Address,
Expand All @@ -46,6 +47,8 @@ impl RemoteENConfig {
.get_testnet_paymaster()
.await
.context("Failed to fetch paymaster")?;
// In case EN is connected to the old server version without `get_bridgehub_contract` method.
let bridgehub_proxy_addr = client.get_bridgehub_contract().await.ok().flatten();
let diamond_proxy_addr = client
.get_main_contract()
.await
Expand All @@ -67,6 +70,7 @@ impl RemoteENConfig {
);

Ok(Self {
bridgehub_proxy_addr,
diamond_proxy_addr,
l2_testnet_paymaster_addr,
l1_erc20_bridge_proxy_addr: bridges.l1_erc20_default_bridge,
Expand Down Expand Up @@ -549,6 +553,7 @@ impl From<ExternalNodeConfig> for InternalApiConfig {
l1_weth_bridge: config.remote.l1_weth_bridge_proxy_addr,
l2_weth_bridge: config.remote.l2_weth_bridge_addr,
},
bridgehub_proxy_addr: config.remote.bridgehub_proxy_addr,
diamond_proxy_addr: config.remote.diamond_proxy_addr,
l2_testnet_paymaster_addr: config.remote.l2_testnet_paymaster_addr,
req_entities_limit: config.optional.req_entities_limit,
Expand Down
5 changes: 5 additions & 0 deletions core/bin/zksync_server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ struct Cli {
/// Generate genesis block for the first contract deployment using temporary DB.
#[arg(long)]
genesis: bool,
/// Wait for the `setChainId` event during genesis.
/// If `--genesis` is not set, this flag is ignored.
#[arg(long)]
set_chain_id: bool,
ly0va marked this conversation as resolved.
Show resolved Hide resolved
/// Rebuild tree.
#[arg(long)]
rebuild_tree: bool,
Expand Down Expand Up @@ -142,6 +146,7 @@ async fn main() -> anyhow::Result<()> {
&network,
&contracts,
&eth_client.web3_url,
opt.set_chain_id,
)
.await
.context("genesis_init")?;
Expand Down
12 changes: 12 additions & 0 deletions core/lib/config/src/configs/contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ pub struct ContractsConfig {
pub fri_recursion_leaf_level_vk_hash: H256,
pub prover_at_genesis: ProverAtGenesis,
pub snark_wrapper_vk_hash: H256,

// These contracts will be used after shared bridge integration.
pub bridgehub_proxy_addr: Option<Address>,
pub bridgehub_impl_addr: Option<Address>,
pub state_transition_proxy_addr: Option<Address>,
pub state_transition_impl_addr: Option<Address>,
pub transparent_proxy_admin_addr: Option<Address>,
}

impl ContractsConfig {
Expand All @@ -52,6 +59,7 @@ impl ContractsConfig {
mailbox_facet_addr: Address::repeat_byte(0x01),
executor_facet_addr: Address::repeat_byte(0x02),
admin_facet_addr: Address::repeat_byte(0x03),
transparent_proxy_admin_addr: Some(Address::repeat_byte(0x04)),
getters_facet_addr: Address::repeat_byte(0x05),
verifier_addr: Address::repeat_byte(0x06),
diamond_init_addr: Address::repeat_byte(0x07),
Expand All @@ -77,6 +85,10 @@ impl ContractsConfig {
governance_addr: Address::repeat_byte(0x13),
prover_at_genesis: ProverAtGenesis::Fri,
snark_wrapper_vk_hash: H256::repeat_byte(0x09),
bridgehub_proxy_addr: Some(Address::repeat_byte(0x14)),
bridgehub_impl_addr: Some(Address::repeat_byte(0x15)),
state_transition_proxy_addr: Some(Address::repeat_byte(0x16)),
state_transition_impl_addr: Some(Address::repeat_byte(0x17)),
}
}
}
5 changes: 5 additions & 0 deletions core/lib/config/src/testonly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,11 @@ impl RandomConfig for configs::ContractsConfig {
fri_recursion_leaf_level_vk_hash: g.gen(),
prover_at_genesis: g.gen(),
snark_wrapper_vk_hash: g.gen(),
bridgehub_impl_addr: g.gen(),
bridgehub_proxy_addr: g.gen(),
state_transition_proxy_addr: g.gen(),
state_transition_impl_addr: g.gen(),
transparent_proxy_admin_addr: g.gen(),
}
}
}
Expand Down
Loading
Loading