Skip to content

Commit

Permalink
rename new fns
Browse files Browse the repository at this point in the history
  • Loading branch information
tzemanovic committed Jan 22, 2024
1 parent 9994b09 commit 9ca40ed
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 27 deletions.
3 changes: 2 additions & 1 deletion crates/apps/src/lib/node/ledger/shell/finalize_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,8 @@ where
let anchor_key = token::storage_key::masp_commitment_anchor_key(
updated_tree.root(),
);
self.wl_storage.write_without_merkldiffs(&anchor_key, ())?;
self.wl_storage
.write_without_merkle_diffs(&anchor_key, ())?;
}

if update_for_tendermint {
Expand Down
6 changes: 3 additions & 3 deletions crates/apps/src/lib/node/ledger/shell/init_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,20 +141,20 @@ where
let note_commitment_tree_key =
token::storage_key::masp_commitment_tree_key();
self.wl_storage
.write_without_merkldiffs(
.write_without_merkle_diffs(
&note_commitment_tree_key,
empty_commitment_tree,
)
.unwrap();
let commitment_tree_anchor_key =
token::storage_key::masp_commitment_anchor_key(anchor);
self.wl_storage
.write_without_merkldiffs(&commitment_tree_anchor_key, ())
.write_without_merkle_diffs(&commitment_tree_anchor_key, ())
.unwrap();

// Init masp convert anchor
let convert_anchor_key = token::storage_key::masp_convert_anchor_key();
self.wl_storage.write_without_merkldiffs(
self.wl_storage.write_without_merkle_diffs(
&convert_anchor_key,
namada::types::hash::Hash(
bls12_381::Scalar::from(
Expand Down
2 changes: 1 addition & 1 deletion crates/apps/src/lib/node/ledger/storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ mod tests {
assert!(res.is_none());

// Write key-val-2 without merklizing or diffs
wls.write_without_merkldiffs(&key2, val2).unwrap();
wls.write_without_merkle_diffs(&key2, val2).unwrap();

// Read from WlStorage should return val2
let res = wls.read::<u64>(&key2).unwrap().unwrap();
Expand Down
2 changes: 1 addition & 1 deletion crates/benches/native_vps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ fn setup_storage_for_masp_verification(
shielded_ctx
.shell
.wl_storage
.write_without_merkldiffs(&anchor_key, ())
.write_without_merkle_diffs(&anchor_key, ())
.unwrap();
shielded_ctx.shell.commit_block();
// Cache the masp tx so that it can be returned when queried
Expand Down
2 changes: 1 addition & 1 deletion crates/ibc/src/context/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ pub trait IbcCommonContext: IbcStorageContext {
u64::checked_add(count, 1).ok_or_else(|| ClientError::Other {
description: format!("The counter overflow: Key {key}"),
})?;
self.write_without_merkldiffs(key, count)
self.write_without_merkle_diffs(key, count)
.map_err(ContextError::from)
}

Expand Down
6 changes: 3 additions & 3 deletions crates/namada/src/ledger/ibc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ where
// the client counter
let key = client_counter_key();
storage
.write_without_merkldiffs(&key, init_value)
.write_without_merkle_diffs(&key, init_value)
.expect("Unable to write the initial client counter");

// the connection counter
let key = connection_counter_key();
storage
.write_without_merkldiffs(&key, init_value)
.write_without_merkle_diffs(&key, init_value)
.expect("Unable to write the initial connection counter");

// the channel counter
let key = channel_counter_key();
storage
.write_without_merkldiffs(&key, init_value)
.write_without_merkle_diffs(&key, init_value)
.expect("Unable to write the initial channel counter");
}
6 changes: 3 additions & 3 deletions crates/shielded_token/src/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,12 @@ where
// but we should make sure the return value's ratio matches
// this new inflation rate in 'update_allowed_conversions',
// otherwise we will have an inaccurate view of inflation
wl_storage.write_without_merkldiffs(
wl_storage.write_without_merkle_diffs(
&masp_last_inflation_key(addr),
inflation_amount,
)?;

wl_storage.write_without_merkldiffs(
wl_storage.write_without_merkle_diffs(
&masp_last_locked_ratio_key(addr),
locked_ratio,
)?;
Expand Down Expand Up @@ -442,7 +442,7 @@ where
wl_storage.storage.conversion_state.tree =
FrozenCommitmentTree::merge(&tree_parts);
// Update the anchor in storage
wl_storage.write_without_merkldiffs(
wl_storage.write_without_merkle_diffs(
&crate::storage_key::masp_convert_anchor_key(),
namada_core::types::hash::Hash(
bls12_381::Scalar::from(
Expand Down
12 changes: 6 additions & 6 deletions crates/shielded_token/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,25 @@ where
kp_gain_nom,
locked_ratio_target: locked_target,
} = params;
storage.write_without_merkldiffs(
storage.write_without_merkle_diffs(
&masp_last_inflation_key(address),
Amount::zero(),
)?;
storage.write_without_merkldiffs(
storage.write_without_merkle_diffs(
&masp_last_locked_ratio_key(address),
Dec::zero(),
)?;
storage.write_without_merkldiffs(
storage.write_without_merkle_diffs(
&masp_max_reward_rate_key(address),
max_rate,
)?;
storage.write_without_merkldiffs(
storage.write_without_merkle_diffs(
&masp_locked_ratio_target_key(address),
locked_target,
)?;
storage
.write_without_merkldiffs(&masp_kp_gain_key(address), kp_gain_nom)?;
.write_without_merkle_diffs(&masp_kp_gain_key(address), kp_gain_nom)?;
storage
.write_without_merkldiffs(&masp_kd_gain_key(address), kd_gain_nom)?;
.write_without_merkle_diffs(&masp_kd_gain_key(address), kd_gain_nom)?;
Ok(())
}
6 changes: 3 additions & 3 deletions crates/shielded_token/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fn reveal_nullifiers(
.sapling_bundle()
.map_or(&vec![], |description| &description.shielded_spends)
{
ctx.write_without_merkldiffs(
ctx.write_without_merkle_diffs(
&masp_nullifier_key(&description.nullifier),
(),
)?;
Expand Down Expand Up @@ -53,7 +53,7 @@ pub fn update_note_commitment_tree(
})?;
}

ctx.write_without_merkldiffs(&tree_key, commitment_tree)?;
ctx.write_without_merkle_diffs(&tree_key, commitment_tree)?;
}
}

Expand All @@ -74,7 +74,7 @@ pub fn handle_masp_tx(

// If storage key has been supplied, then pin this transaction to it
if let Some(key) = pin_key {
ctx.write_without_merkldiffs(
ctx.write_without_merkle_diffs(
&masp_pin_tx_key(key),
IndexedTx {
height: ctx.get_block_height()?,
Expand Down
6 changes: 3 additions & 3 deletions crates/state/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ where
}

/// Write with diffs but no merklization
pub fn write_without_merkl(
pub fn write_without_merkle(
&mut self,
key: &Key,
value: impl AsRef<[u8]>,
Expand All @@ -459,7 +459,7 @@ where
}

/// Write without diffs or merklization
pub fn write_without_merkldiffs(
pub fn write_without_merkle_diffs(
&mut self,
key: &Key,
value: impl AsRef<[u8]>,
Expand Down Expand Up @@ -1420,7 +1420,7 @@ mod tests {
assert!(res.is_none());

// Write key-val-2 without merklizing or diffs
wls.write_without_merkldiffs(&key2, val2).unwrap();
wls.write_without_merkle_diffs(&key2, val2).unwrap();

// Read from WlStorage should return val2
let res = wls.read::<u64>(&key2).unwrap().unwrap();
Expand Down
4 changes: 2 additions & 2 deletions crates/storage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ pub trait StorageWrite {
/// Write a value to be encoded with Borsh at the given key to storage.
/// Additionally, write the data to the diffs. Do not add to the merkle
/// tree.
fn write_without_merkl<T: BorshSerialize>(
fn write_without_merkle<T: BorshSerialize>(
&mut self,
key: &storage::Key,
val: T,
Expand All @@ -185,7 +185,7 @@ pub trait StorageWrite {

/// Write a value to be encoded with Borsh at the given key to storage.
/// Do not update the diffs or merkle tree.
fn write_without_merkldiffs<T: BorshSerialize>(
fn write_without_merkle_diffs<T: BorshSerialize>(
&mut self,
key: &storage::Key,
val: T,
Expand Down

0 comments on commit 9ca40ed

Please sign in to comment.