Skip to content

Commit

Permalink
simplify getAddressFromConfig signature
Browse files Browse the repository at this point in the history
  • Loading branch information
edobry committed Dec 10, 2024
1 parent ea7fb9d commit ad7e77b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions validation/security-configs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ import (
"github.com/stretchr/testify/require"
)

func getAddressFromConfig(t *testing.T, chainID uint64, contractName string) (Address, error) {
func getAddressFromConfig(chainID uint64, contractName string) (Address, error) {
if common.IsHexAddress(contractName) {
return Address(common.HexToAddress(contractName)), nil
}

contractAddress, err := Addresses[chainID].AddressFor(contractName)
require.NoError(t, err)

return contractAddress, err
}
Expand All @@ -49,10 +48,12 @@ func getAddressFromChain(method string, contractAddress Address, client *ethclie

var checkResolutions = func(t *testing.T, r standard.Resolutions, chainID uint64, client *ethclient.Client) {
for contract, methodToOutput := range r {
contractAddress, _ := getAddressFromConfig(t, chainID, contract)
contractAddress, err := getAddressFromConfig(chainID, contract)
require.NoError(t, err)

for method, output := range methodToOutput {
want, _ := getAddressFromConfig(t, chainID, output)
want, err := getAddressFromConfig(chainID, output)
require.NoError(t, err)

got, err := getAddressFromChain(method, contractAddress, client)
require.NoErrorf(t, err, "problem calling %s.%s (%s)", contract, method, contractAddress)
Expand Down

0 comments on commit ad7e77b

Please sign in to comment.