chg: solve conflicts

This commit is contained in:
marcello33 2024-09-10 15:32:42 +02:00
commit 8c14f12d68
No known key found for this signature in database
GPG key ID: 06128777E3C36B16
13 changed files with 92 additions and 26 deletions

View file

@ -6,7 +6,7 @@ labels: 'type:bug'
assignees: '' assignees: ''
--- ---
Our support team has aggregated some common issues and their solutions from past which are faced while running or interacting with a bor client. In order to prevent redundant efforts, we would encourage you to have a look at the [FAQ's section](https://wiki.polygon.technology/docs/faq/technical-faqs/) of our documentation mentioning the same, before filing an issue here. In case of additional support, you can also join our [discord](https://discord.com/invite/0xPolygonDevs) server Our support team has aggregated some common issues and their solutions from past which are faced while running or interacting with a bor client. In order to prevent redundant efforts, we would encourage you to have a look at the [FAQ's section](https://wiki.polygon.technology/docs/faq/technical-faqs/) of our documentation mentioning the same, before filing an issue here. In case of additional support, you can also join our [discord](https://discord.com/invite/0xPolygonCommunity) server
<!-- <!--
NOTE: Please make sure to check of any addresses / private keys / rpc url's / IP's before sharing the logs or anything from the additional information section (start.sh or heimdall config). NOTE: Please make sure to check of any addresses / private keys / rpc url's / IP's before sharing the logs or anything from the additional information section (start.sh or heimdall config).

View file

@ -8,4 +8,4 @@ assignees: ''
This should only be used in very rare cases e.g. if you are not 100% sure if something is a bug or asking a question that leads to improving the documentation. This should only be used in very rare cases e.g. if you are not 100% sure if something is a bug or asking a question that leads to improving the documentation.
For general questions please join our [discord](https://discord.com/invite/0xPolygonDevs) server. For general questions please join our [discord](https://discord.com/invite/0xPolygonCommunity) server.

View file

@ -2,11 +2,11 @@
Bor is the Official Golang implementation of the Polygon PoS blockchain. It is a fork of [geth](https://github.com/ethereum/go-ethereum) and is EVM compatible (upto London fork). Bor is the Official Golang implementation of the Polygon PoS blockchain. It is a fork of [geth](https://github.com/ethereum/go-ethereum) and is EVM compatible (upto London fork).
[![API Reference]( [![API Reference](
https://camo.githubusercontent.com/915b7be44ada53c290eb157634330494ebe3e30a/68747470733a2f2f676f646f632e6f72672f6769746875622e636f6d2f676f6c616e672f6764646f3f7374617475732e737667 https://pkg.go.dev/badge/github.com/maticnetwork/bor
)](https://pkg.go.dev/github.com/maticnetwork/bor) )](https://pkg.go.dev/github.com/maticnetwork/bor)
[![Go Report Card](https://goreportcard.com/badge/github.com/maticnetwork/bor)](https://goreportcard.com/report/github.com/maticnetwork/bor) [![Go Report Card](https://goreportcard.com/badge/github.com/maticnetwork/bor)](https://goreportcard.com/report/github.com/maticnetwork/bor)
![MIT License](https://img.shields.io/github/license/maticnetwork/bor) ![MIT License](https://img.shields.io/github/license/maticnetwork/bor)
[![Discord](https://img.shields.io/discord/714888181740339261?color=1C1CE1&label=Polygon%20%7C%20Discord%20%F0%9F%91%8B%20&style=flat-square)](https://discord.gg/0xpolygon) [![Discord](https://img.shields.io/badge/discord-join%20chat-blue.svg)](https://discord.com/invite/0xpolygonrnd)
[![Twitter Follow](https://img.shields.io/twitter/follow/0xPolygon.svg?style=social)](https://twitter.com/0xPolygon) [![Twitter Follow](https://img.shields.io/twitter/follow/0xPolygon.svg?style=social)](https://twitter.com/0xPolygon)
### Installing bor using packaging ### Installing bor using packaging
@ -79,4 +79,4 @@ included in our repository in the `COPYING` file.
## Join our Discord server ## Join our Discord server
Join Polygon community share your ideas or just say hi over [on Discord](https://discord.com/invite/0xPolygonDevs). Join Polygon community share your ideas or just say hi over on [Polygon Community Discord](https://discord.com/invite/0xPolygonCommunity) or on [Polygon R&D Discord](https://discord.com/invite/0xpolygonrnd).

View file

@ -391,8 +391,6 @@ func geth(ctx *cli.Context) error {
// it unlocks any requested accounts, and starts the RPC/IPC interfaces and the // it unlocks any requested accounts, and starts the RPC/IPC interfaces and the
// miner. // miner.
func startNode(ctx *cli.Context, stack *node.Node, backend ethapi.Backend, isConsole bool) { func startNode(ctx *cli.Context, stack *node.Node, backend ethapi.Backend, isConsole bool) {
debug.Memsize.Add("node", stack)
// Start up the node itself // Start up the node itself
utils.StartNode(ctx, stack, isConsole) utils.StartNode(ctx, stack, isConsole)

View file

@ -363,6 +363,7 @@ func (c *Bor) verifyHeader(chain consensus.ChainHeaderReader, header *types.Head
} }
if isSprintEnd && signersBytes%validatorHeaderBytesLength != 0 { if isSprintEnd && signersBytes%validatorHeaderBytesLength != 0 {
log.Warn("Invalid validator set", "number", number, "signersBytes", signersBytes)
return errInvalidSpanValidators return errInvalidSpanValidators
} }
@ -481,11 +482,13 @@ func (c *Bor) verifyCascadingFields(chain consensus.ChainHeaderReader, header *t
} }
if len(newValidators) != len(headerVals) { if len(newValidators) != len(headerVals) {
log.Warn("Invalid validator set", "block number", number, "newValidators", newValidators, "headerVals", headerVals)
return errInvalidSpanValidators return errInvalidSpanValidators
} }
for i, val := range newValidators { for i, val := range newValidators {
if !bytes.Equal(val.HeaderBytes(), headerVals[i].HeaderBytes()) { if !bytes.Equal(val.HeaderBytes(), headerVals[i].HeaderBytes()) {
log.Warn("Invalid validator set", "block number", number, "index", i, "local validator", val, "header validator", headerVals[i])
return errInvalidSpanValidators return errInvalidSpanValidators
} }
} }
@ -1420,6 +1423,11 @@ func getUpdatedValidatorSet(oldValidatorSet *valset.ValidatorSet, newVals []*val
} }
if err := v.UpdateWithChangeSet(changes); err != nil { if err := v.UpdateWithChangeSet(changes); err != nil {
changesStr := ""
for _, change := range changes {
changesStr += fmt.Sprintf("Address: %s, VotingPower: %d\n", change.Address, change.VotingPower)
}
log.Warn("Changes in validator set", "changes", changesStr)
log.Error("Error while updating change set", "error", err) log.Error("Error while updating change set", "error", err)
} }

View file

@ -20,8 +20,6 @@
package core package core
// TEST CI
import ( import (
"math/big" "math/big"
"path/filepath" "path/filepath"

View file

@ -1196,6 +1196,62 @@ func TestApplyMVWriteSet(t *testing.T) {
assert.Equal(t, sSingleProcess.IntermediateRoot(true), sClean.IntermediateRoot(true)) assert.Equal(t, sSingleProcess.IntermediateRoot(true), sClean.IntermediateRoot(true))
} }
func TestMVHashMapRevertConcurrent(t *testing.T) {
t.Parallel()
db := NewDatabase(rawdb.NewMemoryDatabase())
mvhm := blockstm.MakeMVHashMap()
s, _ := NewWithMVHashmap(common.Hash{}, db, nil, mvhm)
states := []*StateDB{s}
// Create copies of the original state for each transition
for i := 1; i <= 2; i++ {
sCopy := s.Copy()
sCopy.txIndex = i
states = append(states, sCopy)
}
addr := common.HexToAddress("0x01")
balance := new(big.Int).SetUint64(uint64(100))
// Tx0 touches the account. Amount doesn't matter.
// This is to make sure that Tx1 and Tx2 will use the same state object from Tx0.
states[0].AddBalance(addr, common.Big0)
states[0].Finalise(false)
states[0].FlushMVWriteSet()
// Tx1 creates the account and add balance
snapshot1 := states[1].Snapshot()
states[1].CreateAccount(addr)
states[1].AddBalance(addr, balance)
// Tx2 creates the account, reverts.
snapshot2 := states[2].Snapshot()
states[2].CreateAccount(addr)
states[2].RevertToSnapshot(snapshot2)
states[2].Finalise(false)
// Tx2 adds balance
states[2].AddBalance(addr, balance)
// Tx1 now reverts
states[1].RevertToSnapshot(snapshot1)
states[1].Finalise(false)
// Balance after executing Tx0 should be 0 because it shouldn't be affected by Tx1 or Tx2
b := states[0].GetBalance(addr)
assert.Equal(t, common.Big0, b)
// Balance after executing Tx1 should be 0 because Tx1 got reverted
b = states[1].GetBalance(addr)
assert.Equal(t, common.Big0, b)
// Balance after executing Tx2 should be 100 because its snapshot is taken before Tx1 got reverted
b = states[2].GetBalance(addr)
assert.Equal(t, balance, b)
}
// TestCopyOfCopy tests that modified objects are carried over to the copy, and the copy of the copy. // TestCopyOfCopy tests that modified objects are carried over to the copy, and the copy of the copy.
// See https://github.com/ethereum/go-ethereum/pull/15225#issuecomment-380191512 // See https://github.com/ethereum/go-ethereum/pull/15225#issuecomment-380191512
func TestCopyOfCopy(t *testing.T) { func TestCopyOfCopy(t *testing.T) {

View file

@ -548,8 +548,14 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64,
} }
// Check whether the max code size has been exceeded, assign err if the case. // Check whether the max code size has been exceeded, assign err if the case.
if err == nil && evm.chainRules.IsEIP158 && len(ret) > params.MaxCodeSize { if err == nil && evm.chainRules.IsEIP158 {
err = ErrMaxCodeSizeExceeded if evm.chainConfig.Bor != nil && evm.chainConfig.Bor.IsAhmedabad(evm.Context.BlockNumber) {
if len(ret) > params.MaxCodeSizePostAhmedabad {
err = ErrMaxCodeSizeExceeded
}
} else if len(ret) > params.MaxCodeSize {
err = ErrMaxCodeSizeExceeded
}
} }
// Reject code starting with 0xEF if EIP-3541 is enabled. // Reject code starting with 0xEF if EIP-3541 is enabled.

3
go.mod
View file

@ -33,7 +33,6 @@ require (
github.com/fatih/color v1.17.0 github.com/fatih/color v1.17.0
github.com/ferranbt/fastssz v0.1.2 github.com/ferranbt/fastssz v0.1.2
github.com/fjl/gencodec v0.0.0-20230517082657-f9840df7b83e github.com/fjl/gencodec v0.0.0-20230517082657-f9840df7b83e
github.com/fjl/memsize v0.0.2
github.com/fsnotify/fsnotify v1.7.0 github.com/fsnotify/fsnotify v1.7.0
github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08
github.com/gofrs/flock v0.8.1 github.com/gofrs/flock v0.8.1
@ -101,7 +100,7 @@ require (
golang.org/x/text v0.16.0 golang.org/x/text v0.16.0
golang.org/x/time v0.5.0 golang.org/x/time v0.5.0
golang.org/x/tools v0.22.0 golang.org/x/tools v0.22.0
google.golang.org/grpc v1.64.0 google.golang.org/grpc v1.64.1
gopkg.in/natefinch/lumberjack.v2 v2.2.1 gopkg.in/natefinch/lumberjack.v2 v2.2.1
gopkg.in/yaml.v3 v3.0.1 gopkg.in/yaml.v3 v3.0.1
) )

5
go.sum
View file

@ -1159,7 +1159,6 @@ github.com/ferranbt/fastssz v0.1.2 h1:Dky6dXlngF6Qjc+EfDipAkE83N5I5DE68bY6O0VLNP
github.com/ferranbt/fastssz v0.1.2/go.mod h1:X5UPrE2u1UJjxHA8X54u04SBwdAQjG2sFtWs39YxyWs= github.com/ferranbt/fastssz v0.1.2/go.mod h1:X5UPrE2u1UJjxHA8X54u04SBwdAQjG2sFtWs39YxyWs=
github.com/fjl/gencodec v0.0.0-20230517082657-f9840df7b83e h1:bBLctRc7kr01YGvaDfgLbTwjFNW5jdp5y5rj8XXBHfY= github.com/fjl/gencodec v0.0.0-20230517082657-f9840df7b83e h1:bBLctRc7kr01YGvaDfgLbTwjFNW5jdp5y5rj8XXBHfY=
github.com/fjl/gencodec v0.0.0-20230517082657-f9840df7b83e/go.mod h1:AzA8Lj6YtixmJWL+wkKoBGsLWy9gFrAzi4g+5bCKwpY= github.com/fjl/gencodec v0.0.0-20230517082657-f9840df7b83e/go.mod h1:AzA8Lj6YtixmJWL+wkKoBGsLWy9gFrAzi4g+5bCKwpY=
github.com/fjl/memsize v0.0.2 h1:27txuSD9or+NZlnOWdKUxeBzTAUkWCVh+4Gf2dWFOzA=
github.com/fjl/memsize v0.0.2/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/fjl/memsize v0.0.2/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
github.com/flosch/pongo2/v4 v4.0.2/go.mod h1:B5ObFANs/36VwxxlgKpdchIJHMvHB562PW+BWPhwZD8= github.com/flosch/pongo2/v4 v4.0.2/go.mod h1:B5ObFANs/36VwxxlgKpdchIJHMvHB562PW+BWPhwZD8=
github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
@ -3219,8 +3218,8 @@ google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGO
google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s=
google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0=
google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0=
google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY= google.golang.org/grpc v1.64.1 h1:LKtvyfbX3UGVPFcGqJ9ItpVWW6oN/2XqTxfAnwRRXiA=
google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg= google.golang.org/grpc v1.64.1/go.mod h1:hiQF4LFZelK2WKaP6W0L92zGHtiQdZxk8CrSdvyjeP0=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.2.0/go.mod h1:DNq5QpG7LJqD2AamLZ7zvKE0DEpVl2BSEVjFycAAjRY= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.2.0/go.mod h1:DNq5QpG7LJqD2AamLZ7zvKE0DEpVl2BSEVjFycAAjRY=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=

View file

@ -31,15 +31,12 @@ import (
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics" "github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/metrics/exp" "github.com/ethereum/go-ethereum/metrics/exp"
"github.com/fjl/memsize/memsizeui" "github.com/mattn/go-colorable"
colorable "github.com/mattn/go-colorable" "github.com/mattn/go-isatty"
isatty "github.com/mattn/go-isatty" "github.com/urfave/cli/v2"
cli "github.com/urfave/cli/v2" "gopkg.in/natefinch/lumberjack.v2"
lumberjack "gopkg.in/natefinch/lumberjack.v2"
) )
var Memsize memsizeui.Handler
var ( var (
verbosityFlag = &cli.IntFlag{ verbosityFlag = &cli.IntFlag{
Name: "verbosity", Name: "verbosity",
@ -313,7 +310,6 @@ func StartPProf(address string, withMetrics bool) {
if withMetrics { if withMetrics {
exp.Exp(metrics.DefaultRegistry) exp.Exp(metrics.DefaultRegistry)
} }
http.Handle("/memsize/", http.StripPrefix("/memsize", &Memsize))
log.Info("Starting pprof server", "addr", fmt.Sprintf("http://%s/debug/pprof", address)) log.Info("Starting pprof server", "addr", fmt.Sprintf("http://%s/debug/pprof", address))
go func() { go func() {
if err := http.ListenAndServe(address, nil); err != nil { if err := http.ListenAndServe(address, nil); err != nil {

View file

@ -675,6 +675,7 @@ type BorConfig struct {
DelhiBlock *big.Int `json:"delhiBlock"` // Delhi switch block (nil = no fork, 0 = already on delhi) DelhiBlock *big.Int `json:"delhiBlock"` // Delhi switch block (nil = no fork, 0 = already on delhi)
IndoreBlock *big.Int `json:"indoreBlock"` // Indore switch block (nil = no fork, 0 = already on indore) IndoreBlock *big.Int `json:"indoreBlock"` // Indore switch block (nil = no fork, 0 = already on indore)
StateSyncConfirmationDelay map[string]uint64 `json:"stateSyncConfirmationDelay"` // StateSync Confirmation Delay, in seconds, to calculate `to` StateSyncConfirmationDelay map[string]uint64 `json:"stateSyncConfirmationDelay"` // StateSync Confirmation Delay, in seconds, to calculate `to`
AhmedabadBlock *big.Int `json:"ahmedabadBlock"` // Ahmedabad switch block (nil = no fork, 0 = already on ahmedabad)
} }
// String implements the stringer interface, returning the consensus engine details. // String implements the stringer interface, returning the consensus engine details.
@ -714,6 +715,10 @@ func (c *BorConfig) CalculateStateSyncDelay(number uint64) uint64 {
return borKeyValueConfigHelper(c.StateSyncConfirmationDelay, number) return borKeyValueConfigHelper(c.StateSyncConfirmationDelay, number)
} }
func (c *BorConfig) IsAhmedabad(number *big.Int) bool {
return isBlockForked(c.AhmedabadBlock, number)
}
// // TODO: modify this function once the block number is finalized // // TODO: modify this function once the block number is finalized
// func (c *BorConfig) IsNapoli(number *big.Int) bool { // func (c *BorConfig) IsNapoli(number *big.Int) bool {
// if c.NapoliBlock != nil { // if c.NapoliBlock != nil {

View file

@ -134,8 +134,9 @@ const (
DefaultBaseFeeChangeDenominator = 8 // Bounds the amount the base fee can change between blocks. DefaultBaseFeeChangeDenominator = 8 // Bounds the amount the base fee can change between blocks.
DefaultElasticityMultiplier = 2 // Bounds the maximum gas limit an EIP-1559 block may have. DefaultElasticityMultiplier = 2 // Bounds the maximum gas limit an EIP-1559 block may have.
MaxCodeSize = 24576 // Maximum bytecode to permit for a contract MaxCodeSize = 24576 // Maximum bytecode to permit for a contract
MaxInitCodeSize = 2 * MaxCodeSize // Maximum initcode to permit in a creation transaction and create instructions MaxCodeSizePostAhmedabad = 32768 // Maximum bytecode to permit for a contract post Ahmedabad hard fork (bor / polygon pos) (32KB)
MaxInitCodeSize = 2 * MaxCodeSize // Maximum initcode to permit in a creation transaction and create instructions
// Precompiled contract gas prices // Precompiled contract gas prices