Skip to content

Commit 5a03873

Browse files
committed
Make the resetting migration also set the token precision. Also allow nodes to load AllowedConversion and u128 migrations.
1 parent f598ec4 commit 5a03873

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

crates/sdk/src/migrations.rs

+2
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,8 @@ pub fn commit<D, H>(
607607
derive_borshdeserializer!(Vec::<u8>);
608608
derive_borshdeserializer!(Vec::<String>);
609609
derive_borshdeserializer!(u64);
610+
derive_borshdeserializer!(u128);
611+
derive_borshdeserializer!(masp_primitives::convert::AllowedConversion);
610612

611613
#[derive(BorshSerialize, BorshDeserialize)]
612614
#[repr(transparent)]

examples/make-db-migration.rs

+10
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,16 @@ fn shielded_reward_reset_migration() {
194194
})
195195
.clone()
196196
};
197+
// The key holding the shielded reward precision of current token
198+
let shielded_token_reward_precision_key =
199+
masp_reward_precision_key::<Store<()>>(&token_address);
200+
201+
updates.push(migrations::DbUpdateType::Add {
202+
key: shielded_token_reward_precision_key,
203+
cf: DbColFam::SUBSPACE,
204+
value: (precision as u128).into(),
205+
force: false,
206+
});
197207
// Write the new TOK conversions to memory
198208
for digit in MaspDigitPos::iter() {
199209
// -PRECISION TOK[ep, digit] + PRECISION TOK[current_ep, digit]

0 commit comments

Comments
 (0)