Skip to content

Commit a0fb9bb

Browse files
authored
Missing ids dispute fix (#670)
* fixed missingDisputeFix * fixed tests
1 parent 457fede commit a0fb9bb

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

cmd/dispute.go

+6
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,12 @@ func (*UtilsStruct) CheckDisputeForIds(client *ethclient.Client, transactionOpts
206206
transactionOpts.MethodName = "disputeCollectionIdShouldBePresent"
207207
transactionOpts.Parameters = []interface{}{epoch, blockIndex, missingCollectionId}
208208
txnOpts := razorUtils.GetTxnOpts(transactionOpts)
209+
gasLimit := txnOpts.GasLimit
210+
incrementedGasLimit, err := utilsInterface.IncreaseGasLimitValue(client, gasLimit, 5.5)
211+
if err != nil {
212+
return nil, err
213+
}
214+
txnOpts.GasLimit = incrementedGasLimit
209215
log.Debug("Disputing collection id should be present!")
210216
log.Debugf("Epoch: %d, blockIndex: %d, missingCollectionId: %d", epoch, blockIndex, missingCollectionId)
211217
return blockManagerUtils.DisputeCollectionIdShouldBePresent(client, txnOpts, epoch, blockIndex, missingCollectionId)

cmd/dispute_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,7 @@ func TestCheckDisputeForIds(t *testing.T) {
771771
utils.UtilsInterface = utilsPkgMock
772772
razorUtils = utilsMock
773773
blockManagerUtils = blockManagerUtilsMock
774+
utilsInterface = utilsPkgMock
774775

775776
utilsPkgMock.On("IsSorted", mock.Anything).Return(tt.args.isSorted, tt.args.index0, tt.args.index1)
776777
utilsMock.On("GetTxnOpts", mock.AnythingOfType("types.TransactionOptions")).Return(txnOpts)
@@ -779,6 +780,7 @@ func TestCheckDisputeForIds(t *testing.T) {
779780
blockManagerUtilsMock.On("DisputeCollectionIdShouldBePresent", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(tt.args.DisputeCollectionIdShouldBePresent, tt.args.DisputeCollectionIdShouldBePresentErr)
780781
utilsPkgMock.On("IsMissing", mock.Anything, mock.Anything).Return(tt.args.isPresent, tt.args.positionOfPresentValue, tt.args.presentCollectionId)
781782
blockManagerUtilsMock.On("DisputeCollectionIdShouldBeAbsent", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(tt.args.DisputeCollectionIdShouldBeAbsent, tt.args.DisputeCollectionIdShouldBeAbsentErr)
783+
utilsPkgMock.On("IncreaseGasLimitValue", mock.Anything, mock.Anything, mock.Anything).Return(uint64(2000), nil)
782784
ut := &UtilsStruct{}
783785
got, err := ut.CheckDisputeForIds(client, transactionOpts, epoch, blockIndex, tt.args.idsInProposedBlock, tt.args.revealedCollectionIds)
784786
if (err != nil) != tt.wantErr {

0 commit comments

Comments
 (0)