Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **ledger/scan_state/transaction_logic**: move submodule `for_tests` into a
new file `zkapp_command/for_tests.rs`
([#1527](https://github.com/o1-labs/mina-rust/pull/1527)).
- **Ledger/scan-state/transaction-logic**: split
`ledger::scan_state::transaction_logic::zkapp_command` into submodules in a
new directory `zkapp_command`
([#1528](https://github.com/o1-labs/mina-rust/pull/1528/))

## v0.17.0

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
use mina_curves::pasta::Fp;
use std::collections::HashMap;

use super::{AccountId, ToVerifiableCache, ToVerifiableStrategy, VerificationKeyWire};

pub struct Cache {
cache: HashMap<AccountId, VerificationKeyWire>,
}

impl Cache {
pub fn new(cache: HashMap<AccountId, VerificationKeyWire>) -> Self {
Self { cache }
}
}

impl ToVerifiableCache for Cache {
fn find(&self, account_id: &AccountId, vk_hash: &Fp) -> Option<&VerificationKeyWire> {
self.cache
.get(account_id)
.filter(|vk| &vk.hash() == vk_hash)
}

fn add(&mut self, account_id: AccountId, vk: VerificationKeyWire) {
self.cache.insert(account_id, vk);
}
}

pub struct FromAppliedSequence;

impl ToVerifiableStrategy for FromAppliedSequence {
type Cache = Cache;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
use mina_curves::pasta::Fp;
use std::collections::HashMap;

use super::{AccountId, ToVerifiableCache, ToVerifiableStrategy, VerificationKeyWire};

pub struct Cache {
cache: HashMap<AccountId, HashMap<Fp, VerificationKeyWire>>,
}

impl Cache {
pub fn new(cache: HashMap<AccountId, HashMap<Fp, VerificationKeyWire>>) -> Self {
Self { cache }
}
}

impl ToVerifiableCache for Cache {
fn find(&self, account_id: &AccountId, vk_hash: &Fp) -> Option<&VerificationKeyWire> {
let vks = self.cache.get(account_id)?;
vks.get(vk_hash)
}

fn add(&mut self, account_id: AccountId, vk: VerificationKeyWire) {
let vks = self.cache.entry(account_id).or_default();
vks.insert(vk.hash(), vk);
}
}

pub struct FromUnappliedSequence;

impl ToVerifiableStrategy for FromUnappliedSequence {
type Cache = Cache;
}
Loading
Loading