Skip to content

Commit dbd0b42

Browse files
committed
Replace governance with chain admin
Signed-off-by: Danil <deniallugo@gmail.com>
1 parent a7d8222 commit dbd0b42

File tree

15 files changed

+59
-52
lines changed

15 files changed

+59
-52
lines changed

core/bin/zksync_server/src/node_builder.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,8 @@ impl MainNodeBuilder {
314314

315315
fn add_gateway_migrator_layer(mut self) -> anyhow::Result<Self> {
316316
self.node.add_layer(GatewayMigratorLayer::new(
317-
self.contracts_config.diamond_proxy_addr,
317+
self.contracts_config.clone(),
318+
self.gateway_chain_config.clone(),
318319
));
319320
Ok(self)
320321
}

core/lib/config/src/configs/contracts.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub struct ContractsConfig {
5757
pub base_token_addr: Option<Address>,
5858
pub l1_base_token_asset_id: Option<H256>,
5959

60-
pub chain_admin_addr: Option<Address>,
60+
pub chain_admin_addr: Address,
6161
pub l2_da_validator_addr: Option<Address>,
6262
pub no_da_validium_l1_validator_addr: Option<Address>,
6363
}
@@ -83,7 +83,7 @@ impl ContractsConfig {
8383
base_token_addr: Some(Address::repeat_byte(0x14)),
8484
l1_base_token_asset_id: Some(H256::repeat_byte(0x15)),
8585
ecosystem_contracts: Some(EcosystemContracts::for_tests()),
86-
chain_admin_addr: Some(Address::repeat_byte(0x18)),
86+
chain_admin_addr: Address::repeat_byte(0x18),
8787
l2_da_validator_addr: Some(Address::repeat_byte(0x1a)),
8888
no_da_validium_l1_validator_addr: Some(Address::repeat_byte(0x1b)),
8989
}

core/lib/config/src/configs/gateway.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ pub struct GatewayChainConfig {
2828
pub validator_timelock_addr: Address,
2929
pub multicall3_addr: Address,
3030
pub diamond_proxy_addr: Address,
31-
// TODO(EVM-921): there is no "governace" for a chain, only an admin, we
32-
// need to figure out what we mean here
33-
pub chain_admin_addr: Option<Address>,
34-
pub governance_addr: Address,
31+
pub chain_admin_addr: Address,
3532
pub gateway_chain_id: SLChainId,
3633
}
3734

@@ -47,8 +44,7 @@ impl GatewayChainConfig {
4744
validator_timelock_addr: gateway_config.validator_timelock_addr,
4845
multicall3_addr: gateway_config.multicall3_addr,
4946
diamond_proxy_addr,
50-
chain_admin_addr: Some(l2_chain_admin_addr),
51-
governance_addr: l2_chain_admin_addr,
47+
chain_admin_addr: l2_chain_admin_addr,
5248
gateway_chain_id,
5349
}
5450
}
@@ -66,7 +62,6 @@ impl GatewayChainConfig {
6662
multicall3_addr: contracts.l1_multicall3_addr,
6763
diamond_proxy_addr: contracts.diamond_proxy_addr,
6864
chain_admin_addr: contracts.chain_admin_addr,
69-
governance_addr: contracts.governance_addr,
7065
gateway_chain_id,
7166
}
7267
}

core/lib/config/src/testonly.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ impl Distribution<configs::ContractsConfig> for EncodeDist {
267267
ecosystem_contracts: self.sample(rng),
268268
base_token_addr: self.sample_opt(|| rng.gen()),
269269
l1_base_token_asset_id: self.sample_opt(|| rng.gen()),
270-
chain_admin_addr: self.sample_opt(|| rng.gen()),
270+
chain_admin_addr: rng.gen(),
271271
l2_da_validator_addr: self.sample_opt(|| rng.gen()),
272272
no_da_validium_l1_validator_addr: self.sample_opt(|| rng.gen()),
273273
}

core/lib/protobuf_config/src/contracts.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,8 @@ impl ProtoRepr for proto::Contracts {
131131
.map(|x| parse_h256(x))
132132
.transpose()
133133
.context("base_token_asset_id")?,
134-
chain_admin_addr: l1
135-
.chain_admin_addr
136-
.as_ref()
137-
.map(|x| parse_h160(x))
138-
.transpose()
134+
chain_admin_addr: required(&l1.chain_admin_addr)
135+
.and_then(|x| parse_h160(x))
139136
.context("chain_admin_addr")?,
140137
l2_da_validator_addr: l2
141138
.da_validator_addr
@@ -188,7 +185,7 @@ impl ProtoRepr for proto::Contracts {
188185
multicall3_addr: Some(format!("{:?}", this.l1_multicall3_addr)),
189186
base_token_addr: this.base_token_addr.map(|a| format!("{:?}", a)),
190187
base_token_asset_id: this.l1_base_token_asset_id.map(|x| format!("{:?}", x)),
191-
chain_admin_addr: this.chain_admin_addr.map(|a| format!("{:?}", a)),
188+
chain_admin_addr: Some(format!("{:?}", this.chain_admin_addr)),
192189
no_da_validium_l1_validator_addr: this
193190
.no_da_validium_l1_validator_addr
194191
.map(|a| format!("{:?}", a)),

core/lib/protobuf_config/src/gateway.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,10 @@ impl ProtoRepr for proto::GatewayChainConfig {
2626
.and_then(|x| parse_h160(x))
2727
.context("diamond_proxy_addr")?,
2828

29-
chain_admin_addr: self
30-
.chain_admin_addr
31-
.as_ref()
32-
.map(|x| parse_h160(x))
33-
.transpose()?,
34-
35-
governance_addr: required(&self.governance_addr)
29+
chain_admin_addr: required(&self.chain_admin_addr)
3630
.and_then(|x| parse_h160(x))
37-
.context("governance_addr")?,
31+
.context("chain_admin_addr")?,
32+
3833
gateway_chain_id: required(&self.gateway_chain_id)
3934
.map(|x| SLChainId(*x))
4035
.context("gateway_chain_id")?,
@@ -47,8 +42,7 @@ impl ProtoRepr for proto::GatewayChainConfig {
4742
validator_timelock_addr: Some(format!("{:?}", this.validator_timelock_addr)),
4843
multicall3_addr: Some(format!("{:?}", this.multicall3_addr)),
4944
diamond_proxy_addr: Some(format!("{:?}", this.diamond_proxy_addr)),
50-
chain_admin_addr: this.chain_admin_addr.map(|x| format!("{:?}", x)),
51-
governance_addr: Some(format!("{:?}", this.governance_addr)),
45+
chain_admin_addr: Some(format!("{:?}", this.chain_admin_addr)),
5246
gateway_chain_id: Some(this.gateway_chain_id.0),
5347
}
5448
}

core/lib/protobuf_config/src/proto/config/gateway.proto

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ syntax = "proto3";
33
package zksync.config.gateway;
44

55
message GatewayChainConfig {
6-
optional string state_transition_proxy_addr = 1;
7-
optional string validator_timelock_addr = 2;
8-
optional string multicall3_addr = 3;
9-
optional string diamond_proxy_addr = 4;
10-
optional string chain_admin_addr = 5;
11-
optional string governance_addr = 6;
12-
optional uint64 gateway_chain_id = 7;
6+
optional string state_transition_proxy_addr = 1;
7+
optional string validator_timelock_addr = 2;
8+
optional string multicall3_addr = 3;
9+
optional string diamond_proxy_addr = 4;
10+
optional string chain_admin_addr = 5;
11+
optional uint64 gateway_chain_id = 7;
1312
}

core/node/eth_watch/src/client.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ const TOO_MANY_RESULTS_CHAINSTACK: &str = "range limit exceeded";
9797
pub struct EthHttpQueryClient<Net: Network> {
9898
client: Box<DynClient<Net>>,
9999
diamond_proxy_addr: Address,
100-
governance_address: Address,
101100
new_upgrade_cut_data_signature: H256,
102101
bytecode_published_signature: H256,
103102
bytecode_supplier_addr: Option<Address>,
@@ -106,7 +105,7 @@ pub struct EthHttpQueryClient<Net: Network> {
106105
// Only present for post-shared bridge chains.
107106
state_transition_manager_address: Option<Address>,
108107
server_notifier_address: Option<Address>,
109-
chain_admin_address: Option<Address>,
108+
chain_admin_address: Address,
110109
verifier_contract_abi: Contract,
111110
getters_facet_contract_abi: Contract,
112111
message_root_abi: Contract,
@@ -128,24 +127,22 @@ where
128127
wrapped_base_token_store: Option<Address>,
129128
l1_shared_bridge_addr: Option<Address>,
130129
state_transition_manager_address: Option<Address>,
131-
chain_admin_address: Option<Address>,
130+
chain_admin_address: Address,
132131
server_notifier_address: Option<Address>,
133-
governance_address: Address,
134132
confirmations_for_eth_event: Option<u64>,
135133
l2_chain_id: L2ChainId,
136134
) -> Self {
137135
tracing::debug!(
138-
"New eth client, ZKsync addr: {:x}, governance addr: {:?}",
136+
"New eth client, ZKsync addr: {:x}, chain_admin_address: {:?}",
139137
diamond_proxy_addr,
140-
governance_address
138+
chain_admin_address
141139
);
142140
Self {
143141
client: client.for_component("watch"),
144142
diamond_proxy_addr,
145143
state_transition_manager_address,
146144
server_notifier_address,
147145
chain_admin_address,
148-
governance_address,
149146
bytecode_supplier_addr,
150147
new_upgrade_cut_data_signature: state_transition_manager_contract()
151148
.event("NewUpgradeCutData")
@@ -172,9 +169,8 @@ where
172169
fn get_default_address_list(&self) -> Vec<Address> {
173170
[
174171
Some(self.diamond_proxy_addr),
175-
Some(self.governance_address),
176172
self.state_transition_manager_address,
177-
self.chain_admin_address,
173+
Some(self.chain_admin_address),
178174
self.server_notifier_address,
179175
Some(L2_MESSAGE_ROOT_ADDRESS),
180176
]

core/node/node_framework/src/implementations/layers/base_token/base_token_ratio_persister.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ impl WiringLayer for BaseTokenRatioPersisterLayer {
107107
chain_admin_contract: chain_admin_contract(),
108108
getters_facet_contract: getters_facet_contract(),
109109
diamond_proxy_contract_address: self.contracts_config.diamond_proxy_addr,
110-
chain_admin_contract_address: self.contracts_config.chain_admin_addr,
110+
chain_admin_contract_address: Some(self.contracts_config.chain_admin_addr),
111111
config: self.config.clone(),
112112
},
113113
last_persisted_l1_ratio: None,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

0 commit comments

Comments
 (0)