mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 02:40:45 +00:00
fix(all): fix typo foudation (#2063)
This commit is contained in:
parent
5b8c6ef8fd
commit
2611f1dd9a
18 changed files with 71 additions and 71 deletions
|
|
@ -14,7 +14,7 @@
|
||||||
"reward": 10,
|
"reward": 10,
|
||||||
"rewardCheckpoint": 900,
|
"rewardCheckpoint": 900,
|
||||||
"gap": 450,
|
"gap": 450,
|
||||||
"foudationWalletAddr": "0xde5b54e8e7b585153add32f472e8d545e5d42a82",
|
"foundationWalletAddr": "0xde5b54e8e7b585153add32f472e8d545e5d42a82",
|
||||||
"SkipV1Validation": false,
|
"SkipV1Validation": false,
|
||||||
"v2": {
|
"v2": {
|
||||||
"switchBlock": 0,
|
"switchBlock": 0,
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
"reward": 5000,
|
"reward": 5000,
|
||||||
"rewardCheckpoint": 900,
|
"rewardCheckpoint": 900,
|
||||||
"gap": 450,
|
"gap": 450,
|
||||||
"foudationWalletAddr": "xdc92a289fe95a85c53b8d0d113cbaef0c1ec98ac65"
|
"foundationWalletAddr": "xdc92a289fe95a85c53b8d0d113cbaef0c1ec98ac65"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nonce": "0x0",
|
"nonce": "0x0",
|
||||||
|
|
@ -110,4 +110,4 @@
|
||||||
"number": "0x0",
|
"number": "0x0",
|
||||||
"gasUsed": "0x0",
|
"gasUsed": "0x0",
|
||||||
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
|
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
"reward": 5000,
|
"reward": 5000,
|
||||||
"rewardCheckpoint": 900,
|
"rewardCheckpoint": 900,
|
||||||
"gap": 450,
|
"gap": 450,
|
||||||
"foudationWalletAddr": "xdc746249c61f5832c5eed53172776b460491bdcd5c"
|
"foundationWalletAddr": "xdc746249c61f5832c5eed53172776b460491bdcd5c"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nonce": "0x0",
|
"nonce": "0x0",
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ func NewGenesisInput() *GenesisInput {
|
||||||
CertThreshold: 0.667,
|
CertThreshold: 0.667,
|
||||||
StakingThreshold: 10_000_000, // 10M
|
StakingThreshold: 10_000_000, // 10M
|
||||||
RewardYield: 10,
|
RewardYield: 10,
|
||||||
FoundationWalletAddress: common.FoudationAddrBinary,
|
FoundationWalletAddress: common.FoundationAddrBinary,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -324,9 +324,9 @@ func (w *wizard) makeGenesis() {
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
fmt.Println("What is foundation wallet address (collect 10% of all rewards)? (default = xdc0000000000000000000000000000000000000068)")
|
fmt.Println("What is foundation wallet address (collect 10% of all rewards)? (default = xdc0000000000000000000000000000000000000068)")
|
||||||
if input != nil {
|
if input != nil {
|
||||||
genesis.Config.XDPoS.FoudationWalletAddr = input.FoundationWalletAddress
|
genesis.Config.XDPoS.FoundationWalletAddr = input.FoundationWalletAddress
|
||||||
} else {
|
} else {
|
||||||
genesis.Config.XDPoS.FoudationWalletAddr = w.readDefaultAddress(common.FoudationAddrBinary)
|
genesis.Config.XDPoS.FoundationWalletAddr = w.readDefaultAddress(common.FoundationAddrBinary)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validator Smart Contract Code
|
// Validator Smart Contract Code
|
||||||
|
|
@ -370,7 +370,7 @@ func (w *wizard) makeGenesis() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
fmt.Println("Which accounts are allowed to confirm in Foudation MultiSignWallet?")
|
fmt.Println("Which accounts are allowed to confirm in Foundation MultiSignWallet?")
|
||||||
var owners []common.Address
|
var owners []common.Address
|
||||||
if input != nil {
|
if input != nil {
|
||||||
owners = append(owners, input.MasternodesOwner)
|
owners = append(owners, input.MasternodesOwner)
|
||||||
|
|
@ -387,7 +387,7 @@ func (w *wizard) makeGenesis() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
fmt.Println("How many require for confirm tx in Foudation MultiSignWallet? (default = 1)")
|
fmt.Println("How many require for confirm tx in Foundation MultiSignWallet? (default = 1)")
|
||||||
var required uint64
|
var required uint64
|
||||||
if input != nil {
|
if input != nil {
|
||||||
required = 1
|
required = 1
|
||||||
|
|
@ -407,7 +407,7 @@ func (w *wizard) makeGenesis() {
|
||||||
fBalance := big.NewInt(0) // 16m
|
fBalance := big.NewInt(0) // 16m
|
||||||
fBalance.Add(fBalance, big.NewInt(16*1000*1000))
|
fBalance.Add(fBalance, big.NewInt(16*1000*1000))
|
||||||
fBalance.Mul(fBalance, big.NewInt(1000000000000000000))
|
fBalance.Mul(fBalance, big.NewInt(1000000000000000000))
|
||||||
genesis.Alloc[common.FoudationAddrBinary] = types.Account{
|
genesis.Alloc[common.FoundationAddrBinary] = types.Account{
|
||||||
Balance: fBalance,
|
Balance: fBalance,
|
||||||
Code: code,
|
Code: code,
|
||||||
Storage: storage,
|
Storage: storage,
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ var (
|
||||||
BlockSignersBinary = HexToAddress("0x0000000000000000000000000000000000000089")
|
BlockSignersBinary = HexToAddress("0x0000000000000000000000000000000000000089")
|
||||||
MasternodeVotingSMCBinary = HexToAddress("0x0000000000000000000000000000000000000088")
|
MasternodeVotingSMCBinary = HexToAddress("0x0000000000000000000000000000000000000088")
|
||||||
RandomizeSMCBinary = HexToAddress("0x0000000000000000000000000000000000000090")
|
RandomizeSMCBinary = HexToAddress("0x0000000000000000000000000000000000000090")
|
||||||
FoudationAddrBinary = HexToAddress("0x0000000000000000000000000000000000000068")
|
FoundationAddrBinary = HexToAddress("0x0000000000000000000000000000000000000068")
|
||||||
TeamAddrBinary = HexToAddress("0x0000000000000000000000000000000000000099")
|
TeamAddrBinary = HexToAddress("0x0000000000000000000000000000000000000099")
|
||||||
XDCXAddrBinary = HexToAddress("0x0000000000000000000000000000000000000091")
|
XDCXAddrBinary = HexToAddress("0x0000000000000000000000000000000000000091")
|
||||||
TradingStateAddrBinary = HexToAddress("0x0000000000000000000000000000000000000092")
|
TradingStateAddrBinary = HexToAddress("0x0000000000000000000000000000000000000092")
|
||||||
|
|
|
||||||
|
|
@ -343,7 +343,7 @@ var testCases = []struct {
|
||||||
{BlockSignersBinary, "xdc0000000000000000000000000000000000000089"},
|
{BlockSignersBinary, "xdc0000000000000000000000000000000000000089"},
|
||||||
{MasternodeVotingSMCBinary, "xdc0000000000000000000000000000000000000088"},
|
{MasternodeVotingSMCBinary, "xdc0000000000000000000000000000000000000088"},
|
||||||
{RandomizeSMCBinary, "xdc0000000000000000000000000000000000000090"},
|
{RandomizeSMCBinary, "xdc0000000000000000000000000000000000000090"},
|
||||||
{FoudationAddrBinary, "xdc0000000000000000000000000000000000000068"},
|
{FoundationAddrBinary, "xdc0000000000000000000000000000000000000068"},
|
||||||
{TeamAddrBinary, "xdc0000000000000000000000000000000000000099"},
|
{TeamAddrBinary, "xdc0000000000000000000000000000000000000099"},
|
||||||
{XDCXAddrBinary, "xdc0000000000000000000000000000000000000091"},
|
{XDCXAddrBinary, "xdc0000000000000000000000000000000000000091"},
|
||||||
{TradingStateAddrBinary, "xdc0000000000000000000000000000000000000092"},
|
{TradingStateAddrBinary, "xdc0000000000000000000000000000000000000092"},
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ func TestHookRewardV2(t *testing.T) {
|
||||||
a, _ := big.NewInt(0).SetString("225000000000000000000", 10)
|
a, _ := big.NewInt(0).SetString("225000000000000000000", 10)
|
||||||
assert.Zero(t, a.Cmp(r[owner]))
|
assert.Zero(t, a.Cmp(r[owner]))
|
||||||
b, _ := big.NewInt(0).SetString("25000000000000000000", 10)
|
b, _ := big.NewInt(0).SetString("25000000000000000000", 10)
|
||||||
assert.Zero(t, b.Cmp(r[config.XDPoS.FoudationWalletAddr]))
|
assert.Zero(t, b.Cmp(r[config.XDPoS.FoundationWalletAddr]))
|
||||||
}
|
}
|
||||||
header2685 := blockchain.GetHeaderByNumber(config.XDPoS.Epoch*2 + 885)
|
header2685 := blockchain.GetHeaderByNumber(config.XDPoS.Epoch*2 + 885)
|
||||||
header2716 := blockchain.GetHeaderByNumber(config.XDPoS.Epoch*3 + 16)
|
header2716 := blockchain.GetHeaderByNumber(config.XDPoS.Epoch*3 + 16)
|
||||||
|
|
@ -81,7 +81,7 @@ func TestHookRewardV2(t *testing.T) {
|
||||||
a, _ := big.NewInt(0).SetString("225000000000000000000", 10)
|
a, _ := big.NewInt(0).SetString("225000000000000000000", 10)
|
||||||
assert.Zero(t, a.Cmp(r[owner]))
|
assert.Zero(t, a.Cmp(r[owner]))
|
||||||
b, _ := big.NewInt(0).SetString("25000000000000000000", 10)
|
b, _ := big.NewInt(0).SetString("25000000000000000000", 10)
|
||||||
assert.Zero(t, b.Cmp(r[config.XDPoS.FoudationWalletAddr]))
|
assert.Zero(t, b.Cmp(r[config.XDPoS.FoundationWalletAddr]))
|
||||||
}
|
}
|
||||||
// if no signing tx, then reward will be 0
|
// if no signing tx, then reward will be 0
|
||||||
header4499 := blockchain.GetHeaderByNumber(config.XDPoS.Epoch*5 - 1)
|
header4499 := blockchain.GetHeaderByNumber(config.XDPoS.Epoch*5 - 1)
|
||||||
|
|
@ -151,14 +151,14 @@ func TestHookRewardV2SplitReward(t *testing.T) {
|
||||||
a, _ := big.NewInt(0).SetString("149999999999999999999", 10)
|
a, _ := big.NewInt(0).SetString("149999999999999999999", 10)
|
||||||
assert.Zero(t, a.Cmp(r[owner]))
|
assert.Zero(t, a.Cmp(r[owner]))
|
||||||
b, _ := big.NewInt(0).SetString("16666666666666666666", 10)
|
b, _ := big.NewInt(0).SetString("16666666666666666666", 10)
|
||||||
assert.Zero(t, b.Cmp(r[config.XDPoS.FoudationWalletAddr]))
|
assert.Zero(t, b.Cmp(r[config.XDPoS.FoundationWalletAddr]))
|
||||||
case signer:
|
case signer:
|
||||||
r := x.(map[common.Address]*big.Int)
|
r := x.(map[common.Address]*big.Int)
|
||||||
owner := parentState.GetCandidateOwner(addr)
|
owner := parentState.GetCandidateOwner(addr)
|
||||||
a, _ := big.NewInt(0).SetString("74999999999999999999", 10)
|
a, _ := big.NewInt(0).SetString("74999999999999999999", 10)
|
||||||
assert.Zero(t, a.Cmp(r[owner]))
|
assert.Zero(t, a.Cmp(r[owner]))
|
||||||
b, _ := big.NewInt(0).SetString("8333333333333333333", 10)
|
b, _ := big.NewInt(0).SetString("8333333333333333333", 10)
|
||||||
assert.Zero(t, b.Cmp(r[config.XDPoS.FoudationWalletAddr]))
|
assert.Zero(t, b.Cmp(r[config.XDPoS.FoundationWalletAddr]))
|
||||||
default:
|
default:
|
||||||
assert.Fail(t, "wrong reward")
|
assert.Fail(t, "wrong reward")
|
||||||
}
|
}
|
||||||
|
|
@ -234,14 +234,14 @@ func TestHookRewardAfterUpgrade(t *testing.T) {
|
||||||
a, _ := big.NewInt(0).SetString("450000000000000000000", 10)
|
a, _ := big.NewInt(0).SetString("450000000000000000000", 10)
|
||||||
assert.Zero(t, a.Cmp(r[owner]), "real reward is", r[owner])
|
assert.Zero(t, a.Cmp(r[owner]), "real reward is", r[owner])
|
||||||
b, _ := big.NewInt(0).SetString("50000000000000000000", 10)
|
b, _ := big.NewInt(0).SetString("50000000000000000000", 10)
|
||||||
assert.Zero(t, b.Cmp(r[config.XDPoS.FoudationWalletAddr]), "real reward is", r[config.XDPoS.FoudationWalletAddr])
|
assert.Zero(t, b.Cmp(r[config.XDPoS.FoundationWalletAddr]), "real reward is", r[config.XDPoS.FoundationWalletAddr])
|
||||||
case signer:
|
case signer:
|
||||||
r := x.(map[common.Address]*big.Int)
|
r := x.(map[common.Address]*big.Int)
|
||||||
owner := parentState.GetCandidateOwner(addr)
|
owner := parentState.GetCandidateOwner(addr)
|
||||||
a, _ := big.NewInt(0).SetString("450000000000000000000", 10)
|
a, _ := big.NewInt(0).SetString("450000000000000000000", 10)
|
||||||
assert.Zero(t, a.Cmp(r[owner]), "real reward is", r[owner])
|
assert.Zero(t, a.Cmp(r[owner]), "real reward is", r[owner])
|
||||||
b, _ := big.NewInt(0).SetString("50000000000000000000", 10)
|
b, _ := big.NewInt(0).SetString("50000000000000000000", 10)
|
||||||
assert.Zero(t, b.Cmp(r[config.XDPoS.FoudationWalletAddr]), "real reward is", r[config.XDPoS.FoudationWalletAddr])
|
assert.Zero(t, b.Cmp(r[config.XDPoS.FoundationWalletAddr]), "real reward is", r[config.XDPoS.FoundationWalletAddr])
|
||||||
default:
|
default:
|
||||||
assert.Fail(t, "wrong reward")
|
assert.Fail(t, "wrong reward")
|
||||||
}
|
}
|
||||||
|
|
@ -274,14 +274,14 @@ func TestHookRewardAfterUpgrade(t *testing.T) {
|
||||||
a, _ := big.NewInt(0).SetString("360000000000000000000", 10)
|
a, _ := big.NewInt(0).SetString("360000000000000000000", 10)
|
||||||
assert.Zero(t, a.Cmp(r[owner]), "real reward is", r[owner])
|
assert.Zero(t, a.Cmp(r[owner]), "real reward is", r[owner])
|
||||||
b, _ := big.NewInt(0).SetString("40000000000000000000", 10)
|
b, _ := big.NewInt(0).SetString("40000000000000000000", 10)
|
||||||
assert.Zero(t, b.Cmp(r[config.XDPoS.FoudationWalletAddr]), "real reward is", r[config.XDPoS.FoudationWalletAddr])
|
assert.Zero(t, b.Cmp(r[config.XDPoS.FoundationWalletAddr]), "real reward is", r[config.XDPoS.FoundationWalletAddr])
|
||||||
case protector2Addr:
|
case protector2Addr:
|
||||||
r := x.(map[common.Address]*big.Int)
|
r := x.(map[common.Address]*big.Int)
|
||||||
owner := parentState.GetCandidateOwner(addr)
|
owner := parentState.GetCandidateOwner(addr)
|
||||||
a, _ := big.NewInt(0).SetString("360000000000000000000", 10)
|
a, _ := big.NewInt(0).SetString("360000000000000000000", 10)
|
||||||
assert.Zero(t, a.Cmp(r[owner]), "real reward is", r[owner])
|
assert.Zero(t, a.Cmp(r[owner]), "real reward is", r[owner])
|
||||||
b, _ := big.NewInt(0).SetString("40000000000000000000", 10)
|
b, _ := big.NewInt(0).SetString("40000000000000000000", 10)
|
||||||
assert.Zero(t, b.Cmp(r[config.XDPoS.FoudationWalletAddr]), "real reward is", r[config.XDPoS.FoudationWalletAddr])
|
assert.Zero(t, b.Cmp(r[config.XDPoS.FoundationWalletAddr]), "real reward is", r[config.XDPoS.FoundationWalletAddr])
|
||||||
default:
|
default:
|
||||||
assert.Fail(t, "wrong reward")
|
assert.Fail(t, "wrong reward")
|
||||||
}
|
}
|
||||||
|
|
@ -296,7 +296,7 @@ func TestHookRewardAfterUpgrade(t *testing.T) {
|
||||||
a, _ := big.NewInt(0).SetString("270112500000000000000", 10) // this value tests the float64 reward
|
a, _ := big.NewInt(0).SetString("270112500000000000000", 10) // this value tests the float64 reward
|
||||||
assert.Zero(t, a.Cmp(r[owner]), "real reward is", r[owner])
|
assert.Zero(t, a.Cmp(r[owner]), "real reward is", r[owner])
|
||||||
b, _ := big.NewInt(0).SetString("30012500000000000000", 10) // this value tests the float64 reward
|
b, _ := big.NewInt(0).SetString("30012500000000000000", 10) // this value tests the float64 reward
|
||||||
assert.Zero(t, b.Cmp(r[config.XDPoS.FoudationWalletAddr]), "real reward is", r[config.XDPoS.FoudationWalletAddr])
|
assert.Zero(t, b.Cmp(r[config.XDPoS.FoundationWalletAddr]), "real reward is", r[config.XDPoS.FoundationWalletAddr])
|
||||||
}
|
}
|
||||||
epochNum := uint64(3)
|
epochNum := uint64(3)
|
||||||
totalMinted := statedb.GetPostMinted(epochNum).Big()
|
totalMinted := statedb.GetPostMinted(epochNum).Big()
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ func TestRewardBalance(t *testing.T) {
|
||||||
logCaps[i] = &logCap{accounts[randIndex].From.String(), randCap}
|
logCaps[i] = &logCap{accounts[randIndex].From.String(), randCap}
|
||||||
}
|
}
|
||||||
|
|
||||||
foundationAddr := common.FoudationAddrBinary
|
foundationAddr := common.FoundationAddrBinary
|
||||||
totalReward := new(big.Int).SetInt64(15 * 1000)
|
totalReward := new(big.Int).SetInt64(15 * 1000)
|
||||||
rewards, err := GetRewardBalancesRate(foundationAddr, acc3Addr, totalReward, baseValidator)
|
rewards, err := GetRewardBalancesRate(foundationAddr, acc3Addr, totalReward, baseValidator)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -179,7 +179,7 @@ func TestRewardBalance(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetRewardBalancesRate(foudationWalletAddr common.Address, masterAddr common.Address, totalReward *big.Int, validator *contractValidator.XDCValidator) (map[common.Address]*big.Int, error) {
|
func GetRewardBalancesRate(foundationWalletAddr common.Address, masterAddr common.Address, totalReward *big.Int, validator *contractValidator.XDCValidator) (map[common.Address]*big.Int, error) {
|
||||||
owner := GetCandidatesOwnerBySigner(validator, masterAddr)
|
owner := GetCandidatesOwnerBySigner(validator, masterAddr)
|
||||||
balances := make(map[common.Address]*big.Int)
|
balances := make(map[common.Address]*big.Int)
|
||||||
rewardMaster := new(big.Int).Mul(totalReward, new(big.Int).SetInt64(common.RewardMasterPercent))
|
rewardMaster := new(big.Int).Mul(totalReward, new(big.Int).SetInt64(common.RewardMasterPercent))
|
||||||
|
|
@ -226,9 +226,9 @@ func GetRewardBalancesRate(foudationWalletAddr common.Address, masterAddr common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foudationReward := new(big.Int).Mul(totalReward, new(big.Int).SetInt64(common.RewardFoundationPercent))
|
foundationReward := new(big.Int).Mul(totalReward, new(big.Int).SetInt64(common.RewardFoundationPercent))
|
||||||
foudationReward = new(big.Int).Div(foudationReward, new(big.Int).SetInt64(100))
|
foundationReward = new(big.Int).Div(foundationReward, new(big.Int).SetInt64(100))
|
||||||
balances[foudationWalletAddr] = foudationReward
|
balances[foundationWalletAddr] = foundationReward
|
||||||
|
|
||||||
jsonHolders, err := json.Marshal(balances)
|
jsonHolders, err := json.Marshal(balances)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -535,7 +535,7 @@ Response:
|
||||||
"reward": 5000,
|
"reward": 5000,
|
||||||
"rewardCheckpoint": 900,
|
"rewardCheckpoint": 900,
|
||||||
"gap": 450,
|
"gap": 450,
|
||||||
"foudationWalletAddr": "0x92a289fe95a85c53b8d0d113cbaef0c1ec98ac65",
|
"foundationWalletAddr": "0x92a289fe95a85c53b8d0d113cbaef0c1ec98ac65",
|
||||||
"SkipV1Validation": false,
|
"SkipV1Validation": false,
|
||||||
"v2": {
|
"v2": {
|
||||||
"switchBlock": 80370000,
|
"switchBlock": 80370000,
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
"reward": 5000,
|
"reward": 5000,
|
||||||
"rewardCheckpoint": 900,
|
"rewardCheckpoint": 900,
|
||||||
"gap": 450,
|
"gap": 450,
|
||||||
"foudationWalletAddr": "0x92a289fe95a85c53b8d0d113cbaef0c1ec98ac65",
|
"foundationWalletAddr": "0x92a289fe95a85c53b8d0d113cbaef0c1ec98ac65",
|
||||||
"SkipV1Validation": false,
|
"SkipV1Validation": false,
|
||||||
"v2": {
|
"v2": {
|
||||||
"SwitchEpoch": 89300,
|
"SwitchEpoch": 89300,
|
||||||
|
|
|
||||||
|
|
@ -478,7 +478,7 @@ func (b *EthAPIBackend) GetVotersRewards(masternodeAddr common.Address) map[comm
|
||||||
header := chain.CurrentBlock()
|
header := chain.CurrentBlock()
|
||||||
number := header.Number.Uint64()
|
number := header.Number.Uint64()
|
||||||
engine := b.Engine().(*XDPoS.XDPoS)
|
engine := b.Engine().(*XDPoS.XDPoS)
|
||||||
foundationWalletAddr := chain.Config().XDPoS.FoudationWalletAddr
|
foundationWalletAddr := chain.Config().XDPoS.FoundationWalletAddr
|
||||||
|
|
||||||
// calculate for 2 epochs ago
|
// calculate for 2 epochs ago
|
||||||
currentCheckpointNumber, _, err := engine.GetCurrentEpochSwitchBlock(chain, header.Number)
|
currentCheckpointNumber, _, err := engine.GetCurrentEpochSwitchBlock(chain, header.Number)
|
||||||
|
|
|
||||||
|
|
@ -259,7 +259,7 @@ func AttachConsensusV1Hooks(adaptor *XDPoS.XDPoS, bc *core.BlockChain, chainConf
|
||||||
adaptor.EngineV1.HookReward = func(chain consensus.ChainReader, stateBlock vm.StateDB, parentState *state.StateDB, header *types.Header) (map[string]interface{}, error) {
|
adaptor.EngineV1.HookReward = func(chain consensus.ChainReader, stateBlock vm.StateDB, parentState *state.StateDB, header *types.Header) (map[string]interface{}, error) {
|
||||||
number := header.Number.Uint64()
|
number := header.Number.Uint64()
|
||||||
rCheckpoint := chain.Config().XDPoS.RewardCheckpoint
|
rCheckpoint := chain.Config().XDPoS.RewardCheckpoint
|
||||||
foundationWalletAddr := chain.Config().XDPoS.FoudationWalletAddr
|
foundationWalletAddr := chain.Config().XDPoS.FoundationWalletAddr
|
||||||
if foundationWalletAddr == (common.Address{}) {
|
if foundationWalletAddr == (common.Address{}) {
|
||||||
log.Error("Foundation Wallet Address is empty", "error", foundationWalletAddr)
|
log.Error("Foundation Wallet Address is empty", "error", foundationWalletAddr)
|
||||||
return nil, errors.New("foundation Wallet Address is empty")
|
return nil, errors.New("foundation Wallet Address is empty")
|
||||||
|
|
|
||||||
|
|
@ -268,7 +268,7 @@ func AttachConsensusV2Hooks(adaptor *XDPoS.XDPoS, bc *core.BlockChain, chainConf
|
||||||
// Hook calculates reward for masternodes
|
// Hook calculates reward for masternodes
|
||||||
adaptor.EngineV2.HookReward = func(chain consensus.ChainReader, stateBlock vm.StateDB, parentState *state.StateDB, header *types.Header) (map[string]interface{}, error) {
|
adaptor.EngineV2.HookReward = func(chain consensus.ChainReader, stateBlock vm.StateDB, parentState *state.StateDB, header *types.Header) (map[string]interface{}, error) {
|
||||||
number := header.Number.Uint64()
|
number := header.Number.Uint64()
|
||||||
foundationWalletAddr := chain.Config().XDPoS.FoudationWalletAddr
|
foundationWalletAddr := chain.Config().XDPoS.FoundationWalletAddr
|
||||||
if foundationWalletAddr == (common.Address{}) {
|
if foundationWalletAddr == (common.Address{}) {
|
||||||
log.Error("Foundation Wallet Address is empty", "error", foundationWalletAddr)
|
log.Error("Foundation Wallet Address is empty", "error", foundationWalletAddr)
|
||||||
return nil, errors.New("foundation wallet address is empty")
|
return nil, errors.New("foundation wallet address is empty")
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
"reward": 250,
|
"reward": 250,
|
||||||
"rewardCheckpoint": 30,
|
"rewardCheckpoint": 30,
|
||||||
"gap": 10,
|
"gap": 10,
|
||||||
"foudationWalletAddr": "0x0000000000000000000000000000000000000068"
|
"foundationWalletAddr": "0x0000000000000000000000000000000000000068"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nonce": "0x0",
|
"nonce": "0x0",
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
"reward": 10,
|
"reward": 10,
|
||||||
"rewardCheckpoint": 900,
|
"rewardCheckpoint": 900,
|
||||||
"gap": 450,
|
"gap": 450,
|
||||||
"foudationWalletAddr": "0xde5b54e8e7b585153add32f472e8d545e5d42a82",
|
"foundationWalletAddr": "0xde5b54e8e7b585153add32f472e8d545e5d42a82",
|
||||||
"SkipV1Validation": false,
|
"SkipV1Validation": false,
|
||||||
"v2": {
|
"v2": {
|
||||||
"switchBlock": 0,
|
"switchBlock": 0,
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
"reward": 5000,
|
"reward": 5000,
|
||||||
"rewardCheckpoint": 900,
|
"rewardCheckpoint": 900,
|
||||||
"gap": 450,
|
"gap": 450,
|
||||||
"foudationWalletAddr": "xdc92a289fe95a85c53b8d0d113cbaef0c1ec98ac65"
|
"foundationWalletAddr": "xdc92a289fe95a85c53b8d0d113cbaef0c1ec98ac65"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nonce": "0x0",
|
"nonce": "0x0",
|
||||||
|
|
@ -110,4 +110,4 @@
|
||||||
"number": "0x0",
|
"number": "0x0",
|
||||||
"gasUsed": "0x0",
|
"gasUsed": "0x0",
|
||||||
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
|
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
"reward": 5000,
|
"reward": 5000,
|
||||||
"rewardCheckpoint": 900,
|
"rewardCheckpoint": 900,
|
||||||
"gap": 450,
|
"gap": 450,
|
||||||
"foudationWalletAddr": "xdc746249c61f5832c5eed53172776b460491bdcd5c"
|
"foundationWalletAddr": "xdc746249c61f5832c5eed53172776b460491bdcd5c"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nonce": "0x0",
|
"nonce": "0x0",
|
||||||
|
|
|
||||||
|
|
@ -234,12 +234,12 @@ var (
|
||||||
EIP158Block: big.NewInt(3),
|
EIP158Block: big.NewInt(3),
|
||||||
ByzantiumBlock: big.NewInt(4),
|
ByzantiumBlock: big.NewInt(4),
|
||||||
XDPoS: &XDPoSConfig{
|
XDPoS: &XDPoSConfig{
|
||||||
Period: 2,
|
Period: 2,
|
||||||
Epoch: 900,
|
Epoch: 900,
|
||||||
Reward: 5000,
|
Reward: 5000,
|
||||||
RewardCheckpoint: 900,
|
RewardCheckpoint: 900,
|
||||||
Gap: 450,
|
Gap: 450,
|
||||||
FoudationWalletAddr: common.HexToAddress("xdc92a289fe95a85c53b8d0d113cbaef0c1ec98ac65"),
|
FoundationWalletAddr: common.HexToAddress("xdc92a289fe95a85c53b8d0d113cbaef0c1ec98ac65"),
|
||||||
V2: &V2{
|
V2: &V2{
|
||||||
SwitchEpoch: common.MainnetConstant.TIPV2SwitchBlock.Uint64() / 900,
|
SwitchEpoch: common.MainnetConstant.TIPV2SwitchBlock.Uint64() / 900,
|
||||||
SwitchBlock: common.MainnetConstant.TIPV2SwitchBlock,
|
SwitchBlock: common.MainnetConstant.TIPV2SwitchBlock,
|
||||||
|
|
@ -275,12 +275,12 @@ var (
|
||||||
ByzantiumBlock: big.NewInt(4),
|
ByzantiumBlock: big.NewInt(4),
|
||||||
ConstantinopleBlock: nil,
|
ConstantinopleBlock: nil,
|
||||||
XDPoS: &XDPoSConfig{
|
XDPoS: &XDPoSConfig{
|
||||||
Period: 2,
|
Period: 2,
|
||||||
Epoch: 900,
|
Epoch: 900,
|
||||||
Reward: 5000,
|
Reward: 5000,
|
||||||
RewardCheckpoint: 900,
|
RewardCheckpoint: 900,
|
||||||
Gap: 450,
|
Gap: 450,
|
||||||
FoudationWalletAddr: common.HexToAddress("xdc746249c61f5832c5eed53172776b460491bdcd5c"),
|
FoundationWalletAddr: common.HexToAddress("xdc746249c61f5832c5eed53172776b460491bdcd5c"),
|
||||||
V2: &V2{
|
V2: &V2{
|
||||||
SwitchEpoch: common.TestnetConstant.TIPV2SwitchBlock.Uint64() / 900,
|
SwitchEpoch: common.TestnetConstant.TIPV2SwitchBlock.Uint64() / 900,
|
||||||
SwitchBlock: common.TestnetConstant.TIPV2SwitchBlock,
|
SwitchBlock: common.TestnetConstant.TIPV2SwitchBlock,
|
||||||
|
|
@ -299,12 +299,12 @@ var (
|
||||||
EIP158Block: big.NewInt(0),
|
EIP158Block: big.NewInt(0),
|
||||||
ByzantiumBlock: big.NewInt(0),
|
ByzantiumBlock: big.NewInt(0),
|
||||||
XDPoS: &XDPoSConfig{
|
XDPoS: &XDPoSConfig{
|
||||||
Period: 2,
|
Period: 2,
|
||||||
Epoch: 900,
|
Epoch: 900,
|
||||||
Reward: 10,
|
Reward: 10,
|
||||||
RewardCheckpoint: 900,
|
RewardCheckpoint: 900,
|
||||||
Gap: 450,
|
Gap: 450,
|
||||||
FoudationWalletAddr: common.HexToAddress("0xde5b54e8e7b585153add32f472e8d545e5d42a82"),
|
FoundationWalletAddr: common.HexToAddress("0xde5b54e8e7b585153add32f472e8d545e5d42a82"),
|
||||||
V2: &V2{
|
V2: &V2{
|
||||||
SwitchEpoch: common.DevnetConstant.TIPV2SwitchBlock.Uint64() / 900,
|
SwitchEpoch: common.DevnetConstant.TIPV2SwitchBlock.Uint64() / 900,
|
||||||
SwitchBlock: common.DevnetConstant.TIPV2SwitchBlock,
|
SwitchBlock: common.DevnetConstant.TIPV2SwitchBlock,
|
||||||
|
|
@ -409,11 +409,11 @@ var (
|
||||||
Ethash: new(EthashConfig),
|
Ethash: new(EthashConfig),
|
||||||
Clique: nil,
|
Clique: nil,
|
||||||
XDPoS: &XDPoSConfig{
|
XDPoS: &XDPoSConfig{
|
||||||
Epoch: 900,
|
Epoch: 900,
|
||||||
Gap: 450,
|
Gap: 450,
|
||||||
SkipV1Validation: true,
|
SkipV1Validation: true,
|
||||||
FoudationWalletAddr: common.HexToAddress("0x0000000000000000000000000000000000000068"),
|
FoundationWalletAddr: common.HexToAddress("0x0000000000000000000000000000000000000068"),
|
||||||
Reward: 250,
|
Reward: 250,
|
||||||
V2: &V2{
|
V2: &V2{
|
||||||
SwitchEpoch: 1,
|
SwitchEpoch: 1,
|
||||||
SwitchBlock: big.NewInt(900),
|
SwitchBlock: big.NewInt(900),
|
||||||
|
|
@ -538,14 +538,14 @@ func (c *CliqueConfig) String() string {
|
||||||
|
|
||||||
// XDPoSConfig is the consensus engine configs for delegated-proof-of-stake based sealing.
|
// XDPoSConfig is the consensus engine configs for delegated-proof-of-stake based sealing.
|
||||||
type XDPoSConfig struct {
|
type XDPoSConfig struct {
|
||||||
Period uint64 `json:"period"` // Number of seconds between blocks to enforce
|
Period uint64 `json:"period"` // Number of seconds between blocks to enforce
|
||||||
Epoch uint64 `json:"epoch"` // Epoch length to reset votes and checkpoint
|
Epoch uint64 `json:"epoch"` // Epoch length to reset votes and checkpoint
|
||||||
Reward uint64 `json:"reward"` // Block reward - unit Ether
|
Reward uint64 `json:"reward"` // Block reward - unit Ether
|
||||||
RewardCheckpoint uint64 `json:"rewardCheckpoint"` // Checkpoint block for calculate rewards.
|
RewardCheckpoint uint64 `json:"rewardCheckpoint"` // Checkpoint block for calculate rewards.
|
||||||
Gap uint64 `json:"gap"` // Gap time preparing for the next epoch
|
Gap uint64 `json:"gap"` // Gap time preparing for the next epoch
|
||||||
FoudationWalletAddr common.Address `json:"foudationWalletAddr"` // Foundation Address Wallet
|
FoundationWalletAddr common.Address `json:"foundationWalletAddr"` // Foundation Address Wallet
|
||||||
SkipV1Validation bool //Skip Block Validation for testing purpose, V1 consensus only
|
SkipV1Validation bool //Skip Block Validation for testing purpose, V1 consensus only
|
||||||
V2 *V2 `json:"v2"`
|
V2 *V2 `json:"v2"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type V2 struct {
|
type V2 struct {
|
||||||
|
|
@ -612,8 +612,8 @@ func XDPoSConfigEqual(a, b *XDPoSConfig) bool {
|
||||||
log.Warn("[XDPoSConfigEqual] Gap mismatch", "a.Gap", a.Gap, "b.Gap", b.Gap)
|
log.Warn("[XDPoSConfigEqual] Gap mismatch", "a.Gap", a.Gap, "b.Gap", b.Gap)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if a.FoudationWalletAddr != b.FoudationWalletAddr {
|
if a.FoundationWalletAddr != b.FoundationWalletAddr {
|
||||||
log.Warn("[XDPoSConfigEqual] FoudationWalletAddr mismatch", "a.FoudationWalletAddr", a.FoudationWalletAddr.Hex(), "b.FoudationWalletAddr", b.FoudationWalletAddr.Hex())
|
log.Warn("[XDPoSConfigEqual] FoundationWalletAddr mismatch", "a.FoundationWalletAddr", a.FoundationWalletAddr.Hex(), "b.FoundationWalletAddr", b.FoundationWalletAddr.Hex())
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if a.SkipV1Validation != b.SkipV1Validation {
|
if a.SkipV1Validation != b.SkipV1Validation {
|
||||||
|
|
@ -674,7 +674,7 @@ func (c *XDPoSConfig) String() string {
|
||||||
return "XDPoSConfig: <nil>"
|
return "XDPoSConfig: <nil>"
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt.Sprintf("XDPoSConfig{Period: %v, Epoch: %v, Reward: %v, RewardCheckpoint: %v, Gap: %v, FoudationWalletAddr: %v, SkipV1Validation: %v, V2: %s}", c.Period, c.Epoch, c.Reward, c.RewardCheckpoint, c.Gap, c.FoudationWalletAddr.String0x(), c.SkipV1Validation, c.V2.String())
|
return fmt.Sprintf("XDPoSConfig{Period: %v, Epoch: %v, Reward: %v, RewardCheckpoint: %v, Gap: %v, FoundationWalletAddr: %v, SkipV1Validation: %v, V2: %s}", c.Period, c.Epoch, c.Reward, c.RewardCheckpoint, c.Gap, c.FoundationWalletAddr.String0x(), c.SkipV1Validation, c.V2.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Description returns a human-readable description of XDPoSConfig
|
// Description returns a human-readable description of XDPoSConfig
|
||||||
|
|
@ -691,7 +691,7 @@ func (c *XDPoSConfig) Description(indent int) string {
|
||||||
banner += fmt.Sprintf("%s- Reward: %v\n", prefix, c.Reward)
|
banner += fmt.Sprintf("%s- Reward: %v\n", prefix, c.Reward)
|
||||||
banner += fmt.Sprintf("%s- RewardCheckpoint: %v\n", prefix, c.RewardCheckpoint)
|
banner += fmt.Sprintf("%s- RewardCheckpoint: %v\n", prefix, c.RewardCheckpoint)
|
||||||
banner += fmt.Sprintf("%s- Gap: %v\n", prefix, c.Gap)
|
banner += fmt.Sprintf("%s- Gap: %v\n", prefix, c.Gap)
|
||||||
banner += fmt.Sprintf("%s- FoudationWalletAddr: %v\n", prefix, c.FoudationWalletAddr.Hex())
|
banner += fmt.Sprintf("%s- FoundationWalletAddr: %v\n", prefix, c.FoundationWalletAddr.Hex())
|
||||||
banner += fmt.Sprintf("%s- SkipV1Validation: %v\n", prefix, c.SkipV1Validation)
|
banner += fmt.Sprintf("%s- SkipV1Validation: %v\n", prefix, c.SkipV1Validation)
|
||||||
banner += fmt.Sprintf("%s- %s", prefix, c.V2.Description(indent+2))
|
banner += fmt.Sprintf("%s- %s", prefix, c.V2.Description(indent+2))
|
||||||
return banner
|
return banner
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue