Upgrade NNS Canister: Cycles Ledger

Proposal 134202 to upgrade the Cycles Ledger Canister is live.

1 Like

Proposal #134202

Vote: Adopted
Reason: Builds fine and the hash matches, along with all the listed commits and the motivation makes sense.
The Argument Hex that is provided in the summary is also a match, and using the command " $ didc encode ‘()’ | xxd -r -p | sha256sum " we can also match the arg_hash from the payload.

Review:

eff32e8 chore: release 1.0.3
Matches description.
e9b9740 fix: FI-1574: last_block_index shall be leb128 encoded
Adapted icrc3_get_tip_certificate to be compliant with the ICRC-3 specification by changing the encoding of last_block_index to leb128.
Done by adding leb128 version 0.2.5 to the list of dependecies in the toml file, setting the MAX_U64_ENCODING_BYTES constant to 10, as the maximum number of bytes required to encode a 64-bit unsigned integer (u64) in a specific encoding format in our case that being LEB128, to be used by the populate_last_block_hash_and_hash_tree function used to encode and store the last block’s index and its hash.
Using LEB128 for last_block_index ensures that small indices are represented efficiently.
The added test_u64_to_leb128 is used to verify the correctness of LEB128 encoding and decoding.
e9328d1 Set copyright to 2023 DFINITY Foundation
Matches description.
362c2a6 feat: Add get_icp_xdr_conversion_rate to mock cmc
Simply adds the get_icp_xdr_conversion_rate to mock CMC without any changes to the Cycles Ledger.

3 Likes

proposal - 134202

Vote: ADOPT

Reason:

I have successfully built cycles ledger and validated the hash, confirming that all commit messages accurately describe the corresponding modifications in the code.

Hash Match: MATCH

Feedback: NONE

Proposer Check: MATCH

Commits

eff32e868
Add version 1.0.3 of cycles ledger.

e9b9740
New lib leb128 introduced.

Encodes a u64 last_block_index into a compact LEB128 format, stores it in a buffer, and inserts it along with the last_block_index key into a mutable hash tree data structure.

e9328d1

Dfinity Copyright fix.

362c2a6

Unreleased is now 1.0.2 instead of 1.0.1
New type IcpXdrConversionRate and IcpXdrConversionRateResponse for query method get_icp_xdr_conversion_rate.

Changes are specifically for adding functionality to mock the ICP to XDR conversion rate.

2 Likes

Proposal Review

Install mode, canister id and upgrade args are correct.

Build hash is valid and reproducible.

Screenshot 2024-11-22 at 16.39.07

Code changes:

This change updates last_block_index serialization to use LEB128 encoding instead of fixed-size big-endian (to_be_bytes). LEB128 provides a more space-efficient, variable-length representation, reducing storage overhead for smaller values. This aligns with ICRC-3 specification.

Proposal 134202

Vote: ADOPT

Reviews:

362c2a6 Added get_icp_xdr_conversion_rate query endpoint to exchange rate mock canister.

e9328d1 Properly set copyright in license.

e9b9740 Added leb128 crate to dependencies and use it to encode last_block_index

eff32e868 Updated changelog

1 Like