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 upstream 0.3.3 #32

Merged
merged 24 commits into from
Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b7f37c7
Merge pull request #603 from maticnetwork/arpit/v0.3.1-mumbai-candidate
temaniarpit27 Dec 13, 2022
6d11117
Revert "Merge pull request #435 from maticnetwork/POS-553"
manav2401 Dec 13, 2022
0b89983
merge latest master to qa
temaniarpit27 Dec 13, 2022
a8eb21f
Merge pull request #631 from maticnetwork/manav/revert-pos-533
temaniarpit27 Dec 13, 2022
7364f94
revert change for release for go1.19
temaniarpit27 Dec 13, 2022
b177669
Merge branch 'arpit/master-to-qa' of github.com:maticnetwork/bor into…
temaniarpit27 Dec 13, 2022
a37af35
Add default values to CLI helper and docs
cffls Dec 13, 2022
ddf1a4d
Add a summary of new CLI in docs
cffls Dec 14, 2022
5e14528
Merge pull request #632 from cffls/master
cffls Dec 14, 2022
2e45f3b
Updating packager as binutils changed version so that apt-get install…
djpolygon Dec 14, 2022
660677b
Merge branch 'master' of github.com:maticnetwork/bor into arpit/maste…
temaniarpit27 Dec 14, 2022
5eebbfa
Merge pull request #634 from maticnetwork/djpolygon/packagerDepUpdate
djpolygon Dec 14, 2022
b7ed9de
Add state pruning to new CLI
cffls Dec 14, 2022
9b2407a
Minor wording fix in prune state description
cffls Dec 15, 2022
7217f79
Merge pull request #630 from maticnetwork/arpit/master-to-qa
temaniarpit27 Dec 15, 2022
b7b1545
Bumping control file versions
djpolygon Dec 18, 2022
205930e
Merge pull request #639 from maticnetwork/djpolygon/3.2-beta_control
djpolygon Dec 19, 2022
59bdbef
Mainnet Delhi fork
cffls Jan 4, 2023
c12e8f2
Set version to stable
cffls Jan 4, 2023
db7eb29
change delhi hardfork block number
temaniarpit27 Jan 5, 2023
3eb234c
Merge pull request #647 from cffls/qa
temaniarpit27 Jan 5, 2023
b480db1
handle future chain import and skip peer drop (#650)
manav2401 Jan 7, 2023
dcdac12
Bump bor version in control files for v0.3.3 mainnet release
manav2401 Jan 9, 2023
56d3058
Merge pull request #655 from maticnetwork/manav/bump-control-files
cffls Jan 9, 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
5 changes: 4 additions & 1 deletion .github/workflows/packager.yml
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,9 @@ jobs:
- name: Removing systemd file
run: rm -rf packaging/deb/bor/lib/systemd/system/bor.service

- name: Updating the apt-get
run: sudo apt-get update -y

- name: Adding requirements for cross compile
run: sudo apt-get install g++-aarch64-linux-gnu gcc-aarch64-linux-gnu

Expand Down Expand Up @@ -730,4 +733,4 @@ jobs:
prerelease: true
files: |
packaging/deb/bor**.deb
binary/bo**
binary/bo**
7 changes: 5 additions & 2 deletions builder/files/genesis-mainnet-v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@
"londonBlock": 23850000,
"bor": {
"jaipurBlock": 23850000,
"delhiBlock": 38189056,
"period": {
"0": 2
},
"producerDelay": {
"0": 6
"0": 6,
"38189056": 4
},
"sprint": {
"0": 64
"0": 64,
"38189056": 16
},
"backupMultiplier": {
"0": 2
Expand Down
6 changes: 6 additions & 0 deletions core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ var (
snapshotStorageReadTimer = metrics.NewRegisteredTimer("chain/snapshot/storage/reads", nil)
snapshotCommitTimer = metrics.NewRegisteredTimer("chain/snapshot/commits", nil)

blockImportTimer = metrics.NewRegisteredMeter("chain/imports", nil)
blockInsertTimer = metrics.NewRegisteredTimer("chain/inserts", nil)
blockValidationTimer = metrics.NewRegisteredTimer("chain/validation", nil)
blockExecutionTimer = metrics.NewRegisteredTimer("chain/execution", nil)
Expand Down Expand Up @@ -1518,6 +1519,11 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifySeals, setHead bool)
it := newInsertIterator(chain, results, bc.validator)
block, err := it.next()

// Update the block import meter; it will just record chains we've received
// from other peers. (Note that the actual chain which gets imported would be
// quite low).
blockImportTimer.Mark(int64(len(headers)))

// Check the validity of incoming chain
isValid, err1 := bc.forker.ValidateReorg(bc.CurrentBlock().Header(), headers)
if err1 != nil {
Expand Down
4 changes: 1 addition & 3 deletions core/forkchoice.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,7 @@ func (f *ForkChoice) ReorgNeeded(current *types.Header, header *types.Header) (b
func (f *ForkChoice) ValidateReorg(current *types.Header, chain []*types.Header) (bool, error) {
// Call the bor chain validator service
if f.validator != nil {
if isValid := f.validator.IsValidChain(current, chain); !isValid {
return false, nil
}
return f.validator.IsValidChain(current, chain)
}

return true, nil
Expand Down
30 changes: 15 additions & 15 deletions core/forkchoice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ import (

// chainValidatorFake is a mock for the chain validator service
type chainValidatorFake struct {
validate func(currentHeader *types.Header, chain []*types.Header) bool
validate func(currentHeader *types.Header, chain []*types.Header) (bool, error)
}

// chainReaderFake is a mock for the chain reader service
type chainReaderFake struct {
getTd func(hash common.Hash, number uint64) *big.Int
}

func newChainValidatorFake(validate func(currentHeader *types.Header, chain []*types.Header) bool) *chainValidatorFake {
func newChainValidatorFake(validate func(currentHeader *types.Header, chain []*types.Header) (bool, error)) *chainValidatorFake {
return &chainValidatorFake{validate: validate}
}

Expand All @@ -46,18 +46,18 @@ func TestPastChainInsert(t *testing.T) {
getTd := func(hash common.Hash, number uint64) *big.Int {
return big.NewInt(int64(number))
}
validate := func(currentHeader *types.Header, chain []*types.Header) bool {
validate := func(currentHeader *types.Header, chain []*types.Header) (bool, error) {
// Put all explicit conditions here
// If canonical chain is empty and we're importing a chain of 64 blocks
if currentHeader.Number.Uint64() == uint64(0) && len(chain) == 64 {
return true
return true, nil
}
// If canonical chain is of len 64 and we're importing a past chain from 54-64, then accept it
if currentHeader.Number.Uint64() == uint64(64) && chain[0].Number.Uint64() == 55 && len(chain) == 10 {
return true
return true, nil
}

return false
return false, nil
}
mockChainReader := newChainReaderFake(getTd)
mockChainValidator := newChainValidatorFake(validate)
Expand Down Expand Up @@ -116,18 +116,18 @@ func TestFutureChainInsert(t *testing.T) {
getTd := func(hash common.Hash, number uint64) *big.Int {
return big.NewInt(int64(number))
}
validate := func(currentHeader *types.Header, chain []*types.Header) bool {
validate := func(currentHeader *types.Header, chain []*types.Header) (bool, error) {
// Put all explicit conditions here
// If canonical chain is empty and we're importing a chain of 64 blocks
if currentHeader.Number.Uint64() == uint64(0) && len(chain) == 64 {
return true
return true, nil
}
// If length of future chains > some value, they should not be accepted
if currentHeader.Number.Uint64() == uint64(64) && len(chain) <= 10 {
return true
return true, nil
}

return false
return false, nil
}
mockChainReader := newChainReaderFake(getTd)
mockChainValidator := newChainValidatorFake(validate)
Expand Down Expand Up @@ -174,18 +174,18 @@ func TestOverlappingChainInsert(t *testing.T) {
getTd := func(hash common.Hash, number uint64) *big.Int {
return big.NewInt(int64(number))
}
validate := func(currentHeader *types.Header, chain []*types.Header) bool {
validate := func(currentHeader *types.Header, chain []*types.Header) (bool, error) {
// Put all explicit conditions here
// If canonical chain is empty and we're importing a chain of 64 blocks
if currentHeader.Number.Uint64() == uint64(0) && len(chain) == 64 {
return true
return true, nil
}
// If length of chain is > some fixed value then don't accept it
if currentHeader.Number.Uint64() == uint64(64) && len(chain) <= 20 {
return true
return true, nil
}

return false
return false, nil
}
mockChainReader := newChainReaderFake(getTd)
mockChainValidator := newChainValidatorFake(validate)
Expand Down Expand Up @@ -227,7 +227,7 @@ func (c *chainReaderFake) GetTd(hash common.Hash, number uint64) *big.Int {
func (w *chainValidatorFake) IsValidPeer(remoteHeader *types.Header, fetchHeadersByNumber func(number uint64, amount int, skip int, reverse bool) ([]*types.Header, []common.Hash, error)) (bool, error) {
return true, nil
}
func (w *chainValidatorFake) IsValidChain(current *types.Header, headers []*types.Header) bool {
func (w *chainValidatorFake) IsValidChain(current *types.Header, headers []*types.Header) (bool, error) {
return w.validate(current, headers)
}
func (w *chainValidatorFake) ProcessCheckpoint(endBlockNum uint64, endBlockHash common.Hash) {}
Expand Down
4 changes: 3 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# Documentation

- [The new command line interface](./cli)
[The new command line interface (CLI)](./cli) in this version of Bor aims to give users more control over the codebase when interacting with and starting a node. We have made every effort to keep most of the flags similar to the old CLI, except for a few notable changes. One major change is the use of the --config flag, which previously represented fields without available flags. It now represents all flags available to the user, and will overwrite any other flags if provided. As a node operator, you still have the flexibility to modify flags as needed. Please note that this change does not affect the internal functionality of the node, and it remains compatible with Geth and the Ethereum Virtual Machine (EVM).

## Additional notes

Expand All @@ -11,6 +11,8 @@
$ bor server <flags>
```

See [here](./cli/server.md) for more flag details.

- The `bor dumpconfig` sub-command prints the default configurations, in the TOML format, on the terminal. One can `pipe (>)` this to a file (say `config.toml`) and use it to start bor.

- A toml file now can be used instead of flags and can contain all configuration for the node to run. To simply run bor with a configuration file, the following command can be used.
Expand Down
4 changes: 4 additions & 0 deletions docs/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@

- [```server```](./server.md)

- [```snapshot```](./snapshot.md)

- [```snapshot prune-state```](./snapshot_prune-state.md)

- [```status```](./status.md)

- [```version```](./version.md)
2 changes: 1 addition & 1 deletion docs/cli/account_import.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ The ```account import``` command imports an account in Json format to the Bor da

- ```datadir```: Path of the data directory to store information

- ```keystore```: Path of the data directory to store information
- ```keystore```: Path of the data directory to store keys
2 changes: 1 addition & 1 deletion docs/cli/account_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ The `account list` command lists all the accounts in the Bor data directory.

- ```datadir```: Path of the data directory to store information

- ```keystore```: Path of the data directory to store information
- ```keystore```: Path of the data directory to store keys
2 changes: 1 addition & 1 deletion docs/cli/account_new.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ The `account new` command creates a new local account file on the Bor data direc

- ```datadir```: Path of the data directory to store information

- ```keystore```: Path of the data directory to store information
- ```keystore```: Path of the data directory to store keys
10 changes: 5 additions & 5 deletions docs/cli/bootnode.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

## Options

- ```listen-addr```: listening address of bootnode (<ip>:<port>)
- ```listen-addr```: listening address of bootnode (<ip>:<port>) (default: 0.0.0.0:30303)

- ```v5```: Enable UDP v5
- ```v5```: Enable UDP v5 (default: false)

- ```log-level```: Log level (trace|debug|info|warn|error|crit)
- ```log-level```: Log level (trace|debug|info|warn|error|crit) (default: info)

- ```nat```: port mapping mechanism (any|none|upnp|pmp|extip:<IP>)
- ```nat```: port mapping mechanism (any|none|upnp|pmp|extip:<IP>) (default: none)

- ```node-key```: file or hex node key

- ```save-key```: path to save the ecdsa private key

- ```dry-run```: validates parameters and prints bootnode configurations, but does not start bootnode
- ```dry-run```: validates parameters and prints bootnode configurations, but does not start bootnode (default: false)
4 changes: 2 additions & 2 deletions docs/cli/chain_sethead.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ The ```chain sethead <number>``` command sets the current chain to a certain blo

## Options

- ```address```: Address of the grpc endpoint
- ```address```: Address of the grpc endpoint (default: 127.0.0.1:3131)

- ```yes```: Force set head
- ```yes```: Force set head (default: false)
2 changes: 1 addition & 1 deletion docs/cli/debug_block.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ The ```bor debug block <number>``` command will create an archive containing tra

## Options

- ```address```: Address of the grpc endpoint
- ```address```: Address of the grpc endpoint (default: 127.0.0.1:3131)

- ```output```: Output directory
4 changes: 2 additions & 2 deletions docs/cli/debug_pprof.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ The ```debug pprof <enode>``` command will create an archive containing bor ppro

## Options

- ```address```: Address of the grpc endpoint
- ```address```: Address of the grpc endpoint (default: 127.0.0.1:3131)

- ```seconds```: seconds to trace
- ```seconds```: seconds to trace (default: 2)

- ```output```: Output directory
4 changes: 2 additions & 2 deletions docs/cli/peers_add.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ The ```peers add <enode>``` command joins the local client to another remote pee

## Options

- ```address```: Address of the grpc endpoint
- ```address```: Address of the grpc endpoint (default: 127.0.0.1:3131)

- ```trusted```: Add the peer as a trusted
- ```trusted```: Add the peer as a trusted (default: false)
2 changes: 1 addition & 1 deletion docs/cli/peers_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ The ```peers list``` command lists the connected peers.

## Options

- ```address```: Address of the grpc endpoint
- ```address```: Address of the grpc endpoint (default: 127.0.0.1:3131)
4 changes: 2 additions & 2 deletions docs/cli/peers_remove.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ The ```peers remove <enode>``` command disconnects the local client from a conne

## Options

- ```address```: Address of the grpc endpoint
- ```address```: Address of the grpc endpoint (default: 127.0.0.1:3131)

- ```trusted```: Add the peer as a trusted
- ```trusted```: Add the peer as a trusted (default: false)
2 changes: 1 addition & 1 deletion docs/cli/peers_status.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ The ```peers status <peer id>``` command displays the status of a peer by its id

## Options

- ```address```: Address of the grpc endpoint
- ```address```: Address of the grpc endpoint (default: 127.0.0.1:3131)
2 changes: 1 addition & 1 deletion docs/cli/removedb.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ The ```bor removedb``` command will remove the blockchain and state databases at

## Options

- ```address```: Address of the grpc endpoint
- ```address```: Address of the grpc endpoint (default: 127.0.0.1:3131)

- ```datadir```: Path of the data directory to store information
Loading