Skip to content

Commit

Permalink
remove debug prints. fix contract linking test condition
Browse files Browse the repository at this point in the history
  • Loading branch information
jwasinger committed Dec 10, 2024
1 parent e0b77eb commit 6df0f05
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
17 changes: 8 additions & 9 deletions accounts/abi/bind/v2/contract_linking_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"golang.org/x/exp/rand"
"runtime/debug"
"testing"
)

Expand Down Expand Up @@ -107,12 +106,14 @@ func testLinkCase(t *testing.T, tcInput linkTestCaseInput) {
contractAddr := crypto.CreateAddress(testAddr, testAddrNonce)
testAddrNonce++

// assert that this contract only references libs that are known to be deployed or in the override set
for i := 0; i < len(deployer)/20; i += 20 {
var dep common.Address
dep.SetBytes(deployer[i : i+20])
if _, ok := overridesAddrs[dep]; !ok {
t.Fatalf("reference to dependent contract that has not yet been deployed: %x\n", dep)
if len(deployer) >= 20 {
// assert that this contract only references libs that are known to be deployed or in the override set
for i := 0; i < len(deployer); i += 20 {
var dep common.Address
dep.SetBytes(deployer[i : i+20])
if _, ok := overridesAddrs[dep]; !ok {
t.Fatalf("reference to dependent contract that has not yet been deployed: %x\n", dep)
}
}
}
overridesAddrs[contractAddr] = struct{}{}
Expand Down Expand Up @@ -145,7 +146,6 @@ func testLinkCase(t *testing.T, tcInput linkTestCaseInput) {
}

if len(res.Addrs) != len(tcInput.expectDeployed) {
debug.PrintStack()
t.Fatalf("got %d deployed contracts. expected %d.\n", len(res.Addrs), len(tcInput.expectDeployed))
}
for contract, _ := range tcInput.expectDeployed {
Expand All @@ -166,7 +166,6 @@ func TestContractLinking(t *testing.T) {
},
})

fmt.Println("2")
testLinkCase(t, linkTestCaseInput{
map[rune][]rune{
'a': {'b', 'c', 'd', 'e'},
Expand Down
2 changes: 0 additions & 2 deletions accounts/abi/bind/v2/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,6 @@ func LinkAndDeploy(deployParams DeploymentParams, deploy func(input, deployer []

deps := treeBuilder.BuildDepTrees()
for _, tr := range deps {
// TODO: instantiate deployer with its tree?

deployer := treeDeployer{
deploy: deploy,
deployedAddrs: make(map[string]common.Address),
Expand Down

0 comments on commit 6df0f05

Please sign in to comment.