Skip to content

Commit ee9fbb2

Browse files
dlachaumesfauvel
authored andcommitted
Clean mithril-signer
1 parent 8e2c7cd commit ee9fbb2

File tree

4 files changed

+2
-169
lines changed

4 files changed

+2
-169
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mithril-signer/Cargo.toml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ homepage = { workspace = true }
99
license = { workspace = true }
1010
repository = { workspace = true }
1111

12-
[[bench]]
13-
name = "cardano_transactions"
14-
harness = false
15-
1612
[dependencies]
1713
anyhow = "1.0.79"
1814
async-trait = "0.1.77"
@@ -46,7 +42,6 @@ tokio = { version = "1.37.0", features = ["full"] }
4642
tikv-jemallocator = { version = "0.5.4", optional = true }
4743

4844
[dev-dependencies]
49-
criterion = { version = "0.5.1", features = ["html_reports", "async_tokio"] }
5045
httpmock = "0.7.0"
5146
mithril-common = { path = "../mithril-common" }
5247
mockall = "0.12.1"

mithril-signer/benches/cardano_transactions.rs

Lines changed: 0 additions & 118 deletions
This file was deleted.

mithril-signer/src/database/repository/cardano_transaction_repository.rs

Lines changed: 2 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use mithril_persistence::sqlite::GetAllProvider;
3030
/// This is a business oriented layer to perform actions on the database through
3131
/// providers.
3232
pub struct CardanoTransactionRepository {
33-
pub connection: Arc<SqliteConnection>,
33+
connection: Arc<SqliteConnection>,
3434
}
3535

3636
impl CardanoTransactionRepository {
@@ -116,21 +116,6 @@ impl CardanoTransactionRepository {
116116
let records: Vec<CardanoTransactionRecord> =
117117
transactions.into_iter().map(|tx| tx.into()).collect();
118118

119-
let provider = InsertCardanoTransactionProvider::new(&self.connection);
120-
let filters = provider.get_insert_many_condition(records)?;
121-
provider.find(filters)?.next();
122-
123-
Ok(vec![])
124-
}
125-
126-
/// Create new [CardanoTransactionRecord]s in the database.
127-
pub async fn create_transactions_and_collect<T: Into<CardanoTransactionRecord>>(
128-
&self,
129-
transactions: Vec<T>,
130-
) -> StdResult<Vec<CardanoTransactionRecord>> {
131-
let records: Vec<CardanoTransactionRecord> =
132-
transactions.into_iter().map(|tx| tx.into()).collect();
133-
134119
let provider = InsertCardanoTransactionProvider::new(&self.connection);
135120
let filters = provider.get_insert_many_condition(records)?;
136121
let cursor = provider.find(filters)?;
@@ -153,34 +138,6 @@ impl CardanoTransactionRepository {
153138
Ok(cursor.collect())
154139
}
155140

156-
pub async fn store_transactions_with_chunks_size(
157-
&self,
158-
transactions: Vec<CardanoTransaction>,
159-
chunks_size: usize,
160-
) -> StdResult<()> {
161-
// Chunk transactions to avoid an error when we exceed sqlite binding limitations
162-
for transactions_in_chunk in transactions.chunks(chunks_size) {
163-
self.create_transactions(transactions_in_chunk.to_vec())
164-
.await
165-
.with_context(|| "CardanoTransactionRepository can not store transactions")?;
166-
}
167-
Ok(())
168-
}
169-
170-
pub async fn store_transactions_with_chunks_size_and_collect(
171-
&self,
172-
transactions: Vec<CardanoTransaction>,
173-
chunks_size: usize,
174-
) -> StdResult<()> {
175-
// Chunk transactions to avoid an error when we exceed sqlite binding limitations
176-
for transactions_in_chunk in transactions.chunks(chunks_size) {
177-
self.create_transactions_and_collect(transactions_in_chunk.to_vec())
178-
.await
179-
.with_context(|| "CardanoTransactionRepository can not store transactions")?;
180-
}
181-
Ok(())
182-
}
183-
184141
// TODO: remove this function when the Cardano transaction signature is based on block number instead of immutable number
185142
async fn get_highest_block_number_for_immutable_number(
186143
&self,
@@ -281,7 +238,7 @@ impl TransactionStore for CardanoTransactionRepository {
281238
async fn store_transactions(&self, transactions: Vec<CardanoTransaction>) -> StdResult<()> {
282239
// Chunk transactions to avoid an error when we exceed sqlite binding limitations
283240
for transactions_in_chunk in transactions.chunks(100) {
284-
self.create_transactions_and_collect(transactions_in_chunk.to_vec())
241+
self.create_transactions(transactions_in_chunk.to_vec())
285242
.await
286243
.with_context(|| "CardanoTransactionRepository can not store transactions")?;
287244
}

0 commit comments

Comments
 (0)