Skip to content

Commit

Permalink
Rename whitelist to allowlist in comments and variables
Browse files Browse the repository at this point in the history
Co-authored-by: Paul Lange <[email protected]>
  • Loading branch information
ezdac and palango committed Aug 21, 2024
1 parent 8bf5f3c commit f47600e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions common/celo_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var (
}
)

func TestIsWhitelisted(t *testing.T) {
func TestIsCurrencyAllowed(t *testing.T) {
tests := []struct {
name string
feeCurrency *Address
Expand All @@ -40,7 +40,7 @@ func TestIsWhitelisted(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := IsCurrencyAllowed(exchangeRates, tt.feeCurrency); got != tt.want {
t.Errorf("IsWhitelisted() = %v, want %v", got, tt.want)
t.Errorf("IsCurrencyAllowed() = %v, want %v", got, tt.want)
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion core/celo_multi_gaspool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestMultiCurrencyGasPool(t *testing.T) {
expectedValue uint64
}{
{
name: "Empty whitelist, empty mapping, CELO uses default pool",
name: "Empty allowlist, empty mapping, CELO uses default pool",
feeCurrency: nil,
allowlist: []FeeCurrency{},
defaultLimit: 0.9,
Expand Down
4 changes: 2 additions & 2 deletions core/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,8 @@ func (st *StateTransition) preCheck() error {
} else {
isWhiteListed := common.IsCurrencyAllowed(st.evm.Context.FeeCurrencyContext.ExchangeRates, msg.FeeCurrency)
if !isWhiteListed {
log.Trace("fee currency not whitelisted", "fee currency address", msg.FeeCurrency)
return exchange.ErrNonWhitelistedFeeCurrency
log.Trace("fee currency not allowed", "fee currency address", msg.FeeCurrency)
return exchange.ErrUnregisteredFeeCurrency
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions core/txpool/legacypool/celo_legacypool.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import (
// filter Filters transactions from the given list, according to remaining balance (per currency)
// and gasLimit. Returns drops and invalid txs.
func (pool *LegacyPool) filter(list *list, addr common.Address, gasLimit uint64) (types.Transactions, types.Transactions) {
// CELO: drop all transactions that no longer have a whitelisted currency
dropsWhitelist, invalidsWhitelist := list.FilterAllowlisted(pool.feeCurrencyContext.ExchangeRates)
// CELO: drop all transactions that no longer have a registered currency
dropsAllowlist, invalidsAllowlist := list.FilterAllowlisted(pool.feeCurrencyContext.ExchangeRates)
// Check from which currencies we need to get balances
currenciesInList := list.FeeCurrencies()
drops, invalids := list.Filter(pool.getBalances(addr, currenciesInList), gasLimit)
totalDrops := append(dropsWhitelist, drops...)
totalInvalids := append(invalidsWhitelist, invalids...)
totalDrops := append(dropsAllowlist, drops...)
totalInvalids := append(invalidsAllowlist, invalids...)
return totalDrops, totalInvalids
}

Expand Down
4 changes: 2 additions & 2 deletions core/txpool/legacypool/celo_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func TestListFeeCost(t *testing.T) {
assert.Equal(t, uint64(20000), list.TotalCostFor(&curr1).Uint64())
}

func TestFilterWhitelisted(t *testing.T) {
func TestFilterAllowlisted(t *testing.T) {
curr1 := common.HexToAddress("0002")
curr2 := common.HexToAddress("0004")
curr3 := common.HexToAddress("0006")
Expand All @@ -84,7 +84,7 @@ func TestFilterWhitelisted(t *testing.T) {
assert.Equal(t, uint64(0), list.TotalCostFor(&curr2).Uint64())
}

func TestFilterWhitelistedStrict(t *testing.T) {
func TestFilterAllowlistedStrict(t *testing.T) {
curr1 := common.HexToAddress("0002")
curr2 := common.HexToAddress("0004")
curr3 := common.HexToAddress("0006")
Expand Down

0 comments on commit f47600e

Please sign in to comment.