Repository navigation
Conversation
NativeShieldedToken._burn takes a Uint<128> amount, but the preset's burn narrowed it to Uint<64>, and the example and mock copied that signature. A coin above Uint<64> could only be destroyed 2^64 - 1 at a time. Widen all three to Uint<128>, as OpenZeppelin#1033 did for NativeShieldedTokenIssuer. Fixes OpenZeppelin#1171
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Types of changes
Fixes #1171
ZOwnableNativeShieldedToken.burnnarrowed the amount toUint<64>, while theNativeShieldedToken._burnit wraps takesUint<128>. The preset, the example and the mock now takeUint<128>, the same change #1033 made forNativeShieldedTokenIssuer.Not visible in the diff:
mintstays atUint<64>, sincemintShieldedTokencaps it there.Uint<64>is skipped, like in fix(multisig): take Uint<128> issuer burn amounts #1033.compact-runtimestill encodes coin values in 8 bytes (Runtime rejects shielded coin values above Uint<64> LFDT-Minokawa/compact#811), so a coin that large can't be built off-chain yet. The skipped block covers a partial and a full burn and can be turned on once that's fixed.rejects a burn amount above Uint<64>test now checks that such an amount reaches the module's coin value check (NativeShieldedToken: insufficient coin value). Onmainthe same call fails with theUint<0..18446744073709551616>range error.burn.amountis nowUINT_128.burngrows from 48,448 to 48,464 rows and stays at k=16. Both numbers were measured with key generation on compiler 0.36.0, againstmainand this branch.Checked locally:
yarn compile:token, the token unit suite (1224 passed, 12 skipped) andyarn lint. Thearchive/ShieldedToken.burnstill takesUint<64>, but it's archived, so I left it alone.PR Checklist
## Unreleased, or asked a maintainer to add theskip-changeloglabel because nothing user-facing changed. See CONTRIBUTING.md.Summary by CodeRabbit