77 "github.com/ethereum/go-ethereum/core/types"
88 "github.com/ethereum/go-ethereum/crypto"
99 "golang.org/x/exp/rand"
10- "runtime/debug"
1110 "testing"
1211)
1312
@@ -107,12 +106,14 @@ func testLinkCase(t *testing.T, tcInput linkTestCaseInput) {
107106 contractAddr := crypto .CreateAddress (testAddr , testAddrNonce )
108107 testAddrNonce ++
109108
110- // assert that this contract only references libs that are known to be deployed or in the override set
111- for i := 0 ; i < len (deployer )/ 20 ; i += 20 {
112- var dep common.Address
113- dep .SetBytes (deployer [i : i + 20 ])
114- if _ , ok := overridesAddrs [dep ]; ! ok {
115- t .Fatalf ("reference to dependent contract that has not yet been deployed: %x\n " , dep )
109+ if len (deployer ) >= 20 {
110+ // assert that this contract only references libs that are known to be deployed or in the override set
111+ for i := 0 ; i < len (deployer ); i += 20 {
112+ var dep common.Address
113+ dep .SetBytes (deployer [i : i + 20 ])
114+ if _ , ok := overridesAddrs [dep ]; ! ok {
115+ t .Fatalf ("reference to dependent contract that has not yet been deployed: %x\n " , dep )
116+ }
116117 }
117118 }
118119 overridesAddrs [contractAddr ] = struct {}{}
@@ -145,7 +146,6 @@ func testLinkCase(t *testing.T, tcInput linkTestCaseInput) {
145146 }
146147
147148 if len (res .Addrs ) != len (tcInput .expectDeployed ) {
148- debug .PrintStack ()
149149 t .Fatalf ("got %d deployed contracts. expected %d.\n " , len (res .Addrs ), len (tcInput .expectDeployed ))
150150 }
151151 for contract , _ := range tcInput .expectDeployed {
@@ -166,7 +166,6 @@ func TestContractLinking(t *testing.T) {
166166 },
167167 })
168168
169- fmt .Println ("2" )
170169 testLinkCase (t , linkTestCaseInput {
171170 map [rune ][]rune {
172171 'a' : {'b' , 'c' , 'd' , 'e' },
0 commit comments