dfinity / wg-identity-authentication

Repository of the Identity and Wallet Standards Working Group
https://wiki.internetcomputer.org/wiki/Identity_%26_Authentication
Apache License 2.0
26 stars 8 forks source link

ICRC-21: Add PaymentRequired error variant #155

Closed frederikrothenberger closed 4 months ago

frederikrothenberger commented 4 months ago

This PR future proofs ICRC-21 for the addition of a payment flow to be added later. It is highly likely, that if the consent messages get widely used, that some of them are only provided if they are paid for.

A concrete example of that is the install_code method on the management canister: If the provided wasm module is 2MB in size and the consent message is to include the SHA256 of that wasm moduel, empirical measurements have shown that producing such a message costs about 4.5B cycles, which is about $0.006. If every consent message for all install_code calls was provided for free this would incur a significant aggregated cost on the IC as a platform.

While we do not want to introduce a payment flow immediately, we can at least prepare for the eventual introduction of such a flow by adding one additional error variant to the ICRC-21 base standard. This will make payment flow extension a non-breaking enhancement of ICRC-21.