From e926151f8fd685be3057fa8fb5d98c8e770b8ce2 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Mon, 25 Sep 2023 12:05:42 +0000 Subject: [PATCH] zcash_client_sqlite: Use `Uuid::from_u128` for all UUIDs Previously we used `Uuid::from_fields` to ensure that the various UUID fields were correctly constructed, but now that we have a CI lint that checks this automatically, we can consistently use `Uuid::from_u128` which is easier to prepare from `uuidgen` output. --- .../src/wallet/init/migrations/add_transaction_views.rs | 7 +------ .../src/wallet/init/migrations/add_utxo_account.rs | 9 +-------- .../src/wallet/init/migrations/addresses_table.rs | 9 +-------- .../src/wallet/init/migrations/initial_setup.rs | 9 +-------- .../wallet/init/migrations/received_notes_nullable_nf.rs | 7 +------ .../src/wallet/init/migrations/sent_notes_to_internal.rs | 9 +-------- .../src/wallet/init/migrations/shardtree_support.rs | 7 +------ .../src/wallet/init/migrations/ufvk_support.rs | 7 +------ .../src/wallet/init/migrations/utxos_table.rs | 7 +------ .../src/wallet/init/migrations/v_transactions_net.rs | 7 +------ 10 files changed, 10 insertions(+), 68 deletions(-) diff --git a/zcash_client_sqlite/src/wallet/init/migrations/add_transaction_views.rs b/zcash_client_sqlite/src/wallet/init/migrations/add_transaction_views.rs index 05ab54aed..d0b422a02 100644 --- a/zcash_client_sqlite/src/wallet/init/migrations/add_transaction_views.rs +++ b/zcash_client_sqlite/src/wallet/init/migrations/add_transaction_views.rs @@ -17,12 +17,7 @@ use zcash_primitives::{ use super::{add_utxo_account, sent_notes_to_internal}; use crate::wallet::init::WalletMigrationError; -pub(super) const MIGRATION_ID: Uuid = Uuid::from_fields( - 0x282fad2e, - 0x8372, - 0x4ca0, - b"\x8b\xed\x71\x82\x13\x20\x90\x9f", -); +pub(super) const MIGRATION_ID: Uuid = Uuid::from_u128(0x282fad2e_8372_4ca0_8bed_71821320909f); pub(crate) struct Migration; diff --git a/zcash_client_sqlite/src/wallet/init/migrations/add_utxo_account.rs b/zcash_client_sqlite/src/wallet/init/migrations/add_utxo_account.rs index cc3c61f6a..304a4490a 100644 --- a/zcash_client_sqlite/src/wallet/init/migrations/add_utxo_account.rs +++ b/zcash_client_sqlite/src/wallet/init/migrations/add_utxo_account.rs @@ -20,14 +20,7 @@ use { }; /// This migration adds an account identifier column to the UTXOs table. -/// -/// 761884d6-30d8-44ef-b204-0b82551c4ca1 -pub(super) const MIGRATION_ID: Uuid = Uuid::from_fields( - 0x761884d6, - 0x30d8, - 0x44ef, - b"\xb2\x04\x0b\x82\x55\x1c\x4c\xa1", -); +pub(super) const MIGRATION_ID: Uuid = Uuid::from_u128(0x761884d6_30d8_44ef_b204_0b82551c4ca1); pub(super) struct Migration

{ pub(super) _params: P, diff --git a/zcash_client_sqlite/src/wallet/init/migrations/addresses_table.rs b/zcash_client_sqlite/src/wallet/init/migrations/addresses_table.rs index 7601f8d38..9456a4fcc 100644 --- a/zcash_client_sqlite/src/wallet/init/migrations/addresses_table.rs +++ b/zcash_client_sqlite/src/wallet/init/migrations/addresses_table.rs @@ -16,14 +16,7 @@ use super::ufvk_support; /// The migration that removed the address columns from the `accounts` table, and created /// the `accounts` table. -/// -/// d956978c-9c87-4d6e-815d-fb8f088d094c -pub(super) const MIGRATION_ID: Uuid = Uuid::from_fields( - 0xd956978c, - 0x9c87, - 0x4d6e, - b"\x81\x5d\xfb\x8f\x08\x8d\x09\x4c", -); +pub(super) const MIGRATION_ID: Uuid = Uuid::from_u128(0xd956978c_9c87_4d6e_815d_fb8f088d094c); pub(crate) struct Migration { pub(crate) params: P, diff --git a/zcash_client_sqlite/src/wallet/init/migrations/initial_setup.rs b/zcash_client_sqlite/src/wallet/init/migrations/initial_setup.rs index 850136856..4c7387aa6 100644 --- a/zcash_client_sqlite/src/wallet/init/migrations/initial_setup.rs +++ b/zcash_client_sqlite/src/wallet/init/migrations/initial_setup.rs @@ -9,14 +9,7 @@ use uuid::Uuid; use crate::wallet::init::WalletMigrationError; /// Identifier for the migration that performs the initial setup of the wallet database. -/// -/// bc4f5e57-d600-4b6c-990f-b3538f0bfce1, -pub(super) const MIGRATION_ID: Uuid = Uuid::from_fields( - 0xbc4f5e57, - 0xd600, - 0x4b6c, - b"\x99\x0f\xb3\x53\x8f\x0b\xfc\xe1", -); +pub(super) const MIGRATION_ID: Uuid = Uuid::from_u128(0xbc4f5e57_d600_4b6c_990f_b3538f0bfce1); pub(super) struct Migration; diff --git a/zcash_client_sqlite/src/wallet/init/migrations/received_notes_nullable_nf.rs b/zcash_client_sqlite/src/wallet/init/migrations/received_notes_nullable_nf.rs index 5a856dc3d..ff7b14e97 100644 --- a/zcash_client_sqlite/src/wallet/init/migrations/received_notes_nullable_nf.rs +++ b/zcash_client_sqlite/src/wallet/init/migrations/received_notes_nullable_nf.rs @@ -11,12 +11,7 @@ use uuid::Uuid; use super::v_transactions_net; use crate::wallet::init::WalletMigrationError; -pub(super) const MIGRATION_ID: Uuid = Uuid::from_fields( - 0xbdcdcedc, - 0x7b29, - 0x4f1c, - b"\x83\x07\x35\xf9\x37\xf0\xd3\x2a", -); +pub(super) const MIGRATION_ID: Uuid = Uuid::from_u128(0xbdcdcedc_7b29_4f1c_8307_35f937f0d32a); pub(crate) struct Migration; diff --git a/zcash_client_sqlite/src/wallet/init/migrations/sent_notes_to_internal.rs b/zcash_client_sqlite/src/wallet/init/migrations/sent_notes_to_internal.rs index ee191b957..a647894dc 100644 --- a/zcash_client_sqlite/src/wallet/init/migrations/sent_notes_to_internal.rs +++ b/zcash_client_sqlite/src/wallet/init/migrations/sent_notes_to_internal.rs @@ -11,14 +11,7 @@ use super::ufvk_support; use crate::wallet::init::WalletMigrationError; /// This migration adds the `to_account` field to the `sent_notes` table. -/// -/// 0ddbe561-8259-4212-9ab7-66fdc4a74e1d -pub(super) const MIGRATION_ID: Uuid = Uuid::from_fields( - 0x0ddbe561, - 0x8259, - 0x4212, - b"\x9a\xb7\x66\xfd\xc4\xa7\x4e\x1d", -); +pub(super) const MIGRATION_ID: Uuid = Uuid::from_u128(0x0ddbe561_8259_4212_9ab7_66fdc4a74e1d); pub(super) struct Migration; diff --git a/zcash_client_sqlite/src/wallet/init/migrations/shardtree_support.rs b/zcash_client_sqlite/src/wallet/init/migrations/shardtree_support.rs index e35d01805..822c87d9b 100644 --- a/zcash_client_sqlite/src/wallet/init/migrations/shardtree_support.rs +++ b/zcash_client_sqlite/src/wallet/init/migrations/shardtree_support.rs @@ -32,12 +32,7 @@ use crate::{ PRUNING_DEPTH, SAPLING_TABLES_PREFIX, }; -pub(super) const MIGRATION_ID: Uuid = Uuid::from_fields( - 0x7da6489d, - 0xe835, - 0x4657, - b"\x8b\xe5\xf5\x12\xbc\xce\x6c\xbf", -); +pub(super) const MIGRATION_ID: Uuid = Uuid::from_u128(0x7da6489d_e835_4657_8be5_f512bcce6cbf); pub(super) struct Migration

{ pub(super) params: P, diff --git a/zcash_client_sqlite/src/wallet/init/migrations/ufvk_support.rs b/zcash_client_sqlite/src/wallet/init/migrations/ufvk_support.rs index 656281b70..889d8d0ae 100644 --- a/zcash_client_sqlite/src/wallet/init/migrations/ufvk_support.rs +++ b/zcash_client_sqlite/src/wallet/init/migrations/ufvk_support.rs @@ -25,12 +25,7 @@ use crate::wallet::{ pool_code, }; -pub(super) const MIGRATION_ID: Uuid = Uuid::from_fields( - 0xbe57ef3b, - 0x388e, - 0x42ea, - b"\x97\xe2\x67\x8d\xaf\xcf\x97\x54", -); +pub(super) const MIGRATION_ID: Uuid = Uuid::from_u128(0xbe57ef3b_388e_42ea_97e2_678dafcf9754); pub(super) struct Migration

{ pub(super) params: P, diff --git a/zcash_client_sqlite/src/wallet/init/migrations/utxos_table.rs b/zcash_client_sqlite/src/wallet/init/migrations/utxos_table.rs index 718039429..083393e67 100644 --- a/zcash_client_sqlite/src/wallet/init/migrations/utxos_table.rs +++ b/zcash_client_sqlite/src/wallet/init/migrations/utxos_table.rs @@ -8,12 +8,7 @@ use uuid::Uuid; use crate::wallet::init::{migrations::initial_setup, WalletMigrationError}; -pub(super) const MIGRATION_ID: Uuid = Uuid::from_fields( - 0xa2e0ed2e, - 0x8852, - 0x475e, - b"\xb0\xa4\xf1\x54\xb1\x5b\x9d\xbe", -); +pub(super) const MIGRATION_ID: Uuid = Uuid::from_u128(0xa2e0ed2e_8852_475e_b0a4_f154b15b9dbe); pub(super) struct Migration; diff --git a/zcash_client_sqlite/src/wallet/init/migrations/v_transactions_net.rs b/zcash_client_sqlite/src/wallet/init/migrations/v_transactions_net.rs index 14cd830b1..c6ad76403 100644 --- a/zcash_client_sqlite/src/wallet/init/migrations/v_transactions_net.rs +++ b/zcash_client_sqlite/src/wallet/init/migrations/v_transactions_net.rs @@ -11,12 +11,7 @@ use zcash_client_backend::data_api::{PoolType, ShieldedProtocol}; use super::add_transaction_views; use crate::wallet::{init::WalletMigrationError, pool_code}; -pub(super) const MIGRATION_ID: Uuid = Uuid::from_fields( - 0x2aa4d24f, - 0x51aa, - 0x4a4c, - b"\x8d\x9b\xe5\xb8\xa7\x62\x86\x5f", -); +pub(super) const MIGRATION_ID: Uuid = Uuid::from_u128(0x2aa4d24f_51aa_4a4c_8d9b_e5b8a762865f); pub(crate) struct Migration;