Skip to content

Commit

Permalink
Lower governor limits of chains based upon usage (#4102)
Browse files Browse the repository at this point in the history
* Lower governor limits of chains based upon usage

* Change Polygon and Avalanche back to 5M

* Fix Governor tests that broke with 0 value in dailyLimit

---------

Co-authored-by: Maxwell Dulin <[email protected]>
Co-authored-by: Maxwell Dulin <[email protected]>
  • Loading branch information
3 people authored Sep 10, 2024
1 parent 2a22603 commit 6b810ac
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 14 deletions.
22 changes: 11 additions & 11 deletions node/pkg/governor/mainnet_chains.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,33 @@ func chainList() []chainConfigEntry {
return []chainConfigEntry{
{emitterChainID: vaa.ChainIDSolana, dailyLimit: 25_000_000, bigTransactionSize: 2_500_000},
{emitterChainID: vaa.ChainIDEthereum, dailyLimit: 50_000_000, bigTransactionSize: 5_000_000},
{emitterChainID: vaa.ChainIDTerra, dailyLimit: 500_000, bigTransactionSize: 50_000},
{emitterChainID: vaa.ChainIDTerra, dailyLimit: 150_000, bigTransactionSize: 15_000},
{emitterChainID: vaa.ChainIDBSC, dailyLimit: 5_000_000, bigTransactionSize: 500_000},
{emitterChainID: vaa.ChainIDPolygon, dailyLimit: 5_000_000, bigTransactionSize: 500_000},
{emitterChainID: vaa.ChainIDAvalanche, dailyLimit: 5_000_000, bigTransactionSize: 500_000},
{emitterChainID: vaa.ChainIDOasis, dailyLimit: 500_000, bigTransactionSize: 50_000},
{emitterChainID: vaa.ChainIDOasis, dailyLimit: 250_000, bigTransactionSize: 25_000},
{emitterChainID: vaa.ChainIDAlgorand, dailyLimit: 1_000_000, bigTransactionSize: 100_000},
{emitterChainID: vaa.ChainIDAurora, dailyLimit: 500_000, bigTransactionSize: 50_000},
{emitterChainID: vaa.ChainIDAurora, dailyLimit: 0, bigTransactionSize: 0},
{emitterChainID: vaa.ChainIDFantom, dailyLimit: 500_000, bigTransactionSize: 50_000},
{emitterChainID: vaa.ChainIDKarura, dailyLimit: 500_000, bigTransactionSize: 50_000},
{emitterChainID: vaa.ChainIDAcala, dailyLimit: 500_000, bigTransactionSize: 50_000},
{emitterChainID: vaa.ChainIDKarura, dailyLimit: 150_000, bigTransactionSize: 15_000},
{emitterChainID: vaa.ChainIDAcala, dailyLimit: 100_000, bigTransactionSize: 10_000},
{emitterChainID: vaa.ChainIDKlaytn, dailyLimit: 500_000, bigTransactionSize: 50_000},
{emitterChainID: vaa.ChainIDCelo, dailyLimit: 2_000_000, bigTransactionSize: 200_000},
{emitterChainID: vaa.ChainIDNear, dailyLimit: 500_000, bigTransactionSize: 50_000},
{emitterChainID: vaa.ChainIDNear, dailyLimit: 150_000, bigTransactionSize: 15_000},
{emitterChainID: vaa.ChainIDMoonbeam, dailyLimit: 5_000_000, bigTransactionSize: 500_000},
{emitterChainID: vaa.ChainIDTerra2, dailyLimit: 500_000, bigTransactionSize: 50_000},
{emitterChainID: vaa.ChainIDTerra2, dailyLimit: 100_000, bigTransactionSize: 10_000},
{emitterChainID: vaa.ChainIDInjective, dailyLimit: 500_000, bigTransactionSize: 50_000},
{emitterChainID: vaa.ChainIDSui, dailyLimit: 5_000_000, bigTransactionSize: 500_000},
{emitterChainID: vaa.ChainIDAptos, dailyLimit: 1_000_000, bigTransactionSize: 100_000},
{emitterChainID: vaa.ChainIDArbitrum, dailyLimit: 5_000_000, bigTransactionSize: 500_000},
{emitterChainID: vaa.ChainIDOptimism, dailyLimit: 5_000_000, bigTransactionSize: 500_000},
{emitterChainID: vaa.ChainIDXpla, dailyLimit: 500_000, bigTransactionSize: 50_000},
{emitterChainID: vaa.ChainIDXpla, dailyLimit: 50_000, bigTransactionSize: 5_000},
{emitterChainID: vaa.ChainIDBase, dailyLimit: 2_000_000, bigTransactionSize: 200_000},
{emitterChainID: vaa.ChainIDSei, dailyLimit: 5_000_000, bigTransactionSize: 500_000},
{emitterChainID: vaa.ChainIDScroll, dailyLimit: 500_000, bigTransactionSize: 50_000},
{emitterChainID: vaa.ChainIDMantle, dailyLimit: 500_000, bigTransactionSize: 50_000},
{emitterChainID: vaa.ChainIDBlast, dailyLimit: 500_000, bigTransactionSize: 50_000},
{emitterChainID: vaa.ChainIDXLayer, dailyLimit: 500_000, bigTransactionSize: 50_000},
{emitterChainID: vaa.ChainIDMantle, dailyLimit: 100_000, bigTransactionSize: 10_000},
{emitterChainID: vaa.ChainIDBlast, dailyLimit: 100_000, bigTransactionSize: 10_000},
{emitterChainID: vaa.ChainIDXLayer, dailyLimit: 100_000, bigTransactionSize: 10_000},
{emitterChainID: vaa.ChainIDWormchain, dailyLimit: 500_000, bigTransactionSize: 50_000},
{emitterChainID: vaa.ChainIDSnaxchain, dailyLimit: 500_000, bigTransactionSize: 50_000},
}
Expand Down
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 6b810ac

Please sign in to comment.