Skip to content

Commit

Permalink
Merge pull request #9706 from vegaprotocol/9704
Browse files Browse the repository at this point in the history
fix: referral program snapshot fixed
  • Loading branch information
jeremyletang authored Oct 10, 2023
2 parents 7fc5ac7 + e7b3102 commit 221655e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
- [9705](https://github.com/vegaprotocol/vega/issues/9705) - Ensure vote events are sent in the same order.

## 0.72.1
Expand Down
3 changes: 2 additions & 1 deletion core/referral/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion core/referral/snapshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package referral_test

import (
"bytes"
"testing"
"time"

Expand Down Expand Up @@ -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))
}
2 changes: 2 additions & 0 deletions core/types/referral_program_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func (p *PayloadReferralProgramState) IntoProto() *snapshotpb.Payload_ReferralPr
NewProgram: p.NewProgram,
LastProgramVersion: p.LastProgramVersion,
ProgramHasEnded: p.ProgramHasEnded,
Sets: p.Sets,
},
}
}
Expand All @@ -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,
}
}

0 comments on commit 221655e

Please sign in to comment.