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

Sign CCRs as EIP-712 messages #247

Merged
merged 4 commits into from
Jun 20, 2024
Merged

Sign CCRs as EIP-712 messages #247

merged 4 commits into from
Jun 20, 2024

Conversation

ferranbt
Copy link
Collaborator

📝 Summary

This PR introduces CCRs that are signed with EIP-712 signatures. It introduces two changes:

  • A new signer/core/eip712 package with the EIP-712 logic copied from signer/core/apitypes which due to some dependencies of the package types was not possible to use without a circular dependency. So, I copied to the new package only the core primitives.
  • A new field Envelope in the ConfidentialComputeRequest object. If the field Envelope is not set, we use the eip-2718 rules to generate the signing hash. If the field Envelope is set, we generate the signing hash as an EIP-712 envelope.

All the tests in e2e are using by default the new EIP-712 signing scheme.

📚 References


  • I have seen and agree to CONTRIBUTING.md

@@ -17,6 +17,9 @@ type ConfidentialComputeRecord struct {
KettleAddress common.Address
ConfidentialInputsHash common.Hash

// Envelope signals whether this CCR was signed using EIP-712
Envelope bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this feels not very descriptive

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, what about EIP712SigningSchema: bool?

Copy link

@banr1 banr1 May 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you two may not fully grasp the context, please let me know if my comments are off the mark.

This is a boolean, so I feel that using a format like IsXxx would improve readability. What do you think?
For example, how about simply using IsEIP712: bool or something similar?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like IsEIP712 or SignedWithEIP712

suave/cstore/engine.go Outdated Show resolved Hide resolved
suave/cstore/engine.go Outdated Show resolved Hide resolved
suave/cstore/engine.go Outdated Show resolved Hide resolved
suave/cstore/engine.go Outdated Show resolved Hide resolved
"ConfidentialRecord": []eip712.Type{
{Name: "nonce", Type: "uint64"},
{Name: "gasPrice", Type: "uint256"},
{Name: "gas", Type: "uint64"},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this uint64 be a uint256?

zeroXbrock and others added 2 commits June 3, 2024 09:22
* remove chainId from EIP712 msg domain

* use verifyingContract in eip712 domain
@ferranbt ferranbt merged commit cc52b54 into main Jun 20, 2024
2 of 4 checks passed
@ferranbt ferranbt deleted the feature/eip712-ccrs branch June 20, 2024 14:20
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.

4 participants