Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions core/bin/external_node/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ pub(crate) struct RemoteENConfig {
pub l2_weth_bridge_addr: Option<Address>,
pub l2_testnet_paymaster_addr: Option<Address>,
pub l2_timestamp_asserter_addr: Option<Address>,
pub l1_wrapped_base_token_store: Option<Address>,
pub base_token_addr: Address,
pub l1_batch_commit_data_generator_mode: L1BatchCommitmentMode,
pub dummy_verifier: bool,
Expand Down Expand Up @@ -195,6 +196,9 @@ impl RemoteENConfig {
l1_bytecodes_supplier_addr: ecosystem_contracts
.as_ref()
.and_then(|a| a.l1_bytecodes_supplier_addr),
l1_wrapped_base_token_store: ecosystem_contracts
.as_ref()
.and_then(|a| a.l1_wrapped_base_token_store),
l1_diamond_proxy_addr,
l2_testnet_paymaster_addr,
l1_erc20_bridge_proxy_addr: bridges.l1_erc20_default_bridge,
Expand Down Expand Up @@ -235,6 +239,7 @@ impl RemoteENConfig {
l2_shared_bridge_addr: Some(Address::repeat_byte(6)),
l2_legacy_shared_bridge_addr: Some(Address::repeat_byte(7)),
l1_batch_commit_data_generator_mode: L1BatchCommitmentMode::Rollup,
l1_wrapped_base_token_store: None,
dummy_verifier: true,
l2_timestamp_asserter_addr: None,
}
Expand Down Expand Up @@ -1477,6 +1482,7 @@ impl From<&ExternalNodeConfig> for InternalApiConfig {
l2_weth_bridge: config.remote.l2_weth_bridge_addr,
},
l1_bytecodes_supplier_addr: config.remote.l1_bytecodes_supplier_addr,
l1_wrapped_base_token_store: config.remote.l1_wrapped_base_token_store,
l1_bridgehub_proxy_addr: config.remote.l1_bridgehub_proxy_addr,
l1_state_transition_proxy_addr: config.remote.l1_state_transition_proxy_addr,
l1_transparent_proxy_admin_addr: config.remote.l1_transparent_proxy_admin_addr,
Expand Down
8 changes: 5 additions & 3 deletions core/lib/config/src/configs/contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ pub struct EcosystemContracts {
pub state_transition_proxy_addr: Address,
pub transparent_proxy_admin_addr: Address,
pub l1_bytecodes_supplier_addr: Option<Address>,
// Note that on the contract side of things this contract is called `L2WrappedBaseTokenStore`,
// while on the server side for consistency with the conventions, where the prefix denotes
// the location of the contracts we call it `l1_wrapped_base_token_store`
pub l1_wrapped_base_token_store: Option<Address>,
}

impl EcosystemContracts {
Expand All @@ -18,6 +22,7 @@ impl EcosystemContracts {
state_transition_proxy_addr: Address::repeat_byte(0x15),
transparent_proxy_admin_addr: Address::repeat_byte(0x15),
l1_bytecodes_supplier_addr: Some(Address::repeat_byte(0x16)),
l1_wrapped_base_token_store: Some(Address::repeat_byte(0x17)),
}
}
}
Expand Down Expand Up @@ -50,8 +55,6 @@ pub struct ContractsConfig {
pub base_token_addr: Option<Address>,
pub l1_base_token_asset_id: Option<H256>,

pub l2_predeployed_wrapped_base_token_address: Option<Address>,

pub chain_admin_addr: Option<Address>,
pub l2_da_validator_addr: Option<Address>,
}
Expand All @@ -76,7 +79,6 @@ impl ContractsConfig {
governance_addr: Address::repeat_byte(0x13),
base_token_addr: Some(Address::repeat_byte(0x14)),
l1_base_token_asset_id: Some(H256::repeat_byte(0x15)),
l2_predeployed_wrapped_base_token_address: Some(Address::repeat_byte(0x1b)),
ecosystem_contracts: Some(EcosystemContracts::for_tests()),
chain_admin_addr: Some(Address::repeat_byte(0x18)),
l2_da_validator_addr: Some(Address::repeat_byte(0x1a)),
Expand Down
2 changes: 1 addition & 1 deletion core/lib/config/src/testonly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ impl Distribution<configs::ContractsConfig> for EncodeDist {
ecosystem_contracts: self.sample(rng),
base_token_addr: self.sample_opt(|| rng.gen()),
l1_base_token_asset_id: self.sample_opt(|| rng.gen()),
l2_predeployed_wrapped_base_token_address: self.sample_opt(|| rng.gen()),
chain_admin_addr: self.sample_opt(|| rng.gen()),
l2_da_validator_addr: self.sample_opt(|| rng.gen()),
}
Expand Down Expand Up @@ -763,6 +762,7 @@ impl Distribution<configs::EcosystemContracts> for EncodeDist {
state_transition_proxy_addr: rng.gen(),
transparent_proxy_admin_addr: rng.gen(),
l1_bytecodes_supplier_addr: rng.gen(),
l1_wrapped_base_token_store: rng.gen(),
}
}
}
Expand Down
19 changes: 18 additions & 1 deletion core/lib/contracts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ const GETTERS_FACET_CONTRACT_FILE: (&str, &str) = (
);

const MULTICALL3_CONTRACT_FILE: (&str, &str) = ("dev-contracts", "Multicall3.sol/Multicall3.json");
const L1_ASSET_ROUTER_FILE: (&str, &str) = (
"bridge/asset-router",
"L1AssetRouter.sol/L1AssetRouter.json",
);
const L2_WRAPPED_BASE_TOKEN_STORE: (&str, &str) = (
"bridge",
"L2WrappedBaseTokenStore.sol/L2WrappedBaseTokenStore.json",
);

const VERIFIER_CONTRACT_FILE: (&str, &str) = ("state-transition", "Verifier.sol/Verifier.json");
const DUAL_VERIFIER_CONTRACT_FILE: (&str, &str) = (
"state-transition/verifiers",
Expand Down Expand Up @@ -180,6 +189,14 @@ pub fn multicall_contract() -> Contract {
load_contract_for_both_compilers(MULTICALL3_CONTRACT_FILE)
}

pub fn l1_asset_router_contract() -> Contract {
load_contract_for_both_compilers(L1_ASSET_ROUTER_FILE)
}

pub fn wrapped_base_token_store_contract() -> Contract {
load_contract_for_both_compilers(L2_WRAPPED_BASE_TOKEN_STORE)
}

pub fn verifier_contract() -> Contract {
let path = format!("{}/{}", FORGE_PATH_PREFIX, DUAL_VERIFIER_CONTRACT_FILE.1);
let zksync_home = home_path();
Expand All @@ -201,7 +218,7 @@ pub fn l1_messenger_contract() -> Contract {
}

pub fn l2_message_root() -> Contract {
load_contract("contracts/l1-contracts/zkout/MessageRoot.sol/MessageRoot.json")
load_contract("contracts/l1-contracts/out/MessageRoot.sol/MessageRoot.json")
}

pub fn l2_rollup_da_validator_bytecode() -> Vec<u8> {
Expand Down

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

This file was deleted.

19 changes: 19 additions & 0 deletions core/lib/dal/src/eth_sender_dal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,25 @@ impl EthSenderDal<'_, '_> {
Ok(count.try_into().unwrap())
}

pub async fn get_unconfirmed_txs_count(&mut self) -> DalResult<usize> {
let count = sqlx::query!(
r#"
SELECT
COUNT(*)
FROM
eth_txs
WHERE
confirmed_eth_tx_history_id IS NULL
"#
)
.instrument("get_unconfirmed_txs_count")
.fetch_one(self.storage)
.await?
.count
.unwrap();
Ok(count.try_into().unwrap())
}

pub async fn get_eth_l1_batches(&mut self) -> sqlx::Result<L1BatchEthSenderStats> {
struct EthTxRow {
number: i64,
Expand Down
13 changes: 9 additions & 4 deletions core/lib/env_config/src/contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ impl FromEnv for EcosystemContracts {
l1_bytecodes_supplier_addr: std::env::var("CONTRACTS_L1_BYTECODE_SUPPLIER_ADDR")?
.parse()
.ok(),
l1_wrapped_base_token_store: std::env::var(
"CONTRACTS_L1_WRAPPED_BASE_TOKEN_STORE_ADDR",
)?
.parse()
.ok(),
})
}
}
Expand Down Expand Up @@ -79,6 +84,9 @@ mod tests {
l1_bytecodes_supplier_addr: Some(addr(
"0x36ea7f92f4c5f433efe15284e99c040110cf6297",
)),
l1_wrapped_base_token_store: Some(addr(
"0x36ea7f92f4c5f433efe15284e99c040110cf6298",
)),
}),
base_token_addr: Some(SHARED_BRIDGE_ETHER_TOKEN_ADDRESS),
l1_base_token_asset_id: Some(
Expand All @@ -87,9 +95,6 @@ mod tests {
)
.unwrap(),
),
l2_predeployed_wrapped_base_token_address: Some(addr(
"0x35ea7f92f4c5f433efe15284e99c040110cf6299",
)),
chain_admin_addr: Some(addr("0xdd6fa5c14e7550b4caf2aa2818d24c69cbc347ff")),
l2_da_validator_addr: Some(addr("0xed6fa5c14e7550b4caf2aa2818d24c69cbc347ff")),
l2_timestamp_asserter_addr: Some(addr("0x0000000000000000000000000000000000000002")),
Expand Down Expand Up @@ -121,7 +126,7 @@ CONTRACTS_STATE_TRANSITION_PROXY_ADDR="0xd90f1c081c6117241624e97cb6147257c3cb209
CONTRACTS_TRANSPARENT_PROXY_ADMIN_ADDR="0xdd6fa5c14e7550b4caf2aa2818d24c69cbc347e5"
CONTRACTS_BASE_TOKEN_ADDR="0x0000000000000000000000000000000000000001"
CONTRACTS_L1_BASE_TOKEN_ASSET_ID="0x0000000000000000000000000000000000000001000000000000000000000000"
CONTRACTS_L2_PREDEPLOYED_WRAPPED_BASE_TOKEN_ADDRESS="0x35ea7f92f4c5f433efe15284e99c040110cf6299"
CONTRACTS_L1_WRAPPED_BASE_TOKEN_STORE_ADDR="0x36ea7f92f4c5f433efe15284e99c040110cf6298"
CONTRACTS_L2_NATIVE_TOKEN_VAULT_PROXY_ADDR="0xfc073319977e314f251eae6ae6be76b0b3baeecf"
CONTRACTS_PREDEPLOYED_L2_WRAPPED_BASE_TOKEN_ADDRESS="0x35ea7f92f4c5f433efe15284e99c040110cf6299"
CONTRACTS_CHAIN_ADMIN_ADDR="0xdd6fa5c14e7550b4caf2aa2818d24c69cbc347ff"
Expand Down
16 changes: 7 additions & 9 deletions core/lib/protobuf_config/src/contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ impl ProtoRepr for proto::Contracts {
.l1_bytecodes_supplier_addr
.as_ref()
.map(|x| parse_h160(x).expect("Invalid address")),
l1_wrapped_base_token_store: ecosystem_contracts
.l1_wrapped_base_token_store
.as_ref()
.map(|x| parse_h160(x).expect("Invalid address")),
})
} else {
None
Expand Down Expand Up @@ -123,12 +127,6 @@ impl ProtoRepr for proto::Contracts {
.map(|x| parse_h256(x))
.transpose()
.context("base_token_asset_id")?,
l2_predeployed_wrapped_base_token_address: l2
.predeployed_wrapped_base_token_address
.as_ref()
.map(|x| parse_h160(x))
.transpose()
.context("l2 predeployed_wrapped_base_token_address")?,
chain_admin_addr: l1
.chain_admin_addr
.as_ref()
Expand Down Expand Up @@ -164,6 +162,9 @@ impl ProtoRepr for proto::Contracts {
l1_bytecodes_supplier_addr: ecosystem_contracts
.l1_bytecodes_supplier_addr
.map(|x| format!("{:?}", x)),
l1_wrapped_base_token_store: ecosystem_contracts
.l1_wrapped_base_token_store
.map(|x| format!("{:?}", x)),
});
Self {
ecosystem_contracts,
Expand All @@ -184,9 +185,6 @@ impl ProtoRepr for proto::Contracts {
legacy_shared_bridge_addr: this
.l2_legacy_shared_bridge_addr
.map(|a| format!("{:?}", a)),
predeployed_wrapped_base_token_address: this
.l2_predeployed_wrapped_base_token_address
.map(|x| format!("{:?}", x)),
timestamp_asserter_addr: this
.l2_timestamp_asserter_addr
.map(|a| format!("{:?}", a)),
Expand Down
3 changes: 2 additions & 1 deletion core/lib/protobuf_config/src/proto/config/contracts.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ message EcosystemContracts {
optional string state_transition_proxy_addr = 2; // optional; h160
optional string transparent_proxy_admin_addr = 3; // optional; h160
optional string l1_bytecodes_supplier_addr = 4; // optional; h160
optional string l1_wrapped_base_token_store = 5; // optional; h160
}

message L1 {
Expand All @@ -26,7 +27,7 @@ message L2 {
optional string da_validator_addr = 2; // optional; H160
optional string legacy_shared_bridge_addr = 3; // optional; H160
optional string timestamp_asserter_addr = 4; // optional; H160
optional string predeployed_wrapped_base_token_address = 5; // optional; H160
reserved 5; reserved "predeployed_wrapped_base_token_address";
}

message Bridge {
Expand Down
6 changes: 3 additions & 3 deletions core/lib/types/src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ impl GatewayUpgradeEncodedInput {
pub struct ZkChainSpecificUpgradeData {
pub base_token_asset_id: H256,
pub l2_legacy_shared_bridge: Address,
pub predeployed_l2_weth_address: Address,
pub l2_predeployed_wrapped_base_token: Address,
pub base_token_l1_address: Address,
pub base_token_name: String,
pub base_token_symbol: String,
Expand All @@ -551,7 +551,7 @@ impl ZkChainSpecificUpgradeData {
l2_legacy_shared_bridge: l2_legacy_shared_bridge?,
// Note, that some chains may not contain previous deployment of L2 wrapped base
// token. For those, zero address is used.
predeployed_l2_weth_address: predeployed_l2_weth_address.unwrap_or_default(),
l2_predeployed_wrapped_base_token: predeployed_l2_weth_address.unwrap_or_default(),
base_token_l1_address: base_token_l1_address?,
base_token_name: base_token_name?,
base_token_symbol: base_token_symbol?,
Expand All @@ -572,7 +572,7 @@ impl ZkChainSpecificUpgradeData {
Token::Tuple(vec![
Token::FixedBytes(self.base_token_asset_id.0.to_vec()),
Token::Address(self.l2_legacy_shared_bridge),
Token::Address(self.predeployed_l2_weth_address),
Token::Address(self.l2_predeployed_wrapped_base_token),
Token::Address(self.base_token_l1_address),
Token::String(self.base_token_name.clone()),
Token::String(self.base_token_symbol.clone()),
Expand Down
3 changes: 3 additions & 0 deletions core/lib/web3_decl/src/namespaces/unstable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,7 @@ pub trait UnstableNamespace {
l1_batch_number: L1BatchNumber,
chain_id: L2ChainId,
) -> RpcResult<Option<ChainAggProof>>;

#[method(name = "unconfirmedTxsCount")]
async fn get_unconfirmed_txs_count(&self) -> RpcResult<usize>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,10 @@ impl UnstableNamespaceServer for UnstableNamespace {
.await
.map_err(|err| self.current_method().map_err(err))
}

async fn get_unconfirmed_txs_count(&self) -> RpcResult<usize> {
self.get_unconfirmed_txs_count_impl()
.await
.map_err(|err| self.current_method().map_err(err))
}
}
1 change: 1 addition & 0 deletions core/node/api_server/src/web3/namespaces/en.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ impl EnNamespace {
.l1_transparent_proxy_admin_addr
.unwrap(),
l1_bytecodes_supplier_addr: self.state.api_config.l1_bytecodes_supplier_addr,
l1_wrapped_base_token_store: self.state.api_config.l1_wrapped_base_token_store,
})
.context("Shared bridge doesn't supported")?)
}
Expand Down
Loading
Loading