Skip to content

Commit

Permalink
refactor: add salt to unmarshal, docs and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hopeyen committed Dec 11, 2024
1 parent e362fdc commit d91c458
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 7 deletions.
1 change: 0 additions & 1 deletion api/clients/accountant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,6 @@ func TestConcurrentBinRotationAndAccountBlob(t *testing.T) {
defer wg.Done()
_, err := accountant.AccountBlob(ctx, 100, quorums, salt)
assert.NoError(t, err)
time.Sleep(500 * time.Millisecond)
}()
}

Expand Down
2 changes: 1 addition & 1 deletion api/docs/disperser.html
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ <h3 id="disperser.DispersePaidBlobRequest">DispersePaidBlobRequest</h3>
<td>payment_header</td>
<td><a href="#common.PaymentHeader">common.PaymentHeader</a></td>
<td></td>
<td><p>Payment header contains AccountID, ReservationPeriod, CumulativePayment, and Salt </p></td>
<td><p>Payment header contains account_id, reservation_period, cumulative_payment, and salt </p></td>
</tr>

<tr>
Expand Down
2 changes: 1 addition & 1 deletion api/docs/disperser.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ BlobStatusRequest is used to query the status of a blob.
| ----- | ---- | ----- | ----------- |
| data | [bytes](#bytes) | | The data to be dispersed. Same requirements as DisperseBlobRequest. |
| quorum_numbers | [uint32](#uint32) | repeated | The quorums to which the blob to be sent |
| payment_header | [common.PaymentHeader](#common-PaymentHeader) | | Payment header contains AccountID, ReservationPeriod, CumulativePayment, and Salt |
| payment_header | [common.PaymentHeader](#common-PaymentHeader) | | Payment header contains account_id, reservation_period, cumulative_payment, and salt |
| payment_signature | [bytes](#bytes) | | signature of payment_header |


Expand Down
2 changes: 1 addition & 1 deletion api/docs/eigenda-protos.html
Original file line number Diff line number Diff line change
Expand Up @@ -1721,7 +1721,7 @@ <h3 id="disperser.DispersePaidBlobRequest">DispersePaidBlobRequest</h3>
<td>payment_header</td>
<td><a href="#common.PaymentHeader">common.PaymentHeader</a></td>
<td></td>
<td><p>Payment header contains AccountID, ReservationPeriod, CumulativePayment, and Salt </p></td>
<td><p>Payment header contains account_id, reservation_period, cumulative_payment, and salt </p></td>
</tr>

<tr>
Expand Down
2 changes: 1 addition & 1 deletion api/docs/eigenda-protos.md
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ BlobStatusRequest is used to query the status of a blob.
| ----- | ---- | ----- | ----------- |
| data | [bytes](#bytes) | | The data to be dispersed. Same requirements as DisperseBlobRequest. |
| quorum_numbers | [uint32](#uint32) | repeated | The quorums to which the blob to be sent |
| payment_header | [common.PaymentHeader](#common-PaymentHeader) | | Payment header contains AccountID, ReservationPeriod, CumulativePayment, and Salt |
| payment_header | [common.PaymentHeader](#common-PaymentHeader) | | Payment header contains account_id, reservation_period, cumulative_payment, and salt |
| payment_signature | [bytes](#bytes) | | signature of payment_header |


Expand Down
2 changes: 1 addition & 1 deletion api/grpc/disperser/disperser.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/proto/disperser/disperser.proto
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ message DispersePaidBlobRequest {
// The quorums to which the blob to be sent
repeated uint32 quorum_numbers = 2;

// Payment header contains AccountID, ReservationPeriod, CumulativePayment, and Salt
// Payment header contains account_id, reservation_period, cumulative_payment, and salt
common.PaymentHeader payment_header = 3;
// signature of payment_header
bytes payment_signature = 4;
Expand Down
5 changes: 5 additions & 0 deletions core/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,11 @@ func (pm *PaymentMetadata) UnmarshalDynamoDBAttributeValue(av types.AttributeVal
}
pm.ReservationPeriod = uint32(reservationPeriod)
pm.CumulativePayment, _ = new(big.Int).SetString(m.Value["CumulativePayment"].(*types.AttributeValueMemberN).Value, 10)
salt, err := strconv.ParseUint(m.Value["Salt"].(*types.AttributeValueMemberN).Value, 10, 32)
if err != nil {
return fmt.Errorf("failed to parse Salt: %w", err)
}
pm.Salt = uint32(salt)
return nil
}

Expand Down

0 comments on commit d91c458

Please sign in to comment.