|
|
@ -80,91 +80,75 @@ var daoProForkGenesis = `{ |
|
|
|
var daoGenesisHash = common.HexToHash("5e1fc79cb4ffa4739177b5408045cd5d51c6cf766133f23f7cd72ee1f8d790e0") |
|
|
|
var daoGenesisHash = common.HexToHash("5e1fc79cb4ffa4739177b5408045cd5d51c6cf766133f23f7cd72ee1f8d790e0") |
|
|
|
var daoGenesisForkBlock = big.NewInt(314) |
|
|
|
var daoGenesisForkBlock = big.NewInt(314) |
|
|
|
|
|
|
|
|
|
|
|
// Tests that the DAO hard-fork number and the nodes support/opposition is correctly
|
|
|
|
// TestDAOForkBlockNewChain tests that the DAO hard-fork number and the nodes support/opposition is correctly
|
|
|
|
// set in the database after various initialization procedures and invocations.
|
|
|
|
// set in the database after various initialization procedures and invocations.
|
|
|
|
func TestDAODefaultMainnet(t *testing.T) { |
|
|
|
func TestDAOForkBlockNewChain(t *testing.T) { |
|
|
|
testDAOForkBlockNewChain(t, false, "", [][2]bool{{false, false}}, params.MainNetDAOForkBlock, true) |
|
|
|
for _, arg := range []struct { |
|
|
|
} |
|
|
|
testnet bool |
|
|
|
func TestDAOSupportMainnet(t *testing.T) { |
|
|
|
genesis string |
|
|
|
testDAOForkBlockNewChain(t, false, "", [][2]bool{{true, false}}, params.MainNetDAOForkBlock, true) |
|
|
|
votes [][2]bool |
|
|
|
} |
|
|
|
expectBlock *big.Int |
|
|
|
func TestDAOOpposeMainnet(t *testing.T) { |
|
|
|
expectVote bool |
|
|
|
testDAOForkBlockNewChain(t, false, "", [][2]bool{{false, true}}, params.MainNetDAOForkBlock, false) |
|
|
|
}{ |
|
|
|
} |
|
|
|
// Test DAO Default Mainnet
|
|
|
|
func TestDAOSwitchToSupportMainnet(t *testing.T) { |
|
|
|
{false, "", [][2]bool{{false, false}}, params.MainNetDAOForkBlock, true}, |
|
|
|
testDAOForkBlockNewChain(t, false, "", [][2]bool{{false, true}, {true, false}}, params.MainNetDAOForkBlock, true) |
|
|
|
// test DAO Support Mainnet
|
|
|
|
} |
|
|
|
{false, "", [][2]bool{{true, false}}, params.MainNetDAOForkBlock, true}, |
|
|
|
func TestDAOSwitchToOpposeMainnet(t *testing.T) { |
|
|
|
// test DAO Oppose Mainnet
|
|
|
|
testDAOForkBlockNewChain(t, false, "", [][2]bool{{true, false}, {false, true}}, params.MainNetDAOForkBlock, false) |
|
|
|
{false, "", [][2]bool{{false, true}}, params.MainNetDAOForkBlock, false}, |
|
|
|
} |
|
|
|
// test DAO Switch To Support Mainnet
|
|
|
|
func TestDAODefaultTestnet(t *testing.T) { |
|
|
|
{false, "", [][2]bool{{false, true}, {true, false}}, params.MainNetDAOForkBlock, true}, |
|
|
|
testDAOForkBlockNewChain(t, true, "", [][2]bool{{false, false}}, params.TestNetDAOForkBlock, true) |
|
|
|
// test DAO Switch To Oppose Mainnet
|
|
|
|
} |
|
|
|
{false, "", [][2]bool{{true, false}, {false, true}}, params.MainNetDAOForkBlock, false}, |
|
|
|
func TestDAOSupportTestnet(t *testing.T) { |
|
|
|
// test DAO Default Testnet
|
|
|
|
testDAOForkBlockNewChain(t, true, "", [][2]bool{{true, false}}, params.TestNetDAOForkBlock, true) |
|
|
|
{true, "", [][2]bool{{false, false}}, params.TestNetDAOForkBlock, true}, |
|
|
|
} |
|
|
|
// test DAO Support Testnet
|
|
|
|
func TestDAOOpposeTestnet(t *testing.T) { |
|
|
|
{true, "", [][2]bool{{true, false}}, params.TestNetDAOForkBlock, true}, |
|
|
|
testDAOForkBlockNewChain(t, true, "", [][2]bool{{false, true}}, params.TestNetDAOForkBlock, false) |
|
|
|
// test DAO Oppose Testnet
|
|
|
|
} |
|
|
|
{true, "", [][2]bool{{false, true}}, params.TestNetDAOForkBlock, false}, |
|
|
|
func TestDAOSwitchToSupportTestnet(t *testing.T) { |
|
|
|
// test DAO Switch To Support Testnet
|
|
|
|
testDAOForkBlockNewChain(t, true, "", [][2]bool{{false, true}, {true, false}}, params.TestNetDAOForkBlock, true) |
|
|
|
{true, "", [][2]bool{{false, true}, {true, false}}, params.TestNetDAOForkBlock, true}, |
|
|
|
} |
|
|
|
// test DAO Switch To Oppose Testnet
|
|
|
|
func TestDAOSwitchToOpposeTestnet(t *testing.T) { |
|
|
|
{true, "", [][2]bool{{true, false}, {false, true}}, params.TestNetDAOForkBlock, false}, |
|
|
|
testDAOForkBlockNewChain(t, true, "", [][2]bool{{true, false}, {false, true}}, params.TestNetDAOForkBlock, false) |
|
|
|
// test DAO Init Old Privnet
|
|
|
|
} |
|
|
|
{false, daoOldGenesis, [][2]bool{}, nil, false}, |
|
|
|
func TestDAOInitOldPrivnet(t *testing.T) { |
|
|
|
// test DAO Default Old Privnet
|
|
|
|
testDAOForkBlockNewChain(t, false, daoOldGenesis, [][2]bool{}, nil, false) |
|
|
|
{false, daoOldGenesis, [][2]bool{{false, false}}, nil, false}, |
|
|
|
} |
|
|
|
// test DAO Support Old Privnet
|
|
|
|
func TestDAODefaultOldPrivnet(t *testing.T) { |
|
|
|
{false, daoOldGenesis, [][2]bool{{true, false}}, nil, true}, |
|
|
|
testDAOForkBlockNewChain(t, false, daoOldGenesis, [][2]bool{{false, false}}, nil, false) |
|
|
|
// test DAO Oppose Old Privnet
|
|
|
|
} |
|
|
|
{false, daoOldGenesis, [][2]bool{{false, true}}, nil, false}, |
|
|
|
func TestDAOSupportOldPrivnet(t *testing.T) { |
|
|
|
// test DAO Switch To Support Old Privnet
|
|
|
|
testDAOForkBlockNewChain(t, false, daoOldGenesis, [][2]bool{{true, false}}, nil, true) |
|
|
|
{false, daoOldGenesis, [][2]bool{{false, true}, {true, false}}, nil, true}, |
|
|
|
} |
|
|
|
// test DAO Switch To Oppose Old Privnet
|
|
|
|
func TestDAOOpposeOldPrivnet(t *testing.T) { |
|
|
|
{false, daoOldGenesis, [][2]bool{{true, false}, {false, true}}, nil, false}, |
|
|
|
testDAOForkBlockNewChain(t, false, daoOldGenesis, [][2]bool{{false, true}}, nil, false) |
|
|
|
// test DAO Init No Fork Privnet
|
|
|
|
} |
|
|
|
{false, daoNoForkGenesis, [][2]bool{}, daoGenesisForkBlock, false}, |
|
|
|
func TestDAOSwitchToSupportOldPrivnet(t *testing.T) { |
|
|
|
// test DAO Default No Fork Privnet
|
|
|
|
testDAOForkBlockNewChain(t, false, daoOldGenesis, [][2]bool{{false, true}, {true, false}}, nil, true) |
|
|
|
{false, daoNoForkGenesis, [][2]bool{{false, false}}, daoGenesisForkBlock, false}, |
|
|
|
} |
|
|
|
// test DAO Support No Fork Privnet
|
|
|
|
func TestDAOSwitchToOpposeOldPrivnet(t *testing.T) { |
|
|
|
{false, daoNoForkGenesis, [][2]bool{{true, false}}, daoGenesisForkBlock, true}, |
|
|
|
testDAOForkBlockNewChain(t, false, daoOldGenesis, [][2]bool{{true, false}, {false, true}}, nil, false) |
|
|
|
// test DAO Oppose No Fork Privnet
|
|
|
|
} |
|
|
|
{false, daoNoForkGenesis, [][2]bool{{false, true}}, daoGenesisForkBlock, false}, |
|
|
|
func TestDAOInitNoForkPrivnet(t *testing.T) { |
|
|
|
// test DAO Switch To Support No Fork Privnet
|
|
|
|
testDAOForkBlockNewChain(t, false, daoNoForkGenesis, [][2]bool{}, daoGenesisForkBlock, false) |
|
|
|
{false, daoNoForkGenesis, [][2]bool{{false, true}, {true, false}}, daoGenesisForkBlock, true}, |
|
|
|
} |
|
|
|
// test DAO Switch To Oppose No Fork Privnet
|
|
|
|
func TestDAODefaultNoForkPrivnet(t *testing.T) { |
|
|
|
{false, daoNoForkGenesis, [][2]bool{{true, false}, {false, true}}, daoGenesisForkBlock, false}, |
|
|
|
testDAOForkBlockNewChain(t, false, daoNoForkGenesis, [][2]bool{{false, false}}, daoGenesisForkBlock, false) |
|
|
|
// test DAO Init Pro Fork Privnet
|
|
|
|
} |
|
|
|
{false, daoProForkGenesis, [][2]bool{}, daoGenesisForkBlock, true}, |
|
|
|
func TestDAOSupportNoForkPrivnet(t *testing.T) { |
|
|
|
// test DAO Default Pro Fork Privnet
|
|
|
|
testDAOForkBlockNewChain(t, false, daoNoForkGenesis, [][2]bool{{true, false}}, daoGenesisForkBlock, true) |
|
|
|
{false, daoProForkGenesis, [][2]bool{{false, false}}, daoGenesisForkBlock, true}, |
|
|
|
} |
|
|
|
// test DAO Support Pro Fork Privnet
|
|
|
|
func TestDAOOpposeNoForkPrivnet(t *testing.T) { |
|
|
|
{false, daoProForkGenesis, [][2]bool{{true, false}}, daoGenesisForkBlock, true}, |
|
|
|
testDAOForkBlockNewChain(t, false, daoNoForkGenesis, [][2]bool{{false, true}}, daoGenesisForkBlock, false) |
|
|
|
// test DAO Oppose Pro Fork Privnet
|
|
|
|
} |
|
|
|
{false, daoProForkGenesis, [][2]bool{{false, true}}, daoGenesisForkBlock, false}, |
|
|
|
func TestDAOSwitchToSupportNoForkPrivnet(t *testing.T) { |
|
|
|
// test DAO Switch To Support Pro Fork Privnet
|
|
|
|
testDAOForkBlockNewChain(t, false, daoNoForkGenesis, [][2]bool{{false, true}, {true, false}}, daoGenesisForkBlock, true) |
|
|
|
{false, daoProForkGenesis, [][2]bool{{false, true}, {true, false}}, daoGenesisForkBlock, true}, |
|
|
|
} |
|
|
|
// test DAO Switch To Oppose Pro Fork Privnet
|
|
|
|
func TestDAOSwitchToOpposeNoForkPrivnet(t *testing.T) { |
|
|
|
{false, daoProForkGenesis, [][2]bool{{true, false}, {false, true}}, daoGenesisForkBlock, false}, |
|
|
|
testDAOForkBlockNewChain(t, false, daoNoForkGenesis, [][2]bool{{true, false}, {false, true}}, daoGenesisForkBlock, false) |
|
|
|
} { |
|
|
|
} |
|
|
|
testDAOForkBlockNewChain(t, arg.testnet, arg.genesis, arg.votes, arg.expectBlock, arg.expectVote) |
|
|
|
func TestDAOInitProForkPrivnet(t *testing.T) { |
|
|
|
} |
|
|
|
testDAOForkBlockNewChain(t, false, daoProForkGenesis, [][2]bool{}, daoGenesisForkBlock, true) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
func TestDAODefaultProForkPrivnet(t *testing.T) { |
|
|
|
|
|
|
|
testDAOForkBlockNewChain(t, false, daoProForkGenesis, [][2]bool{{false, false}}, daoGenesisForkBlock, true) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
func TestDAOSupportProForkPrivnet(t *testing.T) { |
|
|
|
|
|
|
|
testDAOForkBlockNewChain(t, false, daoProForkGenesis, [][2]bool{{true, false}}, daoGenesisForkBlock, true) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
func TestDAOOpposeProForkPrivnet(t *testing.T) { |
|
|
|
|
|
|
|
testDAOForkBlockNewChain(t, false, daoProForkGenesis, [][2]bool{{false, true}}, daoGenesisForkBlock, false) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
func TestDAOSwitchToSupportProForkPrivnet(t *testing.T) { |
|
|
|
|
|
|
|
testDAOForkBlockNewChain(t, false, daoProForkGenesis, [][2]bool{{false, true}, {true, false}}, daoGenesisForkBlock, true) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
func TestDAOSwitchToOpposeProForkPrivnet(t *testing.T) { |
|
|
|
|
|
|
|
testDAOForkBlockNewChain(t, false, daoProForkGenesis, [][2]bool{{true, false}, {false, true}}, daoGenesisForkBlock, false) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func testDAOForkBlockNewChain(t *testing.T, testnet bool, genesis string, votes [][2]bool, expectBlock *big.Int, expectVote bool) { |
|
|
|
func testDAOForkBlockNewChain(t *testing.T, testnet bool, genesis string, votes [][2]bool, expectBlock *big.Int, expectVote bool) { |
|
|
|