Skip to content

Commit

Permalink
Merge branch 'origin/tomas/fix-masp-missing-await' (#1588)
Browse files Browse the repository at this point in the history
* origin/tomas/fix-masp-missing-await:
  changelog: add #1588
  shared/masp: add missing await on async load and save calls
  • Loading branch information
Fraccaman committed Jun 20, 2023
2 parents e602d97 + 54116a5 commit 506cd7c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Fix missing async awaits in MASP load and save calls.
([\#1588](https://github.com/anoma/namada/pull/1588))
8 changes: 4 additions & 4 deletions apps/src/lib/client/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ pub async fn query_transfers<
|| Either::Right(wallet.get_addresses().into_values().collect()),
Either::Left,
);
let _ = shielded.load();
let _ = shielded.load().await;
// Obtain the effects of all shielded and transparent transactions
let transfers = shielded
.query_tx_deltas(
Expand Down Expand Up @@ -381,7 +381,7 @@ pub async fn query_pinned_balance<
.values()
.map(|fvk| ExtendedFullViewingKey::from(*fvk).fvk.vk)
.collect();
let _ = shielded.load();
let _ = shielded.load().await;
// Print the token balances by payment address
for owner in owners {
let mut balance = Err(PinnedBalanceError::InvalidViewingKey);
Expand Down Expand Up @@ -706,14 +706,14 @@ pub async fn query_shielded_balance<
Some(viewing_key) => vec![viewing_key],
None => wallet.get_viewing_keys().values().copied().collect(),
};
let _ = shielded.load();
let _ = shielded.load().await;
let fvks: Vec<_> = viewing_keys
.iter()
.map(|fvk| ExtendedFullViewingKey::from(*fvk).fvk.vk)
.collect();
shielded.fetch(client, &[], &fvks).await;
// Save the update state so that future fetches can be short-circuited
let _ = shielded.save();
let _ = shielded.save().await;
// The epoch is required to identify timestamped tokens
let epoch = query_and_print_epoch(client).await;
// Map addresses to token names
Expand Down
14 changes: 6 additions & 8 deletions shared/src/ledger/masp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1235,13 +1235,11 @@ impl<U: ShieldedUtils> ShieldedContext<U> {
// We want to fund our transaction solely from supplied spending key
let spending_key = spending_key.map(|x| x.into());
let spending_keys: Vec<_> = spending_key.into_iter().collect();
// Load the current shielded context given the spending key we
// possess
let _ = self.load();
// Load the current shielded context given the spending key we possess
let _ = self.load().await;
self.fetch(client, &spending_keys, &[]).await;
// Save the update state so that future fetches can be
// short-circuited
let _ = self.save();
// Save the update state so that future fetches can be short-circuited
let _ = self.save().await;
// Determine epoch in which to submit potential shielded transaction
let epoch = rpc::query_epoch(client).await;
// Context required for storing which notes are in the source's
Expand Down Expand Up @@ -1414,15 +1412,15 @@ impl<U: ShieldedUtils> ShieldedContext<U> {
(Epoch, TransferDelta, TransactionDelta),
> {
const TXS_PER_PAGE: u8 = 100;
let _ = self.load();
let _ = self.load().await;
let vks = viewing_keys;
let fvks: Vec<_> = vks
.values()
.map(|fvk| ExtendedFullViewingKey::from(*fvk).fvk.vk)
.collect();
self.fetch(client, &[], &fvks).await;
// Save the update state so that future fetches can be short-circuited
let _ = self.save();
let _ = self.save().await;
// Required for filtering out rejected transactions from Tendermint
// responses
let block_results = rpc::query_results(client).await;
Expand Down

0 comments on commit 506cd7c

Please sign in to comment.