Skip to content

Commit

Permalink
fix: reverse order of batch proposals
Browse files Browse the repository at this point in the history
Signed-off-by: Elias Van Ootegem <elias@vega.xyz>
  • Loading branch information
EVODelavega committed May 1, 2024
1 parent 3323afc commit 6dfc7ee
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@
- [11193](https://github.com/vegaprotocol/vega/issues/11193) - Fix loading of liquidation strategy from proto with missing data.
- [11200](https://github.com/vegaprotocol/vega/issues/11200) - Make sure a party can afford the trades before they are submitted to the book.
- [11205](https://github.com/vegaprotocol/vega/issues/11205) - Evaluate transfer interval correctly.
- [11005](https://github.com/vegaprotocol/vega/issues/11005) - Fix order of batch proposals to allow front-end to determine correct market ID.

## 0.75.0

### 🚨 Breaking changes
Expand Down
7 changes: 5 additions & 2 deletions datanode/entities/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,13 @@ func (p Proposal) Cursor() *Cursor {
}

func (p Proposal) ToProtoEdge(_ ...any) (*v2.GovernanceDataEdge, error) {
proposalsProto := make([]*vega.Proposal, len(p.Proposals))
j := len(p.Proposals) - 1
proposalsProto := make([]*vega.Proposal, j+1)

for i, proposal := range p.Proposals {
proposalsProto[i] = proposal.ToProto()
// fill slice in reverse order. The records are inserted (and returned) in reverse order, so to match
// the order in which markets were created, the proposals should be returned in the original order.
proposalsProto[j-i] = proposal.ToProto()
}

return &v2.GovernanceDataEdge{
Expand Down

0 comments on commit 6dfc7ee

Please sign in to comment.