aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmd/geth/dao_test.go2
-rw-r--r--cmd/swarm/main.go112
-rw-r--r--cmd/swarm/run_test.go2
-rw-r--r--contracts/ens/ens.go5
-rw-r--r--core/blockchain.go2
-rw-r--r--core/genesis.go6
-rw-r--r--core/genesis_test.go16
-rw-r--r--core/types/transaction_signing.go2
-rw-r--r--light/lightchain.go2
-rw-r--r--params/config.go28
-rw-r--r--params/dao.go9
-rw-r--r--params/util.go47
-rw-r--r--swarm/api/config.go9
-rwxr-xr-xswarm/dev/scripts/boot-cluster.sh2
-rw-r--r--swarm/swarm.go8
-rw-r--r--tests/state_test.go46
-rw-r--r--tests/vm_test_util.go4
17 files changed, 171 insertions, 131 deletions
diff --git a/cmd/geth/dao_test.go b/cmd/geth/dao_test.go
index 8cc66aabf..a8dbc5163 100644
--- a/cmd/geth/dao_test.go
+++ b/cmd/geth/dao_test.go
@@ -89,7 +89,7 @@ func TestDAOForkBlockNewChain(t *testing.T) {
expectVote bool
}{
// Test DAO Default Mainnet
- {"", params.MainNetDAOForkBlock, true},
+ {"", params.MainnetChainConfig.DAOForkBlock, true},
// test DAO Init Old Privnet
{daoOldGenesis, nil, false},
// test DAO Default No Fork Privnet
diff --git a/cmd/swarm/main.go b/cmd/swarm/main.go
index 71149c310..4ae06a1c9 100644
--- a/cmd/swarm/main.go
+++ b/cmd/swarm/main.go
@@ -17,21 +17,25 @@
package main
import (
+ "context"
"crypto/ecdsa"
"fmt"
"io/ioutil"
+ "math/big"
"os"
"os/signal"
"runtime"
"strconv"
"strings"
"syscall"
+ "time"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/accounts/keystore"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/console"
+ "github.com/ethereum/go-ethereum/contracts/ens"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/internal/debug"
@@ -40,6 +44,7 @@ import (
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/p2p/discover"
"github.com/ethereum/go-ethereum/params"
+ "github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/swarm"
bzzapi "github.com/ethereum/go-ethereum/swarm/api"
"gopkg.in/urfave/cli.v1"
@@ -87,15 +92,23 @@ var (
Name: "swap",
Usage: "Swarm SWAP enabled (default false)",
}
+ SwarmSwapAPIFlag = cli.StringFlag{
+ Name: "swap-api",
+ Usage: "URL of the Ethereum API provider to use to settle SWAP payments",
+ }
SwarmSyncEnabledFlag = cli.BoolTFlag{
Name: "sync",
Usage: "Swarm Syncing enabled (default true)",
}
- EthAPIFlag = cli.StringFlag{
- Name: "ethapi",
- Usage: "URL of the Ethereum API provider",
+ EnsAPIFlag = cli.StringFlag{
+ Name: "ens-api",
+ Usage: "URL of the Ethereum API provider to use for ENS record lookups",
Value: node.DefaultIPCEndpoint("geth"),
}
+ EnsAddrFlag = cli.StringFlag{
+ Name: "ens-addr",
+ Usage: "ENS contract address (default is detected as testnet or mainnet using --ens-api)",
+ }
SwarmApiFlag = cli.StringFlag{
Name: "bzzapi",
Usage: "Swarm HTTP endpoint",
@@ -125,6 +138,12 @@ var (
Name: "corsdomain",
Usage: "Domain on which to send Access-Control-Allow-Origin header (multiple domains can be supplied separated by a ',')",
}
+
+ // the following flags are deprecated and should be removed in the future
+ DeprecatedEthAPIFlag = cli.StringFlag{
+ Name: "ethapi",
+ Usage: "DEPRECATED: please use --ens-api and --swap-api",
+ }
)
var defaultNodeConfig = node.DefaultConfig
@@ -249,9 +268,11 @@ Cleans database of corrupted entries.
utils.PasswordFileFlag,
// bzzd-specific flags
CorsStringFlag,
- EthAPIFlag,
+ EnsAPIFlag,
+ EnsAddrFlag,
SwarmConfigPathFlag,
SwarmSwapEnabledFlag,
+ SwarmSwapAPIFlag,
SwarmSyncEnabledFlag,
SwarmListenAddrFlag,
SwarmPortFlag,
@@ -265,6 +286,8 @@ Cleans database of corrupted entries.
SwarmUploadDefaultPath,
SwarmUpFromStdinFlag,
SwarmUploadMimeType,
+ //deprecated flags
+ DeprecatedEthAPIFlag,
}
app.Flags = append(app.Flags, debug.Flags...)
app.Before = func(ctx *cli.Context) error {
@@ -299,6 +322,11 @@ func version(ctx *cli.Context) error {
}
func bzzd(ctx *cli.Context) error {
+ // exit if the deprecated --ethapi flag is set
+ if ctx.GlobalString(DeprecatedEthAPIFlag.Name) != "" {
+ utils.Fatalf("--ethapi is no longer a valid command line flag, please use --ens-api and/or --swap-api.")
+ }
+
cfg := defaultNodeConfig
utils.SetNodeConfig(ctx, &cfg)
stack, err := node.New(&cfg)
@@ -333,6 +361,38 @@ func bzzd(ctx *cli.Context) error {
return nil
}
+// detectEnsAddr determines the ENS contract address by getting both the
+// version and genesis hash using the client and matching them to either
+// mainnet or testnet addresses
+func detectEnsAddr(client *rpc.Client) (common.Address, error) {
+ ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
+ defer cancel()
+
+ var version string
+ if err := client.CallContext(ctx, &version, "net_version"); err != nil {
+ return common.Address{}, err
+ }
+
+ block, err := ethclient.NewClient(client).BlockByNumber(ctx, big.NewInt(0))
+ if err != nil {
+ return common.Address{}, err
+ }
+
+ switch {
+
+ case version == "1" && block.Hash() == params.MainnetGenesisHash:
+ log.Info("using Mainnet ENS contract address", "addr", ens.MainNetAddress)
+ return ens.MainNetAddress, nil
+
+ case version == "3" && block.Hash() == params.TestnetGenesisHash:
+ log.Info("using Testnet ENS contract address", "addr", ens.TestNetAddress)
+ return ens.TestNetAddress, nil
+
+ default:
+ return common.Address{}, fmt.Errorf("unknown version and genesis hash: %s %s", version, block.Hash())
+ }
+}
+
func registerBzzService(ctx *cli.Context, stack *node.Node) {
prvkey := getAccount(ctx, stack)
@@ -356,20 +416,48 @@ func registerBzzService(ctx *cli.Context, stack *node.Node) {
swapEnabled := ctx.GlobalBool(SwarmSwapEnabledFlag.Name)
syncEnabled := ctx.GlobalBoolT(SwarmSyncEnabledFlag.Name)
- ethapi := ctx.GlobalString(EthAPIFlag.Name)
+ swapapi := ctx.GlobalString(SwarmSwapAPIFlag.Name)
+ if swapEnabled && swapapi == "" {
+ utils.Fatalf("SWAP is enabled but --swap-api is not set")
+ }
+
+ ensapi := ctx.GlobalString(EnsAPIFlag.Name)
+ ensAddr := ctx.GlobalString(EnsAddrFlag.Name)
+
cors := ctx.GlobalString(CorsStringFlag.Name)
boot := func(ctx *node.ServiceContext) (node.Service, error) {
- var client *ethclient.Client
- if len(ethapi) > 0 {
- client, err = ethclient.Dial(ethapi)
+ var swapClient *ethclient.Client
+ if swapapi != "" {
+ log.Info("connecting to SWAP API", "url", swapapi)
+ swapClient, err = ethclient.Dial(swapapi)
if err != nil {
- utils.Fatalf("Can't connect: %v", err)
+ return nil, fmt.Errorf("error connecting to SWAP API %s: %s", swapapi, err)
}
- } else {
- swapEnabled = false
}
- return swarm.NewSwarm(ctx, client, bzzconfig, swapEnabled, syncEnabled, cors)
+
+ var ensClient *ethclient.Client
+ if ensapi != "" {
+ log.Info("connecting to ENS API", "url", ensapi)
+ client, err := rpc.Dial(ensapi)
+ if err != nil {
+ return nil, fmt.Errorf("error connecting to ENS API %s: %s", ensapi, err)
+ }
+ ensClient = ethclient.NewClient(client)
+
+ if ensAddr != "" {
+ bzzconfig.EnsRoot = common.HexToAddress(ensAddr)
+ } else {
+ ensAddr, err := detectEnsAddr(client)
+ if err == nil {
+ bzzconfig.EnsRoot = ensAddr
+ } else {
+ log.Warn(fmt.Sprintf("could not determine ENS contract address, using default %s", bzzconfig.EnsRoot), "err", err)
+ }
+ }
+ }
+
+ return swarm.NewSwarm(ctx, swapClient, ensClient, bzzconfig, swapEnabled, syncEnabled, cors)
}
if err := stack.Register(boot); err != nil {
utils.Fatalf("Failed to register the Swarm service: %v", err)
diff --git a/cmd/swarm/run_test.go b/cmd/swarm/run_test.go
index 2d32a51c8..05cbb27f1 100644
--- a/cmd/swarm/run_test.go
+++ b/cmd/swarm/run_test.go
@@ -194,7 +194,7 @@ func newTestNode(t *testing.T, dir string) *testNode {
"--nodiscover",
"--datadir", dir,
"--ipcpath", conf.IPCPath,
- "--ethapi", "",
+ "--ens-api", "",
"--bzzaccount", account.Address.String(),
"--bzznetworkid", "321",
"--bzzport", httpPort,
diff --git a/contracts/ens/ens.go b/contracts/ens/ens.go
index 83ca9b63b..c292a1714 100644
--- a/contracts/ens/ens.go
+++ b/contracts/ens/ens.go
@@ -29,6 +29,11 @@ import (
"github.com/ethereum/go-ethereum/crypto"
)
+var (
+ MainNetAddress = common.HexToAddress("0x314159265dD8dbb310642f98f50C066173C1259b")
+ TestNetAddress = common.HexToAddress("0x112234455c3a32fd11230c42e7bccd4a84e02010")
+)
+
// swarm domain name registry and resolver
type ENS struct {
*contract.ENSSession
diff --git a/core/blockchain.go b/core/blockchain.go
index aab2e72f3..6772ea284 100644
--- a/core/blockchain.go
+++ b/core/blockchain.go
@@ -1073,7 +1073,7 @@ func (st *insertStats) report(chain []*types.Block, index int) {
}
log.Info("Imported new chain segment", context...)
- *st = insertStats{startTime: now, lastIndex: index}
+ *st = insertStats{startTime: now, lastIndex: index + 1}
}
}
diff --git a/core/genesis.go b/core/genesis.go
index 5815d5901..d587011f0 100644
--- a/core/genesis.go
+++ b/core/genesis.go
@@ -143,7 +143,7 @@ func SetupGenesisBlock(db ethdb.Database, genesis *Genesis) (*params.ChainConfig
// Special case: don't change the existing config of a non-mainnet chain if no new
// config is supplied. These chains would get AllProtocolChanges (and a compat error)
// if we just continued here.
- if genesis == nil && stored != params.MainNetGenesisHash {
+ if genesis == nil && stored != params.MainnetGenesisHash {
return storedcfg, stored, nil
}
@@ -164,9 +164,9 @@ func (g *Genesis) configOrDefault(ghash common.Hash) *params.ChainConfig {
switch {
case g != nil:
return g.Config
- case ghash == params.MainNetGenesisHash:
+ case ghash == params.MainnetGenesisHash:
return params.MainnetChainConfig
- case ghash == params.TestNetGenesisHash:
+ case ghash == params.TestnetGenesisHash:
return params.TestnetChainConfig
default:
return params.AllProtocolChanges
diff --git a/core/genesis_test.go b/core/genesis_test.go
index 4312a80b8..bc82fe54e 100644
--- a/core/genesis_test.go
+++ b/core/genesis_test.go
@@ -32,12 +32,12 @@ import (
func TestDefaultGenesisBlock(t *testing.T) {
block, _ := DefaultGenesisBlock().ToBlock()
- if block.Hash() != params.MainNetGenesisHash {
- t.Errorf("wrong mainnet genesis hash, got %v, want %v", block.Hash(), params.MainNetGenesisHash)
+ if block.Hash() != params.MainnetGenesisHash {
+ t.Errorf("wrong mainnet genesis hash, got %v, want %v", block.Hash(), params.MainnetGenesisHash)
}
block, _ = DefaultTestnetGenesisBlock().ToBlock()
- if block.Hash() != params.TestNetGenesisHash {
- t.Errorf("wrong testnet genesis hash, got %v, want %v", block.Hash(), params.TestNetGenesisHash)
+ if block.Hash() != params.TestnetGenesisHash {
+ t.Errorf("wrong testnet genesis hash, got %v, want %v", block.Hash(), params.TestnetGenesisHash)
}
}
@@ -73,7 +73,7 @@ func TestSetupGenesis(t *testing.T) {
fn: func(db ethdb.Database) (*params.ChainConfig, common.Hash, error) {
return SetupGenesisBlock(db, nil)
},
- wantHash: params.MainNetGenesisHash,
+ wantHash: params.MainnetGenesisHash,
wantConfig: params.MainnetChainConfig,
},
{
@@ -82,7 +82,7 @@ func TestSetupGenesis(t *testing.T) {
DefaultGenesisBlock().MustCommit(db)
return SetupGenesisBlock(db, nil)
},
- wantHash: params.MainNetGenesisHash,
+ wantHash: params.MainnetGenesisHash,
wantConfig: params.MainnetChainConfig,
},
{
@@ -100,8 +100,8 @@ func TestSetupGenesis(t *testing.T) {
customg.MustCommit(db)
return SetupGenesisBlock(db, DefaultTestnetGenesisBlock())
},
- wantErr: &GenesisMismatchError{Stored: customghash, New: params.TestNetGenesisHash},
- wantHash: params.TestNetGenesisHash,
+ wantErr: &GenesisMismatchError{Stored: customghash, New: params.TestnetGenesisHash},
+ wantHash: params.TestnetGenesisHash,
wantConfig: params.TestnetChainConfig,
},
{
diff --git a/core/types/transaction_signing.go b/core/types/transaction_signing.go
index b0f3275b2..ba4f2aa03 100644
--- a/core/types/transaction_signing.go
+++ b/core/types/transaction_signing.go
@@ -28,7 +28,7 @@ import (
)
var (
- ErrInvalidChainId = errors.New("invalid chaid id for signer")
+ ErrInvalidChainId = errors.New("invalid chain id for signer")
errAbstractSigner = errors.New("abstract signer")
abstractSignerAddress = common.HexToAddress("ffffffffffffffffffffffffffffffffffffffff")
diff --git a/light/lightchain.go b/light/lightchain.go
index 87436f4a5..8bbf529cc 100644
--- a/light/lightchain.go
+++ b/light/lightchain.go
@@ -94,7 +94,7 @@ func NewLightChain(odr OdrBackend, config *params.ChainConfig, engine consensus.
if bc.genesisBlock == nil {
return nil, core.ErrNoGenesis
}
- if bc.genesisBlock.Hash() == params.MainNetGenesisHash {
+ if bc.genesisBlock.Hash() == params.MainnetGenesisHash {
// add trusted CHT
WriteTrustedCht(bc.chainDb, TrustedCht{Number: 805, Root: common.HexToHash("85e4286fe0a730390245c49de8476977afdae0eb5530b277f62a52b12313d50f")})
log.Info("Added trusted CHT for mainnet")
diff --git a/params/config.go b/params/config.go
index 50268f633..f4bb6172b 100644
--- a/params/config.go
+++ b/params/config.go
@@ -18,23 +18,29 @@ package params
import (
"fmt"
+ "math"
"math/big"
"github.com/ethereum/go-ethereum/common"
)
var (
+ MainnetGenesisHash = common.HexToHash("0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3") // Mainnet genesis hash to enforce below configs on
+ TestnetGenesisHash = common.HexToHash("0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d") // Testnet genesis hash to enforce below configs on
+)
+
+var (
// MainnetChainConfig is the chain parameters to run a node on the main network.
MainnetChainConfig = &ChainConfig{
- ChainId: MainNetChainID,
- HomesteadBlock: MainNetHomesteadBlock,
- DAOForkBlock: MainNetDAOForkBlock,
+ ChainId: big.NewInt(1),
+ HomesteadBlock: big.NewInt(1150000),
+ DAOForkBlock: big.NewInt(1920000),
DAOForkSupport: true,
- EIP150Block: MainNetHomesteadGasRepriceBlock,
- EIP150Hash: MainNetHomesteadGasRepriceHash,
- EIP155Block: MainNetSpuriousDragon,
- EIP158Block: MainNetSpuriousDragon,
- MetropolisBlock: MainNetMetropolisBlock,
+ EIP150Block: big.NewInt(2463000),
+ EIP150Hash: common.HexToHash("0x2086799aeebeae135c246c65021c82b4e15a2c451340993aacfd2751886514f0"),
+ EIP155Block: big.NewInt(2675000),
+ EIP158Block: big.NewInt(2675000),
+ MetropolisBlock: big.NewInt(math.MaxInt64), // Don't enable yet
Ethash: new(EthashConfig),
}
@@ -49,7 +55,7 @@ var (
EIP150Hash: common.HexToHash("0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d"),
EIP155Block: big.NewInt(10),
EIP158Block: big.NewInt(10),
- MetropolisBlock: TestNetMetropolisBlock,
+ MetropolisBlock: big.NewInt(math.MaxInt64), // Don't enable yet
Ethash: new(EthashConfig),
}
@@ -64,7 +70,7 @@ var (
EIP150Hash: common.HexToHash("0x9b095b36c15eaf13044373aef8ee0bd3a382a5abb92e402afa44b8249c3a90e9"),
EIP155Block: big.NewInt(3),
EIP158Block: big.NewInt(3),
- MetropolisBlock: TestNetMetropolisBlock,
+ MetropolisBlock: big.NewInt(math.MaxInt64), // Don't enable yet
Clique: &CliqueConfig{
Period: 15,
@@ -80,7 +86,7 @@ var (
// means that all fields must be set at all times. This forces
// anyone adding flags to the config to also have to set these
// fields.
- AllProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), new(EthashConfig), nil}
+ AllProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(math.MaxInt64) /*disabled*/, new(EthashConfig), nil}
TestChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), nil, new(EthashConfig), nil}
TestRules = TestChainConfig.Rules(new(big.Int))
)
diff --git a/params/dao.go b/params/dao.go
index ef8e838ff..da3c8dfc9 100644
--- a/params/dao.go
+++ b/params/dao.go
@@ -22,15 +22,6 @@ import (
"github.com/ethereum/go-ethereum/common"
)
-// TestNetDAOForkBlock is the block number where the DAO hard-fork commences on
-// the Ethereum test network. It's enforced nil since it was decided not to do a
-// testnet transition.
-var TestNetDAOForkBlock *big.Int
-
-// MainNetDAOForkBlock is the block number where the DAO hard-fork commences on
-// the Ethereum main network.
-var MainNetDAOForkBlock = big.NewInt(1920000)
-
// DAOForkBlockExtra is the block header extra-data field to set for the DAO fork
// point and a number of consecutive blocks to allow fast/light syncers to correctly
// pick the side they want ("dao-hard-fork").
diff --git a/params/util.go b/params/util.go
deleted file mode 100644
index d4d43d047..000000000
--- a/params/util.go
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2015 The go-ethereum Authors
-// This file is part of the go-ethereum library.
-//
-// The go-ethereum library is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// The go-ethereum library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
-
-package params
-
-import (
- "math"
- "math/big"
-
- "github.com/ethereum/go-ethereum/common"
-)
-
-var (
- TestNetGenesisHash = common.HexToHash("0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d") // Testnet genesis hash to enforce below configs on
- MainNetGenesisHash = common.HexToHash("0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3") // Mainnet genesis hash to enforce below configs on
-
- TestNetHomesteadBlock = big.NewInt(0) // Testnet homestead block
- MainNetHomesteadBlock = big.NewInt(1150000) // Mainnet homestead block
-
- TestNetHomesteadGasRepriceBlock = big.NewInt(0) // Testnet gas reprice block
- MainNetHomesteadGasRepriceBlock = big.NewInt(2463000) // Mainnet gas reprice block
-
- TestNetHomesteadGasRepriceHash = common.HexToHash("0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d") // Testnet gas reprice block hash (used by fast sync)
- MainNetHomesteadGasRepriceHash = common.HexToHash("0x2086799aeebeae135c246c65021c82b4e15a2c451340993aacfd2751886514f0") // Mainnet gas reprice block hash (used by fast sync)
-
- TestNetSpuriousDragon = big.NewInt(10)
- MainNetSpuriousDragon = big.NewInt(2675000)
-
- TestNetMetropolisBlock = big.NewInt(math.MaxInt64)
- MainNetMetropolisBlock = big.NewInt(math.MaxInt64)
-
- TestNetChainID = big.NewInt(3) // Test net default chain ID
- MainNetChainID = big.NewInt(1) // main net default chain ID
-)
diff --git a/swarm/api/config.go b/swarm/api/config.go
index 647c153ed..d8d25b1c8 100644
--- a/swarm/api/config.go
+++ b/swarm/api/config.go
@@ -25,6 +25,7 @@ import (
"path/filepath"
"github.com/ethereum/go-ethereum/common"
+ "github.com/ethereum/go-ethereum/contracts/ens"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/swarm/network"
"github.com/ethereum/go-ethereum/swarm/services/swap"
@@ -36,10 +37,6 @@ const (
DefaultHTTPPort = "8500"
)
-var (
- ensRootAddress = common.HexToAddress("0x112234455c3a32fd11230c42e7bccd4a84e02010")
-)
-
// separate bzz directories
// allow several bzz nodes running in parallel
type Config struct {
@@ -84,7 +81,7 @@ func NewConfig(path string, contract common.Address, prvKey *ecdsa.PrivateKey, n
Swap: swap.DefaultSwapParams(contract, prvKey),
PublicKey: pubkeyhex,
BzzKey: keyhex,
- EnsRoot: ensRootAddress,
+ EnsRoot: ens.TestNetAddress,
NetworkId: networkId,
}
data, err = ioutil.ReadFile(confpath)
@@ -129,7 +126,7 @@ func NewConfig(path string, contract common.Address, prvKey *ecdsa.PrivateKey, n
self.Swap.SetKey(prvKey)
if (self.EnsRoot == common.Address{}) {
- self.EnsRoot = ensRootAddress
+ self.EnsRoot = ens.TestNetAddress
}
return
diff --git a/swarm/dev/scripts/boot-cluster.sh b/swarm/dev/scripts/boot-cluster.sh
index 073b095ad..98ae3c802 100755
--- a/swarm/dev/scripts/boot-cluster.sh
+++ b/swarm/dev/scripts/boot-cluster.sh
@@ -208,7 +208,7 @@ start_swarm_node() {
--bootnodes "${BOOTNODE_URL}"
--datadir "${dir}"
--identity "${name}"
- --ethapi "${GETH_RPC_URL}"
+ --ens-api "${GETH_RPC_URL}"
--bzznetworkid "321"
--bzzaccount "${address}"
--password "${dir}/password"
diff --git a/swarm/swarm.go b/swarm/swarm.go
index 4f93a30b7..830490843 100644
--- a/swarm/swarm.go
+++ b/swarm/swarm.go
@@ -76,7 +76,7 @@ func (self *Swarm) API() *SwarmAPI {
// creates a new swarm service instance
// implements node.Service
-func NewSwarm(ctx *node.ServiceContext, backend chequebook.Backend, config *api.Config, swapEnabled, syncEnabled bool, cors string) (self *Swarm, err error) {
+func NewSwarm(ctx *node.ServiceContext, backend chequebook.Backend, ensClient *ethclient.Client, config *api.Config, swapEnabled, syncEnabled bool, cors string) (self *Swarm, err error) {
if bytes.Equal(common.FromHex(config.PublicKey), storage.ZeroKey) {
return nil, fmt.Errorf("empty public key")
}
@@ -136,10 +136,10 @@ func NewSwarm(ctx *node.ServiceContext, backend chequebook.Backend, config *api.
// set up high level api
transactOpts := bind.NewKeyedTransactor(self.privateKey)
- if backend == (*ethclient.Client)(nil) {
- log.Warn("No ENS, please specify non-empty --ethapi to use domain name resolution")
+ if ensClient == nil {
+ log.Warn("No ENS, please specify non-empty --ens-api to use domain name resolution")
} else {
- self.dns, err = ens.NewENS(transactOpts, config.EnsRoot, self.backend)
+ self.dns, err = ens.NewENS(transactOpts, config.EnsRoot, ensClient)
if err != nil {
return nil, err
}
diff --git a/tests/state_test.go b/tests/state_test.go
index 97c4e5eeb..29180942b 100644
--- a/tests/state_test.go
+++ b/tests/state_test.go
@@ -684,7 +684,7 @@ func TestEIP158Create(t *testing.T) {
chainConfig := &params.ChainConfig{
HomesteadBlock: new(big.Int),
EIP150Block: big.NewInt(2457000),
- EIP158Block: params.MainNetSpuriousDragon,
+ EIP158Block: params.MainnetChainConfig.EIP158Block,
}
fn := filepath.Join(stateTestDir, "EIP158", "stCreateTest.json")
@@ -697,7 +697,7 @@ func TestEIP158Specific(t *testing.T) {
chainConfig := &params.ChainConfig{
HomesteadBlock: new(big.Int),
EIP150Block: big.NewInt(2457000),
- EIP158Block: params.MainNetSpuriousDragon,
+ EIP158Block: params.MainnetChainConfig.EIP158Block,
}
fn := filepath.Join(stateTestDir, "EIP158", "stEIP158SpecificTest.json")
@@ -710,7 +710,7 @@ func TestEIP158NonZeroCalls(t *testing.T) {
chainConfig := &params.ChainConfig{
HomesteadBlock: new(big.Int),
EIP150Block: big.NewInt(2457000),
- EIP158Block: params.MainNetSpuriousDragon,
+ EIP158Block: params.MainnetChainConfig.EIP158Block,
}
fn := filepath.Join(stateTestDir, "EIP158", "stNonZeroCallsTest.json")
@@ -723,7 +723,7 @@ func TestEIP158ZeroCalls(t *testing.T) {
chainConfig := &params.ChainConfig{
HomesteadBlock: new(big.Int),
EIP150Block: big.NewInt(2457000),
- EIP158Block: params.MainNetSpuriousDragon,
+ EIP158Block: params.MainnetChainConfig.EIP158Block,
}
fn := filepath.Join(stateTestDir, "EIP158", "stZeroCallsTest.json")
@@ -736,7 +736,7 @@ func TestEIP158_150Specific(t *testing.T) {
chainConfig := &params.ChainConfig{
HomesteadBlock: new(big.Int),
EIP150Block: big.NewInt(2457000),
- EIP158Block: params.MainNetSpuriousDragon,
+ EIP158Block: params.MainnetChainConfig.EIP158Block,
}
fn := filepath.Join(stateTestDir, "EIP158", "EIP150", "stEIPSpecificTest.json")
@@ -749,7 +749,7 @@ func TestEIP158_150SingleCodeGasPrice(t *testing.T) {
chainConfig := &params.ChainConfig{
HomesteadBlock: new(big.Int),
EIP150Block: big.NewInt(2457000),
- EIP158Block: params.MainNetSpuriousDragon,
+ EIP158Block: params.MainnetChainConfig.EIP158Block,
}
fn := filepath.Join(stateTestDir, "EIP158", "EIP150", "stEIPsingleCodeGasPrices.json")
@@ -762,7 +762,7 @@ func TestEIP158_150MemExpandingCalls(t *testing.T) {
chainConfig := &params.ChainConfig{
HomesteadBlock: new(big.Int),
EIP150Block: big.NewInt(2457000),
- EIP158Block: params.MainNetSpuriousDragon,
+ EIP158Block: params.MainnetChainConfig.EIP158Block,
}
fn := filepath.Join(stateTestDir, "EIP158", "EIP150", "stMemExpandingEIPCalls.json")
@@ -775,7 +775,7 @@ func TestEIP158HomesteadStateSystemOperations(t *testing.T) {
chainConfig := &params.ChainConfig{
HomesteadBlock: new(big.Int),
EIP150Block: big.NewInt(2457000),
- EIP158Block: params.MainNetSpuriousDragon,
+ EIP158Block: params.MainnetChainConfig.EIP158Block,
}
fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stSystemOperationsTest.json")
@@ -788,7 +788,7 @@ func TestEIP158HomesteadStatePreCompiledContracts(t *testing.T) {
chainConfig := &params.ChainConfig{
HomesteadBlock: new(big.Int),
EIP150Block: big.NewInt(2457000),
- EIP158Block: params.MainNetSpuriousDragon,
+ EIP158Block: params.MainnetChainConfig.EIP158Block,
}
fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stPreCompiledContracts.json")
@@ -801,7 +801,7 @@ func TestEIP158HomesteadStateRecursiveCreate(t *testing.T) {
chainConfig := &params.ChainConfig{
HomesteadBlock: new(big.Int),
EIP150Block: big.NewInt(2457000),
- EIP158Block: params.MainNetSpuriousDragon,
+ EIP158Block: params.MainnetChainConfig.EIP158Block,
}
fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stSpecialTest.json")
@@ -814,7 +814,7 @@ func TestEIP158HomesteadStateRefund(t *testing.T) {
chainConfig := &params.ChainConfig{
HomesteadBlock: new(big.Int),
EIP150Block: big.NewInt(2457000),
- EIP158Block: params.MainNetSpuriousDragon,
+ EIP158Block: params.MainnetChainConfig.EIP158Block,
}
fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stRefundTest.json")
@@ -827,7 +827,7 @@ func TestEIP158HomesteadStateInitCode(t *testing.T) {
chainConfig := &params.ChainConfig{
HomesteadBlock: new(big.Int),
EIP150Block: big.NewInt(2457000),
- EIP158Block: params.MainNetSpuriousDragon,
+ EIP158Block: params.MainnetChainConfig.EIP158Block,
}
fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stInitCodeTest.json")
@@ -840,7 +840,7 @@ func TestEIP158HomesteadStateLog(t *testing.T) {
chainConfig := &params.ChainConfig{
HomesteadBlock: new(big.Int),
EIP150Block: big.NewInt(2457000),
- EIP158Block: params.MainNetSpuriousDragon,
+ EIP158Block: params.MainnetChainConfig.EIP158Block,
}
fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stLogTests.json")
@@ -853,7 +853,7 @@ func TestEIP158HomesteadStateTransaction(t *testing.T) {
chainConfig := &params.ChainConfig{
HomesteadBlock: new(big.Int),
EIP150Block: big.NewInt(2457000),
- EIP158Block: params.MainNetSpuriousDragon,
+ EIP158Block: params.MainnetChainConfig.EIP158Block,
}
fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stTransactionTest.json")
@@ -866,7 +866,7 @@ func TestEIP158HomesteadCallCreateCallCode(t *testing.T) {
chainConfig := &params.ChainConfig{
HomesteadBlock: new(big.Int),
EIP150Block: big.NewInt(2457000),
- EIP158Block: params.MainNetSpuriousDragon,
+ EIP158Block: params.MainnetChainConfig.EIP158Block,
}
fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stCallCreateCallCodeTest.json")
@@ -879,7 +879,7 @@ func TestEIP158HomesteadCallCodes(t *testing.T) {
chainConfig := &params.ChainConfig{
HomesteadBlock: new(big.Int),
EIP150Block: big.NewInt(2457000),
- EIP158Block: params.MainNetSpuriousDragon,
+ EIP158Block: params.MainnetChainConfig.EIP158Block,
}
fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stCallCodes.json")
@@ -892,7 +892,7 @@ func TestEIP158HomesteadMemory(t *testing.T) {
chainConfig := &params.ChainConfig{
HomesteadBlock: new(big.Int),
EIP150Block: big.NewInt(2457000),
- EIP158Block: params.MainNetSpuriousDragon,
+ EIP158Block: params.MainnetChainConfig.EIP158Block,
}
fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stMemoryTest.json")
@@ -905,7 +905,7 @@ func TestEIP158HomesteadMemoryStress(t *testing.T) {
chainConfig := &params.ChainConfig{
HomesteadBlock: new(big.Int),
EIP150Block: big.NewInt(2457000),
- EIP158Block: params.MainNetSpuriousDragon,
+ EIP158Block: params.MainnetChainConfig.EIP158Block,
}
if os.Getenv("TEST_VM_COMPLEX") == "" {
@@ -921,7 +921,7 @@ func TestEIP158HomesteadQuadraticComplexity(t *testing.T) {
chainConfig := &params.ChainConfig{
HomesteadBlock: new(big.Int),
EIP150Block: big.NewInt(2457000),
- EIP158Block: params.MainNetSpuriousDragon,
+ EIP158Block: params.MainnetChainConfig.EIP158Block,
}
if os.Getenv("TEST_VM_COMPLEX") == "" {
@@ -937,7 +937,7 @@ func TestEIP158HomesteadWallet(t *testing.T) {
chainConfig := &params.ChainConfig{
HomesteadBlock: new(big.Int),
EIP150Block: big.NewInt(2457000),
- EIP158Block: params.MainNetSpuriousDragon,
+ EIP158Block: params.MainnetChainConfig.EIP158Block,
}
fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stWalletTest.json")
@@ -950,7 +950,7 @@ func TestEIP158HomesteadDelegateCodes(t *testing.T) {
chainConfig := &params.ChainConfig{
HomesteadBlock: new(big.Int),
EIP150Block: big.NewInt(2457000),
- EIP158Block: params.MainNetSpuriousDragon,
+ EIP158Block: params.MainnetChainConfig.EIP158Block,
}
fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stCallDelegateCodes.json")
@@ -963,7 +963,7 @@ func TestEIP158HomesteadDelegateCodesCallCode(t *testing.T) {
chainConfig := &params.ChainConfig{
HomesteadBlock: new(big.Int),
EIP150Block: big.NewInt(2457000),
- EIP158Block: params.MainNetSpuriousDragon,
+ EIP158Block: params.MainnetChainConfig.EIP158Block,
}
fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stCallDelegateCodesCallCode.json")
@@ -976,7 +976,7 @@ func TestEIP158HomesteadBounds(t *testing.T) {
chainConfig := &params.ChainConfig{
HomesteadBlock: new(big.Int),
EIP150Block: big.NewInt(2457000),
- EIP158Block: params.MainNetSpuriousDragon,
+ EIP158Block: params.MainnetChainConfig.EIP158Block,
}
fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stBoundsTest.json")
diff --git a/tests/vm_test_util.go b/tests/vm_test_util.go
index d2ddee039..e7fe74f49 100644
--- a/tests/vm_test_util.go
+++ b/tests/vm_test_util.go
@@ -215,8 +215,8 @@ func runVmTest(test VmTest) error {
func RunVm(statedb *state.StateDB, env, exec map[string]string) ([]byte, []*types.Log, *big.Int, error) {
chainConfig := &params.ChainConfig{
- HomesteadBlock: params.MainNetHomesteadBlock,
- DAOForkBlock: params.MainNetDAOForkBlock,
+ HomesteadBlock: params.MainnetChainConfig.HomesteadBlock,
+ DAOForkBlock: params.MainnetChainConfig.DAOForkBlock,
DAOForkSupport: true,
}
var (