Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
ADR 028: Public Key Addresses #7086
ADR 028: Public Key Addresses #7086
Changes from 14 commits
66f6583
9621bb7
a758d4d
4ef7702
e5227b3
d575b5f
bbdcadd
4cabd3b
5026296
79bff6a
5e5979e
91e36a2
b7d0133
e7ea7f8
049a550
49f8444
4cf17f4
a0b2a41
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
I don't think the prefix will solve the security problem here. I was reading #3685 and I'm not sure if the solution solves the security problem. Here is my reasoning (maybe it's wrong):
Let's say we have to PK algorithms:
A
andB
. For a user with(pk1, sk1)
key pair, we have two possible attacks:A
became vulnerable. Attacker is able to create a valid signature without knowingsk1
. In this case we don't solve anything with this proposal.(pk2, sk2)
, possible belonging to a different PK scheme, such thataddress(typ(pk2), pk2) == address(typ(pk1), pk1)
. Then he basically broke the cryptographic hash function. The key type (and the prefix) is not important here, because the attacker has an algorithm how to find an pre-image.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.
To be clear - I'm not saying that adding prefix is bad. I'm not sure it solves anything. @ethanfrey ?
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.
There is one more attack, which in fact is important here, and this update address it:
(1.)
:A
became vulnerable. Attacker is able to forge a signature forpk \in A
. In all places where we don't store any relationship between addresses and(PK, PK scheme)
pair, the attacker will be able to spend address assets.This proposal (including
scheme
url / name in the address algorithm) protects against the attack described #3685 (isolating address spaces to protect against attacks when one of the PK scheme is broken).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.
When implementing this we should use use
make([]byte, correctSize)
and copy they content usingfor
orcopy
(into slice starting from index2
).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.
Random oracle indifferentiability is cryptographically irrelevant for constructing addresses.
https://blog.cryptographyengineering.com/2012/07/17/indifferentiability/
Cause see the prefix of an address always specifies the length of suffix. Ie. sr25519 key is always 32bytes. In the context of this protocol, a MD hash like sha256 is "random oracle indeffentiable"
I'm just saying this because I'm always going to strongly advocate for a really high bar for adding a new hash function to the Cosmos trusted computing base.
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.
@zmanian I agree with your general approach. But we don't propose a any exotic algorithm. Blake2 is a part of at least Go and Python3 stdlib and it's an improvement. Some cryptographers claim that sha256 is easier to break than blake2 because we already know how to break other hash functions from the MD family.
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.
Some references would be appreciated 👍
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.
So I want to summarize what I heard from @zmanian on our last call about this. Basically:
Thus for now it's probably preferable to stick with SHA256. Is that accurate @zmanian ?
@alessio any progress on getting the cryptographer at AiB to take a look at this?
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.
W3F Research / Polkadot is using blake2b and avoiding sha2.
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.
Would it be helpful to try and put this info in bech32 encodings? Is access to this info really that important?
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.
I don't know. You're saying that maybe we can have the bech32 have an extra prefix that isn't present in the actual address? Would this be something like
cosmossecp256k1sdgh3sghlsdsdg
. Or would the prefix get added before bech32 encoding?