Skip to content

Commit 3475305

Browse files
authored
Merge pull request #43 from blocknative/1.1.0
Merge v1.1.0
2 parents 94e8d5c + 1ec8d6a commit 3475305

18 files changed

Lines changed: 129 additions & 81 deletions

File tree

builder/files/genesis-mainnet-v1.json

Lines changed: 9 additions & 1 deletion
Large diffs are not rendered by default.

consensus/bor/bor.go

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,6 @@ func encodeSigHeader(w io.Writer, header *types.Header, c *params.BorConfig) {
172172
}
173173
}
174174

175-
if header.WithdrawalsHash != nil {
176-
header.WithdrawalsHash = nil
177-
178-
log.Warn("Bor does not support withdrawals", "number", header.Number)
179-
}
180-
181175
if err := rlp.Encode(w, enc); err != nil {
182176
panic("can't encode: " + err.Error())
183177
}
@@ -387,11 +381,14 @@ func (c *Bor) verifyHeader(chain consensus.ChainHeaderReader, header *types.Head
387381

388382
// Verify that the gas limit is <= 2^63-1
389383
gasCap := uint64(0x7fffffffffffffff)
390-
391384
if header.GasLimit > gasCap {
392385
return fmt.Errorf("invalid gasLimit: have %v, max %v", header.GasLimit, gasCap)
393386
}
394387

388+
if header.WithdrawalsHash != nil {
389+
return consensus.ErrUnexpectedWithdrawals
390+
}
391+
395392
// All basic checks passed, verify cascading fields
396393
return c.verifyCascadingFields(chain, header, parents)
397394
}
@@ -823,10 +820,7 @@ func (c *Bor) Finalize(chain consensus.ChainHeaderReader, header *types.Header,
823820
headerNumber := header.Number.Uint64()
824821

825822
if withdrawals != nil || header.WithdrawalsHash != nil {
826-
// withdrawals = nil is not required because withdrawals are not used
827-
header.WithdrawalsHash = nil
828-
829-
log.Warn("Bor does not support withdrawals", "number", headerNumber)
823+
return
830824
}
831825

832826
if IsSprintStart(headerNumber, c.config.CalculateSprint(headerNumber)) {
@@ -904,10 +898,7 @@ func (c *Bor) FinalizeAndAssemble(ctx context.Context, chain consensus.ChainHead
904898
headerNumber := header.Number.Uint64()
905899

906900
if withdrawals != nil || header.WithdrawalsHash != nil {
907-
// withdrawals != nil not required because withdrawals are not used
908-
header.WithdrawalsHash = nil
909-
910-
log.Warn("Bor does not support withdrawals", "number", headerNumber)
901+
return nil, consensus.ErrUnexpectedWithdrawals
911902
}
912903

913904
stateSyncData := []*types.StateSyncData{}

consensus/bor/statefull/processor.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package statefull
22

33
import (
4+
"bytes"
45
"context"
56
"math"
67
"math/big"
@@ -90,7 +91,11 @@ func ApplyMessage(
9091

9192
success := big.NewInt(5).SetBytes(ret)
9293

93-
if success.Cmp(big.NewInt(0)) == 0 {
94+
validatorContract := common.HexToAddress(chainConfig.Bor.ValidatorContract)
95+
96+
// if success == 0 and msg.To() != validatorContractAddress, log Error
97+
// if msg.To() == validatorContractAddress, its committing a span and we don't get any return value
98+
if success.Cmp(big.NewInt(0)) == 0 && !bytes.Equal(msg.To().Bytes(), validatorContract.Bytes()) {
9499
log.Error("message execution failed on contract", "msgData", msg.Data)
95100
}
96101

consensus/errors.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,7 @@ var (
3838
// ErrInvalidTerminalBlock is returned if a block is invalid wrt. the terminal
3939
// total difficulty.
4040
ErrInvalidTerminalBlock = errors.New("invalid terminal block")
41+
42+
// ErrUnexpectedWithdrawals is returned if a pre-Shanghai block has withdrawals.
43+
ErrUnexpectedWithdrawals = errors.New("unexpected withdrawals")
4144
)

core/vm/jump_table.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,15 @@ func newShanghaiInstructionSet() JumpTable {
9090

9191
func newMergeInstructionSet() JumpTable {
9292
instructionSet := newLondonInstructionSet()
93-
instructionSet[PREVRANDAO] = &operation{
94-
execute: opRandom,
95-
constantGas: GasQuickStep,
96-
minStack: minStack(0, 1),
97-
maxStack: maxStack(0, 1),
98-
}
93+
94+
// disabling in pos due to incompatibility with prevrandao
95+
96+
// instructionSet[PREVRANDAO] = &operation{
97+
// execute: opRandom,
98+
// constantGas: GasQuickStep,
99+
// minStack: minStack(0, 1),
100+
// maxStack: maxStack(0, 1),
101+
// }
99102

100103
return validate(instructionSet)
101104
}

eth/tracers/api.go

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,8 +1392,6 @@ func (api *API) traceTx(ctx context.Context, message *core.Message, txctx *Conte
13921392
// Call Prepare to clear out the statedb access list
13931393
statedb.SetTxContext(txctx.TxHash, txctx.TxIndex)
13941394

1395-
var result *core.ExecutionResult
1396-
13971395
if config.BorTx == nil {
13981396
config.BorTx = newBoolPtr(false)
13991397
}
@@ -1414,17 +1412,7 @@ func (api *API) traceTx(ctx context.Context, message *core.Message, txctx *Conte
14141412
// Depending on the tracer type, format and return the output.
14151413
switch tracer := tracer.(type) {
14161414
case *logger.StructLogger:
1417-
// If the result contains a revert reason, return it.
1418-
returnVal := fmt.Sprintf("%x", result.Return())
1419-
if len(result.Revert()) > 0 {
1420-
returnVal = fmt.Sprintf("%x", result.Revert())
1421-
}
1422-
return &ethapi.ExecutionResult{
1423-
Gas: result.UsedGas,
1424-
Failed: result.Failed(),
1425-
ReturnValue: returnVal,
1426-
StructLogs: ethapi.FormatLogs(tracer.StructLogs()),
1427-
}, nil
1415+
return tracer.GetResult()
14281416

14291417
case Tracer:
14301418
return tracer.GetResult()

internal/cli/server/chains/mainnet.go

Lines changed: 8 additions & 0 deletions
Large diffs are not rendered by default.

internal/ethapi/transaction_args_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,10 @@ func (b *backendMock) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent)
361361
return nil
362362
}
363363

364+
func (b *backendMock) SubscribeDropTxsEvent(ch chan<- core.DropTxsEvent) event.Subscription {
365+
return nil
366+
}
367+
364368
func (b *backendMock) Engine() consensus.Engine { return nil }
365369

366370
func (b *backendMock) RPCRpcReturnDataLimit() uint64 {
@@ -380,7 +384,7 @@ func (b *backendMock) GetVoteOnHash(ctx context.Context, starBlockNr uint64, end
380384
}
381385

382386
func (b *backendMock) GetBorBlockReceipt(ctx context.Context, hash common.Hash) (*types.Receipt, error) {
383-
//nolint: nilnil
387+
// nolint: nilnil
384388
return nil, nil
385389
}
386390

packaging/templates/package_scripts/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Source: bor
2-
Version: 1.1.0-beta3
2+
Version: 1.1.0
33
Section: develop
44
Priority: standard
55
Maintainer: Polygon <release-team@polygon.technology>

packaging/templates/package_scripts/control.arm64

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Source: bor
2-
Version: 1.1.0-beta3
2+
Version: 1.1.0
33
Section: develop
44
Priority: standard
55
Maintainer: Polygon <release-team@polygon.technology>
@@ -10,4 +10,3 @@ Architecture: arm64
1010
Multi-Arch: foreign
1111
Depends:
1212
Description: This is the bor package from Polygon Technology.
13-

0 commit comments

Comments
 (0)