From 8f304f8466190f040ddcedab713956cb26222da0 Mon Sep 17 00:00:00 2001 From: tomyrd Date: Mon, 10 Jun 2024 11:47:02 -0300 Subject: [PATCH] Fix submitted typo --- src/store/note_record/mod.rs | 16 +++++++------- src/store/sqlite_store/notes.rs | 38 ++++++++++++++++---------------- src/store/sqlite_store/store.sql | 4 ++-- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/store/note_record/mod.rs b/src/store/note_record/mod.rs index 13baac8dc..622cb460e 100644 --- a/src/store/note_record/mod.rs +++ b/src/store/note_record/mod.rs @@ -63,7 +63,7 @@ pub enum NoteStatus { /// Note has been consumed locally but not yet nullified on chain Processing { consumer_account_id: AccountId, - submited_at: u64, + submitted_at: u64, }, /// Note has been nullified on chain Consumed { @@ -83,9 +83,9 @@ impl Serializable for NoteStatus { target.write_u8(1); target.write_u64(*block_height); }, - NoteStatus::Processing { consumer_account_id, submited_at } => { + NoteStatus::Processing { consumer_account_id, submitted_at } => { target.write_u8(2); - target.write_u64(*submited_at); + target.write_u64(*submitted_at); consumer_account_id.write_into(target); }, NoteStatus::Consumed { consumer_account_id, block_height } => { @@ -110,9 +110,9 @@ impl Deserializable for NoteStatus { Ok(NoteStatus::Committed { block_height }) }, 2 => { - let submited_at = source.read_u64()?; + let submitted_at = source.read_u64()?; let consumer_account_id = AccountId::read_from(source)?; - Ok(NoteStatus::Processing { consumer_account_id, submited_at }) + Ok(NoteStatus::Processing { consumer_account_id, submitted_at }) }, 3 => { let block_height = source.read_u64()?; @@ -138,11 +138,11 @@ impl Display for NoteStatus { NoteStatus::Committed { block_height } => { write!(f, "{NOTE_STATUS_COMMITTED} (at block height {block_height})") }, - NoteStatus::Processing { consumer_account_id, submited_at } => write!( + NoteStatus::Processing { consumer_account_id, submitted_at } => write!( f, - "{NOTE_STATUS_PROCESSING} (submited at {} by account {})", + "{NOTE_STATUS_PROCESSING} (submitted at {} by account {})", Local - .timestamp_opt(*submited_at as i64, 0) + .timestamp_opt(*submitted_at as i64, 0) .single() .expect("timestamp should be valid"), consumer_account_id.to_hex() diff --git a/src/store/sqlite_store/notes.rs b/src/store/sqlite_store/notes.rs index f9bfc2509..0d191b98c 100644 --- a/src/store/sqlite_store/notes.rs +++ b/src/store/sqlite_store/notes.rs @@ -25,7 +25,7 @@ use crate::{ fn insert_note_query(table_name: NoteTable) -> String { format!("\ INSERT INTO {table_name} - (note_id, assets, recipient, status, metadata, details, inclusion_proof, consumer_transaction_id, created_at) + (note_id, assets, recipient, status, metadata, details, inclusion_proof, consumer_transaction_id, created_at) VALUES (:note_id, :assets, :recipient, :status, json(:metadata), json(:details), json(:inclusion_proof), :consumer_transaction_id, unixepoch(current_timestamp));", table_name = table_name) } @@ -108,9 +108,9 @@ impl<'a> NoteFilter<'a> { /// Returns a [String] containing the query for this Filter fn to_query(&self, notes_table: NoteTable) -> String { let base = format!( - "SELECT - note.assets, - note.details, + "SELECT + note.assets, + note.details, note.recipient, note.status, note.metadata, @@ -118,11 +118,11 @@ impl<'a> NoteFilter<'a> { script.serialized_note_script, tx.account_id, note.created_at, - note.submited_at, + note.submitted_at, note.nullifier_height - from {notes_table} AS note + from {notes_table} AS note LEFT OUTER JOIN notes_scripts AS script - ON note.details IS NOT NULL AND + ON note.details IS NOT NULL AND json_extract(note.details, '$.script_hash') = script.script_hash LEFT OUTER JOIN transactions AS tx ON note.consumer_transaction_id IS NOT NULL AND @@ -346,26 +346,26 @@ pub fn update_note_consumer_tx_id( note_id: NoteId, consumer_tx_id: TransactionId, ) -> Result<(), StoreError> { - const UPDATE_INPUT_NOTES_QUERY: &str = "UPDATE input_notes SET consumer_transaction_id = :consumer_transaction_id, submited_at = :submited_at WHERE note_id = :note_id;"; + const UPDATE_INPUT_NOTES_QUERY: &str = "UPDATE input_notes SET consumer_transaction_id = :consumer_transaction_id, submitted_at = :submitted_at WHERE note_id = :note_id;"; tx.execute( UPDATE_INPUT_NOTES_QUERY, named_params! { ":note_id": note_id.inner().to_string(), ":consumer_transaction_id": consumer_tx_id.to_string(), - ":submited_at": Utc::now().timestamp(), + ":submitted_at": Utc::now().timestamp(), }, ) .map_err(|err| StoreError::QueryError(err.to_string()))?; - const UPDATE_OUTPUT_NOTES_QUERY: &str = "UPDATE output_notes SET consumer_transaction_id = :consumer_transaction_id, submited_at = :submited_at WHERE note_id = :note_id;"; + const UPDATE_OUTPUT_NOTES_QUERY: &str = "UPDATE output_notes SET consumer_transaction_id = :consumer_transaction_id, submitted_at = :submitted_at WHERE note_id = :note_id;"; tx.execute( UPDATE_OUTPUT_NOTES_QUERY, named_params! { ":note_id": note_id.inner().to_string(), ":consumer_transaction_id": consumer_tx_id.to_string(), - ":submited_at": Utc::now().timestamp(), + ":submitted_at": Utc::now().timestamp(), }, ) .map_err(|err| StoreError::QueryError(err.to_string()))?; @@ -386,7 +386,7 @@ fn parse_input_note_columns( let serialized_note_script: Vec = row.get(6)?; let consumer_account_id: Option = row.get(7)?; let created_at: u64 = row.get(8)?; - let submited_at: Option = row.get(9)?; + let submitted_at: Option = row.get(9)?; let nullifier_height: Option = row.get(10)?; Ok(( @@ -399,7 +399,7 @@ fn parse_input_note_columns( serialized_note_script, consumer_account_id, created_at, - submited_at, + submitted_at, nullifier_height, )) } @@ -418,7 +418,7 @@ fn parse_input_note( serialized_note_script, consumer_account_id, created_at, - submited_at, + submitted_at, nullifier_height, ) = serialized_input_note_parts; @@ -469,7 +469,7 @@ fn parse_input_note( if let Some(consumer_account_id) = consumer_account_id { NoteStatus::Processing { consumer_account_id, - submited_at: submited_at.unwrap_or(0), + submitted_at: submitted_at.unwrap_or(0), } } else { NoteStatus::Committed { @@ -573,7 +573,7 @@ fn parse_output_note_columns( let serialized_note_script: Option> = row.get(6)?; let consumer_account_id: Option = row.get(7)?; let created_at: u64 = row.get(8)?; - let submited_at: Option = row.get(9)?; + let submitted_at: Option = row.get(9)?; let nullifier_height: Option = row.get(10)?; Ok(( @@ -586,7 +586,7 @@ fn parse_output_note_columns( serialized_note_script, consumer_account_id, created_at, - submited_at, + submitted_at, nullifier_height, )) } @@ -605,7 +605,7 @@ fn parse_output_note( serialized_note_script, consumer_account_id, created_at, - submited_at, + submitted_at, nullifier_height, ) = serialized_output_note_parts; @@ -659,7 +659,7 @@ fn parse_output_note( if let Some(consumer_account_id) = consumer_account_id { NoteStatus::Processing { consumer_account_id, - submited_at: submited_at.unwrap_or(0), + submitted_at: submitted_at.unwrap_or(0), } } else { NoteStatus::Committed { diff --git a/src/store/sqlite_store/store.sql b/src/store/sqlite_store/store.sql index 86909ea79..def9832fa 100644 --- a/src/store/sqlite_store/store.sql +++ b/src/store/sqlite_store/store.sql @@ -95,7 +95,7 @@ CREATE TABLE input_notes ( -- serial_num -- the note serial number consumer_transaction_id BLOB NULL, -- the transaction ID of the transaction that consumed the note created_at UNSIGNED BIG INT NOT NULL, -- timestamp of the note creation/import - submited_at UNSIGNED BIG INT NULL, -- timestamp of the note submission to node + submitted_at UNSIGNED BIG INT NULL, -- timestamp of the note submission to node nullifier_height UNSIGNED BIG INT NULL, -- block height when the nullifier arrived FOREIGN KEY (consumer_transaction_id) REFERENCES transactions(id) PRIMARY KEY (note_id) @@ -140,7 +140,7 @@ CREATE TABLE output_notes ( -- serial_num -- the note serial number consumer_transaction_id BLOB NULL, -- the transaction ID of the transaction that consumed the note created_at UNSIGNED BIG INT NOT NULL, -- timestamp of the note creation/import - submited_at UNSIGNED BIG INT NULL, -- timestamp of the note submission to node + submitted_at UNSIGNED BIG INT NULL, -- timestamp of the note submission to node nullifier_height UNSIGNED BIG INT NULL, -- block height when the nullifier arrived FOREIGN KEY (consumer_transaction_id) REFERENCES transactions(id) PRIMARY KEY (note_id)