From 18864e1c814b4c29761e02a4752b7be6872535d2 Mon Sep 17 00:00:00 2001 From: ze97286 Date: Tue, 10 Oct 2023 09:33:09 +0100 Subject: [PATCH 1/2] fix: referral program snapshot fixed --- CHANGELOG.md | 1 + core/referral/snapshot_test.go | 3 ++- core/types/referral_program_snapshot.go | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 764a41b174..95223904d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -276,6 +276,7 @@ - [9693](https://github.com/vegaprotocol/vega/issues/9693) - Add missing validation for general account public key in governance transfer - [9691](https://github.com/vegaprotocol/vega/issues/9691) - Refactor referral engine snapshot - [8570](https://github.com/vegaprotocol/vega/issues/8570) - Ensure pagination doesn't trigger a sequential scan on block-explorer transactions table. +- [9704](https://github.com/vegaprotocol/vega/issues/9704) - Fix referral program snapshot ## 0.72.1 diff --git a/core/referral/snapshot_test.go b/core/referral/snapshot_test.go index be51481ff9..d18f62577e 100644 --- a/core/referral/snapshot_test.go +++ b/core/referral/snapshot_test.go @@ -16,6 +16,7 @@ package referral_test import ( + "bytes" "testing" "time" @@ -180,5 +181,5 @@ func TestTakingAndRestoringSnapshotSucceeds(t *testing.T) { // Comparing the hash after restoration, to ensure it produces the same result. hash2, _, _ := snapshotEngine2.Info() - require.Equal(t, hash1, hash2) + require.True(t, bytes.Equal(hash1, hash2)) } diff --git a/core/types/referral_program_snapshot.go b/core/types/referral_program_snapshot.go index 387b2cfe4d..169cafa3ae 100644 --- a/core/types/referral_program_snapshot.go +++ b/core/types/referral_program_snapshot.go @@ -45,6 +45,7 @@ func (p *PayloadReferralProgramState) IntoProto() *snapshotpb.Payload_ReferralPr NewProgram: p.NewProgram, LastProgramVersion: p.LastProgramVersion, ProgramHasEnded: p.ProgramHasEnded, + Sets: p.Sets, }, } } @@ -62,5 +63,6 @@ func PayloadReferralProgramStateFromProto(payload *snapshotpb.Payload_ReferralPr NewProgram: payload.ReferralProgram.NewProgram, LastProgramVersion: payload.ReferralProgram.LastProgramVersion, ProgramHasEnded: payload.ReferralProgram.ProgramHasEnded, + Sets: payload.ReferralProgram.Sets, } } From e7b31020fff60e28d6791894a1ee10ea3bcf596a Mon Sep 17 00:00:00 2001 From: ze97286 Date: Tue, 10 Oct 2023 13:38:05 +0100 Subject: [PATCH 2/2] chore: initialise discount factor to zero --- core/referral/engine.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/referral/engine.go b/core/referral/engine.go index cc6d3b02b1..ea83c14608 100644 --- a/core/referral/engine.go +++ b/core/referral/engine.go @@ -550,7 +550,8 @@ func (e *Engine) computeFactorsByReferee(ctx context.Context, epoch uint64, take partyTakerVolume = takerVolume } refereeStats := &types.RefereeStats{ - TakerVolume: partyTakerVolume, + TakerVolume: partyTakerVolume, + DiscountFactor: num.DecimalZero(), } e.factorsByReferee[party] = refereeStats setStats.RefereesStats[party] = refereeStats