Skip to content

Commit

Permalink
zcash_client_sqlite: Use Uuid::from_u128 for all UUIDs
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
str4d committed Sep 25, 2023
1 parent a3332c4 commit e926151
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<P> {
pub(super) _params: P,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<P: consensus::Parameters> {
pub(crate) params: P,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<P> {
pub(super) params: P,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<P> {
pub(super) params: P,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit e926151

Please sign in to comment.