Skip to content

Commit 6c7291d

Browse files
committed
fix: lint errors
1 parent c5526e5 commit 6c7291d

1 file changed

Lines changed: 43 additions & 6 deletions

File tree

experimental/analyzer/evm_analyzer_test.go

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,8 @@ func TestTryEIP1967ProxyFallback(t *testing.T) {
885885
{
886886
name: "chain not available",
887887
setupCtx: func(t *testing.T) (ProposalContext, deployment.Environment) {
888+
t.Helper()
889+
888890
return &DefaultProposalContext{
889891
AddressesByChain: deployment.AddressesByChain{
890892
chainSelector: {
@@ -912,6 +914,8 @@ func TestTryEIP1967ProxyFallback(t *testing.T) {
912914
{
913915
name: "not an EIP-1967 proxy - zero implementation address",
914916
setupCtx: func(t *testing.T) (ProposalContext, deployment.Environment) {
917+
t.Helper()
918+
915919
testEnv, err := testenv.New(t.Context(), testenv.WithEVMSimulated(t, []uint64{chainSelector}))
916920
require.NoError(t, err)
917921

@@ -945,6 +949,8 @@ func TestTryEIP1967ProxyFallback(t *testing.T) {
945949
{
946950
name: "implementation not found in address book",
947951
setupCtx: func(t *testing.T) (ProposalContext, deployment.Environment) {
952+
t.Helper()
953+
948954
testEnv, err := testenv.New(t.Context(), testenv.WithEVMSimulated(t, []uint64{chainSelector}))
949955
require.NoError(t, err)
950956

@@ -966,7 +972,8 @@ func TestTryEIP1967ProxyFallback(t *testing.T) {
966972
testEnv.BlockChains = chain.NewBlockChainsFromSlice(allChains)
967973

968974
// Add proxy address to ExistingAddresses so getAllAddressesByChain can find it
969-
testEnv.ExistingAddresses.Save(chainSelector, proxyAddress, deployment.MustTypeAndVersionFromString("TransparentUpgradeableProxy 1.0.0"))
975+
err = testEnv.ExistingAddresses.Save(chainSelector, proxyAddress, deployment.MustTypeAndVersionFromString("TransparentUpgradeableProxy 1.0.0")) // nolint
976+
require.NoError(t, err)
970977
// Note: Implementation address NOT added to address book (this is the test case)
971978

972979
return &DefaultProposalContext{
@@ -997,6 +1004,8 @@ func TestTryEIP1967ProxyFallback(t *testing.T) {
9971004
{
9981005
name: "implementation ABI not found",
9991006
setupCtx: func(t *testing.T) (ProposalContext, deployment.Environment) {
1007+
t.Helper()
1008+
10001009
testEnv, err := testenv.New(t.Context(), testenv.WithEVMSimulated(t, []uint64{chainSelector}))
10011010
require.NoError(t, err)
10021011

@@ -1018,8 +1027,10 @@ func TestTryEIP1967ProxyFallback(t *testing.T) {
10181027
testEnv.BlockChains = chain.NewBlockChainsFromSlice(allChains)
10191028

10201029
// Add addresses to ExistingAddresses so getAllAddressesByChain can find them
1021-
testEnv.ExistingAddresses.Save(chainSelector, proxyAddress, deployment.MustTypeAndVersionFromString("TransparentUpgradeableProxy 1.0.0"))
1022-
testEnv.ExistingAddresses.Save(chainSelector, implAddress.Hex(), deployment.MustTypeAndVersionFromString("ImplementationContract 1.0.0"))
1030+
err = testEnv.ExistingAddresses.Save(chainSelector, proxyAddress, deployment.MustTypeAndVersionFromString("TransparentUpgradeableProxy 1.0.0")) // nolint
1031+
require.NoError(t, err)
1032+
err = testEnv.ExistingAddresses.Save(chainSelector, implAddress.Hex(), deployment.MustTypeAndVersionFromString("ImplementationContract 1.0.0")) // nolint
1033+
require.NoError(t, err)
10231034

10241035
return &DefaultProposalContext{
10251036
AddressesByChain: deployment.AddressesByChain{
@@ -1051,6 +1062,8 @@ func TestTryEIP1967ProxyFallback(t *testing.T) {
10511062
{
10521063
name: "empty environment - no EVM chains",
10531064
setupCtx: func(t *testing.T) (ProposalContext, deployment.Environment) {
1065+
t.Helper()
1066+
10541067
return &mockProposalContext{}, deployment.Environment{}
10551068
},
10561069
chainSelector: chainSelector,
@@ -1062,6 +1075,8 @@ func TestTryEIP1967ProxyFallback(t *testing.T) {
10621075
{
10631076
name: "success - EIP-1967 proxy fallback succeeds (from ExistingAddresses)",
10641077
setupCtx: func(t *testing.T) (ProposalContext, deployment.Environment) {
1078+
t.Helper()
1079+
10651080
testEnv, err := testenv.New(t.Context(), testenv.WithEVMSimulated(t, []uint64{chainSelector}))
10661081
require.NoError(t, err)
10671082

@@ -1086,7 +1101,8 @@ func TestTryEIP1967ProxyFallback(t *testing.T) {
10861101
implABI := `[{"type":"function","name":"transfer","stateMutability":"nonpayable","inputs":[{"type":"address","name":"to"},{"type":"uint256","name":"amount"}],"outputs":[{"type":"bool"}]}]`
10871102

10881103
// Add implementation address to ExistingAddresses
1089-
testEnv.ExistingAddresses.Save(chainSelector, implAddress.Hex(), deployment.MustTypeAndVersionFromString("ImplementationContract 1.0.0"))
1104+
err = testEnv.ExistingAddresses.Save(chainSelector, implAddress.Hex(), deployment.MustTypeAndVersionFromString("ImplementationContract 1.0.0")) // nolint
1105+
require.NoError(t, err)
10901106

10911107
return &DefaultProposalContext{
10921108
AddressesByChain: deployment.AddressesByChain{
@@ -1113,6 +1129,8 @@ func TestTryEIP1967ProxyFallback(t *testing.T) {
11131129
txData: txData,
11141130
expectedError: false,
11151131
verifyResult: func(t *testing.T, result *DecodedCall, abiObj *abi.ABI, abiStr string) {
1132+
t.Helper()
1133+
11161134
require.NotNil(t, result)
11171135
require.NotNil(t, abiObj)
11181136
require.NotEmpty(t, abiStr)
@@ -1124,6 +1142,8 @@ func TestTryEIP1967ProxyFallback(t *testing.T) {
11241142
{
11251143
name: "success - EIP-1967 proxy fallback succeeds (implementation from DataStore)",
11261144
setupCtx: func(t *testing.T) (ProposalContext, deployment.Environment) {
1145+
t.Helper()
1146+
11271147
testEnv, err := testenv.New(t.Context(), testenv.WithEVMSimulated(t, []uint64{chainSelector}))
11281148
require.NoError(t, err)
11291149

@@ -1188,6 +1208,8 @@ func TestTryEIP1967ProxyFallback(t *testing.T) {
11881208
txData: txData,
11891209
expectedError: false,
11901210
verifyResult: func(t *testing.T, result *DecodedCall, abiObj *abi.ABI, abiStr string) {
1211+
t.Helper()
1212+
11911213
require.NotNil(t, result)
11921214
require.NotNil(t, abiObj)
11931215
require.NotEmpty(t, abiStr)
@@ -1253,6 +1275,7 @@ func (m *mockStorageClient) StorageAt(ctx context.Context, account common.Addres
12531275
// Return the address as 32 bytes (right-padded)
12541276
result := make([]byte, 32)
12551277
copy(result[12:], m.implAddr.Bytes())
1278+
12561279
return result, nil
12571280
}
12581281
// Otherwise, delegate to the underlying client
@@ -1351,6 +1374,8 @@ func TestAnalyzeEVMTransaction_EIP1967ProxyFallback(t *testing.T) {
13511374
Data: txData,
13521375
},
13531376
setupCtx: func(t *testing.T) (ProposalContext, deployment.Environment) {
1377+
t.Helper()
1378+
13541379
testEnv, err := testenv.New(t.Context(), testenv.WithEVMSimulated(t, []uint64{chainSelector}))
13551380
require.NoError(t, err)
13561381

@@ -1372,8 +1397,10 @@ func TestAnalyzeEVMTransaction_EIP1967ProxyFallback(t *testing.T) {
13721397
testEnv.BlockChains = chain.NewBlockChainsFromSlice(allChains)
13731398

13741399
// Add addresses to ExistingAddresses so getAllAddressesByChain can find them
1375-
testEnv.ExistingAddresses.Save(chainSelector, proxyAddress, deployment.MustTypeAndVersionFromString("TransparentUpgradeableProxy 1.0.0"))
1376-
testEnv.ExistingAddresses.Save(chainSelector, implAddressStr, deployment.MustTypeAndVersionFromString("ImplementationContract 1.0.0"))
1400+
err = testEnv.ExistingAddresses.Save(chainSelector, proxyAddress, deployment.MustTypeAndVersionFromString("TransparentUpgradeableProxy 1.0.0")) // nolint
1401+
require.NoError(t, err)
1402+
err = testEnv.ExistingAddresses.Save(chainSelector, implAddressStr, deployment.MustTypeAndVersionFromString("ImplementationContract 1.0.0")) // nolint
1403+
require.NoError(t, err)
13771404

13781405
return &DefaultProposalContext{
13791406
AddressesByChain: deployment.AddressesByChain{
@@ -1398,6 +1425,8 @@ func TestAnalyzeEVMTransaction_EIP1967ProxyFallback(t *testing.T) {
13981425
},
13991426
expectedError: false,
14001427
verifyResult: func(t *testing.T, result *DecodedCall, abiObj *abi.ABI, abiStr string) {
1428+
t.Helper()
1429+
14011430
require.NotNil(t, result)
14021431
require.NotNil(t, abiObj)
14031432
require.Contains(t, abiStr, "transfer")
@@ -1411,6 +1440,8 @@ func TestAnalyzeEVMTransaction_EIP1967ProxyFallback(t *testing.T) {
14111440
Data: []byte{0x12, 0x34}, // Too short, will fail before method lookup
14121441
},
14131442
setupCtx: func(t *testing.T) (ProposalContext, deployment.Environment) {
1443+
t.Helper()
1444+
14141445
return &DefaultProposalContext{
14151446
AddressesByChain: deployment.AddressesByChain{
14161447
chainSelector: {
@@ -1432,6 +1463,8 @@ func TestAnalyzeEVMTransaction_EIP1967ProxyFallback(t *testing.T) {
14321463
expectedError: true,
14331464
errorContains: "error analyzing operation",
14341465
verifyResult: func(t *testing.T, result *DecodedCall, abiObj *abi.ABI, abiStr string) {
1466+
t.Helper()
1467+
14351468
require.Nil(t, result)
14361469
require.Nil(t, abiObj)
14371470
require.Empty(t, abiStr)
@@ -1444,6 +1477,8 @@ func TestAnalyzeEVMTransaction_EIP1967ProxyFallback(t *testing.T) {
14441477
Data: []byte{0x88, 0x61, 0xcc, 0x77, 0x00, 0x00}, // Method ID that doesn't exist in either ABI
14451478
},
14461479
setupCtx: func(t *testing.T) (ProposalContext, deployment.Environment) {
1480+
t.Helper()
1481+
14471482
testEnv, err := testenv.New(t.Context(), testenv.WithEVMSimulated(t, []uint64{chainSelector}))
14481483
require.NoError(t, err)
14491484

@@ -1495,6 +1530,8 @@ func TestAnalyzeEVMTransaction_EIP1967ProxyFallback(t *testing.T) {
14951530
Data: txData,
14961531
},
14971532
setupCtx: func(t *testing.T) (ProposalContext, deployment.Environment) {
1533+
t.Helper()
1534+
14981535
return &DefaultProposalContext{
14991536
AddressesByChain: deployment.AddressesByChain{
15001537
chainSelector: {

0 commit comments

Comments
 (0)