mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 23:26:44 +00:00
v0.3.6 fix (#787)
* Fix get validator set in header verifier * chg : commit tx logs from info to debug (#673) * chg : commit tx logs from info to debug * fix : minor changes * chg : miner : commitTransactions-stats moved from info to debug * lint : fix linters * refactor logging * miner : chg : UnauthorizedSignerError to debug * lint : fix lint * fix : log.Logger interface compatibility --------- Co-authored-by: Evgeny Danienko <6655321@bk.ru> * Remove unnecessary sorting of valset from header in verification * dev: chg: version bump --------- Co-authored-by: SHIVAM SHARMA <shivam691999@gmail.com> Co-authored-by: Evgeny Danienko <6655321@bk.ru> Co-authored-by: marcello33 <marcelloardizzone@hotmail.it>
This commit is contained in:
parent
92cd006df9
commit
72a222091c
19 changed files with 197 additions and 51 deletions
|
|
@ -464,18 +464,10 @@ func (c *Bor) verifyCascadingFields(chain consensus.ChainHeaderReader, header *t
|
|||
|
||||
// Verify the validator list match the local contract
|
||||
if IsSprintStart(number+1, c.config.CalculateSprint(number)) {
|
||||
parentBlockNumber := number - 1
|
||||
|
||||
var newValidators []*valset.Validator
|
||||
|
||||
var err error
|
||||
|
||||
for newValidators, err = c.spanner.GetCurrentValidators(context.Background(), chain.GetHeaderByNumber(parentBlockNumber).Hash(), number+1); err != nil && parentBlockNumber > 0; {
|
||||
parentBlockNumber--
|
||||
}
|
||||
newValidators, err := c.spanner.GetCurrentValidatorsByBlockNrOrHash(context.Background(), rpc.BlockNumberOrHashWithNumber(rpc.LatestBlockNumber), number+1)
|
||||
|
||||
if err != nil {
|
||||
return errUnknownValidators
|
||||
return err
|
||||
}
|
||||
|
||||
sort.Sort(valset.ValidatorsByAddress(newValidators))
|
||||
|
|
@ -486,8 +478,6 @@ func (c *Bor) verifyCascadingFields(chain consensus.ChainHeaderReader, header *t
|
|||
return err
|
||||
}
|
||||
|
||||
sort.Sort(valset.ValidatorsByAddress(headerVals))
|
||||
|
||||
if len(newValidators) != len(headerVals) {
|
||||
return errInvalidSpanValidators
|
||||
}
|
||||
|
|
@ -563,7 +553,7 @@ func (c *Bor) snapshot(chain consensus.ChainHeaderReader, number uint64, hash co
|
|||
hash := checkpoint.Hash()
|
||||
|
||||
// get validators and current span
|
||||
validators, err := c.spanner.GetCurrentValidators(context.Background(), hash, number+1)
|
||||
validators, err := c.spanner.GetCurrentValidatorsByHash(context.Background(), hash, number+1)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -733,7 +723,7 @@ func (c *Bor) Prepare(chain consensus.ChainHeaderReader, header *types.Header) e
|
|||
|
||||
// get validator set if number
|
||||
if IsSprintStart(number+1, c.config.CalculateSprint(number)) {
|
||||
newValidators, err := c.spanner.GetCurrentValidators(context.Background(), header.ParentHash, number+1)
|
||||
newValidators, err := c.spanner.GetCurrentValidatorsByHash(context.Background(), header.ParentHash, number+1)
|
||||
if err != nil {
|
||||
return errUnknownValidators
|
||||
}
|
||||
|
|
@ -1263,7 +1253,7 @@ func (c *Bor) SetHeimdallClient(h IHeimdallClient) {
|
|||
}
|
||||
|
||||
func (c *Bor) GetCurrentValidators(ctx context.Context, headerHash common.Hash, blockNumber uint64) ([]*valset.Validator, error) {
|
||||
return c.spanner.GetCurrentValidators(ctx, headerHash, blockNumber)
|
||||
return c.spanner.GetCurrentValidatorsByHash(ctx, headerHash, blockNumber)
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ func (c *ChainSpanner) GetCurrentSpan(ctx context.Context, headerHash common.Has
|
|||
}
|
||||
|
||||
// GetCurrentValidators get current validators
|
||||
func (c *ChainSpanner) GetCurrentValidators(ctx context.Context, headerHash common.Hash, blockNumber uint64) ([]*valset.Validator, error) {
|
||||
func (c *ChainSpanner) GetCurrentValidatorsByBlockNrOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash, blockNumber uint64) ([]*valset.Validator, error) {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
|
||||
|
|
@ -107,14 +107,11 @@ func (c *ChainSpanner) GetCurrentValidators(ctx context.Context, headerHash comm
|
|||
toAddress := c.validatorContractAddress
|
||||
gas := (hexutil.Uint64)(uint64(math.MaxUint64 / 2))
|
||||
|
||||
// block
|
||||
blockNr := rpc.BlockNumberOrHashWithHash(headerHash, false)
|
||||
|
||||
result, err := c.ethAPI.Call(ctx, ethapi.TransactionArgs{
|
||||
Gas: &gas,
|
||||
To: &toAddress,
|
||||
Data: &msgData,
|
||||
}, blockNr, nil)
|
||||
}, blockNrOrHash, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -144,6 +141,12 @@ func (c *ChainSpanner) GetCurrentValidators(ctx context.Context, headerHash comm
|
|||
return valz, nil
|
||||
}
|
||||
|
||||
func (c *ChainSpanner) GetCurrentValidatorsByHash(ctx context.Context, headerHash common.Hash, blockNumber uint64) ([]*valset.Validator, error) {
|
||||
blockNr := rpc.BlockNumberOrHashWithHash(headerHash, false)
|
||||
|
||||
return c.GetCurrentValidatorsByBlockNrOrHash(ctx, blockNr, blockNumber)
|
||||
}
|
||||
|
||||
const method = "commitSpan"
|
||||
|
||||
func (c *ChainSpanner) CommitSpan(ctx context.Context, heimdallSpan HeimdallSpan, state *state.StateDB, header *types.Header, chainContext core.ChainContext) error {
|
||||
|
|
|
|||
|
|
@ -9,11 +9,13 @@ import (
|
|||
"github.com/ethereum/go-ethereum/core"
|
||||
"github.com/ethereum/go-ethereum/core/state"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/rpc"
|
||||
)
|
||||
|
||||
//go:generate mockgen -destination=./span_mock.go -package=bor . Spanner
|
||||
type Spanner interface {
|
||||
GetCurrentSpan(ctx context.Context, headerHash common.Hash) (*span.Span, error)
|
||||
GetCurrentValidators(ctx context.Context, headerHash common.Hash, blockNumber uint64) ([]*valset.Validator, error)
|
||||
GetCurrentValidatorsByHash(ctx context.Context, headerHash common.Hash, blockNumber uint64) ([]*valset.Validator, error)
|
||||
GetCurrentValidatorsByBlockNrOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash, blockNumber uint64) ([]*valset.Validator, error)
|
||||
CommitSpan(ctx context.Context, heimdallSpan span.HeimdallSpan, state *state.StateDB, header *types.Header, chainContext core.ChainContext) error
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: github.com/ethereum/go-ethereum/consensus/bor (interfaces: Spanner)
|
||||
// Source: consensus/bor/span.go
|
||||
|
||||
// Package bor is a generated GoMock package.
|
||||
package bor
|
||||
|
|
@ -14,6 +14,7 @@ import (
|
|||
core "github.com/ethereum/go-ethereum/core"
|
||||
state "github.com/ethereum/go-ethereum/core/state"
|
||||
types "github.com/ethereum/go-ethereum/core/types"
|
||||
rpc "github.com/ethereum/go-ethereum/rpc"
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
)
|
||||
|
||||
|
|
@ -41,45 +42,60 @@ func (m *MockSpanner) EXPECT() *MockSpannerMockRecorder {
|
|||
}
|
||||
|
||||
// CommitSpan mocks base method.
|
||||
func (m *MockSpanner) CommitSpan(arg0 context.Context, arg1 span.HeimdallSpan, arg2 *state.StateDB, arg3 *types.Header, arg4 core.ChainContext) error {
|
||||
func (m *MockSpanner) CommitSpan(ctx context.Context, heimdallSpan span.HeimdallSpan, state *state.StateDB, header *types.Header, chainContext core.ChainContext) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "CommitSpan", arg0, arg1, arg2, arg3, arg4)
|
||||
ret := m.ctrl.Call(m, "CommitSpan", ctx, heimdallSpan, state, header, chainContext)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// CommitSpan indicates an expected call of CommitSpan.
|
||||
func (mr *MockSpannerMockRecorder) CommitSpan(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call {
|
||||
func (mr *MockSpannerMockRecorder) CommitSpan(ctx, heimdallSpan, state, header, chainContext interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CommitSpan", reflect.TypeOf((*MockSpanner)(nil).CommitSpan), arg0, arg1, arg2, arg3, arg4)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CommitSpan", reflect.TypeOf((*MockSpanner)(nil).CommitSpan), ctx, heimdallSpan, state, header, chainContext)
|
||||
}
|
||||
|
||||
// GetCurrentSpan mocks base method.
|
||||
func (m *MockSpanner) GetCurrentSpan(arg0 context.Context, arg1 common.Hash) (*span.Span, error) {
|
||||
func (m *MockSpanner) GetCurrentSpan(ctx context.Context, headerHash common.Hash) (*span.Span, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetCurrentSpan", arg0, arg1)
|
||||
ret := m.ctrl.Call(m, "GetCurrentSpan", ctx, headerHash)
|
||||
ret0, _ := ret[0].(*span.Span)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetCurrentSpan indicates an expected call of GetCurrentSpan.
|
||||
func (mr *MockSpannerMockRecorder) GetCurrentSpan(arg0, arg1 interface{}) *gomock.Call {
|
||||
func (mr *MockSpannerMockRecorder) GetCurrentSpan(ctx, headerHash interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCurrentSpan", reflect.TypeOf((*MockSpanner)(nil).GetCurrentSpan), arg0, arg1)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCurrentSpan", reflect.TypeOf((*MockSpanner)(nil).GetCurrentSpan), ctx, headerHash)
|
||||
}
|
||||
|
||||
// GetCurrentValidators mocks base method.
|
||||
func (m *MockSpanner) GetCurrentValidators(arg0 context.Context, arg1 common.Hash, arg2 uint64) ([]*valset.Validator, error) {
|
||||
// GetCurrentValidatorsByBlockNrOrHash mocks base method.
|
||||
func (m *MockSpanner) GetCurrentValidatorsByBlockNrOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash, blockNumber uint64) ([]*valset.Validator, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetCurrentValidators", arg0, arg1, arg2)
|
||||
ret := m.ctrl.Call(m, "GetCurrentValidatorsByBlockNrOrHash", ctx, blockNrOrHash, blockNumber)
|
||||
ret0, _ := ret[0].([]*valset.Validator)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetCurrentValidators indicates an expected call of GetCurrentValidators.
|
||||
func (mr *MockSpannerMockRecorder) GetCurrentValidators(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||
// GetCurrentValidatorsByBlockNrOrHash indicates an expected call of GetCurrentValidatorsByBlockNrOrHash.
|
||||
func (mr *MockSpannerMockRecorder) GetCurrentValidatorsByBlockNrOrHash(ctx, blockNrOrHash, blockNumber interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCurrentValidators", reflect.TypeOf((*MockSpanner)(nil).GetCurrentValidators), arg0, arg1, arg2)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCurrentValidatorsByBlockNrOrHash", reflect.TypeOf((*MockSpanner)(nil).GetCurrentValidatorsByBlockNrOrHash), ctx, blockNrOrHash, blockNumber)
|
||||
}
|
||||
|
||||
// GetCurrentValidatorsByHash mocks base method.
|
||||
func (m *MockSpanner) GetCurrentValidatorsByHash(ctx context.Context, headerHash common.Hash, blockNumber uint64) ([]*valset.Validator, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetCurrentValidatorsByHash", ctx, headerHash, blockNumber)
|
||||
ret0, _ := ret[0].([]*valset.Validator)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetCurrentValidatorsByHash indicates an expected call of GetCurrentValidatorsByHash.
|
||||
func (mr *MockSpannerMockRecorder) GetCurrentValidatorsByHash(ctx, headerHash, blockNumber interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCurrentValidatorsByHash", reflect.TypeOf((*MockSpanner)(nil).GetCurrentValidatorsByHash), ctx, headerHash, blockNumber)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1796,7 +1796,7 @@ func testRepair(t *testing.T, tt *rewindTest, snapshots bool) {
|
|||
ethAPIMock.EXPECT().Call(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes()
|
||||
|
||||
spanner := bor.NewMockSpanner(ctrl)
|
||||
spanner.EXPECT().GetCurrentValidators(gomock.Any(), gomock.Any(), gomock.Any()).Return([]*valset.Validator{
|
||||
spanner.EXPECT().GetCurrentValidatorsByHash(gomock.Any(), gomock.Any(), gomock.Any()).Return([]*valset.Validator{
|
||||
{
|
||||
ID: 0,
|
||||
Address: miner.TestBankAddress,
|
||||
|
|
|
|||
|
|
@ -148,3 +148,35 @@ func (l *logger) flush() {
|
|||
}
|
||||
l.h.buf = nil
|
||||
}
|
||||
|
||||
func (l *logger) OnTrace(fn func(l log.Logging)) {
|
||||
if l.GetHandler().Level() >= log.LvlTrace {
|
||||
fn(l.Trace)
|
||||
}
|
||||
}
|
||||
|
||||
func (l *logger) OnDebug(fn func(l log.Logging)) {
|
||||
if l.GetHandler().Level() >= log.LvlDebug {
|
||||
fn(l.Debug)
|
||||
}
|
||||
}
|
||||
func (l *logger) OnInfo(fn func(l log.Logging)) {
|
||||
if l.GetHandler().Level() >= log.LvlInfo {
|
||||
fn(l.Info)
|
||||
}
|
||||
}
|
||||
func (l *logger) OnWarn(fn func(l log.Logging)) {
|
||||
if l.GetHandler().Level() >= log.LvlWarn {
|
||||
fn(l.Warn)
|
||||
}
|
||||
}
|
||||
func (l *logger) OnError(fn func(l log.Logging)) {
|
||||
if l.GetHandler().Level() >= log.LvlError {
|
||||
fn(l.Error)
|
||||
}
|
||||
}
|
||||
func (l *logger) OnCrit(fn func(l log.Logging)) {
|
||||
if l.GetHandler().Level() >= log.LvlCrit {
|
||||
fn(l.Crit)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,6 +106,8 @@ type RecordKeyNames struct {
|
|||
Ctx string
|
||||
}
|
||||
|
||||
type Logging func(msg string, ctx ...interface{})
|
||||
|
||||
// A Logger writes key/value pairs to a Handler
|
||||
type Logger interface {
|
||||
// New returns a new Logger that has this logger's context plus the given context
|
||||
|
|
@ -124,6 +126,13 @@ type Logger interface {
|
|||
Warn(msg string, ctx ...interface{})
|
||||
Error(msg string, ctx ...interface{})
|
||||
Crit(msg string, ctx ...interface{})
|
||||
|
||||
OnTrace(func(l Logging))
|
||||
OnDebug(func(l Logging))
|
||||
OnInfo(func(l Logging))
|
||||
OnWarn(func(l Logging))
|
||||
OnError(func(l Logging))
|
||||
OnCrit(func(l Logging))
|
||||
}
|
||||
|
||||
type logger struct {
|
||||
|
|
@ -198,6 +207,38 @@ func (l *logger) SetHandler(h Handler) {
|
|||
l.h.Swap(h)
|
||||
}
|
||||
|
||||
func (l *logger) OnTrace(fn func(l Logging)) {
|
||||
if l.GetHandler().Level() >= LvlTrace {
|
||||
fn(l.Trace)
|
||||
}
|
||||
}
|
||||
|
||||
func (l *logger) OnDebug(fn func(l Logging)) {
|
||||
if l.GetHandler().Level() >= LvlDebug {
|
||||
fn(l.Debug)
|
||||
}
|
||||
}
|
||||
func (l *logger) OnInfo(fn func(l Logging)) {
|
||||
if l.GetHandler().Level() >= LvlInfo {
|
||||
fn(l.Info)
|
||||
}
|
||||
}
|
||||
func (l *logger) OnWarn(fn func(l Logging)) {
|
||||
if l.GetHandler().Level() >= LvlWarn {
|
||||
fn(l.Warn)
|
||||
}
|
||||
}
|
||||
func (l *logger) OnError(fn func(l Logging)) {
|
||||
if l.GetHandler().Level() >= LvlError {
|
||||
fn(l.Error)
|
||||
}
|
||||
}
|
||||
func (l *logger) OnCrit(fn func(l Logging)) {
|
||||
if l.GetHandler().Level() >= LvlCrit {
|
||||
fn(l.Crit)
|
||||
}
|
||||
}
|
||||
|
||||
func normalize(ctx []interface{}) []interface{} {
|
||||
// if the caller passed a Ctx object, then expand it
|
||||
if len(ctx) == 1 {
|
||||
|
|
|
|||
32
log/root.go
32
log/root.go
|
|
@ -60,6 +60,38 @@ func Crit(msg string, ctx ...interface{}) {
|
|||
os.Exit(1)
|
||||
}
|
||||
|
||||
func OnTrace(fn func(l Logging)) {
|
||||
if root.GetHandler().Level() >= LvlTrace {
|
||||
fn(root.Trace)
|
||||
}
|
||||
}
|
||||
|
||||
func OnDebug(fn func(l Logging)) {
|
||||
if root.GetHandler().Level() >= LvlDebug {
|
||||
fn(root.Debug)
|
||||
}
|
||||
}
|
||||
func OnInfo(fn func(l Logging)) {
|
||||
if root.GetHandler().Level() >= LvlInfo {
|
||||
fn(root.Info)
|
||||
}
|
||||
}
|
||||
func OnWarn(fn func(l Logging)) {
|
||||
if root.GetHandler().Level() >= LvlWarn {
|
||||
fn(root.Warn)
|
||||
}
|
||||
}
|
||||
func OnError(fn func(l Logging)) {
|
||||
if root.GetHandler().Level() >= LvlError {
|
||||
fn(root.Error)
|
||||
}
|
||||
}
|
||||
func OnCrit(fn func(l Logging)) {
|
||||
if root.GetHandler().Level() >= LvlCrit {
|
||||
fn(root.Crit)
|
||||
}
|
||||
}
|
||||
|
||||
// Output is a convenient alias for write, allowing for the modification of
|
||||
// the calldepth (number of stack frames to skip).
|
||||
// calldepth influences the reported line number of the log message.
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ func NewBorDefaultMiner(t *testing.T) *DefaultBorMiner {
|
|||
ethAPI.EXPECT().Call(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes()
|
||||
|
||||
spanner := bor.NewMockSpanner(ctrl)
|
||||
spanner.EXPECT().GetCurrentValidators(gomock.Any(), gomock.Any(), gomock.Any()).Return([]*valset.Validator{
|
||||
spanner.EXPECT().GetCurrentValidatorsByHash(gomock.Any(), gomock.Any(), gomock.Any()).Return([]*valset.Validator{
|
||||
{
|
||||
ID: 0,
|
||||
Address: common.Address{0x1},
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ import (
|
|||
cmath "github.com/ethereum/go-ethereum/common/math"
|
||||
"github.com/ethereum/go-ethereum/common/tracing"
|
||||
"github.com/ethereum/go-ethereum/consensus"
|
||||
"github.com/ethereum/go-ethereum/consensus/bor"
|
||||
"github.com/ethereum/go-ethereum/consensus/misc"
|
||||
"github.com/ethereum/go-ethereum/core"
|
||||
"github.com/ethereum/go-ethereum/core/state"
|
||||
|
|
@ -946,6 +947,22 @@ func (w *worker) commitTransactions(env *environment, txs *types.TransactionsByP
|
|||
}
|
||||
var coalescedLogs []*types.Log
|
||||
|
||||
initialGasLimit := env.gasPool.Gas()
|
||||
initialTxs := txs.GetTxs()
|
||||
|
||||
var breakCause string
|
||||
|
||||
defer func() {
|
||||
log.OnDebug(func(lg log.Logging) {
|
||||
lg("commitTransactions-stats",
|
||||
"initialTxsCount", initialTxs,
|
||||
"initialGasLimit", initialGasLimit,
|
||||
"resultTxsCount", txs.GetTxs(),
|
||||
"resultGapPool", env.gasPool.Gas(),
|
||||
"exitCause", breakCause)
|
||||
})
|
||||
}()
|
||||
|
||||
for {
|
||||
// In the following three cases, we will interrupt the execution of the transaction.
|
||||
// (1) new head block event arrival, the interrupt signal is 1
|
||||
|
|
@ -993,7 +1010,11 @@ func (w *worker) commitTransactions(env *environment, txs *types.TransactionsByP
|
|||
// Start executing the transaction
|
||||
env.state.Prepare(tx.Hash(), env.tcount)
|
||||
|
||||
start := time.Now()
|
||||
var start time.Time
|
||||
|
||||
log.OnDebug(func(log.Logging) {
|
||||
start = time.Now()
|
||||
})
|
||||
|
||||
logs, err := w.commitTransaction(env, tx)
|
||||
|
||||
|
|
@ -1018,7 +1039,10 @@ func (w *worker) commitTransactions(env *environment, txs *types.TransactionsByP
|
|||
coalescedLogs = append(coalescedLogs, logs...)
|
||||
env.tcount++
|
||||
txs.Shift()
|
||||
log.Info("Committed new tx", "tx hash", tx.Hash(), "from", from, "to", tx.To(), "nonce", tx.Nonce(), "gas", tx.Gas(), "gasPrice", tx.GasPrice(), "value", tx.Value(), "time spent", time.Since(start))
|
||||
|
||||
log.OnDebug(func(lg log.Logging) {
|
||||
lg("Committed new tx", "tx hash", tx.Hash(), "from", from, "to", tx.To(), "nonce", tx.Nonce(), "gas", tx.Gas(), "gasPrice", tx.GasPrice(), "value", tx.Value(), "time spent", time.Since(start))
|
||||
})
|
||||
|
||||
case errors.Is(err, core.ErrTxTypeNotSupported):
|
||||
// Pop the unsupported transaction without shifting in the next from the account
|
||||
|
|
@ -1117,7 +1141,12 @@ func (w *worker) prepareWork(genParams *generateParams) (*environment, error) {
|
|||
}
|
||||
// Run the consensus preparation with the default or customized consensus engine.
|
||||
if err := w.engine.Prepare(w.chain, header); err != nil {
|
||||
log.Error("Failed to prepare header for sealing", "err", err)
|
||||
switch err.(type) {
|
||||
case *bor.UnauthorizedSignerError:
|
||||
log.Debug("Failed to prepare header for sealing", "err", err)
|
||||
default:
|
||||
log.Error("Failed to prepare header for sealing", "err", err)
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
// Could potentially happen if starting to mine in an odd state.
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ func testGenerateBlockAndImport(t *testing.T, isClique bool, isBor bool) {
|
|||
ethAPIMock.EXPECT().Call(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes()
|
||||
|
||||
spanner := bor.NewMockSpanner(ctrl)
|
||||
spanner.EXPECT().GetCurrentValidators(gomock.Any(), gomock.Any(), gomock.Any()).Return([]*valset.Validator{
|
||||
spanner.EXPECT().GetCurrentValidatorsByHash(gomock.Any(), gomock.Any(), gomock.Any()).Return([]*valset.Validator{
|
||||
{
|
||||
ID: 0,
|
||||
Address: TestBankAddress,
|
||||
|
|
@ -622,7 +622,7 @@ func BenchmarkBorMining(b *testing.B) {
|
|||
ethAPIMock.EXPECT().Call(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes()
|
||||
|
||||
spanner := bor.NewMockSpanner(ctrl)
|
||||
spanner.EXPECT().GetCurrentValidators(gomock.Any(), gomock.Any(), gomock.Any()).Return([]*valset.Validator{
|
||||
spanner.EXPECT().GetCurrentValidatorsByHash(gomock.Any(), gomock.Any(), gomock.Any()).Return([]*valset.Validator{
|
||||
{
|
||||
ID: 0,
|
||||
Address: TestBankAddress,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
Source: bor
|
||||
Version: 0.3.6
|
||||
Version: 0.3.7
|
||||
Section: develop
|
||||
Priority: standard
|
||||
Maintainer: Polygon <release-team@polygon.technology>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
Source: bor
|
||||
Version: 0.3.6
|
||||
Version: 0.3.7
|
||||
Section: develop
|
||||
Priority: standard
|
||||
Maintainer: Polygon <release-team@polygon.technology>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
Source: bor-profile
|
||||
Version: 0.3.6
|
||||
Version: 0.3.7
|
||||
Section: develop
|
||||
Priority: standard
|
||||
Maintainer: Polygon <release-team@polygon.technology>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
Source: bor-profile
|
||||
Version: 0.3.6
|
||||
Version: 0.3.7
|
||||
Section: develop
|
||||
Priority: standard
|
||||
Maintainer: Polygon <release-team@polygon.technology>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
Source: bor-profile
|
||||
Version: 0.3.6
|
||||
Version: 0.3.7
|
||||
Section: develop
|
||||
Priority: standard
|
||||
Maintainer: Polygon <release-team@polygon.technology>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
Source: bor-profile
|
||||
Version: 0.3.6
|
||||
Version: 0.3.7
|
||||
Section: develop
|
||||
Priority: standard
|
||||
Maintainer: Polygon <release-team@polygon.technology>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import (
|
|||
const (
|
||||
VersionMajor = 0 // Major version component of the current release
|
||||
VersionMinor = 3 // Minor version component of the current release
|
||||
VersionPatch = 6 // Patch version component of the current release
|
||||
VersionPatch = 7 // Patch version component of the current release
|
||||
VersionMeta = "stable" // Version metadata to append to the version string
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -356,7 +356,8 @@ func getMockedSpanner(t *testing.T, validators []*valset.Validator) *bor.MockSpa
|
|||
t.Helper()
|
||||
|
||||
spanner := bor.NewMockSpanner(gomock.NewController(t))
|
||||
spanner.EXPECT().GetCurrentValidators(gomock.Any(), gomock.Any(), gomock.Any()).Return(validators, nil).AnyTimes()
|
||||
spanner.EXPECT().GetCurrentValidatorsByHash(gomock.Any(), gomock.Any(), gomock.Any()).Return(validators, nil).AnyTimes()
|
||||
spanner.EXPECT().GetCurrentValidatorsByBlockNrOrHash(gomock.Any(), gomock.Any(), gomock.Any()).Return(validators, nil).AnyTimes()
|
||||
spanner.EXPECT().GetCurrentSpan(gomock.Any(), gomock.Any()).Return(&span.Span{0, 0, 0}, nil).AnyTimes()
|
||||
spanner.EXPECT().CommitSpan(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
|
||||
return spanner
|
||||
|
|
|
|||
Loading…
Reference in a new issue