Skip to content

Commit

Permalink
refactor: update name convertUint8SliceToStringSlice
Browse files Browse the repository at this point in the history
  • Loading branch information
hopeyen committed Oct 15, 2024
1 parent fab84e3 commit aae5395
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 353 deletions.
168 changes: 0 additions & 168 deletions core/auth/payment_metadata.go

This file was deleted.

173 changes: 0 additions & 173 deletions core/auth/payment_metadata_test.go

This file was deleted.

23 changes: 19 additions & 4 deletions core/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/Layr-Labs/eigenda/common"
"github.com/Layr-Labs/eigenda/encoding"
"github.com/consensys/gnark-crypto/ecc/bn254"
"github.com/ethereum/go-ethereum/crypto"
)

type AccountID = string
Expand Down Expand Up @@ -474,17 +475,31 @@ func (cb Bundles) FromEncodedBundles(eb EncodedBundles) (Bundles, error) {
// PaymentMetadata represents the header information for a blob
type PaymentMetadata struct {
// Existing fields
DataLength uint32 // length in number of symbols
QuorumNumbers []uint8
AccountID string
AccountID string

// New fields
BinIndex uint32
// TODO: we are thinking the contract can use uint128 for cumulative payment,
// but the definition on v2 uses uint64. Double check with team.
CumulativePayment uint64
}

// Hash returns the Keccak256 hash of the PaymentMetadata
func (pm *PaymentMetadata) Hash() []byte {
// Create a byte slice to hold the serialized data
data := make([]byte, 0, len(pm.AccountID)+12)

data = append(data, []byte(pm.AccountID)...)

binIndexBytes := make([]byte, 4)
binary.BigEndian.PutUint32(binIndexBytes, pm.BinIndex)
data = append(data, binIndexBytes...)

paymentBytes := make([]byte, 8)
binary.BigEndian.PutUint64(paymentBytes, pm.CumulativePayment)
data = append(data, paymentBytes...)

Signature []byte
return crypto.Keccak256(data)
}

type TokenAmount uint64 // TODO: change to uint128
Expand Down
Loading

0 comments on commit aae5395

Please sign in to comment.