-
Notifications
You must be signed in to change notification settings - Fork 34
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
feat: Initial V2 E2E Prototype #260
base: eigenda_v2
Are you sure you want to change the base?
Changes from all commits
ae6a199
6806969
f92ba1d
355fc24
33b2cc8
8c52290
b8a3fd6
534a29e
165dd85
a6970a3
f211b5d
b0d014f
65090b4
10a3b7f
5ea4d48
c47aa1b
01c54de
d684f1f
16a50b0
c68d7f3
440493e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Launch Package", | ||
"type": "go", | ||
"request": "launch", | ||
"mode": "debug", | ||
"env": { | ||
"ENV_PATH": "../../.env", | ||
"EIGENDA_PROXY_EIGENDA_CERT_VERIFICATION_DISABLED": "true", | ||
"EIGENDA_PROXY_EIGENDA_TARGET_KZG_G1_PATH": "../../resources/g1.point", | ||
"EIGENDA_PROXY_EIGENDA_TARGET_KZG_G2_POWER_OF_2_PATH": "../../resources/g2.point.powerOf2" | ||
}, | ||
"program": "cmd/server" | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,40 @@ | ||
package commitments | ||
|
||
type CertEncodingCommitment byte | ||
type EigenDACommit byte | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we rename this to EigenDACertVersion or something more explicit. Prefer to reserve commitment for the full bytes sent to batcher inbox only. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we use the term There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perpendicular to the "commitment" vs "cert" discussion, IMO this should be named |
||
|
||
const ( | ||
CertV0 CertEncodingCommitment = 0 | ||
// EigenDA V1 | ||
CertV0 EigenDACommit = iota | ||
// EigenDA V2 | ||
CertV1 | ||
) | ||
|
||
// OPCommitment is the binary representation of a commitment. | ||
// CertCommitment is the binary representation of a commitment. | ||
type CertCommitment interface { | ||
CommitmentType() CertEncodingCommitment | ||
CommitmentType() EigenDACommit | ||
Encode() []byte | ||
Verify(input []byte) error | ||
} | ||
|
||
type CertCommitmentV0 []byte | ||
|
||
// NewV0CertCommitment creates a new commitment from the given input. | ||
func NewV0CertCommitment(input []byte) CertCommitmentV0 { | ||
return CertCommitmentV0(input) | ||
type EigenDACommitment struct { | ||
prefix EigenDACommit | ||
b []byte | ||
} | ||
|
||
// DecodeCertCommitment validates and casts the commitment into a Keccak256Commitment. | ||
func DecodeCertCommitment(commitment []byte) (CertCommitmentV0, error) { | ||
if len(commitment) == 0 { | ||
return nil, ErrInvalidCommitment | ||
// NewEigenDACommitment creates a new commitment from the given input. | ||
func NewEigenDACommitment(input []byte, v EigenDACommit) EigenDACommitment { | ||
return EigenDACommitment{ | ||
prefix: v, | ||
b: input, | ||
} | ||
return commitment, nil | ||
} | ||
|
||
// CommitmentType returns the commitment type of Keccak256. | ||
func (c CertCommitmentV0) CommitmentType() CertEncodingCommitment { | ||
return CertV0 | ||
// CommitmentType returns the commitment type of EigenDACommitment. | ||
func (c EigenDACommitment) CommitmentType() EigenDACommit { | ||
return c.prefix | ||
} | ||
|
||
// Encode adds a commitment type prefix self describing the commitment. | ||
func (c CertCommitmentV0) Encode() []byte { | ||
return append([]byte{byte(CertV0)}, c...) | ||
func (c EigenDACommitment) Encode() []byte { | ||
return append([]byte{byte(c.prefix)}, c.b...) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,8 @@ import ( | |
|
||
type CommitmentMeta struct { | ||
Mode CommitmentMode | ||
// CertVersion is shared for all modes and denotes version of the EigenDA certificate | ||
CertVersion uint8 | ||
// version is shared for all modes and denotes version of the EigenDA certificate | ||
Version EigenDACommit | ||
Comment on lines
+9
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is not used for keccak commitment right? |
||
} | ||
|
||
type CommitmentMode string | ||
|
@@ -31,19 +31,19 @@ func StringToCommitmentMode(s string) (CommitmentMode, error) { | |
} | ||
} | ||
|
||
func EncodeCommitment(b []byte, c CommitmentMode) ([]byte, error) { | ||
switch c { | ||
func EncodeCommitment(b []byte, cm CommitmentMode, daVersion EigenDACommit) ([]byte, error) { | ||
switch cm { | ||
case OptimismKeccak: | ||
return Keccak256Commitment(b).Encode(), nil | ||
|
||
case OptimismGeneric: | ||
certCommit := NewV0CertCommitment(b).Encode() | ||
certCommit := NewEigenDACommitment(b, daVersion).Encode() | ||
svcCommit := EigenDASvcCommitment(certCommit).Encode() | ||
altDACommit := NewGenericCommitment(svcCommit).Encode() | ||
return altDACommit, nil | ||
|
||
case Standard: | ||
return NewV0CertCommitment(b).Encode(), nil | ||
case Standard: // (i.e, Arbitrum) | ||
return NewEigenDACommitment(b, daVersion).Encode(), nil | ||
} | ||
|
||
return nil, fmt.Errorf("unknown commitment mode") | ||
|
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.
why ../..? Which folder is this being run from?
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.
cmd/server
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 is kind of weird though no? Typically a binary is ran from root, like
go run cmd/server
? Is this something specific to how vscode launches the binary?How does this work actually? Does this add a button on the main() function in cmd/server/main.go on the vscode UI?