Fixed tests

This commit is contained in:
Yohan Graterol 2018-04-23 17:36:16 -05:00
commit c042882bec
4 changed files with 23 additions and 23 deletions

View file

@ -51,7 +51,7 @@ func TestConsoleWelcome(t *testing.T) {
geth.SetTemplateFunc("goarch", func() string { return runtime.GOARCH })
geth.SetTemplateFunc("gover", runtime.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 })
// 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("gethver", func() string { return params.Version })
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("datadir", func() string { return geth.Datadir })
attach.SetTemplateFunc("apis", func() string { return apis })

View file

@ -330,7 +330,7 @@ func DefaultCallistoMainnetGenesisBlock() *Genesis {
GasLimit: 10400000,
Difficulty: big.NewInt(524288),
Timestamp: 1519622213,
Nonce: 0,
Nonce: 0,
Coinbase: common.HexToAddress("0xc3F70b10CE5EC4aA47ce44Eb0B7900A883cd45Dd"),
Mixhash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
Alloc: decodePrealloc(callistoMainnetAllocData),
@ -357,7 +357,7 @@ func DefaultCallistoTestnetGenesisBlock() *Genesis {
GasLimit: 4700000,
Difficulty: big.NewInt(524288),
Timestamp: 1519622213,
Nonce: 0,
Nonce: 0,
Coinbase: common.HexToAddress("0xc3F70b10CE5EC4aA47ce44Eb0B7900A883cd45Dd"),
Mixhash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
Alloc: decodePrealloc(callistoTestnetAllocData),

View file

@ -21,18 +21,18 @@ import (
"reflect"
"testing"
"github.com/davecgh/go-spew/spew"
"github.com/EthereumCommonwealth/go-callisto/common"
"github.com/EthereumCommonwealth/go-callisto/consensus/ethash"
"github.com/EthereumCommonwealth/go-callisto/core/vm"
"github.com/EthereumCommonwealth/go-callisto/ethdb"
"github.com/EthereumCommonwealth/go-callisto/params"
"github.com/davecgh/go-spew/spew"
)
func TestDefaultGenesisBlock(t *testing.T) {
block := DefaultGenesisBlock().ToBlock(nil)
if block.Hash() != params.MainnetGenesisHash {
t.Errorf("wrong mainnet genesis hash, got %v, want %v", block.Hash(), params.MainnetGenesisHash)
block := DefaultCallistoMainnetGenesisBlock().ToBlock(nil)
if block.Hash() != params.CallistoMainnetGenesisHash {
t.Errorf("wrong mainnet genesis hash, got %v, want %v", block.Hash(), params.CallistoMainnetGenesisHash)
}
block = DefaultTestnetGenesisBlock().ToBlock(nil)
if block.Hash() != params.TestnetGenesisHash {
@ -78,11 +78,11 @@ func TestSetupGenesis(t *testing.T) {
{
name: "mainnet block in DB, genesis == nil",
fn: func(db ethdb.Database) (*params.ChainConfig, common.Hash, error) {
DefaultGenesisBlock().MustCommit(db)
DefaultCallistoMainnetGenesisBlock().MustCommit(db)
return SetupGenesisBlock(db, nil)
},
wantHash: params.MainnetGenesisHash,
wantConfig: params.MainnetChainConfig,
wantHash: params.CallistoMainnetGenesisHash,
wantConfig: params.CallistoMainnetChainConfig,
},
{
name: "custom block in DB, genesis == nil",

View file

@ -60,13 +60,13 @@ var (
Ethash: new(EthashConfig),
}
CLOMinerReward, _ = new(big.Int).SetString("420000000000000000000", 10)
CLOMinerReward, _ = new(big.Int).SetString("420000000000000000000", 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 = &ChainConfig{
ChainId: big.NewInt(820),
ChainId: big.NewInt(820),
HomesteadBlock: big.NewInt(0),
DAOForkBlock: nil,
DAOForkSupport: false,
@ -76,11 +76,11 @@ var (
EIP158Block: big.NewInt(10),
ByzantiumBlock: big.NewInt(20),
CallistoBlock: big.NewInt(0),
CallistoMinerReward: CLOMinerReward,
CallistoMinerReward: CLOMinerReward,
CallistoTreasuryAddress: common.HexToAddress("0x74682Fc32007aF0b6118F259cBe7bCCC21641600"),
CallistoTreasuryReward: CLOTreasuryReward,
CallistoStakeAddress: common.HexToAddress("0x3c06f218Ce6dD8E2c535a8925A2eDF81674984D9"),
CallistoStakeReward: CLOStakeReward,
CallistoStakeReward: CLOStakeReward,
Ethash: new(EthashConfig),
}
@ -96,11 +96,11 @@ var (
EIP158Block: big.NewInt(10),
ByzantiumBlock: big.NewInt(20),
CallistoBlock: big.NewInt(0),
CallistoMinerReward: CLOMinerReward,
CallistoMinerReward: CLOMinerReward,
CallistoTreasuryAddress: common.HexToAddress("0x74682Fc32007aF0b6118F259cBe7bCCC21641600"),
CallistoTreasuryReward: CLOTreasuryReward,
CallistoStakeAddress: common.HexToAddress("0x3c06f218Ce6dD8E2c535a8925A2eDF81674984D9"),
CallistoStakeReward: CLOStakeReward,
CallistoStakeReward: CLOStakeReward,
Ethash: new(EthashConfig),
}
@ -128,14 +128,14 @@ var (
//
// This configuration is intentionally not using keyed fields to force anyone
// 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
// and accepted by the Ethereum core developers into the Clique consensus.
//
// This configuration is intentionally not using keyed fields to force anyone
// 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}
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)
CallistoBlock *big.Int `json:"callistoBlock,omitempty"`
CallistoMinerReward *big.Int `json:"callistoMinerReward,omitempty"`
CallistoMinerReward *big.Int `json:"callistoMinerReward,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"`
CallistoStakeReward *big.Int `json:"callistoStakeReward,omitempty"`
CallistoStakeReward *big.Int `json:"callistoStakeReward,omitempty"`
// Various consensus engines
Ethash *EthashConfig `json:"ethash,omitempty"`
Clique *CliqueConfig `json:"clique,omitempty"`