mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 09:53:48 +00:00
Fixed tests
This commit is contained in:
commit
c042882bec
4 changed files with 23 additions and 23 deletions
|
|
@ -51,7 +51,7 @@ func TestConsoleWelcome(t *testing.T) {
|
||||||
geth.SetTemplateFunc("goarch", func() string { return runtime.GOARCH })
|
geth.SetTemplateFunc("goarch", func() string { return runtime.GOARCH })
|
||||||
geth.SetTemplateFunc("gover", runtime.Version)
|
geth.SetTemplateFunc("gover", runtime.Version)
|
||||||
geth.SetTemplateFunc("gethver", func() string { return params.Version })
|
geth.SetTemplateFunc("gethver", func() string { return params.Version })
|
||||||
geth.SetTemplateFunc("niltime", func() string { return time.Unix(0, 0).Format(time.RFC1123) })
|
geth.SetTemplateFunc("niltime", func() string { return time.Unix(1519622213, 0).Format(time.RFC1123) })
|
||||||
geth.SetTemplateFunc("apis", func() string { return ipcAPIs })
|
geth.SetTemplateFunc("apis", func() string { return ipcAPIs })
|
||||||
|
|
||||||
// Verify the actual welcome message to the required template
|
// Verify the actual welcome message to the required template
|
||||||
|
|
@ -135,7 +135,7 @@ func testAttachWelcome(t *testing.T, geth *testgeth, endpoint, apis string) {
|
||||||
attach.SetTemplateFunc("gover", runtime.Version)
|
attach.SetTemplateFunc("gover", runtime.Version)
|
||||||
attach.SetTemplateFunc("gethver", func() string { return params.Version })
|
attach.SetTemplateFunc("gethver", func() string { return params.Version })
|
||||||
attach.SetTemplateFunc("etherbase", func() string { return geth.Etherbase })
|
attach.SetTemplateFunc("etherbase", func() string { return geth.Etherbase })
|
||||||
attach.SetTemplateFunc("niltime", func() string { return time.Unix(0, 0).Format(time.RFC1123) })
|
attach.SetTemplateFunc("niltime", func() string { return time.Unix(1519622213, 0).Format(time.RFC1123) })
|
||||||
attach.SetTemplateFunc("ipc", func() bool { return strings.HasPrefix(endpoint, "ipc") })
|
attach.SetTemplateFunc("ipc", func() bool { return strings.HasPrefix(endpoint, "ipc") })
|
||||||
attach.SetTemplateFunc("datadir", func() string { return geth.Datadir })
|
attach.SetTemplateFunc("datadir", func() string { return geth.Datadir })
|
||||||
attach.SetTemplateFunc("apis", func() string { return apis })
|
attach.SetTemplateFunc("apis", func() string { return apis })
|
||||||
|
|
|
||||||
|
|
@ -330,7 +330,7 @@ func DefaultCallistoMainnetGenesisBlock() *Genesis {
|
||||||
GasLimit: 10400000,
|
GasLimit: 10400000,
|
||||||
Difficulty: big.NewInt(524288),
|
Difficulty: big.NewInt(524288),
|
||||||
Timestamp: 1519622213,
|
Timestamp: 1519622213,
|
||||||
Nonce: 0,
|
Nonce: 0,
|
||||||
Coinbase: common.HexToAddress("0xc3F70b10CE5EC4aA47ce44Eb0B7900A883cd45Dd"),
|
Coinbase: common.HexToAddress("0xc3F70b10CE5EC4aA47ce44Eb0B7900A883cd45Dd"),
|
||||||
Mixhash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
|
Mixhash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
|
||||||
Alloc: decodePrealloc(callistoMainnetAllocData),
|
Alloc: decodePrealloc(callistoMainnetAllocData),
|
||||||
|
|
@ -357,7 +357,7 @@ func DefaultCallistoTestnetGenesisBlock() *Genesis {
|
||||||
GasLimit: 4700000,
|
GasLimit: 4700000,
|
||||||
Difficulty: big.NewInt(524288),
|
Difficulty: big.NewInt(524288),
|
||||||
Timestamp: 1519622213,
|
Timestamp: 1519622213,
|
||||||
Nonce: 0,
|
Nonce: 0,
|
||||||
Coinbase: common.HexToAddress("0xc3F70b10CE5EC4aA47ce44Eb0B7900A883cd45Dd"),
|
Coinbase: common.HexToAddress("0xc3F70b10CE5EC4aA47ce44Eb0B7900A883cd45Dd"),
|
||||||
Mixhash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
|
Mixhash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
|
||||||
Alloc: decodePrealloc(callistoTestnetAllocData),
|
Alloc: decodePrealloc(callistoTestnetAllocData),
|
||||||
|
|
|
||||||
|
|
@ -21,18 +21,18 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/davecgh/go-spew/spew"
|
|
||||||
"github.com/EthereumCommonwealth/go-callisto/common"
|
"github.com/EthereumCommonwealth/go-callisto/common"
|
||||||
"github.com/EthereumCommonwealth/go-callisto/consensus/ethash"
|
"github.com/EthereumCommonwealth/go-callisto/consensus/ethash"
|
||||||
"github.com/EthereumCommonwealth/go-callisto/core/vm"
|
"github.com/EthereumCommonwealth/go-callisto/core/vm"
|
||||||
"github.com/EthereumCommonwealth/go-callisto/ethdb"
|
"github.com/EthereumCommonwealth/go-callisto/ethdb"
|
||||||
"github.com/EthereumCommonwealth/go-callisto/params"
|
"github.com/EthereumCommonwealth/go-callisto/params"
|
||||||
|
"github.com/davecgh/go-spew/spew"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestDefaultGenesisBlock(t *testing.T) {
|
func TestDefaultGenesisBlock(t *testing.T) {
|
||||||
block := DefaultGenesisBlock().ToBlock(nil)
|
block := DefaultCallistoMainnetGenesisBlock().ToBlock(nil)
|
||||||
if block.Hash() != params.MainnetGenesisHash {
|
if block.Hash() != params.CallistoMainnetGenesisHash {
|
||||||
t.Errorf("wrong mainnet genesis hash, got %v, want %v", block.Hash(), params.MainnetGenesisHash)
|
t.Errorf("wrong mainnet genesis hash, got %v, want %v", block.Hash(), params.CallistoMainnetGenesisHash)
|
||||||
}
|
}
|
||||||
block = DefaultTestnetGenesisBlock().ToBlock(nil)
|
block = DefaultTestnetGenesisBlock().ToBlock(nil)
|
||||||
if block.Hash() != params.TestnetGenesisHash {
|
if block.Hash() != params.TestnetGenesisHash {
|
||||||
|
|
@ -78,11 +78,11 @@ func TestSetupGenesis(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "mainnet block in DB, genesis == nil",
|
name: "mainnet block in DB, genesis == nil",
|
||||||
fn: func(db ethdb.Database) (*params.ChainConfig, common.Hash, error) {
|
fn: func(db ethdb.Database) (*params.ChainConfig, common.Hash, error) {
|
||||||
DefaultGenesisBlock().MustCommit(db)
|
DefaultCallistoMainnetGenesisBlock().MustCommit(db)
|
||||||
return SetupGenesisBlock(db, nil)
|
return SetupGenesisBlock(db, nil)
|
||||||
},
|
},
|
||||||
wantHash: params.MainnetGenesisHash,
|
wantHash: params.CallistoMainnetGenesisHash,
|
||||||
wantConfig: params.MainnetChainConfig,
|
wantConfig: params.CallistoMainnetChainConfig,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "custom block in DB, genesis == nil",
|
name: "custom block in DB, genesis == nil",
|
||||||
|
|
|
||||||
|
|
@ -60,13 +60,13 @@ var (
|
||||||
Ethash: new(EthashConfig),
|
Ethash: new(EthashConfig),
|
||||||
}
|
}
|
||||||
|
|
||||||
CLOMinerReward, _ = new(big.Int).SetString("420000000000000000000", 10)
|
CLOMinerReward, _ = new(big.Int).SetString("420000000000000000000", 10)
|
||||||
CLOTreasuryReward, _ = new(big.Int).SetString("120000000000000000000", 10)
|
CLOTreasuryReward, _ = new(big.Int).SetString("120000000000000000000", 10)
|
||||||
CLOStakeReward, _ = new(big.Int).SetString("60000000000000000000", 10)
|
CLOStakeReward, _ = new(big.Int).SetString("60000000000000000000", 10)
|
||||||
|
|
||||||
// CallistoMainnetChainConfig contains the chain parameters to run a node on the Callisto Main network.
|
// CallistoMainnetChainConfig contains the chain parameters to run a node on the Callisto Main network.
|
||||||
CallistoMainnetChainConfig = &ChainConfig{
|
CallistoMainnetChainConfig = &ChainConfig{
|
||||||
ChainId: big.NewInt(820),
|
ChainId: big.NewInt(820),
|
||||||
HomesteadBlock: big.NewInt(0),
|
HomesteadBlock: big.NewInt(0),
|
||||||
DAOForkBlock: nil,
|
DAOForkBlock: nil,
|
||||||
DAOForkSupport: false,
|
DAOForkSupport: false,
|
||||||
|
|
@ -76,11 +76,11 @@ var (
|
||||||
EIP158Block: big.NewInt(10),
|
EIP158Block: big.NewInt(10),
|
||||||
ByzantiumBlock: big.NewInt(20),
|
ByzantiumBlock: big.NewInt(20),
|
||||||
CallistoBlock: big.NewInt(0),
|
CallistoBlock: big.NewInt(0),
|
||||||
CallistoMinerReward: CLOMinerReward,
|
CallistoMinerReward: CLOMinerReward,
|
||||||
CallistoTreasuryAddress: common.HexToAddress("0x74682Fc32007aF0b6118F259cBe7bCCC21641600"),
|
CallistoTreasuryAddress: common.HexToAddress("0x74682Fc32007aF0b6118F259cBe7bCCC21641600"),
|
||||||
CallistoTreasuryReward: CLOTreasuryReward,
|
CallistoTreasuryReward: CLOTreasuryReward,
|
||||||
CallistoStakeAddress: common.HexToAddress("0x3c06f218Ce6dD8E2c535a8925A2eDF81674984D9"),
|
CallistoStakeAddress: common.HexToAddress("0x3c06f218Ce6dD8E2c535a8925A2eDF81674984D9"),
|
||||||
CallistoStakeReward: CLOStakeReward,
|
CallistoStakeReward: CLOStakeReward,
|
||||||
|
|
||||||
Ethash: new(EthashConfig),
|
Ethash: new(EthashConfig),
|
||||||
}
|
}
|
||||||
|
|
@ -96,11 +96,11 @@ var (
|
||||||
EIP158Block: big.NewInt(10),
|
EIP158Block: big.NewInt(10),
|
||||||
ByzantiumBlock: big.NewInt(20),
|
ByzantiumBlock: big.NewInt(20),
|
||||||
CallistoBlock: big.NewInt(0),
|
CallistoBlock: big.NewInt(0),
|
||||||
CallistoMinerReward: CLOMinerReward,
|
CallistoMinerReward: CLOMinerReward,
|
||||||
CallistoTreasuryAddress: common.HexToAddress("0x74682Fc32007aF0b6118F259cBe7bCCC21641600"),
|
CallistoTreasuryAddress: common.HexToAddress("0x74682Fc32007aF0b6118F259cBe7bCCC21641600"),
|
||||||
CallistoTreasuryReward: CLOTreasuryReward,
|
CallistoTreasuryReward: CLOTreasuryReward,
|
||||||
CallistoStakeAddress: common.HexToAddress("0x3c06f218Ce6dD8E2c535a8925A2eDF81674984D9"),
|
CallistoStakeAddress: common.HexToAddress("0x3c06f218Ce6dD8E2c535a8925A2eDF81674984D9"),
|
||||||
CallistoStakeReward: CLOStakeReward,
|
CallistoStakeReward: CLOStakeReward,
|
||||||
|
|
||||||
Ethash: new(EthashConfig),
|
Ethash: new(EthashConfig),
|
||||||
}
|
}
|
||||||
|
|
@ -128,14 +128,14 @@ var (
|
||||||
//
|
//
|
||||||
// This configuration is intentionally not using keyed fields to force anyone
|
// This configuration is intentionally not using keyed fields to force anyone
|
||||||
// adding flags to the config to also have to set these fields.
|
// adding flags to the config to also have to set these fields.
|
||||||
AllEthashProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0),common.Address{}, big.NewInt(0), common.Address{}, big.NewInt(0), new(EthashConfig), nil}
|
AllEthashProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), common.Address{}, big.NewInt(0), common.Address{}, big.NewInt(0), new(EthashConfig), nil}
|
||||||
|
|
||||||
// AllCliqueProtocolChanges contains every protocol change (EIPs) introduced
|
// AllCliqueProtocolChanges contains every protocol change (EIPs) introduced
|
||||||
// and accepted by the Ethereum core developers into the Clique consensus.
|
// and accepted by the Ethereum core developers into the Clique consensus.
|
||||||
//
|
//
|
||||||
// This configuration is intentionally not using keyed fields to force anyone
|
// This configuration is intentionally not using keyed fields to force anyone
|
||||||
// adding flags to the config to also have to set these fields.
|
// adding flags to the config to also have to set these fields.
|
||||||
AllCliqueProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0),common.Address{}, big.NewInt(0), common.Address{}, big.NewInt(0), nil, &CliqueConfig{Period: 0, Epoch: 30000}}
|
AllCliqueProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), common.Address{}, big.NewInt(0), common.Address{}, big.NewInt(0), nil, &CliqueConfig{Period: 0, Epoch: 30000}}
|
||||||
|
|
||||||
TestChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), common.Address{}, big.NewInt(0), common.Address{}, big.NewInt(0), new(EthashConfig), nil}
|
TestChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), common.Address{}, big.NewInt(0), common.Address{}, big.NewInt(0), new(EthashConfig), nil}
|
||||||
TestRules = TestChainConfig.Rules(new(big.Int))
|
TestRules = TestChainConfig.Rules(new(big.Int))
|
||||||
|
|
@ -165,11 +165,11 @@ type ChainConfig struct {
|
||||||
ConstantinopleBlock *big.Int `json:"constantinopleBlock,omitempty"` // Constantinople switch block (nil = no fork, 0 = already activated)
|
ConstantinopleBlock *big.Int `json:"constantinopleBlock,omitempty"` // Constantinople switch block (nil = no fork, 0 = already activated)
|
||||||
|
|
||||||
CallistoBlock *big.Int `json:"callistoBlock,omitempty"`
|
CallistoBlock *big.Int `json:"callistoBlock,omitempty"`
|
||||||
CallistoMinerReward *big.Int `json:"callistoMinerReward,omitempty"`
|
CallistoMinerReward *big.Int `json:"callistoMinerReward,omitempty"`
|
||||||
CallistoTreasuryAddress common.Address `json:"callistoTreasuryAddress,omitempty"`
|
CallistoTreasuryAddress common.Address `json:"callistoTreasuryAddress,omitempty"`
|
||||||
CallistoTreasuryReward *big.Int `json:"callistoTreasuryReward,omitempty"`
|
CallistoTreasuryReward *big.Int `json:"callistoTreasuryReward,omitempty"`
|
||||||
CallistoStakeAddress common.Address `json:"callistoStakeAddress,omitempty"`
|
CallistoStakeAddress common.Address `json:"callistoStakeAddress,omitempty"`
|
||||||
CallistoStakeReward *big.Int `json:"callistoStakeReward,omitempty"`
|
CallistoStakeReward *big.Int `json:"callistoStakeReward,omitempty"`
|
||||||
// Various consensus engines
|
// Various consensus engines
|
||||||
Ethash *EthashConfig `json:"ethash,omitempty"`
|
Ethash *EthashConfig `json:"ethash,omitempty"`
|
||||||
Clique *CliqueConfig `json:"clique,omitempty"`
|
Clique *CliqueConfig `json:"clique,omitempty"`
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue