Skip to content

Commit

Permalink
fix: Compute EigenDA preimage hash using preimage length - go fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
epociask committed Aug 15, 2024
1 parent cbcb177 commit fc4808c
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cmd/replay/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func (dasReader *EigenDAPreimageReader) QueryBlob(ctx context.Context, cert *eig
if err != nil {
return nil, err
}

preimage, err := wavmio.ResolveTypedPreimage(arbutil.EigenDaPreimageType, *hash)
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion eigenda/eigenda.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func init() {

const (
sequencerMsgOffset = 41
MaxBatchSize = 2_000_000 // 2MB
MaxBatchSize = 2_000_000 // 2MB
)

func IsEigenDAMessageHeaderByte(header byte) bool {
Expand Down
8 changes: 3 additions & 5 deletions eigenda/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ type readerForEigenDA struct {
readerEigenDA EigenDAReader
}


func (d *readerForEigenDA) IsValidHeaderByte(headerByte byte) bool {
return IsEigenDAMessageHeaderByte(headerByte)
}
Expand Down Expand Up @@ -59,7 +58,6 @@ func RecoverPayloadFromEigenDABatch(ctx context.Context,
return nil, err
}


if preimageRecoder != nil {
// iFFT the preimage data
preimage, err := GenericEncodeBlob(data)
Expand Down Expand Up @@ -104,7 +102,7 @@ func ParseSequencerMsg(calldata []byte) (*EigenDABlobInfo, error) {
}

func uint32ToBytes(n uint32) []byte {
bytes := make([]byte, 4)
binary.BigEndian.PutUint32(bytes, n)
return bytes
bytes := make([]byte, 4)
binary.BigEndian.PutUint32(bytes, n)
return bytes
}
1 change: 0 additions & 1 deletion eigenda/serialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
- https://github.com/Layr-Labs/eigenda/blob/44569ec461c9a1dd1191e7999a72e63bd1e7aba9/api/clients/codecs/ifft_codec.go#L27-L38
*/


func GenericDecodeBlob(data []byte) ([]byte, error) {
if len(data) <= 32 {
return nil, fmt.Errorf("data is not of length greater than 32 bytes: %d", len(data))
Expand Down
3 changes: 1 addition & 2 deletions eigenda/serialize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package eigenda

import "testing"


func Test_EncodeDecodeBlob(t *testing.T) {
rawBlob := []byte("optimistic nihilism")

Expand All @@ -19,4 +18,4 @@ func Test_EncodeDecodeBlob(t *testing.T) {
if string(decodedBlob) != string(rawBlob) {
t.Fatalf("decoded blob does not match raw blob")
}
}
}
2 changes: 1 addition & 1 deletion eigenda/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type EigenDABlobInfo struct {
}

/*
Unlike 4844 there's no need to inject a version byte into the 0th offset of the hash
Unlike 4844 there's no need to inject a version byte into the 0th offset of the hash
*/
func (e *EigenDABlobInfo) PreimageHash() (*common.Hash, error) {
kzgCommit, err := e.SerializeCommitment()
Expand Down

0 comments on commit fc4808c

Please sign in to comment.