mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 14:46:42 +00:00
Merge pull request #1068 from maticnetwork/v1.1.0-beta-candidate
Merge V1.1.0 beta candidate to 'develop'
This commit is contained in:
commit
bc338be57b
30 changed files with 160 additions and 92 deletions
File diff suppressed because one or more lines are too long
|
|
@ -381,11 +381,14 @@ func (c *Bor) verifyHeader(chain consensus.ChainHeaderReader, header *types.Head
|
||||||
|
|
||||||
// Verify that the gas limit is <= 2^63-1
|
// Verify that the gas limit is <= 2^63-1
|
||||||
gasCap := uint64(0x7fffffffffffffff)
|
gasCap := uint64(0x7fffffffffffffff)
|
||||||
|
|
||||||
if header.GasLimit > gasCap {
|
if header.GasLimit > gasCap {
|
||||||
return fmt.Errorf("invalid gasLimit: have %v, max %v", header.GasLimit, gasCap)
|
return fmt.Errorf("invalid gasLimit: have %v, max %v", header.GasLimit, gasCap)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if header.WithdrawalsHash != nil {
|
||||||
|
return consensus.ErrUnexpectedWithdrawals
|
||||||
|
}
|
||||||
|
|
||||||
// All basic checks passed, verify cascading fields
|
// All basic checks passed, verify cascading fields
|
||||||
return c.verifyCascadingFields(chain, header, parents)
|
return c.verifyCascadingFields(chain, header, parents)
|
||||||
}
|
}
|
||||||
|
|
@ -816,13 +819,7 @@ func (c *Bor) Finalize(chain consensus.ChainHeaderReader, header *types.Header,
|
||||||
|
|
||||||
headerNumber := header.Number.Uint64()
|
headerNumber := header.Number.Uint64()
|
||||||
|
|
||||||
if len(withdrawals) > 0 {
|
if withdrawals != nil || header.WithdrawalsHash != nil {
|
||||||
log.Error("Bor does not support withdrawals", "number", headerNumber)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if header.WithdrawalsHash != nil {
|
|
||||||
log.Error("Bor does not support withdrawalHash", "number", headerNumber)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -898,18 +895,14 @@ func (c *Bor) FinalizeAndAssemble(ctx context.Context, chain consensus.ChainHead
|
||||||
finalizeCtx, finalizeSpan := tracing.StartSpan(ctx, "bor.FinalizeAndAssemble")
|
finalizeCtx, finalizeSpan := tracing.StartSpan(ctx, "bor.FinalizeAndAssemble")
|
||||||
defer tracing.EndSpan(finalizeSpan)
|
defer tracing.EndSpan(finalizeSpan)
|
||||||
|
|
||||||
if len(withdrawals) > 0 {
|
headerNumber := header.Number.Uint64()
|
||||||
return nil, errors.New("Bor does not support withdrawals")
|
|
||||||
}
|
|
||||||
|
|
||||||
if header.WithdrawalsHash != nil {
|
if withdrawals != nil || header.WithdrawalsHash != nil {
|
||||||
return nil, errors.New("Bor does not support withdrawalHash")
|
return nil, consensus.ErrUnexpectedWithdrawals
|
||||||
}
|
}
|
||||||
|
|
||||||
stateSyncData := []*types.StateSyncData{}
|
stateSyncData := []*types.StateSyncData{}
|
||||||
|
|
||||||
headerNumber := header.Number.Uint64()
|
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
if IsSprintStart(headerNumber, c.config.CalculateSprint(headerNumber)) {
|
if IsSprintStart(headerNumber, c.config.CalculateSprint(headerNumber)) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package statefull
|
package statefull
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"math"
|
"math"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
@ -90,7 +91,11 @@ func ApplyMessage(
|
||||||
|
|
||||||
success := big.NewInt(5).SetBytes(ret)
|
success := big.NewInt(5).SetBytes(ret)
|
||||||
|
|
||||||
if success.Cmp(big.NewInt(0)) == 0 {
|
validatorContract := common.HexToAddress(chainConfig.Bor.ValidatorContract)
|
||||||
|
|
||||||
|
// if success == 0 and msg.To() != validatorContractAddress, log Error
|
||||||
|
// if msg.To() == validatorContractAddress, its committing a span and we don't get any return value
|
||||||
|
if success.Cmp(big.NewInt(0)) == 0 && !bytes.Equal(msg.To().Bytes(), validatorContract.Bytes()) {
|
||||||
log.Error("message execution failed on contract", "msgData", msg.Data)
|
log.Error("message execution failed on contract", "msgData", msg.Data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,4 +38,7 @@ var (
|
||||||
// ErrInvalidTerminalBlock is returned if a block is invalid wrt. the terminal
|
// ErrInvalidTerminalBlock is returned if a block is invalid wrt. the terminal
|
||||||
// total difficulty.
|
// total difficulty.
|
||||||
ErrInvalidTerminalBlock = errors.New("invalid terminal block")
|
ErrInvalidTerminalBlock = errors.New("invalid terminal block")
|
||||||
|
|
||||||
|
// ErrUnexpectedWithdrawals is returned if a pre-Shanghai block has withdrawals.
|
||||||
|
ErrUnexpectedWithdrawals = errors.New("unexpected withdrawals")
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -529,8 +529,8 @@ func (g *Genesis) ToBlock() *types.Block {
|
||||||
var withdrawals []*types.Withdrawal
|
var withdrawals []*types.Withdrawal
|
||||||
|
|
||||||
if g.Config != nil && g.Config.IsShanghai(new(big.Int).SetUint64(g.Number)) {
|
if g.Config != nil && g.Config.IsShanghai(new(big.Int).SetUint64(g.Number)) {
|
||||||
head.WithdrawalsHash = &types.EmptyWithdrawalsHash
|
head.WithdrawalsHash = nil
|
||||||
withdrawals = make([]*types.Withdrawal, 0)
|
withdrawals = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return types.NewBlock(head, nil, nil, nil, trie.NewStackTrie(nil)).WithWithdrawals(withdrawals)
|
return types.NewBlock(head, nil, nil, nil, trie.NewStackTrie(nil)).WithWithdrawals(withdrawals)
|
||||||
|
|
|
||||||
|
|
@ -101,9 +101,13 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
|
||||||
}
|
}
|
||||||
// Fail if Shanghai not enabled and len(withdrawals) is non-zero.
|
// Fail if Shanghai not enabled and len(withdrawals) is non-zero.
|
||||||
withdrawals := block.Withdrawals()
|
withdrawals := block.Withdrawals()
|
||||||
if len(withdrawals) > 0 && !p.config.IsShanghai(block.Number()) {
|
if !p.config.IsShanghai(block.Number()) && withdrawals != nil {
|
||||||
return nil, nil, 0, fmt.Errorf("withdrawals before shanghai")
|
return nil, nil, 0, fmt.Errorf("withdrawals before shanghai")
|
||||||
}
|
}
|
||||||
|
// Bor does not support withdrawals
|
||||||
|
if withdrawals != nil {
|
||||||
|
withdrawals = nil
|
||||||
|
}
|
||||||
// Finalize the block, applying any consensus engine specific extras (e.g. block rewards)
|
// Finalize the block, applying any consensus engine specific extras (e.g. block rewards)
|
||||||
p.engine.Finalize(p.bc, header, statedb, block.Transactions(), block.Uncles(), withdrawals)
|
p.engine.Finalize(p.bc, header, statedb, block.Transactions(), block.Uncles(), withdrawals)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -90,12 +90,15 @@ func newShanghaiInstructionSet() JumpTable {
|
||||||
|
|
||||||
func newMergeInstructionSet() JumpTable {
|
func newMergeInstructionSet() JumpTable {
|
||||||
instructionSet := newLondonInstructionSet()
|
instructionSet := newLondonInstructionSet()
|
||||||
instructionSet[PREVRANDAO] = &operation{
|
|
||||||
execute: opRandom,
|
// disabling in pos due to incompatibility with prevrandao
|
||||||
constantGas: GasQuickStep,
|
|
||||||
minStack: minStack(0, 1),
|
// instructionSet[PREVRANDAO] = &operation{
|
||||||
maxStack: maxStack(0, 1),
|
// execute: opRandom,
|
||||||
}
|
// constantGas: GasQuickStep,
|
||||||
|
// minStack: minStack(0, 1),
|
||||||
|
// maxStack: maxStack(0, 1),
|
||||||
|
// }
|
||||||
|
|
||||||
return validate(instructionSet)
|
return validate(instructionSet)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -277,6 +277,9 @@ func (api *DebugAPI) DumpBlock(blockNr rpc.BlockNumber) (state.Dump, error) {
|
||||||
// both the pending block as well as the pending state from
|
// both the pending block as well as the pending state from
|
||||||
// the miner and operate on those
|
// the miner and operate on those
|
||||||
_, stateDb := api.eth.miner.Pending()
|
_, stateDb := api.eth.miner.Pending()
|
||||||
|
if stateDb == nil {
|
||||||
|
return state.Dump{}, errors.New("pending state is not available")
|
||||||
|
}
|
||||||
return stateDb.RawDump(opts), nil
|
return stateDb.RawDump(opts), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -385,6 +388,9 @@ func (api *DebugAPI) AccountRange(blockNrOrHash rpc.BlockNumberOrHash, start hex
|
||||||
// both the pending block as well as the pending state from
|
// both the pending block as well as the pending state from
|
||||||
// the miner and operate on those
|
// the miner and operate on those
|
||||||
_, stateDb = api.eth.miner.Pending()
|
_, stateDb = api.eth.miner.Pending()
|
||||||
|
if stateDb == nil {
|
||||||
|
return state.IteratorDump{}, errors.New("pending state is not available")
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
var header *types.Header
|
var header *types.Header
|
||||||
if number == rpc.LatestBlockNumber {
|
if number == rpc.LatestBlockNumber {
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,9 @@ func (b *EthAPIBackend) HeaderByNumber(ctx context.Context, number rpc.BlockNumb
|
||||||
// Pending block is only known by the miner
|
// Pending block is only known by the miner
|
||||||
if number == rpc.PendingBlockNumber {
|
if number == rpc.PendingBlockNumber {
|
||||||
block := b.eth.miner.PendingBlock()
|
block := b.eth.miner.PendingBlock()
|
||||||
|
if block == nil {
|
||||||
|
return nil, errors.New("pending block is not available")
|
||||||
|
}
|
||||||
return block.Header(), nil
|
return block.Header(), nil
|
||||||
}
|
}
|
||||||
// Otherwise resolve and return the block
|
// Otherwise resolve and return the block
|
||||||
|
|
@ -136,6 +139,9 @@ func (b *EthAPIBackend) BlockByNumber(ctx context.Context, number rpc.BlockNumbe
|
||||||
// Pending block is only known by the miner
|
// Pending block is only known by the miner
|
||||||
if number == rpc.PendingBlockNumber {
|
if number == rpc.PendingBlockNumber {
|
||||||
block := b.eth.miner.PendingBlock()
|
block := b.eth.miner.PendingBlock()
|
||||||
|
if block == nil {
|
||||||
|
return nil, errors.New("pending block is not available")
|
||||||
|
}
|
||||||
return block, nil
|
return block, nil
|
||||||
}
|
}
|
||||||
// Otherwise resolve and return the block
|
// Otherwise resolve and return the block
|
||||||
|
|
@ -217,6 +223,9 @@ func (b *EthAPIBackend) StateAndHeaderByNumber(ctx context.Context, number rpc.B
|
||||||
// Pending state is only known by the miner
|
// Pending state is only known by the miner
|
||||||
if number == rpc.PendingBlockNumber {
|
if number == rpc.PendingBlockNumber {
|
||||||
block, state := b.eth.miner.Pending()
|
block, state := b.eth.miner.Pending()
|
||||||
|
if block == nil || state == nil {
|
||||||
|
return nil, nil, errors.New("pending state is not available")
|
||||||
|
}
|
||||||
return state, block.Header(), nil
|
return state, block.Header(), nil
|
||||||
}
|
}
|
||||||
// Otherwise resolve the block number and return its state
|
// Otherwise resolve the block number and return its state
|
||||||
|
|
|
||||||
|
|
@ -328,6 +328,9 @@ func (f *Filter) checkMatches(ctx context.Context, header *types.Header) ([]*typ
|
||||||
// pendingLogs returns the logs matching the filter criteria within the pending block.
|
// pendingLogs returns the logs matching the filter criteria within the pending block.
|
||||||
func (f *Filter) pendingLogs() ([]*types.Log, error) {
|
func (f *Filter) pendingLogs() ([]*types.Log, error) {
|
||||||
block, receipts := f.sys.backend.PendingBlockAndReceipts()
|
block, receipts := f.sys.backend.PendingBlockAndReceipts()
|
||||||
|
if block == nil || receipts == nil {
|
||||||
|
return nil, errors.New("pending block is not available")
|
||||||
|
}
|
||||||
if bloomFilter(block.Bloom(), f.addresses, f.topics) {
|
if bloomFilter(block.Bloom(), f.addresses, f.topics) {
|
||||||
var unfiltered []*types.Log
|
var unfiltered []*types.Log
|
||||||
for _, r := range receipts {
|
for _, r := range receipts {
|
||||||
|
|
|
||||||
|
|
@ -367,11 +367,7 @@ func TestGetBlockBodies68(t *testing.T) {
|
||||||
func testGetBlockBodies(t *testing.T, protocol uint) {
|
func testGetBlockBodies(t *testing.T, protocol uint) {
|
||||||
gen := func(n int, g *core.BlockGen) {
|
gen := func(n int, g *core.BlockGen) {
|
||||||
if n%2 == 0 {
|
if n%2 == 0 {
|
||||||
w := &types.Withdrawal{
|
g.AddWithdrawal(&types.Withdrawal{})
|
||||||
Address: common.Address{0xaa},
|
|
||||||
Amount: 42,
|
|
||||||
}
|
|
||||||
g.AddWithdrawal(w)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -41,6 +41,7 @@ func TestFlagsWithoutConfig(t *testing.T) {
|
||||||
|
|
||||||
require.Equal(t, c.config.Identity, "")
|
require.Equal(t, c.config.Identity, "")
|
||||||
require.Equal(t, c.config.DataDir, "./data")
|
require.Equal(t, c.config.DataDir, "./data")
|
||||||
|
require.Equal(t, c.config.KeyStoreDir, "")
|
||||||
require.Equal(t, c.config.Verbosity, 3)
|
require.Equal(t, c.config.Verbosity, 3)
|
||||||
require.Equal(t, c.config.RPCBatchLimit, uint64(0))
|
require.Equal(t, c.config.RPCBatchLimit, uint64(0))
|
||||||
require.Equal(t, c.config.Snapshot, true)
|
require.Equal(t, c.config.Snapshot, true)
|
||||||
|
|
@ -74,6 +75,7 @@ func TestFlagsWithConfig(t *testing.T) {
|
||||||
|
|
||||||
require.Equal(t, c.config.Identity, "")
|
require.Equal(t, c.config.Identity, "")
|
||||||
require.Equal(t, c.config.DataDir, "./data")
|
require.Equal(t, c.config.DataDir, "./data")
|
||||||
|
require.Equal(t, c.config.KeyStoreDir, "./keystore")
|
||||||
require.Equal(t, c.config.Verbosity, 3)
|
require.Equal(t, c.config.Verbosity, 3)
|
||||||
require.Equal(t, c.config.RPCBatchLimit, uint64(0))
|
require.Equal(t, c.config.RPCBatchLimit, uint64(0))
|
||||||
require.Equal(t, c.config.Snapshot, true)
|
require.Equal(t, c.config.Snapshot, true)
|
||||||
|
|
@ -105,6 +107,7 @@ func TestFlagsWithConfigAndFlags(t *testing.T) {
|
||||||
"--config", "./testdata/test.toml",
|
"--config", "./testdata/test.toml",
|
||||||
"--identity", "Anon",
|
"--identity", "Anon",
|
||||||
"--datadir", "",
|
"--datadir", "",
|
||||||
|
"--keystore", "",
|
||||||
"--verbosity", "0",
|
"--verbosity", "0",
|
||||||
"--rpc.batchlimit", "5",
|
"--rpc.batchlimit", "5",
|
||||||
"--snapshot=false",
|
"--snapshot=false",
|
||||||
|
|
@ -128,6 +131,7 @@ func TestFlagsWithConfigAndFlags(t *testing.T) {
|
||||||
|
|
||||||
require.Equal(t, c.config.Identity, "Anon")
|
require.Equal(t, c.config.Identity, "Anon")
|
||||||
require.Equal(t, c.config.DataDir, "")
|
require.Equal(t, c.config.DataDir, "")
|
||||||
|
require.Equal(t, c.config.KeyStoreDir, "")
|
||||||
require.Equal(t, c.config.Verbosity, 0)
|
require.Equal(t, c.config.Verbosity, 0)
|
||||||
require.Equal(t, c.config.RPCBatchLimit, uint64(5))
|
require.Equal(t, c.config.RPCBatchLimit, uint64(5))
|
||||||
require.Equal(t, c.config.Snapshot, false)
|
require.Equal(t, c.config.Snapshot, false)
|
||||||
|
|
|
||||||
|
|
@ -605,6 +605,7 @@ func DefaultConfig() *Config {
|
||||||
DataDir: DefaultDataDir(),
|
DataDir: DefaultDataDir(),
|
||||||
Ancient: "",
|
Ancient: "",
|
||||||
DBEngine: "leveldb",
|
DBEngine: "leveldb",
|
||||||
|
KeyStoreDir: "",
|
||||||
Logging: &LoggingConfig{
|
Logging: &LoggingConfig{
|
||||||
Vmodule: "",
|
Vmodule: "",
|
||||||
Json: false,
|
Json: false,
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ func TestConfigLegacy(t *testing.T) {
|
||||||
|
|
||||||
testConfig.Identity = ""
|
testConfig.Identity = ""
|
||||||
testConfig.DataDir = "./data"
|
testConfig.DataDir = "./data"
|
||||||
|
testConfig.KeyStoreDir = "./keystore"
|
||||||
testConfig.Verbosity = 3
|
testConfig.Verbosity = 3
|
||||||
testConfig.RPCBatchLimit = 0
|
testConfig.RPCBatchLimit = 0
|
||||||
testConfig.Snapshot = true
|
testConfig.Snapshot = true
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@ func (c *Command) Flags(config *Config) *flagset.Flagset {
|
||||||
Name: "keystore",
|
Name: "keystore",
|
||||||
Usage: "Path of the directory where keystores are located",
|
Usage: "Path of the directory where keystores are located",
|
||||||
Value: &c.cliConfig.KeyStoreDir,
|
Value: &c.cliConfig.KeyStoreDir,
|
||||||
|
Default: c.cliConfig.KeyStoreDir,
|
||||||
})
|
})
|
||||||
f.Uint64Flag(&flagset.Uint64Flag{
|
f.Uint64Flag(&flagset.Uint64Flag{
|
||||||
Name: "rpc.batchlimit",
|
Name: "rpc.batchlimit",
|
||||||
|
|
|
||||||
1
internal/cli/server/testdata/test.toml
vendored
1
internal/cli/server/testdata/test.toml
vendored
|
|
@ -1,5 +1,6 @@
|
||||||
identity = ""
|
identity = ""
|
||||||
datadir = "./data"
|
datadir = "./data"
|
||||||
|
keystore = "./keystore"
|
||||||
verbosity = 3
|
verbosity = 3
|
||||||
"rpc.batchlimit" = 0
|
"rpc.batchlimit" = 0
|
||||||
snapshot = true
|
snapshot = true
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,11 @@ func (api *BorAPI) SendRawTransactionConditional(ctx context.Context, input hexu
|
||||||
}
|
}
|
||||||
|
|
||||||
currentHeader := api.b.CurrentHeader()
|
currentHeader := api.b.CurrentHeader()
|
||||||
currentState, _, _ := api.b.StateAndHeaderByNumber(ctx, rpc.BlockNumber(currentHeader.Number.Int64()))
|
currentState, _, err := api.b.StateAndHeaderByNumber(ctx, rpc.BlockNumber(currentHeader.Number.Int64()))
|
||||||
|
|
||||||
|
if currentState == nil || err != nil {
|
||||||
|
return common.Hash{}, err
|
||||||
|
}
|
||||||
|
|
||||||
// check block number range
|
// check block number range
|
||||||
if err := currentHeader.ValidateBlockNumberOptions4337(options.BlockNumberMin, options.BlockNumberMax); err != nil {
|
if err := currentHeader.ValidateBlockNumberOptions4337(options.BlockNumberMin, options.BlockNumberMax); err != nil {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
Source: bor
|
Source: bor
|
||||||
Version: 1.1.0
|
Version: 1.1.0-beta4
|
||||||
Section: develop
|
Section: develop
|
||||||
Priority: standard
|
Priority: standard
|
||||||
Maintainer: Polygon <release-team@polygon.technology>
|
Maintainer: Polygon <release-team@polygon.technology>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
Source: bor
|
Source: bor
|
||||||
Version: 1.1.0
|
Version: 1.1.0-beta4
|
||||||
Section: develop
|
Section: develop
|
||||||
Priority: standard
|
Priority: standard
|
||||||
Maintainer: Polygon <release-team@polygon.technology>
|
Maintainer: Polygon <release-team@polygon.technology>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
Source: bor-profile
|
Source: bor-profile
|
||||||
Version: 1.1.0
|
Version: 1.1.0-beta4
|
||||||
Section: develop
|
Section: develop
|
||||||
Priority: standard
|
Priority: standard
|
||||||
Maintainer: Polygon <release-team@polygon.technology>
|
Maintainer: Polygon <release-team@polygon.technology>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
Source: bor-profile
|
Source: bor-profile
|
||||||
Version: 1.1.0
|
Version: 1.1.0-beta4
|
||||||
Section: develop
|
Section: develop
|
||||||
Priority: standard
|
Priority: standard
|
||||||
Maintainer: Polygon <release-team@polygon.technology>
|
Maintainer: Polygon <release-team@polygon.technology>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
Source: bor-profile
|
Source: bor-profile
|
||||||
Version: 1.1.0
|
Version: 1.1.0-beta4
|
||||||
Section: develop
|
Section: develop
|
||||||
Priority: standard
|
Priority: standard
|
||||||
Maintainer: Polygon <release-team@polygon.technology>
|
Maintainer: Polygon <release-team@polygon.technology>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
Source: bor-profile
|
Source: bor-profile
|
||||||
Version: 1.1.0
|
Version: 1.1.0-beta4
|
||||||
Section: develop
|
Section: develop
|
||||||
Priority: standard
|
Priority: standard
|
||||||
Maintainer: Polygon <release-team@polygon.technology>
|
Maintainer: Polygon <release-team@polygon.technology>
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -22,6 +22,8 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"gotest.tools/assert"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common/math"
|
"github.com/ethereum/go-ethereum/common/math"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -134,3 +136,45 @@ func TestConfigRules(t *testing.T) {
|
||||||
t.Errorf("expected %v to be shanghai", 0)
|
t.Errorf("expected %v to be shanghai", 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestBorKeyValueConfigHelper(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
backupMultiplier := map[string]uint64{
|
||||||
|
"0": 2,
|
||||||
|
"25275000": 5,
|
||||||
|
"29638656": 2,
|
||||||
|
}
|
||||||
|
assert.Equal(t, borKeyValueConfigHelper(backupMultiplier, 0), uint64(2))
|
||||||
|
assert.Equal(t, borKeyValueConfigHelper(backupMultiplier, 1), uint64(2))
|
||||||
|
assert.Equal(t, borKeyValueConfigHelper(backupMultiplier, 25275000-1), uint64(2))
|
||||||
|
assert.Equal(t, borKeyValueConfigHelper(backupMultiplier, 25275000), uint64(5))
|
||||||
|
assert.Equal(t, borKeyValueConfigHelper(backupMultiplier, 25275000+1), uint64(5))
|
||||||
|
assert.Equal(t, borKeyValueConfigHelper(backupMultiplier, 29638656-1), uint64(5))
|
||||||
|
assert.Equal(t, borKeyValueConfigHelper(backupMultiplier, 29638656), uint64(2))
|
||||||
|
assert.Equal(t, borKeyValueConfigHelper(backupMultiplier, 29638656+1), uint64(2))
|
||||||
|
|
||||||
|
config := map[string]uint64{
|
||||||
|
"0": 1,
|
||||||
|
"90000000": 2,
|
||||||
|
"100000000": 3,
|
||||||
|
}
|
||||||
|
assert.Equal(t, borKeyValueConfigHelper(config, 0), uint64(1))
|
||||||
|
assert.Equal(t, borKeyValueConfigHelper(config, 1), uint64(1))
|
||||||
|
assert.Equal(t, borKeyValueConfigHelper(config, 90000000-1), uint64(1))
|
||||||
|
assert.Equal(t, borKeyValueConfigHelper(config, 90000000), uint64(2))
|
||||||
|
assert.Equal(t, borKeyValueConfigHelper(config, 90000000+1), uint64(2))
|
||||||
|
assert.Equal(t, borKeyValueConfigHelper(config, 100000000-1), uint64(2))
|
||||||
|
assert.Equal(t, borKeyValueConfigHelper(config, 100000000), uint64(3))
|
||||||
|
assert.Equal(t, borKeyValueConfigHelper(config, 100000000+1), uint64(3))
|
||||||
|
|
||||||
|
burntContract := map[string]string{
|
||||||
|
"22640000": "0x70bcA57F4579f58670aB2d18Ef16e02C17553C38",
|
||||||
|
"41824608": "0x617b94CCCC2511808A3C9478ebb96f455CF167aA",
|
||||||
|
}
|
||||||
|
assert.Equal(t, borKeyValueConfigHelper(burntContract, 22640000), "0x70bcA57F4579f58670aB2d18Ef16e02C17553C38")
|
||||||
|
assert.Equal(t, borKeyValueConfigHelper(burntContract, 22640000+1), "0x70bcA57F4579f58670aB2d18Ef16e02C17553C38")
|
||||||
|
assert.Equal(t, borKeyValueConfigHelper(burntContract, 41824608-1), "0x70bcA57F4579f58670aB2d18Ef16e02C17553C38")
|
||||||
|
assert.Equal(t, borKeyValueConfigHelper(burntContract, 41824608), "0x617b94CCCC2511808A3C9478ebb96f455CF167aA")
|
||||||
|
assert.Equal(t, borKeyValueConfigHelper(burntContract, 41824608+1), "0x617b94CCCC2511808A3C9478ebb96f455CF167aA")
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ const (
|
||||||
VersionMajor = 1 // Major version component of the current release
|
VersionMajor = 1 // Major version component of the current release
|
||||||
VersionMinor = 1 // Minor version component of the current release
|
VersionMinor = 1 // Minor version component of the current release
|
||||||
VersionPatch = 0 // Patch version component of the current release
|
VersionPatch = 0 // Patch version component of the current release
|
||||||
VersionMeta = "beta" // Version metadata to append to the version string
|
VersionMeta = "beta4" // Version metadata to append to the version string
|
||||||
)
|
)
|
||||||
|
|
||||||
var GitCommit string
|
var GitCommit string
|
||||||
|
|
|
||||||
|
|
@ -220,7 +220,11 @@ func buildNextBlock(t *testing.T, _bor consensus.Engine, chain *core.BlockChain,
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
// Finalize and seal the block
|
// Finalize and seal the block
|
||||||
block, _ := _bor.FinalizeAndAssemble(ctx, chain, b.header, state, b.txs, nil, b.receipts, []*types.Withdrawal{})
|
block, err := _bor.FinalizeAndAssemble(ctx, chain, b.header, state, b.txs, nil, b.receipts, nil)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
panic(fmt.Sprintf("error finalizing block: %v", err))
|
||||||
|
}
|
||||||
|
|
||||||
// Write state changes to db
|
// Write state changes to db
|
||||||
root, err := state.Commit(chain.Config().IsEIP158(b.header.Number))
|
root, err := state.Commit(chain.Config().IsEIP158(b.header.Number))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue