Skip to content

Commit

Permalink
refactor: rebase with type changes
Browse files Browse the repository at this point in the history
  • Loading branch information
hopeyen committed Oct 17, 2024
1 parent b085195 commit 462f216
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ type PaymentMetadata struct {
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 big.Int
CumulativePayment *big.Int
}

// Hash returns the Keccak256 hash of the PaymentMetadata
Expand Down
2 changes: 1 addition & 1 deletion core/meterer/meterer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ func createMetererInput(binIndex uint32, cumulativePayment uint64, dataLength ui
header = &core.PaymentMetadata{
AccountID: accountID,
BinIndex: binIndex,
CumulativePayment: *big.NewInt(int64(cumulativePayment)),
CumulativePayment: big.NewInt(int64(cumulativePayment)),
}
return blob, header
}
4 changes: 2 additions & 2 deletions core/meterer/offchain_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func (s *OffchainStore) AddOnDemandPayment(ctx context.Context, paymentMetadata
}

// RemoveOnDemandPayment removes a specific payment from the list for a specific account
func (s *OffchainStore) RemoveOnDemandPayment(ctx context.Context, accountID string, payment big.Int) error {
func (s *OffchainStore) RemoveOnDemandPayment(ctx context.Context, accountID string, payment *big.Int) error {
err := s.dynamoClient.DeleteItem(ctx, s.onDemandTableName,
commondynamodb.Key{
"AccountID": &types.AttributeValueMemberS{Value: accountID},
Expand All @@ -182,7 +182,7 @@ func (s *OffchainStore) RemoveOnDemandPayment(ctx context.Context, accountID str

// GetRelevantOnDemandRecords gets previous cumulative payment, next cumulative payment, blob size of next payment
// The queries are done sequentially instead of one-go for efficient querying and would not cause race condition errors for honest requests
func (s *OffchainStore) GetRelevantOnDemandRecords(ctx context.Context, accountID string, cumulativePayment big.Int) (uint64, uint64, uint32, error) {
func (s *OffchainStore) GetRelevantOnDemandRecords(ctx context.Context, accountID string, cumulativePayment *big.Int) (uint64, uint64, uint32, error) {
// Fetch the largest entry smaller than the given cumulativePayment
queryInput := &dynamodb.QueryInput{
TableName: aws.String(s.onDemandTableName),
Expand Down

0 comments on commit 462f216

Please sign in to comment.