From e875e130cb2b11c148d8a85369f8ea849ff5ce56 Mon Sep 17 00:00:00 2001 From: deniallugo Date: Thu, 15 Jul 2021 01:41:55 +0300 Subject: [PATCH 1/3] Deserialize null in eth_sign_data Signed-off-by: deniallugo --- contracts/scripts/submit-regenesis-upgrade.ts | 8 +++++--- core/lib/storage/src/chain/mempool/mod.rs | 12 ++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/contracts/scripts/submit-regenesis-upgrade.ts b/contracts/scripts/submit-regenesis-upgrade.ts index c1cdd2ce97..a04b41cfcd 100644 --- a/contracts/scripts/submit-regenesis-upgrade.ts +++ b/contracts/scripts/submit-regenesis-upgrade.ts @@ -53,9 +53,11 @@ async function finishUpgrade(upgradeGatekeeper: Contract, lastBlockInfo: string) const blockInfo = JSON.parse(lastBlockInfo); const upgradeData = ethers.utils.defaultAbiCoder.encode([storedBlockInfoParam()], [blockInfo]); - console.log('Finishing upgrade'); - await (await upgradeGatekeeper.finishUpgrade([[], [], upgradeData], { gasLimit: 3000000 })).wait(); - console.log('The upgrade has finished'); + console.log(upgradeData2); + + // console.log('Finishing upgrade'); + await (await upgradeGatekeeper.finishUpgrade([[], [], upgradeData], { gasLimit: 3_000_000 })).wait(); + // console.log('The upgrade has finished'); } async function cancelUpgrade(upgradeGatekeeper: Contract) { diff --git a/core/lib/storage/src/chain/mempool/mod.rs b/core/lib/storage/src/chain/mempool/mod.rs index 68992e9722..407d25a784 100644 --- a/core/lib/storage/src/chain/mempool/mod.rs +++ b/core/lib/storage/src/chain/mempool/mod.rs @@ -19,6 +19,8 @@ use zksync_types::{ // Local imports use self::records::{MempoolTx, QueuedBatchTx}; use crate::{QueryResult, StorageProcessor}; +use serde_json::Value; +use zksync_types::tx::TxEthSignatureVariant; pub mod records; @@ -154,6 +156,16 @@ impl<'a, 'c> MempoolSchema<'a, 'c> { .as_ref() .map(|sd| serde_json::to_value(sd).expect("failed to encode EthSignData")); + let eth_sign_data = if let Some(val) = eth_sign_data { + if val.is_null() { + None + } else { + Some(val) + } + } else { + None + }; + sqlx::query!( "INSERT INTO mempool_txs (tx_hash, tx, created_at, eth_sign_data) VALUES ($1, $2, $3, $4)", From 016e987b6279cc8d275d113be63a39361524e522 Mon Sep 17 00:00:00 2001 From: deniallugo Date: Thu, 15 Jul 2021 01:43:54 +0300 Subject: [PATCH 2/3] Return correct submit Signed-off-by: deniallugo --- contracts/scripts/submit-regenesis-upgrade.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/contracts/scripts/submit-regenesis-upgrade.ts b/contracts/scripts/submit-regenesis-upgrade.ts index a04b41cfcd..380ed4bc5e 100644 --- a/contracts/scripts/submit-regenesis-upgrade.ts +++ b/contracts/scripts/submit-regenesis-upgrade.ts @@ -52,12 +52,9 @@ async function startPreparation(upgradeGatekeeper: Contract) { async function finishUpgrade(upgradeGatekeeper: Contract, lastBlockInfo: string) { const blockInfo = JSON.parse(lastBlockInfo); const upgradeData = ethers.utils.defaultAbiCoder.encode([storedBlockInfoParam()], [blockInfo]); - - console.log(upgradeData2); - - // console.log('Finishing upgrade'); - await (await upgradeGatekeeper.finishUpgrade([[], [], upgradeData], { gasLimit: 3_000_000 })).wait(); - // console.log('The upgrade has finished'); + console.log('Finishing upgrade'); + await (await upgradeGatekeeper.finishUpgrade([[], [], upgradeData], { gasLimit: 3000000 })).wait(); + console.log('The upgrade has finished'); } async function cancelUpgrade(upgradeGatekeeper: Contract) { From 788768fa39ec24fd031d03f05f992b09d9c1e690 Mon Sep 17 00:00:00 2001 From: deniallugo Date: Thu, 15 Jul 2021 01:46:09 +0300 Subject: [PATCH 3/3] Remove redundant impport Signed-off-by: deniallugo --- core/lib/storage/src/chain/mempool/mod.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/core/lib/storage/src/chain/mempool/mod.rs b/core/lib/storage/src/chain/mempool/mod.rs index 407d25a784..63eb70a515 100644 --- a/core/lib/storage/src/chain/mempool/mod.rs +++ b/core/lib/storage/src/chain/mempool/mod.rs @@ -19,8 +19,6 @@ use zksync_types::{ // Local imports use self::records::{MempoolTx, QueuedBatchTx}; use crate::{QueryResult, StorageProcessor}; -use serde_json::Value; -use zksync_types::tx::TxEthSignatureVariant; pub mod records;