Skip to content

Conversation

@s0me0ne-unkn0wn
Copy link
Contributor

@s0me0ne-unkn0wn s0me0ne-unkn0wn commented Jan 6, 2025

@s0me0ne-unkn0wn s0me0ne-unkn0wn changed the title Add RFC 135 Standardize compressed blob prefixes Jan 6, 2025
Copy link
Contributor

@bkchr bkchr left a comment

Choose a reason for hiding this comment

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

Generally I would follow the typical RFC format. The spec is currently outdated and not maintained by anyone.

@s0me0ne-unkn0wn
Copy link
Contributor Author

The spec is currently outdated and not maintained by anyone.

That's some bad news. I mean, if I want to create my implementation of Polkadot from scratch, where do I go?


The current approach to compressing binary blobs is defined in [subsection 2.6.2](https://spec.polkadot.network/chap-state#sect-loading-runtime-code) of Polkadot spec. It involves using `zstd` compression, and the resulting compressed blob is prefixed with a unique 64-bit magic value specified in that subsection. Said subsection only defines the means of compressing Wasm code blobs; no other compression procedure is currently defined by the spec.

However, in practice, the current de facto protocol uses the said procedure to compress not only Wasm code blobs but also proofs-of-validity. Such a usage is not stipulated by the spec. Currently, having solely a compressed blob, it's impossible to tell what's inside it without decompression, a Wasm blob, or a PoV. That doesn't cause any problems in the current de facto protocol, as Wasm blobs and PoV blobs take completely different execution paths, and it's impossible to mix them.
Copy link
Contributor

Choose a reason for hiding this comment

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

The argumentation "it's impossible to mix them" is not really that strong :P

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, I'm just describing the current situation here, and that's something that should be fixed by implementing this RFC as well. Surely, we currently can mix them in the code, we just don't want to 🙂

@anaelleltd anaelleltd added the Proposed Is awaiting 3 formal reviews. label Jan 8, 2025
@s0me0ne-unkn0wn
Copy link
Contributor Author

@bkchr, returning to that "let's follow the typical RFC format" part and explaining why I'd like to keep it that formal.

According to the Polkadot Whitepaper, "A system of RFCs, not unlike the Python Enhancement Proposals, will allow a means of publicly collaborating over protocol changes and upgrades". Thus, the RFCs are proposals to change the protocol. But what protocol? We must understand what we're changing. I understand that currently, we're more or less in limbo between the Polkadot Whitepaper and the JAM Gray paper, and that would be acceptable if we found ourselves in this situation, say, for a couple of months. But JAM is not arriving in a couple of months, and if the spec is not currently maintained, that means we're flying in the Bitcoin mode with an implementation-defined spec. What protocol is changed by any given RFC, then? That one which had been implemented by the time when the RFC was first published? Or will we count from the latest stable release?

Again, if a team wants to start its very own implementation of Polkadot tomorrow, where does it start? What should they implement? Should they just read our Rust code and do the same? They may not even know Rust, after all. Or should they take the latest outdated spec and apply all the RFCs over it? Even the infamous EU bureaucracy doesn't treat you like that, you can always get a full text of legislation that is in force right now instead of getting the very first one from 1990s and a hundred amendments to compile everything yourself.

That's why I believe the spec is super important. The spec should be a representation of the current state, and RFCs should propose changes to the spec, not the code. Yes, we're not living in a perfect world, and it may become more or less stale sometimes, but if we drop its support altogether, a lot of things lose sense, including alternative implementations.

Alternatively, if we wanted to follow the IETF's RFC model, we could have a set of "root RFCs" defining the protocol and other RFCs amending the root ones, but I believe for a protocol as complex as Polkadot it's a counterproductive approach as the set of root RFCs would just become the spec on its own. The IETF's TCP protocol had 10 RFCs on its way before it was rewritten from scratch to include all the amendments, and that happened over a time span of 40+ years. We in Polkadot, on the other hand, have already had 60+ RFCs since Fellowship was formed, roughly in a year and a half. The IETF's approach wouldn't work here.

I'll go ahead and tag @gavofyork here 'cause I believe it's a really bad situation. If the spec is not maintained, we should change it today or tomorrow at the latest.

@bkchr
Copy link
Contributor

bkchr commented Jan 8, 2025

There are two things, the spec not being maintained and then there are like the standard RFC format. While I'm also not happy that the spec is not maintained and I would like to change this, it is complicated right now and I don't think this will change until we have JAM. Better to accept the reality instead of denying it.
For the RFC I would just follow the format that everyone is using and not trying to push for the special way for no real benefit right now.

@s0me0ne-unkn0wn
Copy link
Contributor Author

Polkadot Fellowship does not accept reality, it forms it! 😁 Fellowship is a resourceful organization and could acquire both internal and external resources to get that job done. What happens now is just a lack of understanding of the importance of the task. Having an up-to-date spec is a basic need, not a luxury.

Otherwise, we don't hold our guarantees. One of them is "Polkadot is intended to be a free and open project, the protocol specification being under a Creative Commons license". And under that, we encourage people to create alternative implementations to incentivize decentralization. But if anyone wanted to do that right now, he would be fast to learn that the only way to do it is in "just-ask-Basti-how-it-works" mode.

I heard you about this very RFC, and I'll fix it to be more typical, but I'm also willing to keep this discussion going and bring it up at the next in-person Fellowship meeting as I believe it's a huge design flaw in the whole process. RFCs should propose changes to the spec, and implemented RFCs MUST be reflected in the spec. That MUST just be a requirement for the implementation to pass the review. Just imagine yourself implementing the initial Polkadot with only outdated and unsupported Wasm specs in your hands. That would be a hell of an implementation.

Do we have political parties in the Fellowship yet? I'm ready to establish one. "Witnesses of the Spec" or something.

@bkchr
Copy link
Contributor

bkchr commented Jan 9, 2025

Polkadot Fellowship does not accept reality, it forms it! 😁 Fellowship is a resourceful organization and could acquire both internal and external resources to get that job done. What happens now is just a lack of understanding of the importance of the task. Having an up-to-date spec is a basic need, not a luxury.

You are free to take this on and make it happen :)

Copy link
Contributor

@bkchr bkchr left a comment

Choose a reason for hiding this comment

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

Generally looks good.

Just need to be even more conservative when it comes to the time lines as this is not only affecting the relay chain or the collators, but every node.

@s0me0ne-unkn0wn
Copy link
Contributor Author

You are free to take this on and make it happen :)

I don't think a single person can do it because I don't believe there exists a single person who knows all the aspects of the current implementation in depth. I think I could design a pipeline that streamlines the spec updates. But first we should communicate and agree on the procedure anyway. Sounds like one more RFC by itself.

@bkchr
Copy link
Contributor

bkchr commented Jan 9, 2025

I did not meant that you should keep the spec updated on your own. Someone needs to setup the process, find the people to update the spec, find out what is outdated etc.

@anaelleltd anaelleltd added Reviewed Is ready for on-chain voting. and removed Proposed Is awaiting 3 formal reviews. labels Mar 3, 2025
@s0me0ne-unkn0wn
Copy link
Contributor Author

/rfc propose

@paritytech-rfc-bot
Copy link
Contributor

Hey @s0me0ne-unkn0wn, here is a link you can use to create the referendum aiming to approve this RFC number 0135.

Instructions
  1. Open the link.

  2. Switch to the Submission tab.

  1. Adjust the transaction if needed (for example, the proposal Origin).

  2. Submit the Transaction


It is based on commit hash ea85b6c1588e4cddc181c8f59a5a46e63b5332c8.

The proposed remark text is: RFC_APPROVE(0135,8c89c71c582c4d1d98a55fa8c5433a72aaa46e6c3a51f39f3f3d684200f2d752).

@ggwpez
Copy link
Member

ggwpez commented Mar 6, 2025

We have two refs for this now, can we close one? https://collectives.subsquare.io/fellowship/referenda/302 and https://collectives.subsquare.io/fellowship/referenda/301

@s0me0ne-unkn0wn
Copy link
Contributor Author

301 should be closed (not sure if I can do that myself)

@github-actions
Copy link

github-actions bot commented Mar 6, 2025

Voting for this referenda is ongoing.

Vote for it here

@github-actions
Copy link

Referenda voting has finished with status Approved

@github-actions
Copy link

PR can be merged.

Write the following command to trigger the bot

/rfc process 0xd1aed7c0c3a4546e09ece795a711832679edb35ad030051807adecd5b14623d2

@anaelleltd anaelleltd added Approved Has passed on-chain voting. and removed Reviewed Is ready for on-chain voting. labels Mar 12, 2025
@github-actions
Copy link

Referenda voting has finished with status TimedOut

@anaelleltd anaelleltd mentioned this pull request Mar 25, 2025
@s0me0ne-unkn0wn
Copy link
Contributor Author

/rfc process 0xd1aed7c0c3a4546e09ece795a711832679edb35ad030051807adecd5b14623d2

@paritytech-rfc-bot paritytech-rfc-bot bot merged commit 91b3161 into polkadot-fellows:main May 5, 2025
@paritytech-rfc-bot
Copy link
Contributor

The on-chain referendum has approved the RFC.

@s0me0ne-unkn0wn
Copy link
Contributor Author

Status update: A fully functional implementation is part of paritytech/polkadot-sdk#6704, which is unlikely to be merged before #145 is implemented and merged. It will most probably require a separate RFC on its own.

If anyone feels it should be separated from that integration, let me know.

@anaelleltd anaelleltd added Implementing Is actively being worked on. and removed Approved Has passed on-chain voting. labels Oct 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Implementing Is actively being worked on.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants