-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add common crypto utilities used by ccip. #524
Conversation
I guess CI is probably failing because I used a fork. I'll re-open this PR once I have repo permissions. |
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.
We've been trying to move away from the unified utils
tree. What about package hashutil
, up one level, alongside package sqlutil
?
// 2. for each nested array | ||
// encode the array length into fixed-size 8 bytes, append to result | ||
// append the array contents to result | ||
func encodeBytesOfBytes(b [][]byte) ([]byte, error) { |
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 func seems more interesting (and flexible) than BytesOfBytesKeccak
. If this were exported, could BytesOfBytesKeccak
be removed in favor of callers invoking the hash themselves, after calling this func?
[32]byte | ||
} | ||
|
||
type Ctx[H Hash] interface { |
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.
What is the significance of Ctx
here?
Would something simple and direct be fitting, like Hasher
?
type Ctx[H Hash] interface { | |
type Hasher[H Hash] interface { |
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.
Let's move this up out of the utils
subtree.
And is merklemulti
too specialized, compared to just merkle
?
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 believe it's because you can provide multiple indices when making a proof instead of just one.
closing in favor of #527 |
These utilities are used widely for CCIP security. They are also useful in general for applications that need to validate or create CCIP execution proofs.