-
Notifications
You must be signed in to change notification settings - Fork 50
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
Support runtimes that use keccak-256 #1961
Comments
Saying that a chain "uses keccak as its hashing function" is a bit like saying that a video game console is 32 bits or 64 bits, it's really imprecise. Technically, yes, smoldot can support hash functions other than blake2 and we can technically make the hash function customizable. |
I'm also against turning chain specs into the Polkadot equivalent of package.json where everyone randomly adds undocumented custom fields that only one implementation supports. |
Sorry, I didn't explain myself correctly.
What I meant to ask is wether it would be possible for smoldot to support chains that have been created with FRAME but that are using keccak-256 as the FRAME I understand that smoldot has to draw the line somewhere and it can't reasonably support every possible FRAME configuration. However, this strikes to me as a reasonable addition. In the sense that the parachain still works fairly similarly to the way that polkadot/kusama work, but it has customized this trait in FRAME.
I completely agree with this. What about passing it as an optional property on the const smoldot = start();
const relay = await smoldot.addChain({ chainSpec: relayChainSpec, disableJsonRpc: true });
const hyperbridge = smoldot.addChain({
chainSpec,
potentialRelayChains: [relay],
hashing: "keccak_256", // it defaults to `blake2_256`
}) |
I have no idea what that trait does exactly. I care about how parachains work on a conceptual level, whereas this trait is some kind of high-level API for parachain developers. |
Thank you for the clarification. Let me rephrase my question: Would it be possible for smoldot to support a customizable hashing function in any context where blake2_256 is currently being used? Specifically, I believe the relevant areas are:
Do you think it would be feasible to provide this level of configurability? 🙏 |
This would just be a hack. |
This trait is indeed the correct way to solve this issue; It is a way for a runtime to express across itself, and its metadata, what kind of hashing it uses. This trait is bounded to be We can explore a more convenient way to make sure such a type is in the metadata. |
You can't access the metadata without knowing the hash function(s) first. EDIT: in the case of a chain spec that contains for example the full state of a block, we could indeed access the metadata without knowing the hash function, as we know for sure that the block is valid. However, smoldot can accept chain specs that contain just the finalized block hash (and a few more things) then downloads the block from the peer-to-peer network, in which case the hash algorithm has to be known in order to proceed. |
In fact, in the case of parachains: smoldot only requires the " |
Okay, so your Where can I see the format of this type of "partial" chain-spec? |
|
I wasn't able to use smoldot for connecting to Hyperbridge (here is their chainspec). I assume that's because it uses keccak_256 (instead of blake2_256) as its hashing function.
Would it be possible to support chains that use keccak as their hashing function?
An idea would be to have a custom field on the chainspec with the name of the hashing function, and then if smoldot doesn't support it it would print an error.
The text was updated successfully, but these errors were encountered: