Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge v1.1.0 changes to master #1062

Merged
merged 44 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
56ca065
chg : shanghaiTime to shanghaiBlock
0xsharma Aug 18, 2023
25c6656
add : withdrawals check in bor consensus, config block formatting
0xsharma Aug 21, 2023
1637929
fix : config banner print
0xsharma Aug 22, 2023
bd124e6
burn contract testing
temaniarpit27 Oct 4, 2023
2b1bd09
Merge branch 'develop' into shivam/POS-1733
0xsharma Oct 5, 2023
558bb54
fix : config and forkId tests
0xsharma Oct 5, 2023
1fc6354
clean : shanghai changes
0xsharma Oct 6, 2023
ee0907a
update : gen_config.go
0xsharma Oct 9, 2023
5af7192
Update config.go
temaniarpit27 Oct 9, 2023
40760f0
Update bor_test.go
temaniarpit27 Oct 9, 2023
dbb2c35
added testcase
temaniarpit27 Oct 9, 2023
095a06b
generics
temaniarpit27 Oct 9, 2023
61c0b81
fix testcase
temaniarpit27 Oct 9, 2023
c119871
add : agra HF mumbai block
0xsharma Oct 16, 2023
60899e3
add : additional agra HF configs
0xsharma Oct 16, 2023
6ba40bd
fix : spelling
0xsharma Oct 16, 2023
d65fda7
fix : indentation
0xsharma Oct 16, 2023
808c41d
add : mumbai newBurnContract Address
0xsharma Oct 16, 2023
3c9d6b4
Merge pull request #1044 from maticnetwork/shivam/POS-1733-2
temaniarpit27 Oct 16, 2023
398c6ba
dev: chg: update peppermint and cosmos-sdk to latest polygon releases…
marcello33 Oct 16, 2023
0559bd1
change version
temaniarpit27 Oct 17, 2023
3d8ee19
merge develop
temaniarpit27 Oct 17, 2023
e8939bc
chg : withdrawals check in bor consensus
0xsharma Oct 17, 2023
f957755
Merge pull request #1049 from maticnetwork/shivam/POS-1733-2
temaniarpit27 Oct 17, 2023
d104b38
Merge pull request #1025 from maticnetwork/shivam/POS-1733
temaniarpit27 Oct 17, 2023
18728d3
bump : version to v1.1.0-beta
0xsharma Oct 17, 2023
cefca4f
chg : agra mumbai hf blockNumber to 41874000
0xsharma Oct 17, 2023
adfd428
internal/cli: set default value for keystore (#1051)
manav2401 Oct 18, 2023
e1898d5
bump version to v1.1.0-beta2
manav2401 Oct 18, 2023
9f44579
bor: make withdrawals nil
anshalshukla Oct 20, 2023
260deb8
eth: handle nil blocks and state when pending is not available (#1053)
manav2401 Oct 20, 2023
aff2f1f
fix: linting
anshalshukla Oct 20, 2023
a504fa6
fix tests
anshalshukla Oct 20, 2023
da5b880
chg: club error conditions
anshalshukla Oct 23, 2023
95cee33
Merge pull request #1054 from maticnetwork/withdrawals
anshalshukla Oct 23, 2023
d0abdcb
chg: make consistent with erigon
anshalshukla Oct 23, 2023
0133e32
Merge pull request #1056 from maticnetwork/shaghai-fixes
anshalshukla Oct 23, 2023
c8548c9
params: fix bor key-value config look-up (#1055)
yperbasis Oct 23, 2023
b88d00c
add : check for commit span in apply bor message
0xsharma Oct 25, 2023
5da60c2
bump : version to v1.1.0-beta3
anshalshukla Oct 25, 2023
4896ab2
Set withdraw to nil when building blocks for integration tests (#1066)
cffls Oct 31, 2023
953039d
rm : prevrandao
0xsharma Oct 31, 2023
b3f4b0b
Merge pull request #1067 from maticnetwork/shivam/prevrandao-hotfix
temaniarpit27 Oct 31, 2023
6169648
fix : lint
0xsharma Nov 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion builder/files/genesis-testnet-v4.json

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions cmd/evm/internal/t8ntool/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func Transaction(ctx *cli.Context) error {
}
// Check intrinsic gas
if gas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.To() == nil,
chainConfig.IsHomestead(new(big.Int)), chainConfig.IsIstanbul(new(big.Int)), chainConfig.IsShanghai(0)); err != nil {
chainConfig.IsHomestead(new(big.Int)), chainConfig.IsIstanbul(new(big.Int)), chainConfig.IsShanghai(new(big.Int))); err != nil {
r.Error = err
results = append(results, r)

Expand Down Expand Up @@ -190,9 +190,8 @@ func Transaction(ctx *cli.Context) error {
case new(big.Int).Mul(tx.GasFeeCap(), new(big.Int).SetUint64(tx.Gas())).BitLen() > 256:
r.Error = errors.New("gas * maxFeePerGas exceeds 256 bits")
}
// TODO marcello double check
// Check whether the init code size has been exceeded.
if chainConfig.IsShanghai(0) && tx.To() == nil && len(tx.Data()) > params.MaxInitCodeSize {
if chainConfig.IsShanghai(new(big.Int)) && tx.To() == nil && len(tx.Data()) > params.MaxInitCodeSize {
r.Error = errors.New("max initcode size exceeded")
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/evm/internal/t8ntool/transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,8 @@ func Transition(ctx *cli.Context) error {
return NewError(ErrorConfig, errors.New("EIP-1559 config but missing 'currentBaseFee' in env section"))
}
}
// TODO marcello double check
if chainConfig.IsShanghai(prestate.Env.Number) && prestate.Env.Withdrawals == nil {

if chainConfig.IsShanghai(big.NewInt(int64(prestate.Env.Number))) && prestate.Env.Withdrawals == nil {
return NewError(ErrorConfig, errors.New("Shanghai config but missing 'withdrawals' in env section"))
}

Expand Down
1 change: 0 additions & 1 deletion cmd/evm/t8n_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ func TestT8n(t *testing.T) {
output: t8nOutput{result: true},
expOut: "exp.json",
},
// TODO marcello double check
{ // Test post-merge transition
base: "./testdata/24",
input: t8nInput{
Expand Down
6 changes: 3 additions & 3 deletions cmd/geth/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package main

import (
"fmt"
"math/big"
"os"
"time"

Expand Down Expand Up @@ -147,10 +148,9 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, gethConfig) {
// makeFullNode loads geth configuration and creates the Ethereum backend.
func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
stack, cfg := makeConfigNode(ctx)
// TODO marcello double check
if ctx.IsSet(utils.OverrideShanghai.Name) {
v := ctx.Uint64(utils.OverrideShanghai.Name)
cfg.Eth.OverrideShanghai = &v
v := ctx.Int64(utils.OverrideShanghai.Name)
cfg.Eth.OverrideShanghai = new(big.Int).SetInt64(v)
}

backend, eth := utils.RegisterEthService(stack, &cfg.Eth)
Expand Down
1 change: 0 additions & 1 deletion cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ var (
utils.NoUSBFlag,
utils.USBFlag,
utils.SmartCardDaemonPathFlag,
// TODO marcello double check
utils.OverrideShanghai,
utils.EnablePersonal,
utils.EthashCacheDirFlag,
Expand Down
9 changes: 4 additions & 5 deletions consensus/beacon/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,7 @@ func (beacon *Beacon) verifyHeader(chain consensus.ChainHeaderReader, header, pa
return err
}
// Verify existence / non-existence of withdrawalsHash.
// TODO marcello double check
shanghai := chain.Config().IsShanghai(header.Time)
shanghai := chain.Config().IsShanghai(header.Number)
if shanghai && header.WithdrawalsHash == nil {
return errors.New("missing withdrawalsHash")
}
Expand All @@ -293,7 +292,7 @@ func (beacon *Beacon) verifyHeader(chain consensus.ChainHeaderReader, header, pa
return fmt.Errorf("invalid withdrawalsHash: have %x, expected nil", header.WithdrawalsHash)
}
// Verify the existence / non-existence of excessDataGas
cancun := chain.Config().IsCancun(header.Time)
cancun := chain.Config().IsCancun(header.Number)
if cancun && header.ExcessDataGas == nil {
return errors.New("missing excessDataGas")
}
Expand Down Expand Up @@ -391,8 +390,8 @@ func (beacon *Beacon) FinalizeAndAssemble(ctx context.Context, chain consensus.C
if !beacon.IsPoSHeader(header) {
return beacon.ethone.FinalizeAndAssemble(ctx, chain, header, state, txs, uncles, receipts, nil)
}
// TODO marcello double check
shanghai := chain.Config().IsShanghai(header.Time)

shanghai := chain.Config().IsShanghai(header.Number)
if shanghai {
// All blocks after Shanghai must include a withdrawals root.
if withdrawals == nil {
Expand Down
17 changes: 14 additions & 3 deletions consensus/bor/bor.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,11 +381,14 @@

// Verify that the gas limit is <= 2^63-1
gasCap := uint64(0x7fffffffffffffff)

if header.GasLimit > gasCap {
return fmt.Errorf("invalid gasLimit: have %v, max %v", header.GasLimit, gasCap)
}

if header.WithdrawalsHash != nil {
return consensus.ErrUnexpectedWithdrawals
}

Check warning on line 390 in consensus/bor/bor.go

View check run for this annotation

Codecov / codecov/patch

consensus/bor/bor.go#L388-L390

Added lines #L388 - L390 were not covered by tests

// All basic checks passed, verify cascading fields
return c.verifyCascadingFields(chain, header, parents)
}
Expand Down Expand Up @@ -816,6 +819,10 @@

headerNumber := header.Number.Uint64()

if withdrawals != nil || header.WithdrawalsHash != nil {
return
}

if IsSprintStart(headerNumber, c.config.CalculateSprint(headerNumber)) {
ctx := context.Background()
cx := statefull.ChainContext{Chain: chain, Bor: c}
Expand Down Expand Up @@ -888,10 +895,14 @@
finalizeCtx, finalizeSpan := tracing.StartSpan(ctx, "bor.FinalizeAndAssemble")
defer tracing.EndSpan(finalizeSpan)

stateSyncData := []*types.StateSyncData{}

headerNumber := header.Number.Uint64()

Check warning on line 898 in consensus/bor/bor.go

View check run for this annotation

Codecov / codecov/patch

consensus/bor/bor.go#L898

Added line #L898 was not covered by tests

if withdrawals != nil || header.WithdrawalsHash != nil {
return nil, consensus.ErrUnexpectedWithdrawals

Check warning on line 901 in consensus/bor/bor.go

View check run for this annotation

Codecov / codecov/patch

consensus/bor/bor.go#L900-L901

Added lines #L900 - L901 were not covered by tests
}

stateSyncData := []*types.StateSyncData{}

var err error

if IsSprintStart(headerNumber, c.config.CalculateSprint(headerNumber)) {
Expand Down
7 changes: 6 additions & 1 deletion consensus/bor/statefull/processor.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package statefull

import (
"bytes"
"context"
"math"
"math/big"
Expand Down Expand Up @@ -90,7 +91,11 @@ func ApplyMessage(

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)
}

Expand Down
6 changes: 3 additions & 3 deletions consensus/clique/clique.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,12 +308,12 @@ func (c *Clique) verifyHeader(chain consensus.ChainHeaderReader, header *types.H
if header.GasLimit > params.MaxGasLimit {
return fmt.Errorf("invalid gasLimit: have %v, max %v", header.GasLimit, params.MaxGasLimit)
}
// TODO marcello double check
if chain.Config().IsShanghai(header.Time) {

if chain.Config().IsShanghai(header.Number) {
return fmt.Errorf("clique does not support shanghai fork")
}

if chain.Config().IsCancun(header.Time) {
if chain.Config().IsCancun(header.Number) {
return fmt.Errorf("clique does not support cancun fork")
}
// All basic checks passed, verify cascading fields
Expand Down
3 changes: 3 additions & 0 deletions consensus/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,7 @@ var (
// ErrInvalidTerminalBlock is returned if a block is invalid wrt. the terminal
// total difficulty.
ErrInvalidTerminalBlock = errors.New("invalid terminal block")

// ErrUnexpectedWithdrawals is returned if a pre-Shanghai block has withdrawals.
ErrUnexpectedWithdrawals = errors.New("unexpected withdrawals")
)
6 changes: 3 additions & 3 deletions consensus/ethash/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,12 @@ func (ethash *Ethash) verifyHeader(chain consensus.ChainHeaderReader, header, pa
if diff := new(big.Int).Sub(header.Number, parent.Number); diff.Cmp(big.NewInt(1)) != 0 {
return consensus.ErrInvalidNumber
}
// TODO marcello double check
if chain.Config().IsShanghai(header.Time) {

if chain.Config().IsShanghai(header.Number) {
return fmt.Errorf("ethash does not support shanghai fork")
}

if chain.Config().IsCancun(header.Time) {
if chain.Config().IsCancun(header.Number) {
return fmt.Errorf("ethash does not support cancun fork")
}
// Verify the engine specific seal securing the block
Expand Down
2 changes: 1 addition & 1 deletion core/blockchain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4688,7 +4688,7 @@ func TestEIP3651(t *testing.T) {
gspec.Config.LondonBlock = common.Big0
gspec.Config.TerminalTotalDifficulty = common.Big0
gspec.Config.TerminalTotalDifficultyPassed = true
gspec.Config.ShanghaiTime = u64(0)
gspec.Config.ShanghaiBlock = common.Big0
signer := types.LatestSigner(gspec.Config)

_, blocks, _ := GenerateChainWithGenesis(gspec, engine, 1, func(i int, b *BlockGen) {
Expand Down
2 changes: 1 addition & 1 deletion core/chain_makers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func TestGenerateWithdrawalChain(t *testing.T) {

config.TerminalTotalDifficultyPassed = true
config.TerminalTotalDifficulty = common.Big0
config.ShanghaiTime = u64(0)
config.ShanghaiBlock = common.Big0

// init 0xaa with some storage elements
storage := make(map[common.Hash]common.Hash)
Expand Down
Loading
Loading