Commit graph

173 commits

Author SHA1 Message Date
Manav Darji
c3d2c2689a
Merge qa to master (#750)
* Added checks to RPC requests and introduced new flags to customise the parameters (#657)

* added a check to reject rpc requests with batch size > the one set using a newly added flag (rpcbatchlimit)

* added a check to reject rpc requests whose result size > the one set using a newly added flag (rpcreturndatalimit)

* updated the config files and docs

* chg : trieTimeout from 60 to 10 mins (#692)

* chg : trieTimeout from 60 to 10 mins

* chg : cache.timout to 10m from 1h in configs

* internal/cli/server : fix : added triesInMemory in config (#691)

* changed version from 0.3.0 to 0.3.4-beta (#693)

* fix nil state-sync issue, increase grpc limit (#695)

* Increase grpc message size limit in pprof

* consensus/bor/bor.go : stateSyncs init fixed [Fix #686]

* eth/filters: handle nil state-sync before notify

* eth/filters: update check

Co-authored-by: Jerry <jerrycgh@gmail.com>
Co-authored-by: Daniil <daniil.melnik@chainstack.com>

* core, tests/bor: add more tests for state-sync validation (#710)

* core: add get state sync function for tests

* tests/bor: add validation for state sync events post consensus

* Arpit/temp bor sync (#701)

* Increase grpc message size limit in pprof

* ReadBorReceipts improvements

* use internal function

* fix tests

* fetch geth upstread for ReadBorReceiptRLP

* Only query bor receipt when the query index is equal to # tx in block body

This change reduces the frequency of calling ReadBorReceipt and
ReadBorTransaction, which are CPU and db intensive.

* Revert "fetch geth upstread for ReadBorReceiptRLP"

This reverts commit 2e838a6b1313d26674f3a8df4b044e35dcbf35a0.

* Restore ReadBorReceiptRLP

* fix bor receipts

* remove unused

* fix lints

---------

Co-authored-by: Jerry <jerrycgh@gmail.com>
Co-authored-by: Manav Darji <manavdarji.india@gmail.com>
Co-authored-by: Evgeny Danienko <6655321@bk.ru>

* Revert "chg : trieTimeout from 60 to 10 mins (#692)" (#720)

This reverts commit 241843c7e7.

* Arpit/add execution pool 2 (#719)

* initial

* linters

* linters

* remove timeout

* update pool

* change pool size function

* check nil

* check nil

* fix tests

* Use execution pool from server in all handlers

* simplify things

* test fix

* add support for cli, config

* add to cli and config

* merge base branch

* debug statements

* fix bug

* atomic pointer timeout

* add apis

* update workerpool

* fix issues

* change params

* fix issues

* fix ipc issue

* remove execution pool from IPC

* revert

* fix tests

* mutex

* refactor flag and value names

* ordering fix

* refactor flag and value names

* update default ep size to 40

* fix bor start issues

* revert file changes

* debug statements

* fix bug

* update workerpool

* atomic pointer timeout

* add apis

* Merge branch 'add-execution-pool' of github.com:maticnetwork/bor into arpit/add-execution-pool

* fix issues

* change params

* fix issues

* fix ipc issue

* remove execution pool from IPC

* revert

* merge base branch

* Merge branch 'add-execution-pool' of github.com:maticnetwork/bor into arpit/add-execution-pool

* mutex

* fix tests

* Merge branch 'arpit/add-execution-pool' of github.com:maticnetwork/bor into arpit/add-execution-pool

* Change default size of execution pool to 40

* refactor flag and value names

* fix merge conflicts

* ordering fix

* refactor flag and value names

* update default ep size to 40

* fix bor start issues

* revert file changes

* fix linters

* fix go.mod

* change sec to ms

* change default value for ep timeout

* fix node api calls

* comment setter for ep timeout

---------

Co-authored-by: Evgeny Danienko <6655321@bk.ru>
Co-authored-by: Jerry <jerrycgh@gmail.com>
Co-authored-by: Manav Darji <manavdarji.india@gmail.com>

* version change (#721)

* Event based pprof (#732)

* feature

* Save pprof to /tmp

---------

Co-authored-by: Jerry <jerrycgh@gmail.com>

* Cherry-pick changes from develop (#738)

* Check if block is nil to prevent panic (#736)

* miner: use env for tracing instead of block object (#728)

---------

Co-authored-by: Dmitry <46797839+dkeysil@users.noreply.github.com>

* add max code init size check in txpool (#739)

* Revert "Event based pprof" and update version (#742)

* Revert "Event based pprof (#732)"

This reverts commit 22fa4033e8.

* params: update version to 0.3.4-beta3

* packaging/templates: update bor version

* params, packaging/templates: update bor version

---------

Co-authored-by: SHIVAM SHARMA <shivam691999@gmail.com>
Co-authored-by: Pratik Patil <pratikspatil024@gmail.com>
Co-authored-by: Jerry <jerrycgh@gmail.com>
Co-authored-by: Daniil <daniil.melnik@chainstack.com>
Co-authored-by: Arpit Temani <temaniarpit27@gmail.com>
Co-authored-by: Evgeny Danienko <6655321@bk.ru>
Co-authored-by: Dmitry <46797839+dkeysil@users.noreply.github.com>
2023-02-20 18:37:21 +05:30
Shivam Sharma
7d92be2f17 fix : jaipurFork & baseFeeChangeDenom hardfork num to bigInt 2022-11-14 17:52:55 +05:30
Arpit Temani
b7a282792c merge develop 2022-11-13 19:05:26 +05:30
SHIVAM SHARMA
be3f297379
Merge pull request #547 from maticnetwork/shivam/POS-824
Add state sync transaction to debug_trace functions.
2022-10-25 12:22:49 +05:30
Arpit Temani
e39da65458 modified testcase, modified producer delay 2022-10-18 00:44:48 +05:30
Shivam Sharma
554712e954 chg : use https://github.com/maticnetwork/crand instead of JekaMas/crand 2022-10-17 15:44:11 +05:30
Shivam Sharma
d0508e7dc0 chg : lint files 2022-10-14 12:53:46 +05:30
Shivam Sharma
6baa56bc25 add : Add state sync transaction to debug_traceBlock 2022-10-12 20:06:00 +05:30
Arpit Temani
67554f7d1d merge develop 2022-10-04 12:34:35 +05:30
Arpit Temani
2a6ea470a0
Mining Analysis (#429)
* base setup for miner opentel

* version change

* modify ctx passing

* add attributes

* update fill txs span attributes

* fix: use common attributes for remote and local txs

* pass context in seal

* fix

* fix

* add traces to finalize and assemble

* fix

* use task ctx in result loop

* only start parent span if no error

* send nil tracer from Finalize

* clean up

* add sub function timings in span attribute

* modify span attributes

* set time attribute to milliseconds

* linters fix

* fix linters for consensus

* add nolint to worker

* fix testcase

* Added fillTransactions subTraces

* add traces in intermediate root hash function

* add traces in WriteBlockAndSetHead function, fix linters

* fix: linting errors

* fix: test cases

* fix: go.mod

* fix: testcase

* extract tracing package

* linters fix

* debug

* Revert "debug"

This reverts commit 2d68b7c7b1105080563a4e1a6949dabc10acaff8.

* fix: panic in NewTransactionsByPriceAndNonce iteration

* change heimdall version to develop

* miner/worker: fix duplicate call to tx ordering

* miner/worker: refactor tracing

* consensus/bor: use tracing package

* tracing: add more abstraction for spans

* tracing: set all attributes at once

* remove nested tracing from blockchain.WriteBlockAndSetHead function

* remove nested tracing from statedb.IntermediateRoot function

* handle end span in bor.Seal function

* fix: typo

* minor fixes

* fix: linters

* fix: remove nolint

* go mod tidy

Co-authored-by: Manav Darji <manavdarji.india@gmail.com>
Co-authored-by: Shivam Sharma <shivam691999@gmail.com>
Co-authored-by: Evgeny Danienko <6655321@bk.ru>
2022-09-30 13:40:18 +05:30
Arpit Temani
17f403e404 Merge branch 'develop' of github.com:maticnetwork/bor into arpit/pos-655 2022-09-22 14:15:38 +05:30
Evgeny Danilenko
a11952f858
Crypto-secure package with math/rand interface (#509)
* initial

* use crand

* fix

* fix
2022-09-14 14:54:43 +03:00
Arpit Temani
5ef98afb7b merge base branch 2022-09-05 15:43:57 +04:00
Evgeny Danienko
2fd85f6ec8 the source of randomness 2022-09-05 12:47:59 +04:00
Arpit Temani
91108cec4b Merge branch 'shiva/pos-730' of github.com:maticnetwork/bor into arpit/pos-655 2022-09-05 11:52:09 +04:00
Evgeny Danienko
7136ca61e0 linters 2022-09-05 11:33:42 +04:00
Evgeny Danienko
e5fcab70d2 use crypto rand 2022-09-05 10:58:43 +04:00
Evgeny Danienko
9d975fb833 lint 2022-09-05 10:53:22 +04:00
Evgeny Danienko
c0a4b0fbb5 fix flacky test 2022-09-05 10:50:00 +04:00
Arpit Temani
c6c2e74919 Merge branch 'develop' of github.com:maticnetwork/bor into arpit/pos-655 2022-09-05 10:36:52 +04:00
Manav Darji
84529a15cf
rm: snapshot found log in bor consensus (#504) 2022-08-25 23:13:22 +05:30
Manav Darji
f574c4a3c6
consensus/bor/heimdall: add new meter and timer metrics in heimdall client (#459)
* heimdall client: add new meter and timer metrics

* fix: error in handling valid and invalid request metric

* use ctx outside of request

* add separate metrics for each request

* fix: modify metric name

* fix: renmae metric name by removing hyphen

* use ctx value for request type

* fix linters

* fix panic on using string as key for ctx and on nil return

* refactor

* refactor

* rm comment

Co-authored-by: Evgeny Danienko <6655321@bk.ru>
2022-08-23 18:00:54 +05:30
Evgeny Danilenko
3c94dfb25f
A thread safe way to take a free port (#485)
* initial commit

* safe latest error

* remove json listener

* fix: debug block unit test

* remove jsonrpc listener from server

* fix: consume network's find port in heimdall client test

* update key in log while startup

* linters

* fix

Co-authored-by: Manav Darji <manavdarji.india@gmail.com>
2022-08-16 18:43:18 +03:00
Krishna Upadhyaya
72aa44efe6
Fix EOF error in gRPC state-sync (#489)
* Fix EOF error in gRPC state-sync

* linters

Co-authored-by: Evgeny Danienko <6655321@bk.ru>
2022-08-11 20:40:08 +03:00
Evgeny Danilenko
e699254142
Use atomic pointer in go 1.19 (#446)
* use atomic pointer

* golang version

* golang version

* go1.19

* linters

* Bump golangci-lint

* linters

* linters

* linters after merge

* generic logger

* generic logger

* logger

* logger

* linters

* bump toml

* linters1

* linters

* linters

* linter

* linter

* linters

* linters

* linters
2022-08-09 22:11:09 +03:00
Krishna Upadhyaya
0c0fb63491 Implemented retry middleware in heimdall gRPC 2022-07-28 18:11:59 +05:30
Krishna Upadhyaya
75bb3bdeb1 Merge branch 'develop' into POS-648 2022-07-27 19:09:04 +05:30
Krishna Upadhyaya
f55f816351 fixed context in gRPC code 2022-07-27 19:07:48 +05:30
Krishna Upadhyaya
00c2b3329c fix lint 2022-07-26 18:15:21 +05:30
Krishna Upadhyaya
8de8a6815c Integrated heimdall gRPC server flow 2022-07-26 18:08:25 +05:30
Krishna Upadhyaya
dbbacb8b19 Using polyproto v0.0.2 and removed type utils 2022-07-26 11:16:11 +05:30
Krishna Upadhyaya
385aff85f0 Implemented heimdall gRPC client 2022-07-26 02:18:37 +05:30
Jerry
c50ff82ab1 Fix "Signer 0x... is not a part of the producer set at block xxxx"
The validator set json loaded from database will have an empty map. This change will recompute the validator map based on validator set.
2022-07-25 10:19:39 -07:00
Arpit Temani
062ea8b505 sprint type change 2022-07-21 17:20:15 +05:30
Manav Darji
bf60c6ce06
consensus/bor: add mock heimdall rest-server, tests for timeout and cancellation (#458)
* add: mock heimdall rest-server, tests for timeout and cancellation

* fix: use mux for route handling
2022-07-19 16:22:41 +05:30
Manav Darji
c44693706a
RFC35/Common Ancestor: Modifying the forkchoice rule (#425)
* initial

* update

* fix: add validator to NewBlockchain function calls

* handle past chain reorg

* fix: only check with last checkpoint

* rm logs

* add: handle future chain import case

* fix: handle single block case

* add unit tests for past and future chain

* modularise forker tests

* minor fixes

* add: overlapping chain test case, minor fixes

* minor fixes

* add: isolated unit test for IsValidChain

* add more test case for IsValidChain

* fix: use index for header time

* add: fetch last N checkpoints in first run

* fix: change checkpoint count to int64

* fix: handle edge case

* fix: handle no checkpoint case separately

* fix: consider offset for future chain calculation

* re-write test case for split chain

* fix: typo

* add: split chain properties test

* separate reorg checks, validate chain before inserting

* fix: handle err incase of invalid chain

* fix: use error from whitelist service

* split chain property tests

* remove duplicate test cases

* cleanup

* clean up

* fix linters

* fix: fetch checkpoint count bug, add tests

* fix more linters

* fix: handle nil chain validator in downloader

* fix: mock bor tests

Co-authored-by: Evgeny Danienko <6655321@bk.ru>
2022-07-15 10:37:35 +05:30
Arpit Temani
7b25997830
Reciept e2e test (#431)
* initial

* fixed tests

* eip155 tests

* progress

* fix

* fix TestFetchStateSyncEvents*

* debug

* fixed with updated list of validators

* fix

* a bit more stable

* optimize allocations

* linters

* fix vals copy

* a bit of refactoring

* update TestGetTransactionReceiptsByBlock

* remove logs from TestGetTransactionReceiptsByBlock in favour of checks

* comments

* Linters

* linters

* fixes after merge

* fixes after merge

* fixes after merge

* fixes after merge

* fail fast

Co-authored-by: Evgeny Danienko <6655321@bk.ru>
2022-07-14 19:28:56 +03:00
SHIVAM SHARMA
1147994c65
Added valSet testcases (#452)
* Added valSet testcases

* Added Negative Assertions

* Minor Changes

* Added varying valset length

* Minor changes

* Linting
2022-07-13 12:21:29 +03:00
Evgeny Danilenko
3c42bfc633
add context to Fetch* methods (#445)
* add context

* fix mocks

* fixes after CR

* fixes

* fix

* Linters
2022-07-13 09:07:32 +03:00
Jerry
9ec673870a Set Heimdall client to nil when 'withoutheimdall' is set 2022-06-16 10:28:28 -07:00
Evgeny Danilenko
342bf3089e
Merge develop branch into v0.3.0-dev (#430)
* merge geth v1.10.15

* fix: Removed FastSync from cli server

* fix: TestHeadersRLPStorage

* Added t.skip(ETH2 in bor)

* fix: flow in create consensus engine

* bumped version

* Fix typo

* increase block time

* remove file

* bumped version

* merge gethv1.10.17

* bumped version

* fix failing tests

* Bump Go version to v1.18 (#368)

* Bump Go version to v1.18.1

* Build using netgo tag

This will create a static build using Go native networking stack.

Checked and it works stable for all archs and distros.

* Fix meta

* initial implementation for common ancestor approach

* extract whitelist interface

* fix types

* fix tests and format

* add unit tests for IsValidChain function

* more tests

* wip

* test ErrCheckpointMismatch

* minor fixes

* fix test

* dont panic

* fmt

* Limit state sync by gas

* Added logging for state-sync total gas usage

* Added number of event-records in log

* Minor Changes

* Minor Fix

* Adding individual gasUsed

* Minor Fix

* fix: return value for no remote block

* handle all errors

* modularise fake chain validator in downloader

* add more tests

* fix tests

* Modifying miner.recommit flag and its adjustment function. (#370)

* changed min/max/current recommit values

* Remove Hardcoded min/max

* Code Sanitization

* Skipping tests for constant recommit interval

* Adding default miner.recommit value

* Minor Change

* Increased default value of rpc.txfeecap to 5

* add debug rpc endpoints for checkpoint whitelist service

* minor fixes and enhancements

* avoid capping warnings for gas set by internal system transactions

* use typed mocks

* fix

* fix

* fix

* fix close

* fix

* Create stale.yml

* Fix bor consensus checkpoint bug

Co-authored-by: Arpit Temani <temaniarpit27@gmail.com>
Co-authored-by: Shivam Sharma <shivam691999@gmail.com>
Co-authored-by: Manav Darji <manavdarji.india@gmail.com>
Co-authored-by: Sandeep Sreenath <sandeep.sreenath@gmail.com>
Co-authored-by: Victor Castell <victor@victorcastell.com>
Co-authored-by: Ferran <ferranbt@protonmail.com>
Co-authored-by: Krishna Upadhyaya <krishnau1604@gmail.com>
Co-authored-by: Karlo <karlonovak@gmail.com>
Co-authored-by: Sandeep Sreenath <ssandeep@users.noreply.github.com>
Co-authored-by: Jerry <jerrycgh@gmail.com>
2022-06-15 09:02:01 +03:00
Evgeny Danilenko
9c8bf51f57
Prepare Bor package for testing (#416)
* Limit state sync by gas

* Added logging for state-sync total gas usage

* Added number of event-records in log

* Minor Changes

* Minor Fix

* Adding individual gasUsed

* Minor Fix

* it works

* fix tests

* log wiggle and delay with block number

* log delays as numbers

* linters

* fix tests

* restore linters for the project

* fix linters

* fix

* fix

* fix

* linters

* generation

* fix tests

* remove heimdall wrapper response

* linters

* remove possible collisions

* remove possible collisions

* remove possible collisions

* tests for unique address generation

* generalize set

* bor miner tests got restored

* fixes after CR

* final step and mining test

* fix

* fix e2e

* more tests for Heimdall requests

* fix linters

Co-authored-by: Ferran <ferranbt@protonmail.com>
Co-authored-by: Shivam Sharma <shivam691999@gmail.com>
2022-06-08 16:39:30 +03:00
Jerry
5092006b27 Fix default Dockerfile for new CLI 2022-05-27 14:40:04 -07:00
Jerry
2e2557a2d0 Enable prealloc check and improve address comparison 2022-05-26 11:55:44 -07:00
Jerry
12ab0f0240 Lint consensus/bor module
Cleanup, lint, and enable linters for consenssus/bor module.

Disabled linter "gomnd" and "tagliatelle" because they are not
easy to fix and the return on the time investment is very low.
Disabled linter "prealloc" because it is not easy to guess and pre-allocate the
slice accurately in many cases.
2022-05-23 19:46:59 -07:00
Evgeny Danilenko
87a2e5224f
Merge pull request #395 from maticnetwork/testing-flags
Restores linters and separate kinds of tests
2022-05-23 19:42:18 +03:00
Manav Darji
be01489883 move logs 2022-05-10 17:03:08 +02:00
Manav Darji
e4e5d4a0c1 fix: fetch span retry bug 2022-05-10 17:02:57 +02:00
Shivam Sharma
c3d180cc46 Minor fix 2022-05-09 17:08:03 +02:00
Shivam Sharma
b172ba8fbf Sorted Difficulties 2022-05-09 17:08:03 +02:00