Skip to content

Commit

Permalink
Merge pull request #246 from vegaprotocol/diff_fixes
Browse files Browse the repository at this point in the history
fix: diff discrepancies fixed
  • Loading branch information
ze97286 authored Nov 9, 2022
2 parents cb68f08 + 94d0380 commit 18544c7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion difftool/diff/core_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ func (s *snap) getOrders() []*vega.Order {
o.ExpiresAt = (o.ExpiresAt / 1000) * 1000
o.UpdatedAt = (o.UpdatedAt / 1000) * 1000
price, _ := decimal.NewFromString(o.Price)
o.Price = price.Div(dpFactors[o.MarketId]).String()
o.Price = price.Div(dpFactors[o.MarketId]).Truncate(0).String()
}

return orders
Expand Down
9 changes: 7 additions & 2 deletions difftool/diff/datanode_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,9 @@ func (dnc *dataNodeClient) listAssets() ([]*vega.Asset, error) {
}
assets := make([]*vega.Asset, 0, len(assetResp.Assets.Edges))
for _, a := range assetResp.Assets.Edges {
assets = append(assets, a.Node)
if a.Node.Status != vega.Asset_STATUS_REJECTED {
assets = append(assets, a.Node)
}
}
return assets, nil
}
Expand Down Expand Up @@ -435,7 +437,10 @@ func (dnc *dataNodeClient) getStake() ([]*v1.StakeLinking, error) {
return stake, err
}
for _, sle := range resp.StakeLinkings.Edges {
stake = append(stake, sle.Node)
// ignore 0 amounts
if sle.Node.Amount != "0" {
stake = append(stake, sle.Node)
}
}
}
return stake, nil
Expand Down
4 changes: 0 additions & 4 deletions difftool/diff/diff_report.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ func diffAccountBalances(coreSnapshot *Result, dn *Result) Status {
}
datanode = filteredDN

if len(core) != len(datanode) {
return getSizeMismatchStatus("accounts", core, datanode)
}

sort.Slice(core, func(i, j int) bool {
return core[i].Owner+core[i].MarketId+core[i].Asset+core[i].Type.String() < core[j].Owner+core[j].MarketId+core[j].Asset+core[j].Type.String()
})
Expand Down

0 comments on commit 18544c7

Please sign in to comment.