diff --git a/core/bin/external_node/src/config/mod.rs b/core/bin/external_node/src/config/mod.rs
index db2c6eac9cf6..235802e1073b 100644
--- a/core/bin/external_node/src/config/mod.rs
+++ b/core/bin/external_node/src/config/mod.rs
@@ -128,6 +128,7 @@ pub(crate) struct RemoteENConfig {
pub l2_weth_bridge_addr: Option
,
pub l2_testnet_paymaster_addr: Option,
pub l2_timestamp_asserter_addr: Option,
+ pub l1_wrapped_base_token_store: Option,
pub base_token_addr: Address,
pub l1_batch_commit_data_generator_mode: L1BatchCommitmentMode,
pub dummy_verifier: bool,
@@ -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,
@@ -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,
}
@@ -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,
diff --git a/core/lib/basic_types/src/protocol_version.rs b/core/lib/basic_types/src/protocol_version.rs
index 89251b3a2a40..eb8117b01e03 100644
--- a/core/lib/basic_types/src/protocol_version.rs
+++ b/core/lib/basic_types/src/protocol_version.rs
@@ -123,7 +123,7 @@ impl ProtocolVersionId {
ProtocolVersionId::Version23 => VmVersion::Vm1_5_0SmallBootloaderMemory,
ProtocolVersionId::Version24 => VmVersion::Vm1_5_0IncreasedBootloaderMemory,
ProtocolVersionId::Version25 => VmVersion::Vm1_5_0IncreasedBootloaderMemory,
- ProtocolVersionId::Version26 => VmVersion::Vm1_5_0IncreasedBootloaderMemory,
+ ProtocolVersionId::Version26 => VmVersion::VmGateway,
ProtocolVersionId::Version27 => VmVersion::VmGateway,
ProtocolVersionId::Version28 => unreachable!("Version 28 is not yet supported"),
}
@@ -192,7 +192,7 @@ impl ProtocolVersionId {
}
pub const fn gateway_upgrade() -> Self {
- ProtocolVersionId::Version27
+ ProtocolVersionId::Version26
}
}
@@ -298,7 +298,7 @@ impl From for VmVersion {
ProtocolVersionId::Version23 => VmVersion::Vm1_5_0SmallBootloaderMemory,
ProtocolVersionId::Version24 => VmVersion::Vm1_5_0IncreasedBootloaderMemory,
ProtocolVersionId::Version25 => VmVersion::Vm1_5_0IncreasedBootloaderMemory,
- ProtocolVersionId::Version26 => VmVersion::Vm1_5_0IncreasedBootloaderMemory,
+ ProtocolVersionId::Version26 => VmVersion::VmGateway,
ProtocolVersionId::Version27 => VmVersion::VmGateway,
ProtocolVersionId::Version28 => unreachable!("Version 28 is not yet supported"),
}
diff --git a/core/lib/basic_types/src/vm.rs b/core/lib/basic_types/src/vm.rs
index f11f98596f18..4469785c7411 100644
--- a/core/lib/basic_types/src/vm.rs
+++ b/core/lib/basic_types/src/vm.rs
@@ -22,7 +22,7 @@ pub enum VmVersion {
impl VmVersion {
/// Returns the latest supported VM version.
pub const fn latest() -> VmVersion {
- Self::Vm1_5_0IncreasedBootloaderMemory
+ Self::VmGateway
}
}
diff --git a/core/lib/config/src/configs/contracts.rs b/core/lib/config/src/configs/contracts.rs
index f6bd02f2dfae..561e51fa5dd5 100644
--- a/core/lib/config/src/configs/contracts.rs
+++ b/core/lib/config/src/configs/contracts.rs
@@ -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,
+ // 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,
}
impl EcosystemContracts {
@@ -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)),
}
}
}
@@ -50,8 +55,6 @@ pub struct ContractsConfig {
pub base_token_addr: Option,
pub l1_base_token_asset_id: Option,
- pub l2_predeployed_wrapped_base_token_address: Option,
-
pub chain_admin_addr: Option,
pub l2_da_validator_addr: Option,
}
@@ -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)),
diff --git a/core/lib/config/src/testonly.rs b/core/lib/config/src/testonly.rs
index 3472cf4e7d0a..431fa406d109 100644
--- a/core/lib/config/src/testonly.rs
+++ b/core/lib/config/src/testonly.rs
@@ -268,7 +268,6 @@ impl Distribution 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()),
}
@@ -763,6 +762,7 @@ impl Distribution 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(),
}
}
}
diff --git a/core/lib/contracts/src/lib.rs b/core/lib/contracts/src/lib.rs
index 9ca679fef899..5e9de985f22f 100644
--- a/core/lib/contracts/src/lib.rs
+++ b/core/lib/contracts/src/lib.rs
@@ -1423,7 +1423,25 @@ pub static POST_SHARED_BRIDGE_EXECUTE_FUNCTION: Lazy = Lazy::new(|| {
serde_json::from_str(abi).unwrap()
});
-// Temporary thing, should be removed when new contracts are merged.
+// Temporary items, should be removed when new contracts are merged.
+
+pub static L1_ASSET_ROUTER_CONTRACT: Lazy = Lazy::new(|| {
+ let abi = r#"
+ [
+ {"type":"function","name":"l2BridgeAddress","inputs":[{"name":"_chainId","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},
+ {"type":"function","name":"L1_NULLIFIER","inputs":[],"outputs":[{"name":"","type":"address","internalType":"contract IL1Nullifier"}],"stateMutability":"view"}
+ ]"#;
+ serde_json::from_str(abi).unwrap()
+});
+
+pub static WRAPPED_BASE_TOKEN_STORE_CONTRACT: Lazy = Lazy::new(|| {
+ let abi = r#"
+ [
+ {"type":"function","name":"l2WBaseTokenAddress","inputs":[{"name":"chainId","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"l2WBaseTokenAddress","type":"address","internalType":"address"}],"stateMutability":"view"}
+ ]"#;
+ serde_json::from_str(abi).unwrap()
+});
+
pub static MESSAGE_ROOT_CONTRACT: Lazy = Lazy::new(|| {
let abi = r#"
[{
diff --git a/core/lib/dal/.sqlx/query-33d49ec6028974fa8b46d7bf1f79e41923477ed8dc179ca0e1fe64b4700e6572.json b/core/lib/dal/.sqlx/query-33d49ec6028974fa8b46d7bf1f79e41923477ed8dc179ca0e1fe64b4700e6572.json
new file mode 100644
index 000000000000..703a57ae0597
--- /dev/null
+++ b/core/lib/dal/.sqlx/query-33d49ec6028974fa8b46d7bf1f79e41923477ed8dc179ca0e1fe64b4700e6572.json
@@ -0,0 +1,20 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n SELECT\n COUNT(*)\n FROM\n eth_txs\n WHERE\n confirmed_eth_tx_history_id IS NULL\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "count",
+ "type_info": "Int8"
+ }
+ ],
+ "parameters": {
+ "Left": []
+ },
+ "nullable": [
+ null
+ ]
+ },
+ "hash": "33d49ec6028974fa8b46d7bf1f79e41923477ed8dc179ca0e1fe64b4700e6572"
+}
diff --git a/core/lib/dal/src/eth_sender_dal.rs b/core/lib/dal/src/eth_sender_dal.rs
index 191ea3231d1c..eecd102f395e 100644
--- a/core/lib/dal/src/eth_sender_dal.rs
+++ b/core/lib/dal/src/eth_sender_dal.rs
@@ -86,6 +86,25 @@ impl EthSenderDal<'_, '_> {
Ok(count.try_into().unwrap())
}
+ pub async fn get_unconfirmed_txs_count(&mut self) -> DalResult {
+ 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 {
struct EthTxRow {
number: i64,
diff --git a/core/lib/env_config/src/contracts.rs b/core/lib/env_config/src/contracts.rs
index 457a946d9831..4cd0b021ff20 100644
--- a/core/lib/env_config/src/contracts.rs
+++ b/core/lib/env_config/src/contracts.rs
@@ -10,8 +10,14 @@ impl FromEnv for EcosystemContracts {
.parse()?,
transparent_proxy_admin_addr: std::env::var("CONTRACTS_TRANSPARENT_PROXY_ADMIN_ADDR")?
.parse()?,
- // Not supported yet
- l1_bytecodes_supplier_addr: None,
+ 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(),
})
}
}
@@ -44,6 +50,9 @@ impl FromEnv for ContractsConfig {
#[cfg(test)]
mod tests {
+ use std::str::FromStr;
+
+ use zksync_basic_types::H256;
use zksync_config::configs::EcosystemContracts;
use zksync_system_constants::SHARED_BRIDGE_ETHER_TOKEN_ADDRESS;
@@ -72,11 +81,20 @@ mod tests {
bridgehub_proxy_addr: addr("0x35ea7f92f4c5f433efe15284e99c040110cf6297"),
state_transition_proxy_addr: addr("0xd90f1c081c6117241624e97cb6147257c3cb2097"),
transparent_proxy_admin_addr: addr("0xdd6fa5c14e7550b4caf2aa2818d24c69cbc347e5"),
- l1_bytecodes_supplier_addr: None,
+ 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: None,
- l2_predeployed_wrapped_base_token_address: None,
+ l1_base_token_asset_id: Some(
+ H256::from_str(
+ "0x0000000000000000000000000000000000000001000000000000000000000000",
+ )
+ .unwrap(),
+ ),
chain_admin_addr: Some(addr("0xdd6fa5c14e7550b4caf2aa2818d24c69cbc347ff")),
l2_da_validator_addr: Some(addr("0xed6fa5c14e7550b4caf2aa2818d24c69cbc347ff")),
l2_timestamp_asserter_addr: Some(addr("0x0000000000000000000000000000000000000002")),
@@ -101,11 +119,16 @@ CONTRACTS_L2_CONSENSUS_REGISTRY_ADDR="D64e136566a9E04eb05B30184fF577F52682D182"
CONTRACTS_L1_MULTICALL3_ADDR="0xcA11bde05977b3631167028862bE2a173976CA11"
CONTRACTS_L1_SHARED_BRIDGE_PROXY_ADDR="0x8656770FA78c830456B00B4fFCeE6b1De0e1b888"
CONTRACTS_L2_SHARED_BRIDGE_ADDR="0x8656770FA78c830456B00B4fFCeE6b1De0e1b888"
+CONTRACTS_L1_BYTECODE_SUPPLIER_ADDR="0x36ea7f92f4c5f433efe15284e99c040110cf6297"
CONTRACTS_L2_LEGACY_SHARED_BRIDGE_ADDR="0x8656770FA78c830456B00B4fFCeE6b1De0e1b888"
CONTRACTS_BRIDGEHUB_PROXY_ADDR="0x35ea7f92f4c5f433efe15284e99c040110cf6297"
CONTRACTS_STATE_TRANSITION_PROXY_ADDR="0xd90f1c081c6117241624e97cb6147257c3cb2097"
CONTRACTS_TRANSPARENT_PROXY_ADMIN_ADDR="0xdd6fa5c14e7550b4caf2aa2818d24c69cbc347e5"
CONTRACTS_BASE_TOKEN_ADDR="0x0000000000000000000000000000000000000001"
+CONTRACTS_L1_BASE_TOKEN_ASSET_ID="0x0000000000000000000000000000000000000001000000000000000000000000"
+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"
CONTRACTS_L2_DA_VALIDATOR_ADDR="0xed6fa5c14e7550b4caf2aa2818d24c69cbc347ff"
CONTRACTS_L2_TIMESTAMP_ASSERTER_ADDR="0x0000000000000000000000000000000000000002"
diff --git a/core/lib/protobuf_config/src/contracts.rs b/core/lib/protobuf_config/src/contracts.rs
index 12cbf996697b..1c9711ef62d2 100644
--- a/core/lib/protobuf_config/src/contracts.rs
+++ b/core/lib/protobuf_config/src/contracts.rs
@@ -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
@@ -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()
@@ -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,
@@ -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)),
diff --git a/core/lib/protobuf_config/src/proto/config/contracts.proto b/core/lib/protobuf_config/src/proto/config/contracts.proto
index febbc981478b..31c6a122f800 100644
--- a/core/lib/protobuf_config/src/proto/config/contracts.proto
+++ b/core/lib/protobuf_config/src/proto/config/contracts.proto
@@ -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 {
@@ -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 {
diff --git a/core/lib/types/src/abi.rs b/core/lib/types/src/abi.rs
index b40aaaf882e2..da51c6297d4d 100644
--- a/core/lib/types/src/abi.rs
+++ b/core/lib/types/src/abi.rs
@@ -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,
@@ -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?,
@@ -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()),
diff --git a/core/lib/vm_executor/src/oneshot/contracts.rs b/core/lib/vm_executor/src/oneshot/contracts.rs
index 257ede5a7c7c..d67d1dfbc662 100644
--- a/core/lib/vm_executor/src/oneshot/contracts.rs
+++ b/core/lib/vm_executor/src/oneshot/contracts.rs
@@ -106,10 +106,8 @@ impl MultiVmBaseSystemContracts {
ProtocolVersionId::Version21 | ProtocolVersionId::Version22 => &self.post_1_4_2,
ProtocolVersionId::Version23 => &self.vm_1_5_0_small_memory,
ProtocolVersionId::Version24 => &self.vm_1_5_0_increased_memory,
- ProtocolVersionId::Version25 | ProtocolVersionId::Version26 => {
- &self.vm_protocol_defense
- }
- ProtocolVersionId::Version27 => &self.gateway,
+ ProtocolVersionId::Version25 => &self.vm_protocol_defense,
+ ProtocolVersionId::Version26 | ProtocolVersionId::Version27 => &self.gateway,
ProtocolVersionId::Version28 => unreachable!("Version 28 is not supported yet"),
};
let base = base.clone();
diff --git a/core/lib/web3_decl/src/namespaces/unstable.rs b/core/lib/web3_decl/src/namespaces/unstable.rs
index f666f02f2811..da18806d126c 100644
--- a/core/lib/web3_decl/src/namespaces/unstable.rs
+++ b/core/lib/web3_decl/src/namespaces/unstable.rs
@@ -38,4 +38,7 @@ pub trait UnstableNamespace {
l1_batch_number: L1BatchNumber,
chain_id: L2ChainId,
) -> RpcResult