Skip to content

Commit

Permalink
parsing correctly with the abi decoder now! Bringing other changes ba…
Browse files Browse the repository at this point in the history
…ck in to see what breaks the build
  • Loading branch information
afkbyte committed Jun 8, 2024
1 parent 670432b commit cd78e91
Showing 1 changed file with 51 additions and 15 deletions.
66 changes: 51 additions & 15 deletions eigenda/eigenda.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type payload struct {
BlobVerificationProof *BlobVerificationProof
BlobHeader *BlobHeader
AfterDelayedMessagesRead *big.Int
GasRefunder *common.Address
GasRefunder common.Address
PrevMessageCount *big.Int
NewMessageCount *big.Int
}
Expand Down Expand Up @@ -384,20 +384,34 @@ func ParseSequencerMsg(calldata []byte) *EigenDABlobInfo {

func convertToPayload(pa []interface{}) (payload, error) {
blobVerificationProof := pa[1].(struct {
BatchId uint32
BlobIndex uint32
BatchId uint32 `json:"batchId"`
BlobIndex uint32 `json:"blobIndex"`
BatchMetadata struct {
BatchHeader struct {
BlobHeadersRoot [32]uint8
QuorumNumbers []uint8
SignedStakeForQuorums []uint8
ReferenceBlockNumber uint32
}
SignatoryRecordHash [32]uint8
ConfirmationBlockNumber uint32
}
InclusionProof []uint8
QuorumIndices []uint8
BlobHeadersRoot [32]uint8 `json:"blobHeadersRoot"`
QuorumNumbers []uint8 `json:"quorumNumbers"`
SignedStakeForQuorums []uint8 `json:"signedStakeForQuorums"`
ReferenceBlockNumber uint32 `json:"referenceBlockNumber"`
} `json:"batchHeader"`
SignatoryRecordHash [32]uint8 `json:"signatoryRecordHash"`
ConfirmationBlockNumber uint32 `json:"confirmationBlockNumber"`
} `json:"batchMetadata"`
InclusionProof []uint8 `json:"inclusionProof"`
QuorumIndices []uint8 `json:"quorumIndices"`
})

blobHeader := pa[2].(struct {
Commitment struct {
X *big.Int `json:"X"`
Y *big.Int `json:"Y"`
} `json:"commitment"`
DataLength uint32 `json:"dataLength"`
QuorumBlobParams []struct {
QuorumNumber uint8 `json:"quorumNumber"`
AdversaryThresholdPercentage uint8 `json:"adversaryThresholdPercentage"`
ConfirmationThresholdPercentage uint8 `json:"confirmationThresholdPercentage"`
ChunkLength uint32 `json:"chunkLength"`
} `json:"quorumBlobParams"`
})

return payload{
Expand All @@ -418,14 +432,36 @@ func convertToPayload(pa []interface{}) (payload, error) {
InclusionProof: blobVerificationProof.InclusionProof,
QuorumIndices: blobVerificationProof.QuorumIndices,
},
BlobHeader: pa[2].(*BlobHeader),
BlobHeader: &BlobHeader{
Commitment: &G1Point{},
DataLength: blobHeader.DataLength,
QuorumBlobParams: func() []*QuorumBlobParams {
params := make([]*QuorumBlobParams, len(blobHeader.QuorumBlobParams))
for i, p := range blobHeader.QuorumBlobParams {
params[i] = &QuorumBlobParams{
QuorumNumber: p.QuorumNumber,
AdversaryThresholdPercentage: p.AdversaryThresholdPercentage,
ConfirmationThresholdPercentage: p.ConfirmationThresholdPercentage,
ChunkLength: p.ChunkLength,
}
}
return params
}(),
},
AfterDelayedMessagesRead: pa[3].(*big.Int),
GasRefunder: pa[4].(*common.Address),
GasRefunder: pa[4].(common.Address),
PrevMessageCount: pa[5].(*big.Int),
NewMessageCount: pa[6].(*big.Int),
}, nil
}

// type QuorumBlobParams struct {
// QuorumNumber uint8
// AdversaryThresholdPercentage uint8
// ConfirmationThresholdPercentage uint8
// ChunkLength uint32
// }

func convertCalldataToInt(calldata []byte) (int, error) {
num := new(big.Int).SetBytes(calldata)

Expand Down

0 comments on commit cd78e91

Please sign in to comment.