Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editorial pass for minor style guide issues and clarity #1

Merged

Conversation

bumblefudge
Copy link

Looking good!

@bumblefudge
Copy link
Author

I'm a little confused because on line 51 you say there is "no algorithm" for computing CAIP-2 hash from genesis hash, but there seems to be a pre-defined function in Octez for doing exactly that, and besides, CAIP-2 defines that algorithm? I don't understand the original intent of line 51, i edited it for clarity before realizing i didn't understand it at all...

@jdsika
Copy link

jdsika commented Mar 13, 2024

Thx! I would like to keep the ":" in the alias if possible as I think the construction of the account ID should work the same way like
"tezos:mainnet:tz1...."

Copy link

@jdsika jdsika left a comment

Choose a reason for hiding this comment

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

thank you! Only my comment

@jdsika
Copy link

jdsika commented Mar 13, 2024

I'm a little confused because on line 51 you say there is "no algorithm" for computing CAIP-2 hash from genesis hash, but there seems to be a pre-defined function in Octez for doing exactly that, and besides, CAIP-2 defines that algorithm? I don't understand the original intent of line 51, i edited it for clarity before realizing i didn't understand it at all...

ok, it is good that you point that out! I created a ticket in the Tezos GitLab about it https://gitlab.com/tezos/tezos/-/issues/7023

I believe that there is a mapping table in the codebase where the network name is mapped to the known chain IDs of mainnet and ghostnet (mainnet -> NetXdQprcVkpaWU). But the other way around seems missing (NetXdQprcVkpaWU -> mainnet). With "no algorithm" I meant that I cannot throw the string "mainnet" with a prefix of "XY" into a hash function to get the chain id and vice versa. It is "just" the Octez devs maintaing the mapping table and a social consensus of people accepting this Octez version with this feature. Is that clearer?

@bumblefudge
Copy link
Author

Thx! I would like to keep the ":" in the alias if possible as I think the construction of the account ID should work the same way like "tezos:mainnet:tz1...."

i find this a little confusing because neither in the mapping table in octez nor on discussion forums does anyone refer to "tezos:mainnet" -- they refer to "mainnet" or "Tezos mainnet" or "the mainnet of the Tezos ecosystem". backfilling the CAIP-10 syntax onto the real world implies that tooling exists in the world (or should) that takes flags like --network tezos:mainnet when, in reality, octez already takes flags like --network mainnet (the tezos is implicit from context and no heirarchical URN : syntax is needed).

to put it another way, the CAIP-10 syntaxes uses : to be machine-readable (qua URN)-- the human readable equivalent has no reason to look like, or be, a valid URN?

@bumblefudge
Copy link
Author

if it's simpler, we could simply cut out all mention of registries and aliases-- you don't really NEED it for this profile to be usable for cross-chain/CAIP-25 tooling to be able to interact with the main 3 chains! the reason OED mentioned it in the other thread is that we generally discourage profiles that DEFINE an original mapping; unless there is already an authoritative registry that can be normatively linked, like chainlist or SS58 (in the case of polkadot), we prefer deterministic, self-confirmable transformations of genesis-block hashes (every namespace without such a registry uses some form of machine-readable, confirmable-from-the-node genesis hash IDs).

@bumblefudge
Copy link
Author

if you think the octez/tezos community WANTS or NEEDS such a registry, feel free to keep working on it (and i'm sympathetic since the octez CLI already seems to have this feature in underdocumented form!), i just don't want you to feel like it's homework before merging this. if anything, it's a hopefully-fun sidequest 😉

@jdsika
Copy link

jdsika commented Mar 20, 2024

Good morning @bumblefudge
Thanks for your input! Let`s see if I can give a proper answer to that :)

I think a specification like CAIP can in general do at least two things. First define what is the currently implemented practical use of something an write it down for others to follow the method and thought process behind it and second, provide a suggestion on how something should be done in order to steamline something that seems to cause misunderstanding and confusion.

Mentioning a chain registry:
I created tickets for that and they have already been assigned to someone. I will definitely follow up on those due to my interest in the topic but I sadly have too less time for side quests in my life since I stopped playing lineage 2 in my youth :( At the very least I think it is very valuable to make people aware of the fact that they often use an alias instead of the correct definition of the chain ID and that needs to be properly defined somewhere. In addition I think it is valuable to point to the fact that the mentioning of that alias has simply the character of information and recommendation as it is not a normative part of the CAIP. It is a great reminder imo.

Alias URN:
I would like the alias to be a URN as that is imo the correct way of constructing the account ID in which the chain ID has an alias:

"tezos mainnet" is derived from "${namespace(account-id)} ${alias(chain_id(account-id))}"

I have seen in the repo of your ex colleagues the following: spruceid/did-tezos#33

I know it is not maintained but if you read my ticket then you will see that people are using a chain ID alias in the construction of URNs. It is apparently in their mind. Trying to propose a clear way on how to reuse the definition of the CAIP chain ID and a potential alias is here useful.

I also talked to implementers of wallets like kukai who said that the general way of presenting the chain ID to the user is using an alias. I mentioned explicitly that this is an optional UX decision of the wallet implementer and the correctness of the mapping is their responsibility in CAIP-122.

@bumblefudge
Copy link
Author

oh wow, i did NOT know the backstory, that is very interesting! if i've got my chronology straight, the did:tz method (primarily written by wayne, as i recall) actually predates the tezos "namespace" for CAIP-10; i vaguely remember tezos being one of the early examples of opting for a machine-readable chainId for lack of a definitive registry to map aliases unambiguously, if you can believe that. i had no idea that kukai or anyone else had taken the "heirarchical URN" approach to chainIds!

in that case, feel free to reject or rollback my totally superficial/aesthetic edits about the : in the alias column, that makes a lot more sense. this also makes clearer you comment on UX decision. totally cool.

when you merge this PR over here, it will update that PR over there, and I'll approve it! thanks again for this great work (and I hope you find time for sidequests both professional and literal in the near future!)

# sandbox
# ghostnet

> ./octez-node run --data-dir ~/tezos-ghostnet --network ghostnet
```

There is currently no algorithm to connect the `chain ID` to the `network` as it is part of the Octez reference implementation of Tezos. In general it is determined by social consensus what chain ID is considered as `tezos:mainnet`. It is RECOMMENDED to use a separate chain registry to map an alias to the chain ID.
There is currently no algorithm to connecting `chain ID`s to `network`s in the Octez reference implementation of Tezos.
Copy link
Author

Choose a reason for hiding this comment

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

Suggested change
There is currently no algorithm to connecting `chain ID`s to `network`s in the Octez reference implementation of Tezos.
There is currently no algorithm for connecting to a network in the Octez reference implementation of Tezos by that network's CAIP-2 chainId, nor a way to query a node directly for a chainId.

Copy link

@jdsika jdsika left a comment

Choose a reason for hiding this comment

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

I cannot change on your branch and will do it myself afterwards

@jdsika jdsika merged commit de23e9b into StakeNow:feat/extend-tezos-CAIP-2-10-122 Mar 25, 2024
@jdsika
Copy link

jdsika commented Mar 25, 2024

Done.

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.

2 participants