From cdac3e827cd00854e84ab8584911eba628351945 Mon Sep 17 00:00:00 2001 From: Tiago Carvalho Date: Tue, 13 Aug 2024 14:11:04 +0100 Subject: [PATCH 1/2] Rename notes map to index --- chain/src/entity/mod.rs | 2 +- .../{tx_note_map.rs => tx_notes_index.rs} | 6 +-- chain/src/main.rs | 8 ++-- chain/src/services/db.rs | 12 +++--- chain/src/services/masp.rs | 6 +-- .../2024-04-17-131702_notes_map/down.sql | 2 +- .../2024-04-17-131702_notes_map/up.sql | 8 ++-- orm/src/lib.rs | 2 +- orm/src/{notes_map.rs => notes_index.rs} | 10 ++--- orm/src/schema.rs | 4 +- swagger.yml | 6 +-- webserver/src/app.rs | 2 +- webserver/src/dto/mod.rs | 2 +- .../src/dto/{notes_map.rs => notes_index.rs} | 2 +- webserver/src/error/mod.rs | 2 +- .../error/{notes_map.rs => notes_index.rs} | 10 ++--- webserver/src/handler/mod.rs | 2 +- webserver/src/handler/notes_index.rs | 29 ++++++++++++++ webserver/src/handler/notes_map.rs | 29 -------------- webserver/src/repository/mod.rs | 2 +- .../{notes_map.rs => notes_index.rs} | 24 ++++++------ webserver/src/response/mod.rs | 2 +- .../response/{notes_map.rs => notes_index.rs} | 10 ++--- webserver/src/service/mod.rs | 2 +- webserver/src/service/notes_index.rs | 38 +++++++++++++++++++ webserver/src/service/notes_map.rs | 38 ------------------- webserver/src/state/common.rs | 6 +-- 27 files changed, 133 insertions(+), 133 deletions(-) rename chain/src/entity/{tx_note_map.rs => tx_notes_index.rs} (88%) rename orm/src/{notes_map.rs => notes_index.rs} (77%) rename webserver/src/dto/{notes_map.rs => notes_index.rs} (82%) rename webserver/src/error/{notes_map.rs => notes_index.rs} (62%) create mode 100644 webserver/src/handler/notes_index.rs delete mode 100644 webserver/src/handler/notes_map.rs rename webserver/src/repository/{notes_map.rs => notes_index.rs} (66%) rename webserver/src/response/{notes_map.rs => notes_index.rs} (83%) create mode 100644 webserver/src/service/notes_index.rs delete mode 100644 webserver/src/service/notes_map.rs diff --git a/chain/src/entity/mod.rs b/chain/src/entity/mod.rs index bdd726b..13d893e 100644 --- a/chain/src/entity/mod.rs +++ b/chain/src/entity/mod.rs @@ -1,4 +1,4 @@ pub mod chain_state; pub mod commitment_tree; -pub mod tx_note_map; +pub mod tx_notes_index; pub mod witness_map; diff --git a/chain/src/entity/tx_note_map.rs b/chain/src/entity/tx_notes_index.rs similarity index 88% rename from chain/src/entity/tx_note_map.rs rename to chain/src/entity/tx_notes_index.rs index 3026596..cc92580 100644 --- a/chain/src/entity/tx_note_map.rs +++ b/chain/src/entity/tx_notes_index.rs @@ -1,6 +1,6 @@ use std::collections::BTreeMap; -use orm::notes_map::NotesMapInsertDb; +use orm::notes_index::NotesIndexInsertDb; use shared::indexed_tx::IndexedTx; #[derive(Default, Clone, Debug)] @@ -20,7 +20,7 @@ impl TxNoteMap { self.0.is_empty() } - pub fn into_db(&self) -> Vec { + pub fn into_db(&self) -> Vec { self.0 .iter() .map( @@ -31,7 +31,7 @@ impl TxNoteMap { masp_tx_index, }, &(is_fee_unshielding, note_pos), - )| NotesMapInsertDb { + )| NotesIndexInsertDb { is_fee_unshielding, block_index: block_index.0 as i32, note_position: note_pos as i32, diff --git a/chain/src/main.rs b/chain/src/main.rs index c417f85..6077f36 100644 --- a/chain/src/main.rs +++ b/chain/src/main.rs @@ -23,7 +23,7 @@ use crate::appstate::AppState; use crate::config::AppConfig; use crate::entity::chain_state::ChainState; use crate::entity::commitment_tree::CommitmentTree; -use crate::entity::tx_note_map::TxNoteMap; +use crate::entity::tx_notes_index::TxNoteMap; use crate::entity::witness_map::WitnessMap; use crate::services::masp::update_witness_map; use crate::services::{ @@ -207,7 +207,7 @@ async fn build_and_commit_masp_data_at_height( }; let mut shielded_txs = BTreeMap::new(); - let mut tx_note_map = TxNoteMap::default(); + let mut tx_notes_index = TxNoteMap::default(); tracing::info!( %block_height, @@ -229,7 +229,7 @@ async fn build_and_commit_masp_data_at_height( update_witness_map( &commitment_tree, - &mut tx_note_map, + &mut tx_notes_index, &witness_map, indexed_tx, &masp_tx, @@ -245,7 +245,7 @@ async fn build_and_commit_masp_data_at_height( chain_state, commitment_tree, witness_map, - tx_note_map, + tx_notes_index, shielded_txs, ) .await diff --git a/chain/src/services/db.rs b/chain/src/services/db.rs index 00bf10e..c3e66ac 100644 --- a/chain/src/services/db.rs +++ b/chain/src/services/db.rs @@ -25,7 +25,7 @@ use shared::indexed_tx::IndexedTx; use crate::entity::chain_state::ChainState; use crate::entity::commitment_tree::CommitmentTree; -use crate::entity::tx_note_map::TxNoteMap; +use crate::entity::tx_notes_index::TxNoteMap; use crate::entity::witness_map::WitnessMap; const MIGRATIONS: EmbeddedMigrations = embed_migrations!("../orm/migrations/"); @@ -179,7 +179,7 @@ pub async fn commit( chain_state: ChainState, commitment_tree: CommitmentTree, witness_map: WitnessMap, - notes_map: TxNoteMap, + notes_index: TxNoteMap, shielded_txs: BTreeMap, ) -> anyhow::Result<()> { tracing::info!( @@ -231,15 +231,15 @@ pub async fn commit( ); } - if !notes_map.is_empty() { + if !notes_index.is_empty() { tracing::debug!( block_height = %chain_state.block_height, "Pre-committing notes map" ); - let notes_map_db = notes_map.into_db(); - diesel::insert_into(schema::notes_map::table) - .values(¬es_map_db) + let notes_index_db = notes_index.into_db(); + diesel::insert_into(schema::notes_index::table) + .values(¬es_index_db) .on_conflict_do_nothing() .execute(transaction_conn) .context("Failed to insert notes map into db")?; diff --git a/chain/src/services/masp.rs b/chain/src/services/masp.rs index 634306e..5d28765 100644 --- a/chain/src/services/masp.rs +++ b/chain/src/services/masp.rs @@ -4,20 +4,20 @@ use namada_sdk::masp_primitives::merkle_tree::IncrementalWitness; use shared::indexed_tx::IndexedTx; use crate::entity::commitment_tree::CommitmentTree; -use crate::entity::tx_note_map::TxNoteMap; +use crate::entity::tx_notes_index::TxNoteMap; use crate::entity::witness_map::WitnessMap; /// Update the merkle tree of witnesses the first time we /// scan a new MASP transaction. pub fn update_witness_map( commitment_tree: &CommitmentTree, - tx_note_map: &mut TxNoteMap, + tx_notes_index: &mut TxNoteMap, witness_map: &WitnessMap, indexed_tx: IndexedTx, shielded: &namada_core::masp_primitives::transaction::Transaction, ) -> anyhow::Result<()> { let mut note_pos = commitment_tree.size(); - tx_note_map + tx_notes_index .insert(indexed_tx, false /* is_fee_unshielding */, note_pos); for so in shielded diff --git a/orm/migrations/2024-04-17-131702_notes_map/down.sql b/orm/migrations/2024-04-17-131702_notes_map/down.sql index 11f210b..a01aea9 100644 --- a/orm/migrations/2024-04-17-131702_notes_map/down.sql +++ b/orm/migrations/2024-04-17-131702_notes_map/down.sql @@ -1 +1 @@ -DROP TABLE notes_map; \ No newline at end of file +DROP TABLE notes_index; \ No newline at end of file diff --git a/orm/migrations/2024-04-17-131702_notes_map/up.sql b/orm/migrations/2024-04-17-131702_notes_map/up.sql index cc6f444..3dcbb1a 100644 --- a/orm/migrations/2024-04-17-131702_notes_map/up.sql +++ b/orm/migrations/2024-04-17-131702_notes_map/up.sql @@ -1,4 +1,4 @@ -CREATE TABLE notes_map ( +CREATE TABLE notes_index ( note_position INT PRIMARY KEY, block_index INT NOT NULL, is_fee_unshielding BOOLEAN NOT NULL, @@ -6,7 +6,7 @@ CREATE TABLE notes_map ( masp_tx_index INT NOT NULL ); -CREATE INDEX notes_map_block_height_asc ON notes_map (block_height ASC); -CREATE INDEX notes_map_block_height_desc ON notes_map (block_height DESC); +CREATE INDEX notes_index_block_height_asc ON notes_index (block_height ASC); +CREATE INDEX notes_index_block_height_desc ON notes_index (block_height DESC); -CREATE INDEX notes_map_block_height ON notes_map USING HASH (block_height); +CREATE INDEX notes_index_block_height ON notes_index USING HASH (block_height); diff --git a/orm/src/lib.rs b/orm/src/lib.rs index 80dcd1f..b962240 100644 --- a/orm/src/lib.rs +++ b/orm/src/lib.rs @@ -1,6 +1,6 @@ pub mod block_index; pub mod chain_state; -pub mod notes_map; +pub mod notes_index; pub mod schema; pub mod tree; pub mod tx; diff --git a/orm/src/notes_map.rs b/orm/src/notes_index.rs similarity index 77% rename from orm/src/notes_map.rs rename to orm/src/notes_index.rs index 2f6c9e1..5c202da 100644 --- a/orm/src/notes_map.rs +++ b/orm/src/notes_index.rs @@ -1,12 +1,12 @@ use diesel::{Insertable, Queryable, Selectable}; use serde::Serialize; -use crate::schema::notes_map; +use crate::schema::notes_index; #[derive(Serialize, Queryable, Selectable, Clone)] -#[diesel(table_name = notes_map)] +#[diesel(table_name = notes_index)] #[diesel(check_for_backend(diesel::pg::Pg))] -pub struct NotesMapDb { +pub struct NotesIndexDb { pub block_index: i32, pub is_fee_unshielding: bool, pub note_position: i32, @@ -15,9 +15,9 @@ pub struct NotesMapDb { } #[derive(Serialize, Insertable, Clone)] -#[diesel(table_name = notes_map)] +#[diesel(table_name = notes_index)] #[diesel(check_for_backend(diesel::pg::Pg))] -pub struct NotesMapInsertDb { +pub struct NotesIndexInsertDb { pub block_index: i32, pub is_fee_unshielding: bool, pub note_position: i32, diff --git a/orm/src/schema.rs b/orm/src/schema.rs index 015ae63..717bec4 100644 --- a/orm/src/schema.rs +++ b/orm/src/schema.rs @@ -24,7 +24,7 @@ diesel::table! { } diesel::table! { - notes_map (note_position) { + notes_index (note_position) { note_position -> Int4, block_index -> Int4, is_fee_unshielding -> Bool, @@ -56,7 +56,7 @@ diesel::allow_tables_to_appear_in_same_query!( block_index, chain_state, commitment_tree, - notes_map, + notes_index, tx, witness, ); diff --git a/swagger.yml b/swagger.yml index 22f58e1..94f80ac 100644 --- a/swagger.yml +++ b/swagger.yml @@ -58,7 +58,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/NotesMapResponse' + $ref: '#/components/schemas/NotesIndexResponse' /witness-map: get: parameters: @@ -139,10 +139,10 @@ components: type: integer minimum: 0 description: The block height of the commitment tree. - NotesMapResponse: + NotesIndexResponse: type: object properties: - notes_map: + notes_index: type: array items: type: object diff --git a/webserver/src/app.rs b/webserver/src/app.rs index e3fe800..9859144 100644 --- a/webserver/src/app.rs +++ b/webserver/src/app.rs @@ -48,7 +48,7 @@ impl ApplicationServer { "/witness-map", get(handler::witness_map::get_witness_map), ) - .route("/notes-map", get(handler::notes_map::get_notes_map)) + .route("/notes-map", get(handler::notes_index::get_notes_index)) .route("/tx", get(handler::tx::get_tx)) .route("/height", get(handler::namada_state::get_latest_height)) .route( diff --git a/webserver/src/dto/mod.rs b/webserver/src/dto/mod.rs index 8b31edf..fb454bd 100644 --- a/webserver/src/dto/mod.rs +++ b/webserver/src/dto/mod.rs @@ -1,4 +1,4 @@ -pub mod notes_map; +pub mod notes_index; pub mod tree; pub mod txs; pub mod witness; diff --git a/webserver/src/dto/notes_map.rs b/webserver/src/dto/notes_index.rs similarity index 82% rename from webserver/src/dto/notes_map.rs rename to webserver/src/dto/notes_index.rs index 096e57d..f5170ef 100644 --- a/webserver/src/dto/notes_map.rs +++ b/webserver/src/dto/notes_index.rs @@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize}; use validator::Validate; #[derive(Clone, Serialize, Deserialize, Validate)] -pub struct NotesMapQueryParams { +pub struct NotesIndexQueryParams { #[validate(range(min = 1))] pub height: u64, } diff --git a/webserver/src/error/mod.rs b/webserver/src/error/mod.rs index de49025..7bb5e5f 100644 --- a/webserver/src/error/mod.rs +++ b/webserver/src/error/mod.rs @@ -1,6 +1,6 @@ pub mod api; pub mod namada_state; -pub mod notes_map; +pub mod notes_index; pub mod tree; pub mod tx; pub mod witness_map; diff --git a/webserver/src/error/notes_map.rs b/webserver/src/error/notes_index.rs similarity index 62% rename from webserver/src/error/notes_map.rs rename to webserver/src/error/notes_index.rs index ff082d8..0f4feb3 100644 --- a/webserver/src/error/notes_map.rs +++ b/webserver/src/error/notes_index.rs @@ -5,18 +5,18 @@ use thiserror::Error; use crate::response::api::ApiErrorResponse; #[derive(Error, Debug)] -pub enum NotesMapError { - #[error("NotesMap not found")] +pub enum NotesIndexError { + #[error("NotesIndex not found")] NotFound, #[error("Database error: {0}")] Database(String), } -impl IntoResponse for NotesMapError { +impl IntoResponse for NotesIndexError { fn into_response(self) -> Response { let status_code = match self { - NotesMapError::NotFound => StatusCode::NOT_FOUND, - NotesMapError::Database(_) => StatusCode::INTERNAL_SERVER_ERROR, + NotesIndexError::NotFound => StatusCode::NOT_FOUND, + NotesIndexError::Database(_) => StatusCode::INTERNAL_SERVER_ERROR, }; ApiErrorResponse::send(status_code.as_u16(), Some(self.to_string())) diff --git a/webserver/src/handler/mod.rs b/webserver/src/handler/mod.rs index b5ad2ba..bdcfff2 100644 --- a/webserver/src/handler/mod.rs +++ b/webserver/src/handler/mod.rs @@ -1,5 +1,5 @@ pub mod namada_state; -pub mod notes_map; +pub mod notes_index; pub mod tree; pub mod tx; pub mod witness_map; diff --git a/webserver/src/handler/notes_index.rs b/webserver/src/handler/notes_index.rs new file mode 100644 index 0000000..bdba3c2 --- /dev/null +++ b/webserver/src/handler/notes_index.rs @@ -0,0 +1,29 @@ +use axum::extract::{Query, State}; +use axum::Json; +use axum_macros::debug_handler; +use axum_trace_id::TraceId; +use shared::error::InspectWrap; + +use crate::dto::notes_index::NotesIndexQueryParams; +use crate::error::notes_index::NotesIndexError; +use crate::response::notes_index::NotesIndexResponse; +use crate::state::common::CommonState; + +#[debug_handler] +pub async fn get_notes_index( + _trace_id: TraceId, + State(state): State, + Query(query_params): Query, +) -> Result, NotesIndexError> { + let from_block_height = query_params.height; + + let notes_index = state + .notes_index_service + .get_notes_index(from_block_height) + .await + .inspect_wrap("get_notes_index", |err| { + NotesIndexError::Database(err.to_string()) + })?; + + Ok(Json(NotesIndexResponse::new(notes_index))) +} diff --git a/webserver/src/handler/notes_map.rs b/webserver/src/handler/notes_map.rs deleted file mode 100644 index 4772040..0000000 --- a/webserver/src/handler/notes_map.rs +++ /dev/null @@ -1,29 +0,0 @@ -use axum::extract::{Query, State}; -use axum::Json; -use axum_macros::debug_handler; -use axum_trace_id::TraceId; -use shared::error::InspectWrap; - -use crate::dto::notes_map::NotesMapQueryParams; -use crate::error::notes_map::NotesMapError; -use crate::response::notes_map::NotesMapResponse; -use crate::state::common::CommonState; - -#[debug_handler] -pub async fn get_notes_map( - _trace_id: TraceId, - State(state): State, - Query(query_params): Query, -) -> Result, NotesMapError> { - let from_block_height = query_params.height; - - let notes_map = state - .notes_map_service - .get_notes_map(from_block_height) - .await - .inspect_wrap("get_notes_map", |err| { - NotesMapError::Database(err.to_string()) - })?; - - Ok(Json(NotesMapResponse::new(notes_map))) -} diff --git a/webserver/src/repository/mod.rs b/webserver/src/repository/mod.rs index b5ad2ba..bdcfff2 100644 --- a/webserver/src/repository/mod.rs +++ b/webserver/src/repository/mod.rs @@ -1,5 +1,5 @@ pub mod namada_state; -pub mod notes_map; +pub mod notes_index; pub mod tree; pub mod tx; pub mod witness_map; diff --git a/webserver/src/repository/notes_map.rs b/webserver/src/repository/notes_index.rs similarity index 66% rename from webserver/src/repository/notes_map.rs rename to webserver/src/repository/notes_index.rs index 39c3c75..9417910 100644 --- a/webserver/src/repository/notes_map.rs +++ b/webserver/src/repository/notes_index.rs @@ -1,42 +1,42 @@ use anyhow::Context; use diesel::{ExpressionMethods, QueryDsl, RunQueryDsl, SelectableHelper}; -use orm::notes_map::NotesMapDb; -use orm::schema::notes_map; +use orm::notes_index::NotesIndexDb; +use orm::schema::notes_index; use shared::error::ContextDbInteractError; use crate::appstate::AppState; #[derive(Clone)] -pub struct NotesMapRepository { +pub struct NotesIndexRepository { pub(crate) app_state: AppState, } -pub trait NotesMapRepositoryTrait { +pub trait NotesIndexRepositoryTrait { fn new(app_state: AppState) -> Self; - async fn get_notes_map( + async fn get_notes_index( &self, block_height: i32, - ) -> anyhow::Result>; + ) -> anyhow::Result>; } -impl NotesMapRepositoryTrait for NotesMapRepository { +impl NotesIndexRepositoryTrait for NotesIndexRepository { fn new(app_state: AppState) -> Self { Self { app_state } } - async fn get_notes_map( + async fn get_notes_index( &self, block_height: i32, - ) -> anyhow::Result> { + ) -> anyhow::Result> { let conn = self.app_state.get_db_connection().await.context( "Failed to retrieve connection from the pool of database \ connections", )?; conn.interact(move |conn| { - notes_map::table - .filter(notes_map::dsl::block_height.le(block_height)) - .select(NotesMapDb::as_select()) + notes_index::table + .filter(notes_index::dsl::block_height.le(block_height)) + .select(NotesIndexDb::as_select()) .get_results(conn) .with_context(|| { format!( diff --git a/webserver/src/response/mod.rs b/webserver/src/response/mod.rs index de49025..7bb5e5f 100644 --- a/webserver/src/response/mod.rs +++ b/webserver/src/response/mod.rs @@ -1,6 +1,6 @@ pub mod api; pub mod namada_state; -pub mod notes_map; +pub mod notes_index; pub mod tree; pub mod tx; pub mod witness_map; diff --git a/webserver/src/response/notes_map.rs b/webserver/src/response/notes_index.rs similarity index 83% rename from webserver/src/response/notes_map.rs rename to webserver/src/response/notes_index.rs index c5d953c..7c82221 100644 --- a/webserver/src/response/notes_map.rs +++ b/webserver/src/response/notes_index.rs @@ -1,8 +1,8 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, Deserialize, Serialize, Default)] -pub struct NotesMapResponse { - pub notes_map: Vec, +pub struct NotesIndexResponse { + pub notes_index: Vec, } #[derive(Clone, Debug, Deserialize, Serialize, Default)] @@ -14,10 +14,10 @@ pub struct Note { pub note_position: u64, } -impl NotesMapResponse { - pub fn new(notes_map: Vec<(bool, u64, u64, u64, u64)>) -> Self { +impl NotesIndexResponse { + pub fn new(notes_index: Vec<(bool, u64, u64, u64, u64)>) -> Self { Self { - notes_map: notes_map + notes_index: notes_index .into_iter() .map( |( diff --git a/webserver/src/service/mod.rs b/webserver/src/service/mod.rs index b5ad2ba..bdcfff2 100644 --- a/webserver/src/service/mod.rs +++ b/webserver/src/service/mod.rs @@ -1,5 +1,5 @@ pub mod namada_state; -pub mod notes_map; +pub mod notes_index; pub mod tree; pub mod tx; pub mod witness_map; diff --git a/webserver/src/service/notes_index.rs b/webserver/src/service/notes_index.rs new file mode 100644 index 0000000..35ea646 --- /dev/null +++ b/webserver/src/service/notes_index.rs @@ -0,0 +1,38 @@ +use crate::appstate::AppState; +use crate::repository::notes_index::{ + NotesIndexRepository, NotesIndexRepositoryTrait, +}; + +#[derive(Clone)] +pub struct NotesIndexService { + notes_index_repo: NotesIndexRepository, +} + +impl NotesIndexService { + pub fn new(app_state: AppState) -> Self { + Self { + notes_index_repo: NotesIndexRepository::new(app_state), + } + } + + pub async fn get_notes_index( + &self, + from_block_height: u64, + ) -> anyhow::Result> { + Ok(self + .notes_index_repo + .get_notes_index(from_block_height as i32) + .await? + .into_iter() + .map(|notes_index_entry| { + ( + notes_index_entry.is_fee_unshielding, + notes_index_entry.block_height as u64, + notes_index_entry.block_index as u64, + notes_index_entry.masp_tx_index as u64, + notes_index_entry.note_position as u64, + ) + }) + .collect()) + } +} diff --git a/webserver/src/service/notes_map.rs b/webserver/src/service/notes_map.rs deleted file mode 100644 index 5adb811..0000000 --- a/webserver/src/service/notes_map.rs +++ /dev/null @@ -1,38 +0,0 @@ -use crate::appstate::AppState; -use crate::repository::notes_map::{ - NotesMapRepository, NotesMapRepositoryTrait, -}; - -#[derive(Clone)] -pub struct NotesMapService { - notes_map_repo: NotesMapRepository, -} - -impl NotesMapService { - pub fn new(app_state: AppState) -> Self { - Self { - notes_map_repo: NotesMapRepository::new(app_state), - } - } - - pub async fn get_notes_map( - &self, - from_block_height: u64, - ) -> anyhow::Result> { - Ok(self - .notes_map_repo - .get_notes_map(from_block_height as i32) - .await? - .into_iter() - .map(|notes_map_entry| { - ( - notes_map_entry.is_fee_unshielding, - notes_map_entry.block_height as u64, - notes_map_entry.block_index as u64, - notes_map_entry.masp_tx_index as u64, - notes_map_entry.note_position as u64, - ) - }) - .collect()) - } -} diff --git a/webserver/src/state/common.rs b/webserver/src/state/common.rs index e798069..cad9e5f 100644 --- a/webserver/src/state/common.rs +++ b/webserver/src/state/common.rs @@ -1,6 +1,6 @@ use crate::appstate::AppState; use crate::service::namada_state::NamadaStateService; -use crate::service::notes_map::NotesMapService; +use crate::service::notes_index::NotesIndexService; use crate::service::tree::TreeService; use crate::service::tx::TxService; use crate::service::witness_map::WitnessMapService; @@ -9,7 +9,7 @@ use crate::service::witness_map::WitnessMapService; pub struct CommonState { pub tree_service: TreeService, pub witness_map_service: WitnessMapService, - pub notes_map_service: NotesMapService, + pub notes_index_service: NotesIndexService, pub tx_service: TxService, pub namada_state_service: NamadaStateService, } @@ -19,7 +19,7 @@ impl CommonState { Self { tree_service: TreeService::new(data.clone()), witness_map_service: WitnessMapService::new(data.clone()), - notes_map_service: NotesMapService::new(data.clone()), + notes_index_service: NotesIndexService::new(data.clone()), tx_service: TxService::new(data.clone()), namada_state_service: NamadaStateService::new(data), } From 0026f092def457c2e6a29f4600df4fad30dd624e Mon Sep 17 00:00:00 2001 From: Tiago Carvalho Date: Tue, 13 Aug 2024 14:32:01 +0100 Subject: [PATCH 2/2] fix route name --- swagger.yml | 2 +- webserver/src/app.rs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/swagger.yml b/swagger.yml index 94f80ac..334cd0c 100644 --- a/swagger.yml +++ b/swagger.yml @@ -43,7 +43,7 @@ paths: application/json: schema: $ref: '#/components/schemas/LatestHeightResponse' - /notes-map: + /notes-index: get: parameters: - in: query diff --git a/webserver/src/app.rs b/webserver/src/app.rs index 9859144..59e5c6e 100644 --- a/webserver/src/app.rs +++ b/webserver/src/app.rs @@ -48,7 +48,10 @@ impl ApplicationServer { "/witness-map", get(handler::witness_map::get_witness_map), ) - .route("/notes-map", get(handler::notes_index::get_notes_index)) + .route( + "/notes-index", + get(handler::notes_index::get_notes_index), + ) .route("/tx", get(handler::tx::get_tx)) .route("/height", get(handler::namada_state::get_latest_height)) .route(