Skip to content

Commit 8e1f4f9

Browse files
committed
remove debug prints. fix contract linking test condition
1 parent 2e0de31 commit 8e1f4f9

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

accounts/abi/bind/v2/contract_linking_test.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
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'},

accounts/abi/bind/v2/lib.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,6 @@ func LinkAndDeploy(deployParams DeploymentParams, deploy func(input, deployer []
208208

209209
deps := treeBuilder.BuildDepTrees()
210210
for _, tr := range deps {
211-
// TODO: instantiate deployer with its tree?
212-
213211
deployer := treeDeployer{
214212
deploy: deploy,
215213
deployedAddrs: make(map[string]common.Address),

0 commit comments

Comments
 (0)