-
Notifications
You must be signed in to change notification settings - Fork 52
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
Conversation
core/types/confidential.go
Outdated
@@ -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 |
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.
nit: this feels not very descriptive
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.
Agree, what about EIP712SigningSchema: bool
?
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.
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?
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 like IsEIP712
or SignedWithEIP712
"ConfidentialRecord": []eip712.Type{ | ||
{Name: "nonce", Type: "uint64"}, | ||
{Name: "gasPrice", Type: "uint256"}, | ||
{Name: "gas", Type: "uint64"}, |
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.
should this uint64
be a uint256
?
* remove chainId from EIP712 msg domain * use verifyingContract in eip712 domain
📝 Summary
This PR introduces CCRs that are signed with EIP-712 signatures. It introduces two changes:
signer/core/eip712
package with theEIP-712
logic copied fromsigner/core/apitypes
which due to some dependencies of the packagetypes
was not possible to use without a circular dependency. So, I copied to the new package only the core primitives.Envelope
in theConfidentialComputeRequest
object. If the fieldEnvelope
is not set, we use theeip-2718
rules to generate the signing hash. If the fieldEnvelope
is set, we generate the signing hash as anEIP-712
envelope.All the tests in e2e are using by default the new EIP-712 signing scheme.
📚 References