Skip to content

Commit

Permalink
Corrected the compounding of the MASP transparent balance.
Browse files Browse the repository at this point in the history
  • Loading branch information
Murisi Tarusenga committed Mar 13, 2023
1 parent 73fea5f commit aa7bba1
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 23 deletions.
14 changes: 9 additions & 5 deletions core/src/ledger/storage/masp_conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,6 @@ where
let addr_bal: token::Amount = wl_storage
.read(&token::balance_key(addr, &masp_addr))?
.unwrap_or_default();
// The reward for each reward.1 units of the current asset is
// reward.0 units of the reward token
// Since floor(a) + floor(b) <= floor(a+b), there will always be
// enough rewards to reimburse users
total_reward += (addr_bal * reward).0;
// Provide an allowed conversion from previous timestamp. The
// negative sign allows each instance of the old asset to be
// cancelled out/replaced with the new asset
Expand Down Expand Up @@ -119,6 +114,10 @@ where
.unwrap())
.into(),
);
// The reward for each reward.1 units of the current asset is
// reward.0 units of the reward token
total_reward +=
(addr_bal * (new_normed_inflation, *normed_inflation)).0 - addr_bal;
// Save the new normed inflation
*normed_inflation = new_normed_inflation;
} else {
Expand All @@ -135,6 +134,11 @@ where
.unwrap())
.into(),
);
// The reward for each reward.1 units of the current asset is
// reward.0 units of the reward token
total_reward +=
((addr_bal * (real_reward, reward.1)).0 *
(*normed_inflation, ref_inflation)).0 - addr_bal;
}
// Add a conversion from the previous asset type
wl_storage.storage.conversion_state.assets.insert(
Expand Down
36 changes: 18 additions & 18 deletions wasm/checksums.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"tx_bond.wasm": "tx_bond.3be93ca11fc699b95032a02b40cd4788f111dbd66f01cfbe221d15028691068e.wasm",
"tx_change_validator_commission.wasm": "tx_change_validator_commission.2c7bfa33180fbd7931a0c53809cfac08a75974ef367c0182bd9dff2aa1c30fb2.wasm",
"tx_ibc.wasm": "tx_ibc.ed5fce98867c5e62221faf463e1d55bb8d8936f23ad2120bc9f76150bea3b5d7.wasm",
"tx_init_account.wasm": "tx_init_account.509bdc349213d0a56f96494fa0aa795a95ae2a9e01a919f9841c7f38cc2c1c36.wasm",
"tx_init_proposal.wasm": "tx_init_proposal.c7e189f6afbbdac098eb0060a1f5b0c057dfdd4973a90e3579d468581ff6e3af.wasm",
"tx_init_validator.wasm": "tx_init_validator.42ae8475555db1ed8d58d47c8ffcb60e868091e99c1abb52052d06608edc4dee.wasm",
"tx_reveal_pk.wasm": "tx_reveal_pk.4344d868b92039524e76b9eb1c40fbf5f44298948dcac33dd6321f6d77ccba9d.wasm",
"tx_transfer.wasm": "tx_transfer.b0f16ecfa5c30cbf0ec080dfaff561e51b8815ac2fa048f50897f6523906345c.wasm",
"tx_unbond.wasm": "tx_unbond.60b9e991da0d296967f026486bb7e2cf9bd0ade493a71881cc2c31e2cc9feb66.wasm",
"tx_update_vp.wasm": "tx_update_vp.8b1315238f73a6b6c07b2e46db5ecf2500247b63103f899030afc75e2a765387.wasm",
"tx_vote_proposal.wasm": "tx_vote_proposal.85369669c7a2f266f890ff1a3482a9cd2368bb52b77b6a55e8d5f3541d154636.wasm",
"tx_withdraw.wasm": "tx_withdraw.0fdbd8cff63293796334d95ebb64529e04a627c1d71338ff4b505b0c50a378f5.wasm",
"vp_implicit.wasm": "vp_implicit.6c4bbd9538ec6a0dd7cec53db7f36ee5d9c8d7213852f89d710540a82a8b8caf.wasm",
"vp_masp.wasm": "vp_masp.d16897d0340705b5bed826072a4b5c6c95f19c78ab97712272a07e8698f82b03.wasm",
"vp_testnet_faucet.wasm": "vp_testnet_faucet.7b68e53a8467062cdf0548b4a0a73ca079fd6c766c77a92de0538cabc06d816a.wasm",
"vp_token.wasm": "vp_token.90c8b200126b160814f6fb2938190a2a63d660d5027d573429f6ef59c6865013.wasm",
"vp_user.wasm": "vp_user.6d224484530e866f28a5193e34fb418ea4ce8b71962233b3dab0b14d1aceda08.wasm",
"vp_validator.wasm": "vp_validator.e55d35c9d5ff4021695fa792378252bcb2b3190682fdae5ddc3d33cbf7b2e58e.wasm"
"tx_bond.wasm": "tx_bond.8d7d124ac92b9f014522ddb21b651186d4530f55462d8be4ebeda10f4ccaeaed.wasm",
"tx_change_validator_commission.wasm": "tx_change_validator_commission.20d7f3ad9431a2d22e0b955622ac66b99a94a84fb8ad0828ad16fcb426335472.wasm",
"tx_ibc.wasm": "tx_ibc.00179813a013f997f0c192938eb231dcfff1ffc79304e36af1ff470ab540e649.wasm",
"tx_init_account.wasm": "tx_init_account.9fade81282d4e299460d777888d0259cfefa558731285fd54f780a914c84c0e5.wasm",
"tx_init_proposal.wasm": "tx_init_proposal.db5211f020325da4a2209fdca803b87989e23600490861f59b37e74e84a80109.wasm",
"tx_init_validator.wasm": "tx_init_validator.1539bac0ecb1aeebcbcdd299d5f887de9283d56a05eec2f26826822616c651f5.wasm",
"tx_reveal_pk.wasm": "tx_reveal_pk.fa96359e712c2eb98ba7b1498d4df5fa79c38a780fe06e3628f0d749bb1423e3.wasm",
"tx_transfer.wasm": "tx_transfer.0839693d13d7a7d24aec254c532b50752425eae704a2da826f544f27821ea3f2.wasm",
"tx_unbond.wasm": "tx_unbond.a489091c72da12a76dd3665260ab8c69569e45632cb86c0b31d00000d4afccb7.wasm",
"tx_update_vp.wasm": "tx_update_vp.caf7814b442e86f5ae1b4dae1edf13cba6fcf8c997f4735df97649a08bd4d223.wasm",
"tx_vote_proposal.wasm": "tx_vote_proposal.8fdf692589ee2e7cb37f76ffd8bb25e869498f3158a52c33ea4dc305e9dfea15.wasm",
"tx_withdraw.wasm": "tx_withdraw.0265190e0d29ea96820c76e5aa5e0adc7dac6e087f3f72ebc4451047afb0a65e.wasm",
"vp_implicit.wasm": "vp_implicit.cabb4658d17a95c011e9782ac921360a801442681589bc8a20ecc88680476691.wasm",
"vp_masp.wasm": "vp_masp.5576090f52935f7763d8ca48fb559312cf65cc928c68598e299062adb29140ec.wasm",
"vp_testnet_faucet.wasm": "vp_testnet_faucet.f7b5d93ff4fa09332390ffc8fae6894706fc9becefbaa4d3fb311326848f507e.wasm",
"vp_token.wasm": "vp_token.3a9a7d3b6f590a8b15cb0d1e93d99d37ced5604de8f6a52527bed680661f9d3d.wasm",
"vp_user.wasm": "vp_user.1d0a07ed40765cff97c85a2a9fb467dfe7af56bc51a4b95ad12ed77aea82e8a9.wasm",
"vp_validator.wasm": "vp_validator.de713b8aa04874c4af9620db6db0009a83a1795759302066753608abb98d5745.wasm"
}
Binary file modified wasm_for_tests/tx_memory_limit.wasm
Binary file not shown.
Binary file modified wasm_for_tests/tx_mint_tokens.wasm
Binary file not shown.
Binary file modified wasm_for_tests/tx_no_op.wasm
Binary file not shown.
Binary file modified wasm_for_tests/tx_proposal_code.wasm
Binary file not shown.
Binary file modified wasm_for_tests/tx_read_storage_key.wasm
Binary file not shown.
Binary file modified wasm_for_tests/tx_write.wasm
Binary file not shown.
Binary file modified wasm_for_tests/vp_always_false.wasm
Binary file not shown.
Binary file modified wasm_for_tests/vp_always_true.wasm
Binary file not shown.
Binary file modified wasm_for_tests/vp_eval.wasm
Binary file not shown.
Binary file modified wasm_for_tests/vp_memory_limit.wasm
Binary file not shown.
Binary file modified wasm_for_tests/vp_read_storage_key.wasm
Binary file not shown.

0 comments on commit aa7bba1

Please sign in to comment.