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: EcPairing precompile as system contract #1761

Merged
merged 10 commits into from
Apr 24, 2024
5 changes: 5 additions & 0 deletions core/lib/constants/src/contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ pub const EC_MUL_PRECOMPILE_ADDRESS: Address = H160([
0x00, 0x00, 0x00, 0x07,
]);

pub const EC_PAIRING_PRECOMPILE_ADDRESS: Address = H160([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x08,
]);

pub const P256VERIFY_PRECOMPILE_ADDRESS: Address = H160([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00,
Expand Down
14 changes: 10 additions & 4 deletions core/lib/types/src/system_contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ use zksync_system_constants::{
use crate::{
block::DeployedContract, ACCOUNT_CODE_STORAGE_ADDRESS, BOOTLOADER_ADDRESS,
COMPLEX_UPGRADER_ADDRESS, CONTRACT_DEPLOYER_ADDRESS, ECRECOVER_PRECOMPILE_ADDRESS,
EC_ADD_PRECOMPILE_ADDRESS, EC_MUL_PRECOMPILE_ADDRESS, IMMUTABLE_SIMULATOR_STORAGE_ADDRESS,
KECCAK256_PRECOMPILE_ADDRESS, KNOWN_CODES_STORAGE_ADDRESS, L1_MESSENGER_ADDRESS,
L2_BASE_TOKEN_ADDRESS, MSG_VALUE_SIMULATOR_ADDRESS, NONCE_HOLDER_ADDRESS,
EC_ADD_PRECOMPILE_ADDRESS, EC_MUL_PRECOMPILE_ADDRESS, EC_PAIRING_PRECOMPILE_ADDRESS,
IMMUTABLE_SIMULATOR_STORAGE_ADDRESS, KECCAK256_PRECOMPILE_ADDRESS, KNOWN_CODES_STORAGE_ADDRESS,
L1_MESSENGER_ADDRESS, L2_BASE_TOKEN_ADDRESS, MSG_VALUE_SIMULATOR_ADDRESS, NONCE_HOLDER_ADDRESS,
SHA256_PRECOMPILE_ADDRESS, SYSTEM_CONTEXT_ADDRESS,
};

Expand All @@ -25,7 +25,7 @@ use crate::{
pub const TX_NONCE_INCREMENT: U256 = U256([1, 0, 0, 0]); // 1
pub const DEPLOYMENT_NONCE_INCREMENT: U256 = U256([0, 0, 1, 0]); // 2^128

static SYSTEM_CONTRACT_LIST: [(&str, &str, Address, ContractLanguage); 24] = [
static SYSTEM_CONTRACT_LIST: [(&str, &str, Address, ContractLanguage); 25] = [
(
"",
"AccountCodeStorage",
Expand Down Expand Up @@ -104,6 +104,12 @@ static SYSTEM_CONTRACT_LIST: [(&str, &str, Address, ContractLanguage); 24] = [
EC_MUL_PRECOMPILE_ADDRESS,
ContractLanguage::Yul,
),
(
"precompiles/",
"EcPairing",
EC_PAIRING_PRECOMPILE_ADDRESS,
ContractLanguage::Yul,
),
(
"precompiles/",
"P256Verify",
Expand Down
4 changes: 2 additions & 2 deletions etc/env/base/chain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ fee_model_version = "V1"
validation_computational_gas_limit = 300000
save_call_traces = true

bootloader_hash = "0x010008e7e76ac18ea5e49634399ec7062152c224259c85f4fa88690e5447d2e7"
default_aa_hash = "0x01000563dc93ec6220498801ccef18c8e667fe26b7fdd9fb9a8d8e01796144ff"
bootloader_hash = "0x010008e7f0f15ed191392960117f88fe371348982b28a033c7207ed2c09bc0f4"
default_aa_hash = "0x01000563374c277a2c1e34659a2a1e87371bb6d852ce142022d497bfb50b9e32"

[chain.operations_manager]
# Sleep time when there is no new input data
Expand Down
6 changes: 3 additions & 3 deletions etc/env/base/contracts.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ RECURSION_NODE_LEVEL_VK_HASH = "0x1186ec268d49f1905f8d9c1e9d39fc33e98c74f91d91a2
RECURSION_LEAF_LEVEL_VK_HASH = "0x101e08b00193e529145ee09823378ef51a3bc8966504064f1f6ba3f1ba863210"
RECURSION_CIRCUITS_SET_VKS_HASH = "0x18c1639094f58177409186e8c48d9f577c9410901d2f1d486b3e7d6cf553ae4c"
GENESIS_TX_HASH = "0xb99ebfea46cbe05a21cd80fe5597d97b204befc52a16303f579c607dc1ac2e2e"
GENESIS_ROOT = "0xa0aa5de6ded5c1911d5fee166ee17f3fef98c1ea796c608b9cbee4ce04aaf839"
GENESIS_BATCH_COMMITMENT = "0x3f9ceab98b3baecaa77ba9681919ef822c5a2a6ba97c3be1a68712e1ae63c2ac"
GENESIS_ROOT = "0xabdb766b18a479a5c783a4b80e12686bc8ea3cc2d8a3050491b701d72370ebb5"
GENESIS_BATCH_COMMITMENT = "0x49276362411c40c07ab01d3dfa9428abca95e361d8c980cd39f1ab6a9c561c0c"
PRIORITY_TX_MAX_GAS_LIMIT = 72000000
DEPLOY_L2_BRIDGE_COUNTERPART_GAS_LIMIT = 10000000
GENESIS_ROLLUP_LEAF_INDEX = "52"
GENESIS_ROLLUP_LEAF_INDEX = "54"
GENESIS_PROTOCOL_VERSION = "23"
L1_WETH_BRIDGE_IMPL_ADDR = "0x5E6D086F5eC079ADFF4FB3774CDf3e8D6a34F7E9"
L1_WETH_BRIDGE_PROXY_ADDR = "0x5E6D086F5eC079ADFF4FB3774CDf3e8D6a34F7E9"
Expand Down
Loading