Skip to content

Commit

Permalink
Fix merge
Browse files Browse the repository at this point in the history
Signed-off-by: deniallugo <[email protected]>
  • Loading branch information
Deniallugo committed Jul 13, 2021
1 parent 014c610 commit 16a28ae
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 62 deletions.
1 change: 0 additions & 1 deletion core/bin/zksync_api/src/api_server/tx_sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,6 @@ impl TxSender {
.await?;
}

let tx_hash = verified_tx.tx.hash();
// Send verified transactions to the mempool.
self.core_api_client
.send_tx(verified_tx)
Expand Down
5 changes: 0 additions & 5 deletions core/bin/zksync_api/src/fee_ticker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use futures::{
StreamExt,
};
use num::{
bigint::ToBigInt,
rational::Ratio,
traits::{Inv, Pow},
BigUint, CheckedDiv, Zero,
Expand Down Expand Up @@ -73,12 +72,8 @@ impl GasOperationsCost {
// size, resulting in us paying more gas than for bigger block.
let standard_fast_withdrawal_cost =
(constants::BASE_WITHDRAW_COST as f64 * fast_processing_coeff) as u32;
let subsidy_fast_withdrawal_cost =
(constants::SUBSIDY_WITHDRAW_COST as f64 * fast_processing_coeff) as u32;
let standard_fast_withdrawal_nft_cost =
(constants::BASE_WITHDRAW_NFT_COST as f64 * fast_processing_coeff) as u32;
let subsidy_fast_withdrawal_nft_cost =
(constants::SUBSIDY_WITHDRAW_NFT_COST as f64 * fast_processing_coeff) as u32;

let standard_cost = vec![
(
Expand Down
74 changes: 37 additions & 37 deletions core/lib/storage/sqlx-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -2542,6 +2542,19 @@
"nullable": []
}
},
"5bfcd9e4747395bdd0cd3f48700c70ae930af359b357f707da1cbe7ea8267273": {
"query": "\n INSERT INTO txs_batches_hashes (batch_id, batch_hash)\n SELECT u.batch_id, u.batch_hash\n FROM UNNEST ($1::bigint[], $2::bytea[])\n AS u(batch_id, batch_hash)\n ",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Int8Array",
"ByteaArray"
]
},
"nullable": []
}
},
"5d114595ec0f4fb9c49b846b4f245e454b02a47e88fa3b800d90c50564db74f0": {
"query": "UPDATE eth_parameters SET last_committed_block = $1 WHERE id = true",
"describe": {
Expand Down Expand Up @@ -2689,30 +2702,6 @@
]
}
},
"6a8f81ac8f56574e5a048e6acfa04d1c9f0adf348f1eee2ac0dde84f3cf63c40": {
"query": "SELECT batch_id, array_agg(tx_hash) as txs\n FROM executed_transactions\n GROUP BY batch_id\n HAVING batch_id IS NOT NULL AND batch_id != 0;\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "batch_id",
"type_info": "Int8"
},
{
"ordinal": 1,
"name": "txs",
"type_info": "ByteaArray"
}
],
"parameters": {
"Left": []
},
"nullable": [
true,
null
]
}
},
"6c25f6955c7381b5ed9bf4f2eb233adbd2923baafc688f36b66b86f44b456668": {
"query": "UPDATE blocks\n SET root_hash = $1\n WHERE number = $2",
"describe": {
Expand Down Expand Up @@ -3895,6 +3884,30 @@
"nullable": []
}
},
"9e72348619aa9c7f0f330c31f5ea4b3a73a4727a817e65e026756feea4d13d69": {
"query": "SELECT batch_id, array_agg(tx_hash) as txs\n FROM executed_transactions\n WHERE batch_id IS NOT NULL AND batch_id != 0\n GROUP BY batch_id\n ORDER BY batch_id;\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "batch_id",
"type_info": "Int8"
},
{
"ordinal": 1,
"name": "txs",
"type_info": "ByteaArray"
}
],
"parameters": {
"Left": []
},
"nullable": [
true,
null
]
}
},
"9fb67f0d0bc8387201e5358ca011da4b6d4d48c38c5de3f628c9818804c01376": {
"query": "\n WITH transactions AS (\n SELECT\n tx_hash,\n tx as op,\n block_number,\n created_at,\n success,\n fail_reason,\n Null::bytea as eth_hash,\n Null::bigint as priority_op_serialid,\n block_index\n FROM executed_transactions\n WHERE block_number = $1 AND created_at <= $2\n ), priority_ops AS (\n SELECT\n tx_hash,\n operation as op,\n block_number,\n created_at,\n true as success,\n Null as fail_reason,\n eth_hash,\n priority_op_serialid,\n block_index\n FROM executed_priority_operations\n WHERE block_number = $1 AND created_at <= $2\n ), everything AS (\n SELECT * FROM transactions\n UNION ALL\n SELECT * FROM priority_ops\n )\n SELECT\n tx_hash as \"tx_hash!\",\n block_number as \"block_number!\",\n op as \"op!\",\n created_at as \"created_at!\",\n success as \"success!\",\n fail_reason as \"fail_reason?\",\n eth_hash as \"eth_hash?\",\n priority_op_serialid as \"priority_op_serialid?\"\n FROM everything\n ORDER BY created_at DESC, block_index DESC\n LIMIT $3\n ",
"describe": {
Expand Down Expand Up @@ -6163,19 +6176,6 @@
"nullable": []
}
},
"ec07bf1dcfe77b28e753f3f145ff02ce47924ed311b2b7848b6e13c377d1a235": {
"query": "\n INSERT INTO txs_batches_hashes (batch_id, batch_hash)\n SELECT u.batch_id, u.batch_hash\n FROM UNNEST ($1::bigint[], $2::bytea[])\n AS u(batch_id, batch_hash)\n ",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Int8Array",
"ByteaArray"
]
},
"nullable": []
}
},
"ec1b0d11c29e691e78145bf04665fd1967b329722cf0d54a0611eedc4caff866": {
"query": "\n SELECT * FROM tokens\n WHERE id >= $1 AND is_nft = false\n ORDER BY id ASC\n LIMIT $2\n ",
"describe": {
Expand Down
32 changes: 19 additions & 13 deletions core/lib/storage/src/chain/operations/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -650,8 +650,9 @@ impl<'a, 'c> OperationsSchema<'a, 'c> {
let batches = sqlx::query!(
"SELECT batch_id, array_agg(tx_hash) as txs
FROM executed_transactions
WHERE batch_id IS NOT NULL AND batch_id != 0
GROUP BY batch_id
HAVING batch_id IS NOT NULL AND batch_id != 0;
ORDER BY batch_id;
"
)
.fetch_all(self.0.conn())
Expand All @@ -668,18 +669,23 @@ impl<'a, 'c> OperationsSchema<'a, 'c> {
batch_hashes.push(sha256(&bytes).to_vec());
}

sqlx::query!(
r#"
INSERT INTO txs_batches_hashes (batch_id, batch_hash)
SELECT u.batch_id, u.batch_hash
FROM UNNEST ($1::bigint[], $2::bytea[])
AS u(batch_id, batch_hash)
"#,
&ids,
&batch_hashes,
)
.execute(self.0.conn())
.await?;
assert!(ids.len() == batch_hashes.len());

for (chunk_ids, chunk_hashes) in ids.chunks(10).zip(batch_hashes.chunks(10)) {
sqlx::query!(
r#"
INSERT INTO txs_batches_hashes (batch_id, batch_hash)
SELECT u.batch_id, u.batch_hash
FROM UNNEST ($1::bigint[], $2::bytea[])
AS u(batch_id, batch_hash)
"#,
&chunk_ids,
&chunk_hashes,
)
.execute(self.0.conn())
.await?;
println!("First id {:?}", &chunk_ids[0]);
}

Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion docker/dev-ticker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:experimental
FROM rust:1.48 as builder
FROM rust:1.51 as builder
RUN --mount=type=cache,target=/usr/local/cargo/registry \
cargo install sccache
WORKDIR /usr/src/zksync
Expand Down
8 changes: 3 additions & 5 deletions infrastructure/zk/src/docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,13 @@ async function _build(image: string) {
await contract.build();
}
const { stdout: imageTag } = await utils.exec('git rev-parse --short HEAD');
// TODO Uncomment this code, after nft deploying
// const latestImage = `-t matterlabs/${image}:latest`;
const latestImage = `-t matterlabs/${image}:latest`;
const taggedImage = ['nginx', 'server', 'prover'].includes(image) ? `-t matterlabs/${image}:${imageTag}` : '';
await utils.spawn(`DOCKER_BUILDKIT=1 docker build ${taggedImage} -f ./docker/${image}/Dockerfile .`);
await utils.spawn(`DOCKER_BUILDKIT=1 docker build ${latestImage} ${taggedImage} -f ./docker/${image}/Dockerfile .`);
}

async function _push(image: string) {
// TODO Uncomment this code, after nft deploying
// await utils.spawn(`docker push matterlabs/${image}:latest`);
await utils.spawn(`docker push matterlabs/${image}:latest`);
if (['nginx', 'server', 'prover', 'event-listener'].includes(image)) {
const { stdout: imageTag } = await utils.exec('git rev-parse --short HEAD');
await utils.spawn(`docker push matterlabs/${image}:${imageTag}`);
Expand Down

0 comments on commit 16a28ae

Please sign in to comment.