Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

winder
Copy link
Collaborator

@winder winder commented May 20, 2024

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.

@winder
Copy link
Collaborator Author

winder commented May 20, 2024

I guess CI is probably failing because I used a fork. I'll re-open this PR once I have repo permissions.

Copy link
Collaborator

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) {
Copy link
Collaborator

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 {
Copy link
Collaborator

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?

Suggested change
type Ctx[H Hash] interface {
type Hasher[H Hash] interface {

Copy link
Collaborator

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?

Copy link
Collaborator Author

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.

@winder
Copy link
Collaborator Author

winder commented May 23, 2024

closing in favor of #527

@winder winder closed this May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants