Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
58d7a4b
ci/mergify: update for maint-1.1 and maint-libs-0.47
tzemanovic Jan 27, 2025
420cd92
Merge pull request #4281 from anoma/mergify/bp/maint-libs-0.47/pr-4277
mergify[bot] Jan 28, 2025
7447761
Update hardware wallet test vectors to display transaction fees in no…
murisi Jan 6, 2025
d73ebd1
Added changelog entry.
murisi Jan 6, 2025
d1ec931
Use prop_filter to ensure that random transactions are generated with…
murisi Jan 6, 2025
31861a0
Upgrade the Ledger app Rust library and also upgrade the Ledger app u…
murisi Jan 30, 2025
1b3bf2b
Make sure the CI installs libudev-dev before building Namada.
murisi Jan 31, 2025
dc1aef1
Added a changelog entry.
murisi Jan 31, 2025
79bb591
Merge pull request #4292 from anoma/mergify/bp/maint-libs-0.47/pr-4218
mergify[bot] Feb 3, 2025
db59c30
Adds more cases to multisig unit test
grarco Jan 31, 2025
e27d3cd
Changelog: #4289
grarco Jan 31, 2025
91cbce3
Merge pull request #4293 from anoma/mergify/bp/maint-libs-0.47/pr-4286
mergify[bot] Feb 3, 2025
5e5203b
Merge pull request #4295 from anoma/mergify/bp/maint-libs-0.47/pr-4289
mergify[bot] Feb 3, 2025
3eca617
switch to published ledger-namada-rs fork
tzemanovic Feb 3, 2025
6064afc
Merge pull request #4300 from anoma/mergify/bp/maint-libs-0.47/pr-4298
mergify[bot] Feb 3, 2025
062e5b2
[pos] Add epoch argument to vp::pos::rewards
joel-u410 Dec 17, 2024
3e740f9
[pos] when querying rewards by epoch, use the historical rewards_coun…
joel-u410 Dec 19, 2024
fc53bd9
refactor: use existing storage_value query function for looking up pa…
joel-u410 Dec 19, 2024
6d17c9a
cargo fmt
joel-u410 Dec 19, 2024
c16ceee
slight wording change: for -> at to make it more clear that rewards a…
joel-u410 Dec 19, 2024
afa066e
refactor: Amount::from(0) -> Amount::zero()
joel-u410 Dec 19, 2024
a1f6a69
changelog: add
joel-u410 Dec 19, 2024
87fcd04
[vscode] Add namada_sdk unit test debug launch definition
joel-u410 Jan 23, 2025
faa5a52
enhancement: implement read_subspace_val_with_height for mockdb
joel-u410 Jan 23, 2025
1c1cf7f
[pos] Add unit test for vp::pos::rewards query with epochs
joel-u410 Jan 23, 2025
e164863
fix: address review suggestions
joel-u410 Jan 28, 2025
1f165ec
fix: improve documentation for --epoch option in rewards command to c…
joel-u410 Jan 28, 2025
1a00e45
Check for a last reward claim in addition to whether the key is in th…
joel-u410 Jan 31, 2025
2527914
pos: extend test case to also cover what happens when rewards are cla…
joel-u410 Jan 31, 2025
62fe537
make fmt
tzemanovic Feb 3, 2025
3599d9d
Merge pull request #4302 from anoma/mergify/bp/maint-libs-0.47/pr-4196
mergify[bot] Feb 3, 2025
d025a0e
Hermes for v1.1.0
yito88 Jan 27, 2025
b40eab0
checking CI failure
yito88 Jan 28, 2025
bce4efe
fix typo
yito88 Jan 28, 2025
aba9815
Revert
yito88 Jan 28, 2025
9ed7fa8
Revert
yito88 Jan 28, 2025
6626aae
add hermes logs
yito88 Jan 28, 2025
f19b5c5
revert Hermes for CI
yito88 Jan 29, 2025
2561b0c
changelog
yito88 Jan 30, 2025
f41a663
Merge pull request #4306 from anoma/mergify/bp/maint-libs-0.47/pr-4280
mergify[bot] Feb 3, 2025
bae7cd2
WIP: upgrade ibc-rs
yito88 Jan 16, 2025
2f27699
WIP: replaced errors
yito88 Jan 17, 2025
d0d63ab
updete ibc-middleware
yito88 Jan 17, 2025
d38d5e4
upstream ibc-rs
yito88 Jan 23, 2025
64756e5
ibc-rs 0.57.0
yito88 Jan 30, 2025
b0ed2fe
update middleware
yito88 Jan 30, 2025
be2ed49
Update crates/tests/src/e2e/setup.rs
tzemanovic Feb 3, 2025
cc19728
deps: switch to published ibc-middleware crates
tzemanovic Feb 3, 2025
58223a8
changelog
yito88 Feb 3, 2025
51cb210
Merge pull request #4310 from anoma/mergify/bp/maint-libs-0.47/pr-4247
mergify[bot] Feb 4, 2025
8ea6fb2
update recommended CometBFT to 0.37.15
tzemanovic Feb 3, 2025
235f161
changelog: add #4299
tzemanovic Feb 3, 2025
48f7ea0
Utilize leftover dust in conversions.
murisi Jan 31, 2025
0f8a2e7
Added changelog entry.
murisi Jan 31, 2025
518515a
Use the normed inflation as the precision to get more accurate native…
murisi Feb 4, 2025
ca096ce
Do not exchange balance amounts when querying non-native token balances.
murisi Feb 3, 2025
597def5
Added a changelog entry.
murisi Feb 4, 2025
542c790
Added changelog entry.
murisi Feb 3, 2025
4993c6e
Merge pull request #4319 from anoma/mergify/bp/maint-libs-0.47/pr-4299
mergify[bot] Feb 5, 2025
e96e20e
Merge pull request #4320 from anoma/mergify/bp/maint-libs-0.47/pr-4287
mergify[bot] Feb 5, 2025
49adfeb
Merge pull request #4321 from anoma/mergify/bp/maint-libs-0.47/pr-4308
mergify[bot] Feb 5, 2025
0ae67f5
Merge pull request #4322 from anoma/mergify/bp/maint-libs-0.47/pr-4291
mergify[bot] Feb 5, 2025
6578768
Invert the loop and conditional in the reward distribution algorithm.
murisi Feb 4, 2025
e045005
Move the construction of reward assets out into a separate function.
murisi Feb 4, 2025
c435dab
Split the production of native and non-native conversions into separa…
murisi Feb 4, 2025
a521b9f
Added a changelog entry.
murisi Feb 4, 2025
3910309
Merge pull request #4325 from anoma/mergify/bp/maint-libs-0.47/pr-4311
mergify[bot] Feb 5, 2025
b05ec7e
wallet: change the derivation path for modified ZIP32
tzemanovic Feb 4, 2025
53f4c23
changelog: add #4307
tzemanovic Feb 4, 2025
50acc29
wallet: update the rustdoc warning about modified ZIP32
tzemanovic Feb 4, 2025
187c3f6
fixup! wallet: change the derivation path for modified ZIP32
tzemanovic Feb 5, 2025
4136a6f
fixup! changelog: add #4307
tzemanovic Feb 5, 2025
1a59c23
Merge pull request #4330 from anoma/mergify/bp/maint-libs-0.47/pr-4307
mergify[bot] Feb 5, 2025
e720e45
deps: rm unused borsh-ext
tzemanovic Feb 4, 2025
fd03c11
specify all internal lib crates in workspace
tzemanovic Feb 4, 2025
525e725
deps: use internal crates defined in workspace
tzemanovic Feb 4, 2025
297de30
deps: fix ignored and rm unused default-features flags
tzemanovic Feb 4, 2025
f6eb209
config/release: allow to publish released crates
tzemanovic Feb 4, 2025
5700810
deps: update non-lib crates Cargo.toml to use workspace defs
tzemanovic Feb 4, 2025
37ccfdb
fixup! deps: use internal crates defined in workspace
tzemanovic Feb 5, 2025
ba22c26
Merge pull request #4331 from anoma/mergify/bp/maint-libs-0.47/pr-4312
mergify[bot] Feb 5, 2025
44211f8
Now parameterize query_allowed_conversion with the target epoch.
murisi Jan 31, 2025
9778ecb
Update inverse conversion test.
murisi Jan 31, 2025
141f02d
Added changelog entry.
murisi Jan 31, 2025
38fb533
Do not query for the inverse conversion when converting to the latest…
murisi Feb 3, 2025
ead5876
Remove the ability to specify which historical epoch amounts are exch…
murisi Jan 31, 2025
c4092c8
Added changelog entry.
murisi Feb 3, 2025
ff6c1d7
Rename test_inverse_conversions to make it clear that it now tests so…
murisi Feb 4, 2025
70a5ed1
Merge pull request #4334 from anoma/mergify/bp/maint-libs-0.47/pr-4290
mergify[bot] Feb 5, 2025
ab83348
Print the transaction's chain ID in expert mode.
murisi Feb 5, 2025
0979728
Added a changelog entry.
murisi Feb 5, 2025
a1fde47
Merge pull request #4337 from anoma/mergify/bp/maint-libs-0.47/pr-4332
mergify[bot] Feb 5, 2025
eb5e77e
PoS: emit token transfer event on claim rewards tx
tzemanovic Jan 29, 2025
cf6fba1
changelog: add #4283
tzemanovic Jan 29, 2025
f83e181
Merge pull request #4338 from anoma/mergify/bp/maint-libs-0.47/pr-4283
mergify[bot] Feb 5, 2025
9d2d3f9
Revert "Merge pull request #4332 from anoma/murisi/test-vectors-with-…
tzemanovic Feb 5, 2025
ff2a403
Merge pull request #4340 from anoma/mergify/bp/maint-libs-0.47/pr-4339
mergify[bot] Feb 5, 2025
1fce97a
Namada libs 0.47.1
tzemanovic Feb 5, 2025
c934e9f
changelog: release Namada libs 0.47.1
tzemanovic Feb 5, 2025
5b24e1f
Merge branch 'maint-libs-0.47' into maint-1.1
tzemanovic Feb 5, 2025
587a25b
changelog: add #4343
tzemanovic Feb 5, 2025
bec2e97
Namada 1.1.1
tzemanovic Feb 5, 2025
7a60628
changelog: release Namada apps 1.1.1
tzemanovic Feb 5, 2025
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
Prev Previous commit
Next Next commit
Now parameterize query_allowed_conversion with the target epoch.
(cherry picked from commit f698787)
  • Loading branch information
murisi authored and mergify[bot] committed Feb 5, 2025
commit 44211f81e54995816799e74d194c37efba04973b
110 changes: 45 additions & 65 deletions crates/shielded_token/src/masp/shielded_wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -499,36 +499,54 @@ pub trait ShieldedApi<U: ShieldedUtils + MaybeSend + MaybeSync>:
}

/// Query the ledger for the conversion that is allowed for the given asset
/// type and cache it.
/// type and cache it. The target epoch must be greater than or equal to the
/// asset's epoch.
#[allow(async_fn_in_trait)]
async fn query_allowed_conversion<'a, C: Client + Sync>(
&'a mut self,
client: &C,
asset_type: AssetType,
target_epoch: MaspEpoch,
conversions: &'a mut Conversions,
) {
if let btree_map::Entry::Vacant(conv_entry) =
) -> Result<(), eyre::Error> {
let btree_map::Entry::Vacant(conv_entry) =
conversions.entry(asset_type)
else {
return Ok(());
};
// Get the conversion for the given asset type, otherwise fail
let Some((token, denom, position, _ep, mut conv, path)) =
Self::query_conversion(client, asset_type).await
else {
return Ok(());
};
// Get the equivalent to the original asset in the target epoch
let pre_asset_type = AssetData {
token,
denom,
position,
epoch: Some(target_epoch),
};
let target_asset_type = pre_asset_type
.encode()
.map_err(|_| eyre!("unable to create asset type",))?;
// Get the conversion for the target asset type. If this query returns
// None for a target_epoch that is less than or equal to the latest,
// then the token stopped participating in the rewards program before
// target_epoch. Therefore a conversion to target_epoch is the same as
// one to the latest epoch.
if let Some((_token, _denom, _position, _ep, nconv, _path)) =
Self::query_conversion(client, target_asset_type).await
{
let Some((token, denom, position, ep, conv, path)) =
Self::query_conversion(client, asset_type).await
else {
return;
};
self.asset_types.insert(
asset_type,
AssetData {
token,
denom,
position,
epoch: Some(ep),
},
);
// If the conversion is 0, then we just have a pure decoding
if !conv.is_zero() {
conv_entry.insert((conv.into(), path, 0));
}
// Subtract (conversion from target to latest) from (conversion from
// original to latest) to get (conversion from original to target).
conv -= nconv;
}
// If the conversion is 0, then we just have a pure decoding
if !conv.is_zero() {
conv_entry.insert((conv.into(), path, 0));
}
Ok(())
}

/// Convert the given amount into the latest asset types whilst making a
Expand All @@ -548,38 +566,20 @@ pub trait ShieldedApi<U: ShieldedUtils + MaybeSend + MaybeSync>:
let mut output = I128Sum::zero();
// Repeatedly exchange assets until it is no longer possible
while let Some(asset_type) = input.asset_types().next().cloned() {
// Get the equivalent to the current asset in the target epoch and
// note whether this equivalent chronologically comes after the
// current asset
let target_asset_type = self
.decode_asset_type(client, asset_type)
.await
.map(|mut pre_asset_type| {
pre_asset_type.redate(target_epoch);
pre_asset_type
.encode()
.map_err(|_| eyre!("unable to create asset type",))
})
.transpose()?
.unwrap_or(asset_type);
let at_target_asset_type = target_asset_type == asset_type;
// Fetch and store the required conversions
self.query_allowed_conversion(
client,
target_asset_type,
asset_type,
target_epoch,
&mut conversions,
)
.await;
self.query_allowed_conversion(client, asset_type, &mut conversions)
.await;
.await?;
// Consolidate the current amount with any dust from output.
// Whatever is not used is moved back to output anyway.
let dust = output.project(asset_type);
input += dust.clone();
output -= dust;
// Now attempt to apply conversions
if let (Some((conv, _wit, usage)), false) =
(conversions.get_mut(&asset_type), at_target_asset_type)
if let Some((conv, _wit, usage)) = conversions.get_mut(&asset_type)
{
display_line!(
io,
Expand All @@ -598,27 +598,6 @@ pub trait ShieldedApi<U: ShieldedUtils + MaybeSend + MaybeSync>:
&mut output,
)
.await?;
} else if let (Some((conv, _wit, usage)), false) = (
conversions.get_mut(&target_asset_type),
at_target_asset_type,
) {
display_line!(
io,
"converting latest asset type to target asset type..."
);
// Not at the target asset type, yet at the latest asset type.
// Apply inverse conversion to get from latest asset type to the
// target asset type.
self.apply_conversion(
io,
conv.clone(),
asset_type,
input[&asset_type],
usage,
&mut input,
&mut output,
)
.await?;
} else {
// At the target asset type. Then move component over to output.
let comp = input.project(asset_type);
Expand Down Expand Up @@ -781,9 +760,10 @@ pub trait ShieldedApi<U: ShieldedUtils + MaybeSend + MaybeSync>:
self.query_allowed_conversion(
context.client(),
redated_asset_type,
current_epoch,
&mut latest_conversions,
)
.await;
.await?;
}

let mut estimated_next_epoch_conversions = Conversions::new();
Expand Down