Skip to content

Commit

Permalink
Fix: rollup_actions flag (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
aopoltorzhicky authored Sep 1, 2024
1 parent 8a08238 commit fe5e207
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/storage/postgres/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func (a *Action) ByRollupAndBridge(ctx context.Context, rollupId uint64, fltrs s
return
}

subQuery = sortScope(subQuery, "rollup_action.time", fltrs.Sort)
subQuery = sortScope(subQuery, "time", fltrs.Sort)
subQuery = limitScope(subQuery, fltrs.Limit)
subQuery = offsetScope(subQuery, fltrs.Offset)

Expand Down
24 changes: 24 additions & 0 deletions internal/storage/postgres/action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,27 @@ func (s *StorageTestSuite) TestActionByRollupAndBridge() {
s.Require().NotNil(action.Action.Data)
s.Require().NotNil(action.Action.Fee)
}

func (s *StorageTestSuite) TestActionByRollupAndBridgeWithoutRollupActions() {
ctx, ctxCancel := context.WithTimeout(context.Background(), 5*time.Second)
defer ctxCancel()

actions, err := s.storage.Action.ByRollupAndBridge(ctx, 1, storage.RollupAndBridgeActionsFilter{
Sort: sdk.SortOrderAsc,
Limit: 10,
Offset: 0,
RollupActions: false,
BridgeActions: true,
})
s.Require().NoError(err)
s.Require().Len(actions, 2)

action := actions[0]
s.Require().EqualValues(7316, action.Height)
s.Require().NotNil(action.Tx)
s.Require().NotNil(action.Action)
s.Require().EqualValues(1, action.Action.TxId)
s.Require().EqualValues(types.ActionTypeSequence, action.Action.Type)
s.Require().NotNil(action.Action.Data)
s.Require().NotNil(action.Action.Fee)
}

0 comments on commit fe5e207

Please sign in to comment.