Skip to content

Commit

Permalink
Merge branch 'deniallugo-merge-dev' into perekopskiy-zkd-67-support-n…
Browse files Browse the repository at this point in the history
…ft-and-swaps-in-v-02
  • Loading branch information
Deniallugo committed Jun 28, 2021
2 parents 2d6c232 + 5af42fe commit f7c8581
Show file tree
Hide file tree
Showing 53 changed files with 2,898 additions and 2,902 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ jobs:
ci_run zk db basic-setup
ci_run zk run yarn
- name: liquidity-token
run: docker-compose -f docker-compose-runner.yml restart dev-liquidity-token-watcher
- name: restart dev-liquidity-token-watcher and dev-ticker
run: docker-compose -f docker-compose-runner.yml restart dev-liquidity-token-watcher dev-ticker

- name: contracts-unit-tests
run: ci_run zk test contracts
Expand Down Expand Up @@ -102,8 +102,8 @@ jobs:
ci_run zk dummy-prover enable --no-redeploy
ci_run zk init
- name: liquidity-token
run: docker-compose -f docker-compose-runner.yml restart dev-liquidity-token-watcher
- name: restart dev-liquidity-token-watcher and dev-ticker
run: docker-compose -f docker-compose-runner.yml restart dev-liquidity-token-watcher dev-ticker

- name: run-services
run: |
Expand Down
26 changes: 14 additions & 12 deletions .github/workflows/deploy-apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,24 @@ jobs:
key: "${{ github.event.deployment.environment }}"
map: |
{
"mainnet": {
"^mainnet$": {
"KUBECONF": "KUBECONF_MAINNET",
"HFENV": "zksync-prod",
"HFENV": "prod",
"RUNNER": "mainnet"
},
"rinkeby": {
"^rinkeby$": {
"KUBECONF": "KUBECONF_TESTNET",
"HFENV": "zksync-${{ github.event.deployment.environment }}",
"HFENV": "${{ github.event.deployment.environment }}",
"RUNNER": "testnet"
},
"ropsten": {
"^ropsten$": {
"KUBECONF": "KUBECONF_TESTNET",
"HFENV": "zksync-${{ github.event.deployment.environment }}",
"HFENV": "${{ github.event.deployment.environment }}",
"RUNNER": "testnet"
},
".*": {
"KUBECONF": "KUBECONF_STAGE",
"HFENV": "zksync-${{ github.event.deployment.environment }}",
"HFENV": "${{ github.event.deployment.environment }}",
"RUNNER": "stage"
}
}
Expand All @@ -68,10 +68,9 @@ jobs:
name: Deploy Apps
runs-on: [k8s, deployer, "${{ needs.pre.outputs.runner }}"]
needs: pre
if: ${{ needs.pre.outputs.isTag == 'true' }}

container:
image: dysnix/kubectl:v1.16-gcloud
image: dysnix/kubectl:v1.19-gcloud

env:
IMAGE_TAG: ${{ needs.pre.outputs.shortRev }}
Expand All @@ -80,9 +79,11 @@ jobs:

steps:
-
if: ${{ needs.pre.outputs.isTag == 'true' }}
name: Create ~/.kube/config
run: mkdir -p ~/.kube && echo "$KUBECONF" | base64 -d > ~/.kube/config
-
if: ${{ needs.pre.outputs.isTag == 'true' }}
name: Clone helm-infra
uses: actions/checkout@v2
with:
Expand All @@ -91,6 +92,7 @@ jobs:
ref: master
token: ${{ secrets.GH_TOKEN }}
-
if: ${{ needs.pre.outputs.isTag == 'true' }}
name: Deploy apps
working-directory: helm-infra
run: |
Expand All @@ -100,25 +102,25 @@ jobs:
UPDATE_REPOS=y helmfile -e $HFENV repos
helmfile -e $HFENV $DEPLOY_APPS apply --args "timeout 180s"
-
if: success() && needs.pre.outputs.isTag == 'true'
name: Update deployment status (success)
if: success()
uses: chrnorm/deployment-status@releases/v1
with:
token: ${{ github.token }}
state: success
deployment_id: ${{ github.event.deployment.id }}
-
if: failure() && needs.pre.outputs.isTag == 'true'
name: Update deployment status (failure)
if: failure()
uses: chrnorm/deployment-status@releases/v1
with:
token: ${{ github.token }}
state: failure
deployment_id: ${{ github.event.deployment.id }}
-
if: failure() && needs.pre.outputs.isTag == 'true'
name: Notify to Mattermost (on failure)
uses: tferreira/matterfy@releases/v1
if: failure()
with:
type: ${{ job.status }}
job_name: '*Deployment to "${{ github.event.deployment.environment }}" failed*'
Expand Down
135 changes: 69 additions & 66 deletions .github/workflows/deploy-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- dev
- breaking

env:
DEPLOY_APPS: -l name=server -l name=prover -l name=explorer
Expand Down Expand Up @@ -51,73 +52,75 @@ jobs:
run: |
docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
zk docker push rust
zk docker push nginx
deploy:
name: Deploy to the Stage enviroment
runs-on: [k8s, deployer, stage]
needs: [pre, build-images]
container:
image: dysnix/kubectl:v1.16-gcloud
# deploy:
# ## TODO: fix stage and enable deployments back.
# ## NOTE: breaking deployment is not supported.

env:
KUBECONF: ${{ secrets.KUBECONF_STAGE }}
IMAGE_TAG: ${{ needs.pre.outputs.shortRev }}
HFENV: zksync-stage
# name: Deploy to the Stage enviroment
# runs-on: [k8s, deployer, stage]
# needs: [pre, build-images]

steps:
-
name: Create ~/.kube/config
run: mkdir -p ~/.kube && echo "$KUBECONF" | base64 -d > ~/.kube/config
-
name: Clone helm-infra
uses: actions/checkout@v2
with:
repository: matter-labs/helm-infra
path: helm-infra
ref: master
token: ${{ secrets.GH_TOKEN }}
-
uses: chrnorm/deployment-action@releases/v1
name: Create GitHub deployment
id: deployment
with:
token: "${{ github.token }}"
environment: stage
# TODO fix stage and resume deploy to stage
# -
# name: Deploy apps
# working-directory: helm-infra
# run: |
# copy helm plugins over (from dysnix/kubectl, don't forget)!!!
# cp -r /dysnix/kubectl/.local /dysnix/kubectl/.cache ~
#
# UPDATE_REPOS=y helmfile -e $HFENV repos
# helmfile -e $HFENV $DEPLOY_APPS apply --args "timeout 180s"
-
name: Update deployment status (success)
if: success()
uses: chrnorm/deployment-status@releases/v1
with:
token: ${{ github.token }}
state: success
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
-
name: Update deployment status (failure)
if: failure()
uses: chrnorm/deployment-status@releases/v1
with:
token: ${{ github.token }}
state: failure
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
-
name: Notify to Mattermost (on failure)
uses: tferreira/matterfy@releases/v1
if: failure()
with:
type: ${{ job.status }}
job_name: '*Deployment to stage failed*'
icon_emoji: octocat
channel: 'matterlabs-alerts'
url: ${{ secrets.MATTERMOST_WEBHOOK }}
# container:
# image: dysnix/kubectl:v1.19-gcloud

# env:
# KUBECONF: ${{ secrets.KUBECONF_STAGE }}
# IMAGE_TAG: ${{ needs.pre.outputs.shortRev }}
# HFENV: stage

# steps:
# -
# name: Create ~/.kube/config
# run: mkdir -p ~/.kube && echo "$KUBECONF" | base64 -d > ~/.kube/config
# -
# name: Clone helm-infra
# uses: actions/checkout@v2
# with:
# repository: matter-labs/helm-infra
# path: helm-infra
# ref: master
# token: ${{ secrets.GH_TOKEN }}
# -
# uses: chrnorm/deployment-action@releases/v1
# name: Create GitHub deployment
# id: deployment
# with:
# token: "${{ github.token }}"
# environment: stage
# -
# name: Deploy apps
# working-directory: helm-infra
# run: |
# # copy helm plugins over (from dysnix/kubectl, don't forget)!!!
# cp -r /dysnix/kubectl/.local /dysnix/kubectl/.cache ~

# UPDATE_REPOS=y helmfile -e $HFENV repos
# helmfile -e $HFENV $DEPLOY_APPS apply --args "timeout 180s"
# -
# name: Update deployment status (success)
# if: success()
# uses: chrnorm/deployment-status@releases/v1
# with:
# token: ${{ github.token }}
# state: success
# deployment_id: ${{ steps.deployment.outputs.deployment_id }}
# -
# name: Update deployment status (failure)
# if: failure()
# uses: chrnorm/deployment-status@releases/v1
# with:
# token: ${{ github.token }}
# state: failure
# deployment_id: ${{ steps.deployment.outputs.deployment_id }}
# -
# name: Notify to Mattermost (on failure)
# uses: tferreira/matterfy@releases/v1
# if: failure()
# with:
# type: ${{ job.status }}
# job_name: '*Deployment to stage failed*'
# icon_emoji: octocat
# channel: 'matterlabs-alerts'
# url: ${{ secrets.MATTERMOST_WEBHOOK }}
2 changes: 2 additions & 0 deletions changelog/infrastructure.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ components, the logs will have the following format:

### Added

- (`api-docs`): tool for generating and testing API documentation. Docs are generated from a bunch of .apib files where
API endpoints and their inputs/outputs are defined.
- (`token_list_manager`): CLI for updating to new version of a previously saved list of trusted tokens.
- (`loadnext`): Crate, a new implementation of the loadtest for zkSync.
- (`api-docs`): tool for generating and testing API documentation. Docs are generated from a bunch of .apib files where
Expand Down
10 changes: 10 additions & 0 deletions changelog/js-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,21 @@ All notable changes to `zksync.js` will be documented in this file.
- `SyncProvider` interface: common interface for API v0.2 `RestProvider` and JSON RPC `Provider`.
- Types for REST API v0.2.

- `RestProvider` class, that is used for queriing REST API v0.2.
- `SyncProvider` interface: common interface for API v0.2 `RestProvider` and JSON RPC `Provider`.
- Types for REST API v0.2.

### Changed

- Changed type of `provider` field in `Wallet` class from `Provider` to `SyncProvider`.
- `ForcedExit` fee type is used for `ForcedExit` transactions instead of `Withdraw` fee type.
- `zksync-crypto` to support atomic swaps/limit orders functionality.
- Changed type of `provider` field in `Wallet` class from `Provider` to `SyncProvider`.
- `ForcedExit` fee type is used for `ForcedExit` transactions instead of `Withdraw` fee type.

### Deprecated

### Fixed

## Version 0.10.9 (13.04.2021)

Expand Down
3 changes: 2 additions & 1 deletion contracts/scripts/upgrade-testnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ async function main() {
});
parser.addArgument('--initArgs', {
required: false,
help: 'Upgrade function parameters comma-separated, RLP serialized in hex (Governance,Verifier,ZkSync): 0xaa..aa,0xbb..bb,0xcc..c or zero by default.',
help:
'Upgrade function parameters comma-separated, RLP serialized in hex (Governance,Verifier,ZkSync): 0xaa..aa,0xbb..bb,0xcc..c or zero by default.',
defaultValue: '0x,0x,0x'
});
parser.addArgument('--cancelPreviousUpgrade', {
Expand Down
10 changes: 10 additions & 0 deletions core/bin/prover/src/plonk_step_by_step_prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
use std::sync::Mutex;
// Workspace deps
use zksync_config::ChainConfig;
use zksync_crypto::bellman::Circuit;
use zksync_crypto::proof::{AggregatedProof, PrecomputedSampleProofs, SingleProof};
use zksync_crypto::Engine;
use zksync_prover_utils::aggregated_proofs::{gen_aggregate_proof, prepare_proof_data};
Expand All @@ -10,6 +11,7 @@ use zksync_prover_utils::{PlonkVerificationKey, SetupForStepByStepProver};
use zksync_utils::parse_env;
// Local deps
use crate::{ProverConfig, ProverImpl};
use zksync_crypto::franklin_crypto::circuit::test::TestConstraintSystem;
use zksync_prover_utils::fs_utils::load_precomputed_proofs;

/// We prepare some data before making proof for each block size, so we cache it in case next block
Expand Down Expand Up @@ -56,6 +58,14 @@ impl PlonkStepByStepProver {
block_size: usize,
) -> anyhow::Result<SingleProof> {
// we do this way here so old precomp is dropped
let mut cs = TestConstraintSystem::<Engine>::new();
witness.clone().synthesize(&mut cs).unwrap();

if let Some(err) = cs.which_is_unsatisfied() {
println!("unconstrained: {}", cs.find_unconstrained());
println!("number of constraints {}", cs.num_constraints());
println!("Unsatisfied {:?}", err);
}
let valid_cached_precomp = {
self.prepared_computations
.lock()
Expand Down
10 changes: 9 additions & 1 deletion core/bin/zksync_api/src/api_server/rest/v02/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,21 @@ impl ApiAccountData {
.map(|(id, nft)| (*id, nft.clone().into()))
.collect();

let account_type = storage
.chain()
.account_schema()
.account_type_by_id(account_id)
.await
.map_err(Error::storage)?
.map(|t| t.into());
Ok(Account {
account_id,
address: account.address,
nonce: account.nonce,
pub_key_hash: account.pub_key_hash,
last_update_in_block,
balances,
account_type,
nfts,
minted_nfts,
})
Expand Down Expand Up @@ -520,7 +528,7 @@ mod tests {
.get_block_transactions(block)
.await?;

let tx = &transactions[1];
let tx = &transactions[0];
let op = tx.op.as_object().unwrap();

let id = if op.contains_key("accountId") {
Expand Down
7 changes: 3 additions & 4 deletions core/bin/zksync_api/src/api_server/rest/v02/paginate_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,14 @@ impl Paginate<ApiEither<TokenId>> for StorageProcessor<'_> {
.map_err(Error::storage)?;
let count = transaction
.tokens_schema()
.get_last_token_id()
.get_count()
.await
.map_err(Error::storage)?
.0;
.map_err(Error::storage)?;

transaction.commit().await.map_err(Error::storage)?;

Ok(Paginated::new(
tokens,
tokens.values().cloned().collect(),
query.from,
query.limit,
query.direction,
Expand Down
Loading

0 comments on commit f7c8581

Please sign in to comment.