Skip to content

Commit

Permalink
feat: Remove data fetchers (#694)
Browse files Browse the repository at this point in the history
## What ❔

Removes the data fetchers from the codebase.
The tables they've been writing to are left intact since we need to
support the RPC methods that interact with them for a while.
This way these methods will be accessing the latest available data
there.

Additionally, as discussed before, `get_well_known_token_addresses` no
longer checks for `well_known = true`.

## Why ❔

This component is deprecated.

## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [ ] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [ ] Tests for the changes have been added / updated.
- [ ] Documentation comments have been added / updated.
- [ ] Code has been formatted via `zk fmt` and `zk lint`.
- [ ] Spellcheck has been run via `cargo spellcheck
--cfg=./spellcheck/era.cfg --code 1`.
  • Loading branch information
popzxc authored Dec 20, 2023
1 parent 84ec18b commit f48d677
Show file tree
Hide file tree
Showing 29 changed files with 82 additions and 973 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-core-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ jobs:
# `sleep 30` because we need to wait until server added all the tokens
- name: Run server
run: |
ci_run zk server --uring --components api,tree,eth,data_fetcher,state_keeper,housekeeper &>server.log &
ci_run zk server --uring --components api,tree,eth,state_keeper,housekeeper &>server.log &
ci_run sleep 30
- name: Perform loadtest
Expand Down
5 changes: 2 additions & 3 deletions core/bin/zksync_server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use zksync_config::{
ProofDataHandlerConfig, ProverGroupConfig, WitnessGeneratorConfig,
},
ApiConfig, ContractsConfig, DBConfig, ETHClientConfig, ETHSenderConfig, ETHWatchConfig,
FetcherConfig, GasAdjusterConfig, ObjectStoreConfig, PostgresConfig, ProverConfigs,
GasAdjusterConfig, ObjectStoreConfig, PostgresConfig, ProverConfigs,
};
use zksync_core::{
genesis_init, initialize_components, is_genesis_needed, setup_sigint_handler,
Expand All @@ -41,7 +41,7 @@ struct Cli {
/// Comma-separated list of components to launch.
#[arg(
long,
default_value = "api,tree,eth,data_fetcher,state_keeper,housekeeper,basic_witness_input_producer"
default_value = "api,tree,eth,state_keeper,housekeeper,basic_witness_input_producer"
)]
components: ComponentsToRun,
}
Expand Down Expand Up @@ -118,7 +118,6 @@ async fn main() -> anyhow::Result<()> {
eth_client_config: ETHClientConfig::from_env().ok(),
eth_sender_config: ETHSenderConfig::from_env().ok(),
eth_watch_config: ETHWatchConfig::from_env().ok(),
fetcher_config: FetcherConfig::from_env().ok(),
gas_adjuster_config: GasAdjusterConfig::from_env().ok(),
prover_configs: ProverConfigs::from_env().ok(),
object_store_config: ObjectStoreConfig::from_env().ok(),
Expand Down
46 changes: 0 additions & 46 deletions core/lib/config/src/configs/fetcher.rs

This file was deleted.

2 changes: 0 additions & 2 deletions core/lib/config/src/configs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ pub use self::{
eth_client::ETHClientConfig,
eth_sender::{ETHSenderConfig, GasAdjusterConfig},
eth_watch::ETHWatchConfig,
fetcher::FetcherConfig,
fri_proof_compressor::FriProofCompressorConfig,
fri_prover::FriProverConfig,
fri_prover_gateway::FriProverGatewayConfig,
Expand All @@ -35,7 +34,6 @@ pub mod database;
pub mod eth_client;
pub mod eth_sender;
pub mod eth_watch;
pub mod fetcher;
pub mod fri_proof_compressor;
pub mod fri_prover;
pub mod fri_prover_gateway;
Expand Down
4 changes: 2 additions & 2 deletions core/lib/config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

pub use crate::configs::{
ApiConfig, ChainConfig, ContractVerifierConfig, ContractsConfig, DBConfig, ETHClientConfig,
ETHSenderConfig, ETHWatchConfig, FetcherConfig, GasAdjusterConfig, ObjectStoreConfig,
PostgresConfig, ProverConfig, ProverConfigs, SnapshotsCreatorConfig,
ETHSenderConfig, ETHWatchConfig, GasAdjusterConfig, ObjectStoreConfig, PostgresConfig,
ProverConfig, ProverConfigs, SnapshotsCreatorConfig,
};

pub mod configs;
132 changes: 66 additions & 66 deletions core/lib/dal/sqlx-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -7056,30 +7056,6 @@
},
"query": "\n INSERT INTO\n consensus_replica_state (fake_key, state)\n VALUES\n (TRUE, $1)\n ON CONFLICT (fake_key) DO\n UPDATE\n SET\n state = excluded.state\n "
},
"78720a210af2364dbf0e6213ae1b9263dbe6655fcce708998ca871d22cc41df0": {
"describe": {
"columns": [
{
"name": "l1_address",
"ordinal": 0,
"type_info": "Bytea"
},
{
"name": "l2_address",
"ordinal": 1,
"type_info": "Bytea"
}
],
"nullable": [
false,
false
],
"parameters": {
"Left": []
}
},
"query": "\n SELECT\n l1_address,\n l2_address\n FROM\n tokens\n WHERE\n well_known = TRUE\n "
},
"78978c19282961c5b3dc06352b41caa4cca66d6ad74b2cd1a34ea5f7bc1e6909": {
"describe": {
"columns": [
Expand Down Expand Up @@ -8712,6 +8688,48 @@
},
"query": "\n UPDATE prover_jobs_fri\n SET\n status = 'sent_to_server',\n updated_at = NOW()\n WHERE\n l1_batch_number = $1\n "
},
"af74cb82724bdf9fa4f716cf2ee07a011c3ad3f13a2ed37c4bcce515786fc867": {
"describe": {
"columns": [
{
"name": "l1_address",
"ordinal": 0,
"type_info": "Bytea"
},
{
"name": "l2_address",
"ordinal": 1,
"type_info": "Bytea"
},
{
"name": "name",
"ordinal": 2,
"type_info": "Varchar"
},
{
"name": "symbol",
"ordinal": 3,
"type_info": "Varchar"
},
{
"name": "decimals",
"ordinal": 4,
"type_info": "Int4"
}
],
"nullable": [
false,
false,
false,
false,
false
],
"parameters": {
"Left": []
}
},
"query": "\n SELECT\n l1_address,\n l2_address,\n NAME,\n symbol,\n decimals\n FROM\n tokens\n ORDER BY\n symbol\n "
},
"afc24bd1407dba82cd3dc9e7ee71ac4ab2d73bda6022700aeb0a630a2563a4b4": {
"describe": {
"columns": [],
Expand Down Expand Up @@ -9545,6 +9563,30 @@
},
"query": "\n INSERT INTO\n prover_jobs_fri (\n l1_batch_number,\n circuit_id,\n circuit_blob_url,\n aggregation_round,\n sequence_number,\n depth,\n is_node_final_proof,\n protocol_version,\n status,\n created_at,\n updated_at\n )\n VALUES\n ($1, $2, $3, $4, $5, $6, $7, $8, 'queued', NOW(), NOW())\n ON CONFLICT (l1_batch_number, aggregation_round, circuit_id, depth, sequence_number) DO\n UPDATE\n SET\n updated_at = NOW()\n "
},
"c4ea7812861a283448095acbb1164420a25eef488de2b67e91ed39657667bd4a": {
"describe": {
"columns": [
{
"name": "l1_address",
"ordinal": 0,
"type_info": "Bytea"
},
{
"name": "l2_address",
"ordinal": 1,
"type_info": "Bytea"
}
],
"nullable": [
false,
false
],
"parameters": {
"Left": []
}
},
"query": "\n SELECT\n l1_address,\n l2_address\n FROM\n tokens\n "
},
"c5656667e5610ffb33e7b977ac92b7c4d79cbd404e0267794ec203df0cbb169d": {
"describe": {
"columns": [
Expand Down Expand Up @@ -11592,48 +11634,6 @@
},
"query": "\n UPDATE prover_jobs\n SET\n status = 'queued',\n updated_at = NOW(),\n processing_started_at = NOW()\n WHERE\n (\n status = 'in_progress'\n AND processing_started_at <= NOW() - $1::INTERVAL\n AND attempts < $2\n )\n OR (\n status = 'in_gpu_proof'\n AND processing_started_at <= NOW() - $1::INTERVAL\n AND attempts < $2\n )\n OR (\n status = 'failed'\n AND attempts < $2\n )\n RETURNING\n id,\n status,\n attempts\n "
},
"f39372e37160df4897f62a800694867ed765dcb9dc60754df9df8700d4244bfb": {
"describe": {
"columns": [
{
"name": "l1_address",
"ordinal": 0,
"type_info": "Bytea"
},
{
"name": "l2_address",
"ordinal": 1,
"type_info": "Bytea"
},
{
"name": "name",
"ordinal": 2,
"type_info": "Varchar"
},
{
"name": "symbol",
"ordinal": 3,
"type_info": "Varchar"
},
{
"name": "decimals",
"ordinal": 4,
"type_info": "Int4"
}
],
"nullable": [
false,
false,
false,
false,
false
],
"parameters": {
"Left": []
}
},
"query": "\n SELECT\n l1_address,\n l2_address,\n NAME,\n symbol,\n decimals\n FROM\n tokens\n WHERE\n well_known = TRUE\n ORDER BY\n symbol\n "
},
"f4362a61ab05af3d71a3232d2f017db60405a887f9f7fa0ca60aa7fc879ce630": {
"describe": {
"columns": [],
Expand Down
4 changes: 1 addition & 3 deletions core/lib/dal/src/tokens_dal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl TokensDal<'_, '_> {
}
}

pub async fn get_well_known_token_addresses(&mut self) -> Vec<(Address, Address)> {
pub(crate) async fn get_well_known_token_addresses(&mut self) -> Vec<(Address, Address)> {
{
let records = sqlx::query!(
r#"
Expand All @@ -94,8 +94,6 @@ impl TokensDal<'_, '_> {
l2_address
FROM
tokens
WHERE
well_known = TRUE
"#
)
.fetch_all(self.storage.conn())
Expand Down
2 changes: 0 additions & 2 deletions core/lib/dal/src/tokens_web3_dal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ impl TokensWeb3Dal<'_, '_> {
decimals
FROM
tokens
WHERE
well_known = TRUE
ORDER BY
symbol
"#
Expand Down
68 changes: 0 additions & 68 deletions core/lib/env_config/src/fetcher.rs

This file was deleted.

1 change: 0 additions & 1 deletion core/lib/env_config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ mod database;
mod eth_client;
mod eth_sender;
mod eth_watch;
mod fetcher;
mod fri_proof_compressor;
mod fri_prover;
mod fri_prover_gateway;
Expand Down
Loading

0 comments on commit f48d677

Please sign in to comment.