NNS Dapp To Remove Protobuf Dependency: Upgrade Your Ledger IC app to 2.4.9

What Is Protobuf?

“Protocol Buffers (a.k.a., protobuf) are Google’s language-neutral, platform-neutral, extensible mechanism for serializing structured data.” Protobuf Repository

When NNS dapp was first developed, it used protobuf as the format to fetch the data and talk to canisters. This was before the Internet Computer adopted the use of Candid.

Since the introduction of Candid, the NNS dapp has been migrating away from protobuf.

Currently, the only usage for protobuf in the NNS dapp is to support old versions of the Internet Computer application in the Ledger hardware wallets.

Proposal: Stop supporting old Ledger app versions

In order to save space and simplify the NNS dapp code, we propose to remove the protobuf dependency from the NNS dapp. As a consequence, the NNS dapp would stop supporting Ledger application versions older than 2.4.9, the version published in October 2023.

Users who control ICP or neurons with a Ledger device can simply update their Ledger app in order to keep using all the functionality of hardware wallets with the NNS dapp.

Why?

There are three main reasons why we propose this change.

  1. Reduce the bundle size: The library to support protobuf (@dfinity/nns-proto) weighs more than 500Kb. It has been split apart so that it could be loaded on demand. But it’s still part of the Wasm uploaded to the IC on every NNS dapp upgrade.

  2. Reduce the complexity of the NNS dapp code: The library (@dfinity/nns) to support interaction with the Governance canister has double the code paths (example) to support the old versions with protobuf. Some methods and types are duplicated, making code harder to maintain.

  3. Free memory in the Ledger device: Last but not least, the IC app in the Ledger devices is almost at the memory limit. There are plans to support ICRC-21 in those devices, where the memory could be a problem. We propose proactively preventing memory issues instead of fixing them later.

Am I Impacted As a User?

You will be impacted by this change if, and only if, you use a Ledger hardware wallet to interact with the NNS dapp where the Internet Computer app is installed with a version lower than 2.4.9.

In that case, you would need to upgrade your Internet Computer application within your Ledger device.

Am I Impacted As a Developer?

If you are a developer and rely on nns-js or ledger-icp, you should be aware that removing the protobuf dependency will introduce a breaking change. The optional parameter hardwareWallet will be removed from nns-js and ledger-icp.

We will publish a new major version of both libraries. You have two options:

  • If you want to keep supporting old versions of the Ledger IC app, you won’t be able to upgrade the libraries.
  • If you upgrade the libraries, you should be aware that the new version of the libraries won’t support older versions of the Ledger IC app and must act accordingly in your client to give a nice UX.

Proposed Next Steps

If there are no concerns raised by the community here, we plan to proceed as follows. In a first step planned for the upcoming weeks, we will propose to the NNS a version of the NNS dapp that stops supporting old versions of the IC app on Ledger devices and changes the code to only use Candid. After this step, the old code would still be there in case we need to revert.

If the proposal is adopted and there are no unexpected problems, we would then remove the protobuf dependency from ic-js (the library that is used by the NNS dapp), publish a new version with the breaking changes, and submit a proposal to update the NNS dapp without the dependency.

Thanks for reading and don’t hesitate to reply to this thread.

7 Likes

I’m not part of this project, so if I may share my opinion:

→ I’ve been waiting for this my whole life! :+1:

4 Likes