Skip to content

Replace GenericApplicationId with MultiAddress.#3593

Closed
deuszx wants to merge 1 commit intouserapplicationid-is-multiaddressfrom
rm-multiaddress-chain
Closed

Replace GenericApplicationId with MultiAddress.#3593
deuszx wants to merge 1 commit intouserapplicationid-is-multiaddressfrom
rm-multiaddress-chain

Conversation

@deuszx
Copy link
Contributor

@deuszx deuszx commented Mar 18, 2025

Motivation

Simplify types, prepare for multiple variants of Address.

Proposal

Remove GenericApplicationId enum (which had two variants: System and User(UserApplicationId)) and use MultiAddress directly. GenericApplicationId::System variant is now using a special MultiAddress::chain() address which is a special address used for system/chain operations (pub-sub channels, etc.) and its CryptoHash cannot be constructed by the user.

Test Plan

CI

Release Plan

  • Nothing to do / These changes follow the usual release cycle.

Links

@deuszx deuszx force-pushed the userapplicationid-is-multiaddress branch 2 times, most recently from 133b8cb to aed6cc2 Compare March 18, 2025 13:00
@deuszx deuszx force-pushed the rm-multiaddress-chain branch 2 times, most recently from 16a74dc to 34767d0 Compare March 18, 2025 13:16
Copy link
Contributor

@afck afck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to just call the type Address? "Multi" sounds like it could be more than one address (as opposed to one of several different kinds of addresses).


impl BcsHashable<'_> for Chain {}

/// The CryptoHash of `Chain` newtype struct.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// The CryptoHash of `Chain` newtype struct.
/// The `CryptoHash` of `Chain` newtype struct.

(It's also not ideal that the comment of a pub item refers to a private type.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but this will go away when we switch to Account::Reserved variant.


impl MultiAddress {
/// Returns the default chain address.
pub fn chain() -> Self {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be a pub const CHAIN instead?

Copy link
Contributor Author

@deuszx deuszx Mar 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately we cannot. I can't use const and call CryptoHash::new and I can't construct one manually.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer what's in our internal design doc: Reserved(0) (syntax 0x0) for the chain balance.

Copy link
Contributor Author

@deuszx deuszx Mar 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need a special variant for this. It doesn't seem like it's needed anywhere and I've been trying to get rid of unnecessary variants, I don't want to re-introduce them.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we have both Address32 and Address20, I don't like to choose between the two for special addresses

Copy link
Contributor Author

@deuszx deuszx Mar 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The chain will always have one address and we can hardcode the choice. Let's discuss that in a meeting.

@deuszx deuszx marked this pull request as ready for review March 19, 2025 09:29
@deuszx deuszx force-pushed the userapplicationid-is-multiaddress branch 4 times, most recently from a917cca to b2f4ee3 Compare March 21, 2025 18:29
@deuszx deuszx force-pushed the rm-multiaddress-chain branch from 34767d0 to b6b4700 Compare March 21, 2025 18:33
@deuszx deuszx force-pushed the userapplicationid-is-multiaddress branch from b2f4ee3 to 864f74a Compare March 21, 2025 18:47
@deuszx deuszx force-pushed the rm-multiaddress-chain branch from b6b4700 to 74195cc Compare March 21, 2025 18:47
@deuszx deuszx force-pushed the userapplicationid-is-multiaddress branch 2 times, most recently from 6dd49a2 to cfe2cd5 Compare March 21, 2025 19:02
@deuszx deuszx force-pushed the rm-multiaddress-chain branch from 74195cc to 17cc7e7 Compare March 21, 2025 19:03
@deuszx
Copy link
Contributor Author

deuszx commented Mar 24, 2025

(Re)addressed in #3633

@deuszx deuszx closed this Mar 24, 2025
@deuszx deuszx deleted the rm-multiaddress-chain branch May 1, 2025 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants