diff --git a/cmd/puppeth/wizard_genesis.go b/cmd/puppeth/wizard_genesis.go index eb89a4ec71..1b1f75096e 100644 --- a/cmd/puppeth/wizard_genesis.go +++ b/cmd/puppeth/wizard_genesis.go @@ -173,12 +173,13 @@ func (w *wizard) makeGenesis() { validatorAddress, _, err := validatorContract.DeployValidator(transactOpts, contractBackend) if err != nil { - fmt.Println("can't deploy root registry: %v", err) + fmt.Println("Can't deploy root registry") } contractBackend.Commit() d := time.Now().Add(1000 * time.Millisecond) - ctx, _ := context.WithDeadline(context.Background(), d) + ctx, cancel := context.WithDeadline(context.Background(), d) + defer cancel() code, _ := contractBackend.CodeAt(ctx, validatorAddress, nil) storage := make(map[common.Hash]common.Hash) f := func(key, val common.Hash) bool { diff --git a/contracts/blocksigner/blocksigner_test.go b/contracts/blocksigner/blocksigner_test.go index 6bbdadfe6f..b2576203c0 100644 --- a/contracts/blocksigner/blocksigner_test.go +++ b/contracts/blocksigner/blocksigner_test.go @@ -8,6 +8,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/crypto" ) @@ -21,14 +22,15 @@ func TestBlockSigner(t *testing.T) { contractBackend := backends.NewSimulatedBackend(core.GenesisAlloc{addr: {Balance: big.NewInt(1000000000)}}) transactOpts := bind.NewKeyedTransactor(key) - _, blockSigner, err := DeployBlockSigner(transactOpts, contractBackend) + blockSignerAddress, blockSigner, err := DeployBlockSigner(transactOpts, contractBackend) if err != nil { t.Fatalf("can't deploy root registry: %v", err) } contractBackend.Commit() d := time.Now().Add(1000 * time.Millisecond) - ctx, _ := context.WithDeadline(context.Background(), d) + ctx, cancel := context.WithDeadline(context.Background(), d) + defer cancel() code, _ := contractBackend.CodeAt(ctx, blockSignerAddress, nil) t.Log("contract code", common.ToHex(code)) f := func(key, val common.Hash) bool { diff --git a/contracts/randomize/randomize_test.go b/contracts/randomize/randomize_test.go index 275e081721..909de5116c 100644 --- a/contracts/randomize/randomize_test.go +++ b/contracts/randomize/randomize_test.go @@ -31,7 +31,8 @@ func TestRandomize(t *testing.T) { contractBackend.Commit() d := time.Now().Add(1000 * time.Millisecond) - ctx, _ := context.WithDeadline(context.Background(), d) + ctx, cancel := context.WithDeadline(context.Background(), d) + defer cancel() code, _ := contractBackend.CodeAt(ctx, randomizeAddress, nil) t.Log("contract code", common.ToHex(code)) f := func(key, val common.Hash) bool { diff --git a/contracts/validator/validator_test.go b/contracts/validator/validator_test.go index 9ccdbd5f34..0842b06760 100644 --- a/contracts/validator/validator_test.go +++ b/contracts/validator/validator_test.go @@ -40,7 +40,8 @@ func TestValidator(t *testing.T) { contractBackend.Commit() d := time.Now().Add(1000 * time.Millisecond) - ctx, _ := context.WithDeadline(context.Background(), d) + ctx, cancel := context.WithDeadline(context.Background(), d) + defer cancel() code, _ := contractBackend.CodeAt(ctx, validatorAddress, nil) t.Log("contract code", common.ToHex(code)) f := func(key, val common.Hash) bool {