forked from matter-labs/zksync
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Danil <[email protected]> Signed-off-by: Danil <[email protected]>
- Loading branch information
1 parent
2766f6b
commit 5fd47c1
Showing
9 changed files
with
191 additions
and
125 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
core/bin/tree_cache_updater/Cargo.toml → core/bin/tx_count_migration/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[package] | ||
name = "tree_cache_updater" | ||
name = "tx_count_migration" | ||
version = "1.0.0" | ||
edition = "2018" | ||
authors = ["The Matter Labs Team <[email protected]>"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
use zksync_storage::StorageProcessor; | ||
|
||
#[tokio::main] | ||
async fn main() -> anyhow::Result<()> { | ||
let mut storage = StorageProcessor::establish_connection().await?; | ||
let mut first_account = None; | ||
loop { | ||
let mut transaction = storage.start_transaction().await?; | ||
match transaction | ||
.chain() | ||
.operations_ext_schema() | ||
.get_accounts_range(first_account, 10000) | ||
.await | ||
{ | ||
Some((start_account, final_account)) => { | ||
transaction | ||
.chain() | ||
.operations_ext_schema() | ||
.update_txs_count(start_account, final_account) | ||
.await; | ||
println!( | ||
"Data for accounts from {:?} to {:?} has been updated", | ||
&start_account, &final_account, | ||
); | ||
first_account = Some(final_account); | ||
} | ||
None => { | ||
// We can forget about tx because we will close | ||
// the connection without updating any data | ||
println!("Finish"); | ||
break; | ||
} | ||
} | ||
transaction.commit().await?; | ||
} | ||
|
||
Ok(()) | ||
} |
1 change: 0 additions & 1 deletion
1
core/lib/storage/migrations/2023-01-19-190417_fill-tx_count-with-data/down.sql
This file was deleted.
Oops, something went wrong.
40 changes: 0 additions & 40 deletions
40
core/lib/storage/migrations/2023-01-19-190417_fill-tx_count-with-data/up.sql
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters