diff --git a/.github/workflows/ci-iov-sim-tool.yml b/.github/workflows/ci-iov-sim-tool.yml index 6a2af2dfa..dfc577195 100644 --- a/.github/workflows/ci-iov-sim-tool.yml +++ b/.github/workflows/ci-iov-sim-tool.yml @@ -20,7 +20,7 @@ jobs: - name: start-services run: | - docker-compose -f docker-compose-runner.yml up --build -d zk + docker-compose -f docker-compose.ci.yml up --build -d zk - name: init run: | diff --git a/.github/workflows/ci-iov.yml b/.github/workflows/ci-iov.yml index 607f0f48e..f6ff633a5 100644 --- a/.github/workflows/ci-iov.yml +++ b/.github/workflows/ci-iov.yml @@ -21,12 +21,17 @@ jobs: run: | echo ZKSYNC_HOME=$(pwd) >> $GITHUB_ENV echo $(pwd)/bin >> $GITHUB_PATH + + # dev.env file is required before running zk init + - name: create-empty-dev-file + run: | + touch $ZKSYNC_HOME/etc/env/dev.env - name: start-services run: | - docker-compose -f docker-compose-runner.yml down - docker-compose -f docker-compose-runner.yml pull - docker-compose -f docker-compose-runner.yml -f docker-compose-runner.unit-tests.yml up --build -d rskj postgres zk + docker-compose -f docker-compose.ci.yml down + docker-compose -f docker-compose.ci.yml pull + docker-compose -f docker-compose.ci.yml -f docker-compose.ci.unit-tests.yml up --build -d rskj postgres zk ci_run sccache --start-server & - name: generate SSL certificates @@ -44,8 +49,8 @@ jobs: ci_run zk ci_run zk init - - name: restart dev-ticker - run: docker-compose -f docker-compose-runner.yml restart dev-ticker + - name: start dev-ticker + run: docker-compose -f docker-compose.ci.yml up -d dev-ticker - name: Toolchain info run: | @@ -70,9 +75,9 @@ jobs: - name: start-services (rskj, postgres, zk) run: | - docker-compose -f docker-compose-runner.yml down - docker-compose -f docker-compose-runner.yml pull - docker-compose -f docker-compose-runner.yml up --build -d rskj postgres zk + docker-compose -f docker-compose.ci.yml down + docker-compose -f docker-compose.ci.yml pull + docker-compose -f docker-compose.ci.yml up --build -d rskj postgres zk ci_run sccache --start-server & - name: run zk init @@ -80,8 +85,8 @@ jobs: ci_run zk ci_run zk init - - name: restart dev-ticker - run: docker-compose -f docker-compose-runner.yml restart dev-ticker + - name: start dev-ticker + run: docker-compose -f docker-compose.ci.yml up -d dev-ticker - name: run-services run: | @@ -113,7 +118,7 @@ jobs: ci_run cat dummy_prover.log ci_run mkdir -p ./target/release/coverage/ ci_run "grcov . --binary-path ./target/release/deps/ -s . -t lcov --branch --ignore-not-existing --ignore '../*' --ignore '/*' -o ./target/release/coverage/lcov.info" - docker compose -f docker-compose-runner.yml cp zk:/usr/src/zksync/target/release/coverage/lcov.info lcov.info + docker compose -f docker-compose.ci.yml cp zk:/usr/src/zksync/target/release/coverage/lcov.info lcov.info du lcov.info - uses: codecov/codecov-action@v3 diff --git a/bin/ci_run b/bin/ci_run index 6df0ebff8..7b1fb8634 100755 --- a/bin/ci_run +++ b/bin/ci_run @@ -3,4 +3,4 @@ # Runs the command from within CI docker-compose environment. export ZKSYNC_HOME=$(pwd) && \ cd $ZKSYNC_HOME || exit 1 && \ -docker-compose -f docker-compose-runner.yml exec -T zk $@ +docker-compose -f docker-compose.ci.yml exec -T zk $@ diff --git a/contracts/scripts/governance-add-erc20.ts b/contracts/scripts/governance-add-erc20.ts index 23f3b38e0..623377ad3 100644 --- a/contracts/scripts/governance-add-erc20.ts +++ b/contracts/scripts/governance-add-erc20.ts @@ -10,7 +10,7 @@ const ethTestConfig = JSON.parse(fs.readFileSync(`${testConfigPath}/eth.json`, { const deployer = new Deployer({ deployWallet: ethers.Wallet.createRandom() }); const provider = web3Provider(); const governorWallet = process.env.MNEMONIC - ? Wallet.fromMnemonic(process.env.MNEMONIC, "m/44'/137'/0'/0/1").connect(provider) + ? Wallet.fromMnemonic(process.env.MNEMONIC, "m/44'/37310'/0'/0/0").connect(provider) : new Wallet(Buffer.from(ethTestConfig.account_with_rbtc_cow1_privK, 'hex'), provider); async function governanceAddToken(address: string) { diff --git a/core/bin/zksync_api/src/bin/dev_ticker_server.rs b/core/bin/zksync_api/src/bin/dev_ticker_server.rs index 8de0cd1f0..d967fa6de 100644 --- a/core/bin/zksync_api/src/bin/dev_ticker_server.rs +++ b/core/bin/zksync_api/src/bin/dev_ticker_server.rs @@ -11,7 +11,7 @@ use std::{ }; use structopt::StructOpt; use tokio::sync::Mutex; -use zksync_config::ZkSyncConfig; +use zksync_config::ChainConfig; use zksync_types::{network::Network, TokenInfo}; use zksync_utils::parse_env; @@ -37,7 +37,7 @@ fn load_tokens(path: impl AsRef) -> Result, serde_json::Err #[actix_web::main] async fn main() -> std::io::Result<()> { let _vlog_guard = vlog::init(); - let network = ZkSyncConfig::from_env().chain.eth.network; + let network = ChainConfig::from_env().eth.network; let opts = FeeTickerOpts::from_args(); if opts.sloppy { diff --git a/core/bin/zksync_api/src/bin/providers/proxy_price_provider.rs b/core/bin/zksync_api/src/bin/providers/proxy_price_provider.rs index f74530c82..9fca7376b 100644 --- a/core/bin/zksync_api/src/bin/providers/proxy_price_provider.rs +++ b/core/bin/zksync_api/src/bin/providers/proxy_price_provider.rs @@ -22,17 +22,11 @@ async fn fetch_coins_list() -> HttpResponse { // TODO: we always return the platforms, instead of checking for the query param `include_platform` to be true let rif_token = CoinsListItem { id: "rif-token".to_string(), - platforms: Some(rootstock_platform.clone()), + platforms: Some(rootstock_platform), name: "RIF Token".to_string(), symbol: "TRIF".to_string(), }; - let rbtc = CoinsListItem { - id: "rootstock".to_string(), - symbol: "TRBTC".to_string(), - name: "Rootstock RSK".to_string(), - platforms: Some(rootstock_platform), - }; - let coin_list: &[CoinsListItem] = &[rif_token, rbtc]; + let coin_list: &[CoinsListItem] = &[rif_token]; HttpResponse::Ok().json(coin_list) } @@ -111,9 +105,8 @@ mod fetch_coins_list_tests { let body: Vec = serde_json::from_slice(&body_bytes).unwrap(); let rif_token = body.iter().find(|coin| coin.id == "rif-token").unwrap(); - let rbtc = body.iter().find(|coin| coin.id == "rootstock").unwrap(); - assert_eq!(body.len(), 2); + assert_eq!(body.len(), 1); assert_eq!(rif_token.name, "RIF Token"); assert_eq!(rif_token.symbol, "TRIF"); assert_eq!( @@ -127,17 +120,5 @@ mod fetch_coins_list_tests { .unwrap(), RIF_TOKEN_TESTNET_ADDRESS ); - assert_eq!(rbtc.name, "Rootstock RSK"); - assert_eq!(rbtc.symbol, "TRBTC"); - assert_eq!( - rbtc.platforms - .as_ref() - .unwrap() - .get("rootstock") - .unwrap() - .as_ref() - .unwrap(), - RIF_TOKEN_TESTNET_ADDRESS - ); } } diff --git a/core/bin/zksync_api/src/fee_ticker/ticker_api/coingecko.rs b/core/bin/zksync_api/src/fee_ticker/ticker_api/coingecko.rs index 29ef95d18..a563e797f 100644 --- a/core/bin/zksync_api/src/fee_ticker/ticker_api/coingecko.rs +++ b/core/bin/zksync_api/src/fee_ticker/ticker_api/coingecko.rs @@ -75,7 +75,7 @@ impl TokenPriceAPI for CoinGeckoAPI { .query(&[ ("vs_currency", "usd"), ("days", "1"), - // Removed ("interval", "hourly"), parameter as hourly charts are only available to coingecko enterprice plan customers + // Removed ("interval", "hourly"), parameter as hourly charts are only available to coingecko enterprise plan customers // The default interval is daily ]) .send() diff --git a/core/bin/zksync_api/src/fee_ticker/ticker_info.rs b/core/bin/zksync_api/src/fee_ticker/ticker_info.rs index adab68c39..011a814ec 100644 --- a/core/bin/zksync_api/src/fee_ticker/ticker_info.rs +++ b/core/bin/zksync_api/src/fee_ticker/ticker_info.rs @@ -200,7 +200,7 @@ impl FeeTickerInfo for TickerInfo { }; // TODO: remove hardcode for tokens - if ["RDOC", "USDRIF"].contains(&token.symbol.as_str()) { + if ["RDOC", "USDRIF"].contains(&token.symbol.to_uppercase().as_str()) { metrics::histogram!(TICKET_INFO_GET_LAST_TOKEN_PRICE, start.elapsed(), "type" => token.symbol); return Ok(price_1_usd); } diff --git a/core/bin/zksync_api/src/fee_ticker/validator/mod.rs b/core/bin/zksync_api/src/fee_ticker/validator/mod.rs index 52c4555f1..e1c6047c4 100644 --- a/core/bin/zksync_api/src/fee_ticker/validator/mod.rs +++ b/core/bin/zksync_api/src/fee_ticker/validator/mod.rs @@ -14,6 +14,7 @@ use std::{ use bigdecimal::BigDecimal; use chrono::Utc; +use itertools::Itertools; // Workspace uses use zksync_types::{ tokens::{Token, TokenLike, TokenMarketVolume}, @@ -73,10 +74,24 @@ impl MarketUpdater { pub async fn keep_updated(mut self, duration_secs: u64) { let mut error_counter = 0; + // Market volume is not available for these tokens and + // we don't need it because they're added among the unconditionally_valid_tokens + let unavailable_market_volume_tokens = ["RDOC", "RBTC", "USDRIF"]; loop { let tokens = self.tokens_cache.get_all_tokens().await; let result = match tokens { - Ok(tokens) => self.update_all_tokens(tokens).await, + Ok(tokens) => { + self.update_all_tokens( + tokens + .into_iter() + .filter(|token| { + !unavailable_market_volume_tokens + .contains(&token.symbol.to_uppercase().as_str()) + }) + .collect_vec(), + ) + .await + } Err(e) => Err(e), }; diff --git a/docker-compose-runner.unit-tests.yml b/docker-compose.ci.unit-tests.yml similarity index 100% rename from docker-compose-runner.unit-tests.yml rename to docker-compose.ci.unit-tests.yml diff --git a/docker-compose-runner.yml b/docker-compose.ci.yml similarity index 89% rename from docker-compose-runner.yml rename to docker-compose.ci.yml index d42a9c6e8..795458408 100644 --- a/docker-compose-runner.yml +++ b/docker-compose.ci.yml @@ -17,9 +17,12 @@ services: - ./docker/rskj/node.conf:/etc/rsk/node.conf dev-ticker: - image: "rsksmart/rollup-dev-ticker:1.0.0-beta" + image: "rsksmart/rollup-dev-ticker:1.1.2-beta" env_file: + - ./etc/env/dev.env - ./etc/env/docker.env + environment: + - ZKSYNC_HOME=/ volumes: - ./etc/tokens/:/etc/tokens @@ -28,7 +31,6 @@ services: depends_on: - postgres - rskj - - dev-ticker command: tail -f /dev/null volumes: - .:/usr/src/zksync diff --git a/docker-compose.deploy.yml b/docker-compose.deploy.yml index 27f6d232d..6cfe17e2c 100644 --- a/docker-compose.deploy.yml +++ b/docker-compose.deploy.yml @@ -2,7 +2,7 @@ version: '3.2' services: server: - image: "rsksmart/rollup-server:1.0.1-beta" + image: "rsksmart/rollup-server:1.1.1-beta" ports: #Ports that where configured using the environment variables - 3001:3001 # RestApi - 3002:3002 # Web3 @@ -51,9 +51,12 @@ services: - ./etc/env/${ENV_OVERRIDE-deploy}.env dev-ticker: - image: "rsksmart/rollup-dev-ticker:1.0.0-beta" + image: "rsksmart/rollup-dev-ticker:1.1.2-beta" env_file: + - ./etc/env/${ZKSYNC_ENV-dev}.env - ./etc/env/${ENV_OVERRIDE-deploy}.env + environment: + - ZKSYNC_HOME=/ ports: - "9876:9876" volumes: diff --git a/docker-compose.yml b/docker-compose.yml index 1a087e6f2..bc1ae27f9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,7 +35,7 @@ services: start_period: 15s dev-ticker: - image: "rsksmart/rollup-dev-ticker:1.1.0-beta" + image: "rsksmart/rollup-dev-ticker:1.1.2-beta" env_file: - ./etc/env/${ZKSYNC_ENV-dev}.env - ./etc/env/${ENV_OVERRIDE-deploy}.env diff --git a/docker/dev-ticker/Dockerfile b/docker/dev-ticker/Dockerfile index 80f8bcd3a..fc42433a5 100644 --- a/docker/dev-ticker/Dockerfile +++ b/docker/dev-ticker/Dockerfile @@ -10,8 +10,7 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry \ cargo build --bin dev_ticker_server --release FROM debian:bullseye -RUN apt update -RUN apt install openssl -y +RUN apt-get update && apt-get install -y openssl ca-certificates && rm -rf /var/lib/apt/lists/* EXPOSE 9876 ENV RUST_BACKTRACE "full" ENV RUST_LOG info diff --git a/docker/rskj/node.conf b/docker/rskj/node.conf index 5a16400cc..8afda71eb 100644 --- a/docker/rskj/node.conf +++ b/docker/rskj/node.conf @@ -60,7 +60,7 @@ rpc { hosts = [ "localhost", "127.0.0.1", - "rskj", # rskj is the service name in docker-compose-runner.ymlfor CI + "rskj", # rskj is the service name in docker-compose.ci.yml for CI "host.docker.internal", # host.docker.internal localhost from container Windows and Mac "172.17.0.1" # 172.17.0.1 localhost from container Linux ] diff --git a/etc/env/qa/forced_exit_requests.toml b/etc/env/qa/forced_exit_requests.toml index 21e72f84f..29d54cb9b 100644 --- a/etc/env/qa/forced_exit_requests.toml +++ b/etc/env/qa/forced_exit_requests.toml @@ -24,7 +24,7 @@ wait_confirmations=1 # The account of the ForcedExit sender # The private key is defined in sender_eth_private_key -sender_account_address="0xa4dea4d5c954f5fd9e87f0e9752911e83a3d18b3" +sender_account_address="0x47DD9BB622fFF25CF562aC264e6075807B754EC8" # The time after which an invalid request is deleted in milliseconds expiration_period=3000 diff --git a/etc/env/qa/private.toml b/etc/env/qa/private.toml index 7bbd51bc2..272e31e0a 100644 --- a/etc/env/qa/private.toml +++ b/etc/env/qa/private.toml @@ -38,4 +38,4 @@ fee_account_private_key="0xea09e1fe584019bef786ba95da92bd0c256f599457aa6bf1520c0 # L2 private key of the account that sends ForcedExits sender_private_key="0x0092788f3890ed50dcab7f72fb574a0a9d30b1bc778ba076c609c311a8555352" # L1 private key of the account that sends ForcedExits -sender_eth_private_key="0xd77b8a342be95c5c31fa85c20450b424663c4fb4a499cfc80c202c592c85c219" +sender_eth_private_key="0xd783469124d7db80f6531ca19156cb777a1922d9edbbb1a9a35b75b5b981b2d8" diff --git a/etc/env/testnet/forced_exit_requests.toml b/etc/env/testnet/forced_exit_requests.toml index 21e72f84f..206c3f635 100644 --- a/etc/env/testnet/forced_exit_requests.toml +++ b/etc/env/testnet/forced_exit_requests.toml @@ -24,7 +24,7 @@ wait_confirmations=1 # The account of the ForcedExit sender # The private key is defined in sender_eth_private_key -sender_account_address="0xa4dea4d5c954f5fd9e87f0e9752911e83a3d18b3" +sender_account_address="0xe10C0796fF6f6Ff4185109bE8Cf133a66e5f024D" # The time after which an invalid request is deleted in milliseconds expiration_period=3000