From 94d03801764cfe5b9d360bd82ae0763a8e856df1 Mon Sep 17 00:00:00 2001 From: ze97286 Date: Wed, 9 Nov 2022 19:21:42 +0000 Subject: [PATCH] fix: diff discrepancies fixed --- difftool/diff/core_snapshot.go | 2 +- difftool/diff/datanode_client.go | 9 +++++++-- difftool/diff/diff_report.go | 4 ---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/difftool/diff/core_snapshot.go b/difftool/diff/core_snapshot.go index a30550d..32bcd77 100644 --- a/difftool/diff/core_snapshot.go +++ b/difftool/diff/core_snapshot.go @@ -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 diff --git a/difftool/diff/datanode_client.go b/difftool/diff/datanode_client.go index f20d34d..0307534 100644 --- a/difftool/diff/datanode_client.go +++ b/difftool/diff/datanode_client.go @@ -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 } @@ -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 diff --git a/difftool/diff/diff_report.go b/difftool/diff/diff_report.go index 1456c80..116ed17 100644 --- a/difftool/diff/diff_report.go +++ b/difftool/diff/diff_report.go @@ -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() })