remove debug prints. fix contract linking test condition
This commit is contained in:
parent
c293caade9
commit
e7e1426d89
|
@ -7,7 +7,6 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
"golang.org/x/exp/rand"
|
"golang.org/x/exp/rand"
|
||||||
"runtime/debug"
|
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -107,12 +106,14 @@ func testLinkCase(t *testing.T, tcInput linkTestCaseInput) {
|
||||||
contractAddr := crypto.CreateAddress(testAddr, testAddrNonce)
|
contractAddr := crypto.CreateAddress(testAddr, testAddrNonce)
|
||||||
testAddrNonce++
|
testAddrNonce++
|
||||||
|
|
||||||
// assert that this contract only references libs that are known to be deployed or in the override set
|
if len(deployer) >= 20 {
|
||||||
for i := 0; i < len(deployer)/20; i += 20 {
|
// assert that this contract only references libs that are known to be deployed or in the override set
|
||||||
var dep common.Address
|
for i := 0; i < len(deployer); i += 20 {
|
||||||
dep.SetBytes(deployer[i : i+20])
|
var dep common.Address
|
||||||
if _, ok := overridesAddrs[dep]; !ok {
|
dep.SetBytes(deployer[i : i+20])
|
||||||
t.Fatalf("reference to dependent contract that has not yet been deployed: %x\n", dep)
|
if _, ok := overridesAddrs[dep]; !ok {
|
||||||
|
t.Fatalf("reference to dependent contract that has not yet been deployed: %x\n", dep)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
overridesAddrs[contractAddr] = struct{}{}
|
overridesAddrs[contractAddr] = struct{}{}
|
||||||
|
@ -145,7 +146,6 @@ func testLinkCase(t *testing.T, tcInput linkTestCaseInput) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(res.Addrs) != len(tcInput.expectDeployed) {
|
if len(res.Addrs) != len(tcInput.expectDeployed) {
|
||||||
debug.PrintStack()
|
|
||||||
t.Fatalf("got %d deployed contracts. expected %d.\n", len(res.Addrs), len(tcInput.expectDeployed))
|
t.Fatalf("got %d deployed contracts. expected %d.\n", len(res.Addrs), len(tcInput.expectDeployed))
|
||||||
}
|
}
|
||||||
for contract, _ := range tcInput.expectDeployed {
|
for contract, _ := range tcInput.expectDeployed {
|
||||||
|
@ -166,7 +166,6 @@ func TestContractLinking(t *testing.T) {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
fmt.Println("2")
|
|
||||||
testLinkCase(t, linkTestCaseInput{
|
testLinkCase(t, linkTestCaseInput{
|
||||||
map[rune][]rune{
|
map[rune][]rune{
|
||||||
'a': {'b', 'c', 'd', 'e'},
|
'a': {'b', 'c', 'd', 'e'},
|
||||||
|
|
|
@ -208,8 +208,6 @@ func LinkAndDeploy(deployParams DeploymentParams, deploy func(input, deployer []
|
||||||
|
|
||||||
deps := treeBuilder.BuildDepTrees()
|
deps := treeBuilder.BuildDepTrees()
|
||||||
for _, tr := range deps {
|
for _, tr := range deps {
|
||||||
// TODO: instantiate deployer with its tree?
|
|
||||||
|
|
||||||
deployer := treeDeployer{
|
deployer := treeDeployer{
|
||||||
deploy: deploy,
|
deploy: deploy,
|
||||||
deployedAddrs: make(map[string]common.Address),
|
deployedAddrs: make(map[string]common.Address),
|
||||||
|
|
Loading…
Reference in New Issue