mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-16 17:03:46 +00:00
Add IsCallisto in config to keep the compatibility with go-ethereum
This commit is contained in:
parent
6ed8fbfc4b
commit
6c1f21e405
5 changed files with 4767 additions and 17 deletions
|
|
@ -463,7 +463,7 @@ func TestBindings(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed check for goimports symlink bug: %v", err)
|
t.Fatalf("failed check for goimports symlink bug: %v", err)
|
||||||
}
|
}
|
||||||
if !strings.Contains(string(linkTestDeps), "go-ethereum") {
|
if !strings.Contains(string(linkTestDeps), "go-callisto") {
|
||||||
t.Skip("symlinked environment doesn't support bind (https://github.com/golang/go/issues/14845)")
|
t.Skip("symlinked environment doesn't support bind (https://github.com/golang/go/issues/14845)")
|
||||||
}
|
}
|
||||||
// Create a temporary workspace for the test suite
|
// Create a temporary workspace for the test suite
|
||||||
|
|
|
||||||
10
build/env.sh
10
build/env.sh
|
|
@ -10,11 +10,11 @@ fi
|
||||||
# Create fake Go workspace if it doesn't exist yet.
|
# Create fake Go workspace if it doesn't exist yet.
|
||||||
workspace="$PWD/build/_workspace"
|
workspace="$PWD/build/_workspace"
|
||||||
root="$PWD"
|
root="$PWD"
|
||||||
ethdir="$workspace/src/github.com/ethereum"
|
ethdir="$workspace/src/github.com/EthereumCommonwealth"
|
||||||
if [ ! -L "$ethdir/go-ethereum" ]; then
|
if [ ! -L "$ethdir/go-callisto" ]; then
|
||||||
mkdir -p "$ethdir"
|
mkdir -p "$ethdir"
|
||||||
cd "$ethdir"
|
cd "$ethdir"
|
||||||
ln -s ../../../../../. go-ethereum
|
ln -s ../../../../../. go-callisto
|
||||||
cd "$root"
|
cd "$root"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -23,8 +23,8 @@ GOPATH="$workspace"
|
||||||
export GOPATH
|
export GOPATH
|
||||||
|
|
||||||
# Run the command inside the workspace.
|
# Run the command inside the workspace.
|
||||||
cd "$ethdir/go-ethereum"
|
cd "$ethdir/go-callisto"
|
||||||
PWD="$ethdir/go-ethereum"
|
PWD="$ethdir/go-callisto"
|
||||||
|
|
||||||
# Launch the arguments with the configured environment.
|
# Launch the arguments with the configured environment.
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|
|
||||||
|
|
@ -37,8 +37,8 @@ import (
|
||||||
// Ethash proof-of-work protocol constants.
|
// Ethash proof-of-work protocol constants.
|
||||||
var (
|
var (
|
||||||
callistoBlockReward, _ = new(big.Int).SetString("10000000000000000000", 10) // Block reward in wei for successfully mining a block
|
callistoBlockReward, _ = new(big.Int).SetString("10000000000000000000", 10) // Block reward in wei for successfully mining a block
|
||||||
frontierBlockReward *big.Int = big.NewInt(5e+18) // Block reward in wei for successfully mining a block
|
FrontierBlockReward *big.Int = big.NewInt(5e+18) // Block reward in wei for successfully mining a block
|
||||||
byzantiumBlockReward *big.Int = big.NewInt(3e+18) // Block reward in wei for successfully mining a block upward from Byzantium
|
ByzantiumBlockReward *big.Int = big.NewInt(3e+18) // Block reward in wei for successfully mining a block upward from Byzantium
|
||||||
maxUncles = 2 // Maximum number of uncles allowed in a single block
|
maxUncles = 2 // Maximum number of uncles allowed in a single block
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -530,10 +530,16 @@ var (
|
||||||
// TODO (karalabe): Move the chain maker into this package and make this private!
|
// TODO (karalabe): Move the chain maker into this package and make this private!
|
||||||
func AccumulateRewards(config *params.ChainConfig, state *state.StateDB, header *types.Header, uncles []*types.Header) {
|
func AccumulateRewards(config *params.ChainConfig, state *state.StateDB, header *types.Header, uncles []*types.Header) {
|
||||||
// Select the correct block reward based on chain progression
|
// Select the correct block reward based on chain progression
|
||||||
blockReward := callistoBlockReward
|
blockReward := FrontierBlockReward
|
||||||
//if config.IsByzantium(header.Number) {
|
|
||||||
// blockReward = byzantiumBlockReward
|
if config.IsCallisto(header.Number) {
|
||||||
//}
|
blockReward = callistoBlockReward
|
||||||
|
}
|
||||||
|
|
||||||
|
if config.IsByzantium(header.Number) {
|
||||||
|
blockReward = ByzantiumBlockReward
|
||||||
|
}
|
||||||
|
|
||||||
treasuryPercent := getTreasuryPercent(header)
|
treasuryPercent := getTreasuryPercent(header)
|
||||||
reward := new(big.Int).Set(blockReward)
|
reward := new(big.Int).Set(blockReward)
|
||||||
treasuryReward := new(big.Int)
|
treasuryReward := new(big.Int)
|
||||||
|
|
@ -551,9 +557,13 @@ func AccumulateRewards(config *params.ChainConfig, state *state.StateDB, header
|
||||||
r.Div(blockReward, big32)
|
r.Div(blockReward, big32)
|
||||||
reward.Add(reward, r)
|
reward.Add(reward, r)
|
||||||
}
|
}
|
||||||
reward.Sub(reward, treasuryReward)
|
|
||||||
|
if config.IsCallisto(header.Number) {
|
||||||
|
reward.Sub(reward, treasuryReward)
|
||||||
|
state.AddBalance(common.HexToAddress("SET ADDRESS IN SETTINGS"), treasuryReward)
|
||||||
|
}
|
||||||
|
|
||||||
state.AddBalance(header.Coinbase, reward)
|
state.AddBalance(header.Coinbase, reward)
|
||||||
state.AddBalance(common.HexToAddress("SET ADDRESS IN SETTINGS"), treasuryReward)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// getTreasuryPercent computes the current block reward's percent will be for
|
// getTreasuryPercent computes the current block reward's percent will be for
|
||||||
|
|
|
||||||
|
|
@ -82,16 +82,16 @@ 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), 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), 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), 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), 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), 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), new(EthashConfig), nil}
|
||||||
TestRules = TestChainConfig.Rules(new(big.Int))
|
TestRules = TestChainConfig.Rules(new(big.Int))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -117,6 +117,7 @@ type ChainConfig struct {
|
||||||
|
|
||||||
ByzantiumBlock *big.Int `json:"byzantiumBlock,omitempty"` // Byzantium switch block (nil = no fork, 0 = already on byzantium)
|
ByzantiumBlock *big.Int `json:"byzantiumBlock,omitempty"` // Byzantium switch block (nil = no fork, 0 = already on byzantium)
|
||||||
|
|
||||||
|
CallistoBlock *big.Int `json:"byzantiumBlock,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"`
|
||||||
|
|
@ -161,6 +162,7 @@ func (c *ChainConfig) String() string {
|
||||||
c.EIP155Block,
|
c.EIP155Block,
|
||||||
c.EIP158Block,
|
c.EIP158Block,
|
||||||
c.ByzantiumBlock,
|
c.ByzantiumBlock,
|
||||||
|
c.CallistoBlock,
|
||||||
engine,
|
engine,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -191,6 +193,10 @@ func (c *ChainConfig) IsByzantium(num *big.Int) bool {
|
||||||
return isForked(c.ByzantiumBlock, num)
|
return isForked(c.ByzantiumBlock, num)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *ChainConfig) IsCallisto(num *big.Int) bool {
|
||||||
|
return isForked(c.CallistoBlock, num)
|
||||||
|
}
|
||||||
|
|
||||||
// GasTable returns the gas table corresponding to the current phase (homestead or homestead reprice).
|
// GasTable returns the gas table corresponding to the current phase (homestead or homestead reprice).
|
||||||
//
|
//
|
||||||
// The returned GasTable's fields shouldn't, under any circumstances, be changed.
|
// The returned GasTable's fields shouldn't, under any circumstances, be changed.
|
||||||
|
|
|
||||||
4734
test_result
Normal file
4734
test_result
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue