Skip to content

Commit

Permalink
Fix Governor tests that broke with 0 value in dailyLimit
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxwell Dulin authored and Maxwell Dulin committed Sep 5, 2024
1 parent cf2cfcf commit d8eabfa
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions node/pkg/governor/mainnet_chains_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ func TestChainListSize(t *testing.T) {
func TestChainDailyLimitRange(t *testing.T) {
chainConfigEntries := chainList()

/* This IS a hard limit, if daily limit is set to zero it would
basically mean no value movement is allowed for that chain*/
/*
If a chain is deprecated, we want to make sure its still governed
in the case that it is used. This will effectively stall all
transfers for 24 hours on a deprecated chain.
*/
min_daily_limit := uint64(0)

/* This IS NOT a hard limit, we can adjust it up as we see fit,
Expand All @@ -36,7 +39,7 @@ func TestChainDailyLimitRange(t *testing.T) {
/* Assuming that a governed chains should always be more than zero and less than 50,000,001 */
for _, chainConfigEntry := range chainConfigEntries {
t.Run(chainConfigEntry.emitterChainID.String(), func(t *testing.T) {
assert.Greater(t, chainConfigEntry.dailyLimit, min_daily_limit)
assert.GreaterOrEqual(t, chainConfigEntry.dailyLimit, min_daily_limit)
assert.Less(t, chainConfigEntry.dailyLimit, max_daily_limit)
})
}
Expand All @@ -62,6 +65,13 @@ func TestChainListBigTransfers(t *testing.T) {
chainConfigEntries := chainList()

for _, e := range chainConfigEntries {

// If the daily limit is 0 then both the big TX and daily limit should be 0.
if e.dailyLimit == 0 {
assert.Equal(t, e.bigTransactionSize, e.dailyLimit)
continue
}

// it's always ideal to have bigTransactionSize be less than dailyLimit
assert.Less(t, e.bigTransactionSize, e.dailyLimit)

Expand Down

0 comments on commit d8eabfa

Please sign in to comment.