Skip to content

Commit

Permalink
feat: use MKTreeStoreSqlite to sign Cardano transactions in signer
Browse files Browse the repository at this point in the history
  • Loading branch information
jpraynaud committed Aug 27, 2024
1 parent 7428c79 commit 6e2d861
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
13 changes: 5 additions & 8 deletions mithril-signer/src/mktree_store_sqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,12 @@ pub struct MKTreeStoreSqlite {
impl MKTreeStoreSqlite {
fn try_new() -> StdResult<Self> {
let connection = sqlite::Connection::open_thread_safe(":memory:")?;
connection
.execute(
"pragma journal_mode = wal; pragma synchronous = normal; pragma shrink_memory; pragma temp_store = FILE;",
)
?;
let query = "
connection.execute("pragma shrink_memory; pragma temp_store = FILE;")?;
connection.execute(
"
CREATE TABLE merkle_tree (pos INTEGER, elem TEXT, primary key (pos));
";
connection.execute(query)?;
",
)?;

Ok(Self {
inner_store: RwLock::new(connection),
Expand Down
8 changes: 4 additions & 4 deletions mithril-signer/src/runtime/signer_services.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use mithril_common::{
cardano_transactions_preloader::CardanoTransactionsPreloader,
chain_observer::{CardanoCliRunner, ChainObserver, ChainObserverBuilder, ChainObserverType},
chain_reader::PallasChainReader,
crypto_helper::{MKTreeStoreInMemory, OpCert, ProtocolPartyId, SerDeShelleyFileFormat},
crypto_helper::{OpCert, ProtocolPartyId, SerDeShelleyFileFormat},
digesters::{
cache::{ImmutableFileDigestCacheProvider, JsonImmutableFileDigestCacheProviderBuilder},
CardanoImmutableDigester, ImmutableDigester, ImmutableFileObserver,
Expand All @@ -33,8 +33,8 @@ use mithril_persistence::{
use crate::{
aggregator_client::AggregatorClient, metrics::MetricsService, single_signer::SingleSigner,
AggregatorHTTPClient, CardanoTransactionsImporter,
CardanoTransactionsPreloaderActivationSigner, Configuration, MithrilSingleSigner,
ProtocolInitializerStore, ProtocolInitializerStorer, SignerUpkeepService,
CardanoTransactionsPreloaderActivationSigner, Configuration, MKTreeStoreSqlite,
MithrilSingleSigner, ProtocolInitializerStore, ProtocolInitializerStorer, SignerUpkeepService,
TransactionsImporterByChunk, TransactionsImporterWithPruner, TransactionsImporterWithVacuum,
UpkeepService, HTTP_REQUEST_TIMEOUT_DURATION, SQLITE_FILE, SQLITE_FILE_CARDANO_TRANSACTION,
};
Expand Down Expand Up @@ -316,7 +316,7 @@ impl<'a> ServiceBuilder for ProductionServiceBuilder<'a> {
));
let block_range_root_retriever = transaction_store.clone();
let cardano_transactions_builder = Arc::new(CardanoTransactionsSignableBuilder::<
MKTreeStoreInMemory,
MKTreeStoreSqlite,
>::new(
state_machine_transactions_importer,
block_range_root_retriever,
Expand Down

0 comments on commit 6e2d861

Please sign in to comment.