While working on fixing the bor mining loop I stumbled across an error
in `ChainReader.BorSpan` - not implemented panic. Also hit a few other
panics due to missed logger in `ChainReaderImpl` struct initialisations.
This PR fixes both.
This request implements the insertion of Bor ephemeral transactions into
snapshot indexes.
I does this by taking the block hash from the header index and passing
it to the transaction indexer to add an additional index entry per block
into the transaction hash -> block index.
The passed entries are currently contained in an in memory array which
is (32 * number of blocks / sprint size) bytes.
In addition to the functional code there is also an update to the
`dump_test.go` so that it runs `DumpBlocks` to exercise the indexing
code. To facilitate this the `InsertChain` method in `mock_sentry` has
been modified so that it can process >128 blocks.
The code in this request also includes additional bor/consensus code
with the following functions:
`CalculateSprint`
`CalculateSprintCount`
The first function is a modification of the code in erigon-lib so that
the sprints are numerically rather than lexically ordered. This code
should be migrated to erigon-lib and should have its sprint set
calculated once from its underlying map rather than this process being
repeated every calculation.
---------
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
Co-authored-by: ledgerwatch <akhounov@gmail.com>
Co-authored-by: Enrique Jose Avila Asapche <eavilaasapche@gmail.com>
Co-authored-by: Giulio <giulio.rebuffo@gmail.com>
Changes summary:
- Continue with the gasLimit check skip in ``verifyHeader`` of
``merge.go`` for unless pre-merge block and blockGasLimitContract
present
- Refactor ``aura.go`` a bit
- Have ``sysCall`` method customized to be able to call state (contract)
at a parent (or any other) header state
- breaks dependency from staged_sync to package with block_reader
implementation
- breaks dependency from snap_sync to package with block_reader
implementation
- breaks dependency from mining to txpool implementation
Dirty hack to fix Chiado until #7151 is properly implemented. Should fix
the following error:
```
[WARN] [05-23|17:07:39.303] Verification failed for header hash=0x4eee718e5958a862746ea9a9531a16e6a404698d3a0e8120e8aff743b9f1e0a2 height=1 err="invalid gas limit: have 12500000, want 10000000 +-= 9764"
```
* Enable the `clique` option in the `--http.api` flag.
* List of Clique commands:
`clique_getSnapshot(block number)`
`clique_getSnapshotAtHash(block hash)`
`clique_getSnapshotAtHash(block hash)`
`clique_getSigners(block number)`
`clique_getSignersAtHash(block hash)`
`clique_proposals()`
`clique_propose(signer address, bool)`
`clique_discard(signer address)`
`clique_status()`
Example:
`curl --data
'{"method":"clique_getSigners","params":[],"id":1,"jsonrpc":"2.0"}' -H
"Content-Type: application/json" -X POST http://localhost:8545`
* Please be careful while using the Clique API. Do not make the HTTP API
public on the Clique's signer node, as anyone can directly call a Clique
command. Instead, it should only be allowed in the localhost by using
the flag `--http.addr "127.0.0.1"`.
In this PR Header's ExcessDataGas is set to the actual value, but it's
still unused. It will be used to compute data fee for eip-4844 data
blobs, logic of which will be added in later PRs. Also eip-4844 header
verification logic added.
So there is an issue with tracing certain blocks/transactions on
Polygon, for example:
```
> '{"method": "trace_transaction","params":["0xb198d93f640343a98f90d93aa2b74b4fc5c64f3a649f1608d2bfd1004f9dee0e"],"id":1,"jsonrpc":"2.0"}'
```
gives the error `first run for txIndex 1 error: insufficient funds for
gas * price + value: address 0x10AD27A96CDBffC90ab3b83bF695911426A69f5E
have 16927727762862809 want 17594166808296934`
The reason is that this transaction is from the author of the block,
which doesn't have enough ETH to pay for the gas fee + tx value if he's
not the block author receiving transactions fees.
The issue is that currently the APIs are using `ethash.NewFaker()`
Engine for running traces, etc. which doesn't know how to get the author
for a specific block (which is consensus dependant); as it was noting in
several TODO comments.
The fix is to pass the Engine to the BaseAPI, which can then be used to
create the right Block Context. I chose to split the current Engine
interface in 2, with Reader and Writer, so that the BaseAPI only
receives the Reader one, which might be safer (even though it's only
used for getting the block Author).
BaseFee is required in AuRa headers when
[EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) is activated.
Also:
- Basic AuRa header verification
- Extract some common RLP methods
- Tiny log clean-up
* Consensus tests update 11
* Add GrayGlacier fork
* Wire currentRandom from tests into PREVRANDAO
* Serenity engine
* Support insertion of PoS blocks in MockSentry
* Introduce marshallTypedTransactionsAsRlpStrings arg into (*Block) RawBody()
* Revert "Introduce marshallTypedTransactionsAsRlpStrings arg into (*Block) RawBody()"
This reverts commit 903fca572be03c7de33318ce177a03a4be34927b.
* Post-merge fix
* Don't wait for Beacon Chain in tests
* Skip powToPosBlockRejection transition test
* ForkChoice in insertPoSBlocks
* Add withPosDownloader arg to MockWithEverything in order to fix TestPoSDownloader
* consensus/clique: remove race condition
* consensus/clique: fix one more signer data race
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
Co-authored-by: Harry Kalodner <harry.kalodner@gmail.com>
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
* implemented bor consensus
* add bor flags to default
* change bucket into snapshot to clique
* enable stateSync
* bypass reciept checks
* fix receipt calculation and bor logs
* fix: contract call wrt bor
* Update mumbai config
* Add: bor-mainnet flag and config
* Add bor consensus to integration
* use header coinbase in block context
* london fork mumbai changes
* fix genesis error
* Jaipur fork for mumbai
* add sysCall to verifyHeader
* added bor related rpc method implementation
* added bor specific rpc extensions
* fixes in snapshot implementation, major refactor for bor rpc
* modify consensus specific db path for bor
* fix: remove parallel compute for get root hash rpc method
* Added bor-receipt flow
* Use turbo-bor-lib and bor tables
* Use bor table in RPC snapshot
* Update README.md
* Update README.md
* Update README.md
* Update README.md
* update rpc readme
* link rpc docs in readme
* Update Readme
* Update Readme
* move erigon namespace rpc methods to eth
* rm: erigon namespace
* rm: erigon namespace, update list of available rpc methods, add example
* fix: binary name in rpc readme
* fix: max db size
* Add london to bor-mainnet
* updated node.go
* add system req to readme
* golang version fix readme
* added networknames in correct place
* nil
* ran gofmt
* erigon
* fixed fake.go
* dont need turbor-lib
* old readme
* fixing readme
* half
* other half
* changed return
* fixing return
* fixed return
* fixed flags
* gofmt
* merge with devel
* latest erigon-lib
* fixed context.coinbase
* took out syscall
* fixed params in hash
* bor type now is consensus.Engine
* parlia is consensus.Engine
* missing arg and repeated importation
* repeated importation
* fixed eth_receipts.go
* deleted duplicate issuance
* part of consensus.Engine type
* added eth_api issuance
* networkname
* added erigon_system file
* fork struct taken out
* added erigon block
* getLogByHash for erigonImpl
* gofmt
* fixed lint
* ops
* gofmt
* gofmt
* added APIImple functions
* fixed clique test
* took out print
* fixed state added balance
* fixed README
* fixed rpcDaemon README
* fixed integration README
* updated blockchain.go
* lint
* added bor back into blockchain.go
* took out comment
* lint
* updated daemon
* updated wtb
* removed duplicate
* removed VerifyHeaders
* prevent use of wrong Transfer
* fixed state_processor.go
* fixed state_transition.go
* fixed headers
* returning err
* error handling in bor read tx look up
* put for txLookUp
* dealing with error
* lint
* traces
* more traces
* fixed receipt in execution
* getTrasanction receipt for bor or others
* nil
* lint
* ops
* deleted syscall
* took out else
* Merge branch 'devel
* tests syscalls
* changed borReceipt to receipt
* reset header algos
* arguments fix
* took out prefixes
* lint
* erigon-named
* borReceiptKey = blocknumber
* reverts e3b60c2e159d03efcb855f7ab3da5a098dd60c33.
* correct hashing tx
* dont need it here
* lint
* added txlookup for bor
* change to uint256
* outputs for isBor
* wrapper
* added isBor and isParlia
* isBor
* fixed BorTransfer
* not readBody
* correct prefix
* added blockNum
* added readStorageBody
* readStorageBody
* lint
* got rid of unnecessary bor_receipt func
* onlny if bor
* use clone
* append
* writeToSlice
* added isBor flag
* fixed writeToSlice
* normal sorting
* lint
* Reset erigon-snapshots
* Move bor prefix into if
Co-authored-by: Krishna Upadhyaya <krishnau1604@gmail.com>
Co-authored-by: Manav Darji <manavdarji.india@gmail.com>
Co-authored-by: Uttam Singh <uttamkhanduja@yahoo.in>
Co-authored-by: Giulio Rebuffo <giulio.rebuffo@gmail.com>
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro.local>