-
Notifications
You must be signed in to change notification settings - Fork 46
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
docs: Document safe use of Twox64Concat #601
base: develop
Are you sure you want to change the base?
Conversation
We can't ensure that the `Identifier` is not user choosable
_, | ||
Twox64Concat, | ||
<T as Config>::Namespace, | ||
Blake2_128Concat, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note this change. I think the DepositKey might be chosable by the user
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This follows the same reasoning as my other comments (not sure if above or below). The concrete type of a deposit key is defined by the runtime, but it could take user-specified values, so I am all in favor for this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The public credentials pallet also has a pub type Credentials<T> = StorageDoubleMap<_, Twox64Concat, SubjectIdOf<T>, Blake2_128Concat, CredentialIdOf<T>, CredentialEntryOf<T>>;
which, more than anything else, allows for a user-chosen SubjectId
, which is typically an asset DID which, although it has a specific syntax, can still be crafted by the user.
_, | ||
Twox64Concat, | ||
<T as Config>::Namespace, | ||
Blake2_128Concat, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This follows the same reasoning as my other comments (not sure if above or below). The concrete type of a deposit key is defined by the runtime, but it could take user-specified values, so I am all in favor for this change.
// SAFETY of Twox64Concat: | ||
// The DID Identifier must be registered on chain first. To register a DID | ||
// Identifier, you must provide a valid signature for the identifier or | ||
// control the origin that corresponds to the identifier. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this play out with cross-chain origins? I know probably migration would be hard here, but it might still be worth it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The DID that creates the endpoint still needs to be a valid accountId. If you would be able to choose an arbitrary accountId you could impersonate other accounts. So I don't think that this will ever be possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, but the resulting account ID is given by our location converter. There might be a way for a chain to craft origins which are then converted into something else on our chain. That would be the same as crafting origins on our chain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Creating specific AccountIds on our chain should never be possible? Even if the origin is coming from another chain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not saying that. But to have an account on our chain you must have a valid private key to generate the signature. On a different chain, "trying" with different accounts might be cheaper, e.g., if, by absurd, you simply create a chain to spam all possible account IDs. This is probably very theoretical, but still possible. All those origins would be converted into some sort of account ID on our chain, but we don't really know what's the "proof of ownership" for that account ID on the source chain. Maybe this is somehow prevented by having XCM fees in place, which is also a mitigation in our case.
|
This will break cross-chain DIP proofs since the storage keys (and the related proofs) have changed, hence we might want to change at least the DIP stuff to make it resistant. |
Changing the storage hasher before we deploy on production, otherwise we would then need a migration strategy. I think we can disregard any migrations on our testnets, as the effort is not justified. I also lowered the limits of the DIP provider template, which were higher than Peregrine, so that it is faster to generate the benchmark worst case. Related to #601, based on top of #612.
DIP stuff was fixed in #613. |
I'm putting this on hold until we get to a polkadot-sdk version that supports multi-block-migrations, after which we can revise this PR and perform the necessary migrations. |
fixes https://github.com/KILTprotocol/ticket/issues/2529
Metadata Diff to Develop Branch
Peregrine Diff
Spiritnet Diff
Checklist:
array[3]
useget(3)
, ...)