Quentin Kniep
3775f4a5d4
Extend gas optimization for eth_createAccessList ( #8261 )
...
This builds upon #3453 and #3524 , which previously implemented gas
optimizations for the access lists generated by Erigon's implementation
of the `eth_createAccessList` RPC call.
Erigon currently optimizes inclusion of the recipient address based on
how many storage keys are accessed, but does not perform the same
optimization for sender address and precompiled contract addresses.
These changes make the same optimization available for all of these
cases.
Additionally, this handles the cases of block producer address and
created smart contract addresses. If these cases were omitted on purpose
since they heavily rely on state, it may still make sense to offer them
to users but disable them by default.
2023-10-01 13:24:15 +02:00
Alex Sharov
e993ee984b
stage loop: allow nil in hook ( #8318 )
2023-09-29 09:03:19 +07:00
lupin012
92446bfa66
Rpcdaemon: fixed few bugs in erigon_getLatestLogs ( #8153 )
...
doing some testing some bugs in the API implementation were found and
fixed
---------
Co-authored-by: alex.sharov <AskAlexSharov@gmail.com>
2023-09-22 17:07:16 +07:00
Anshal Shukla
3c8cbda809
fix finalized api for polygon chain ( #8247 )
...
Co-authored-by: Ubuntu <ubuntu@ip-10-0-0-234.eu-west-1.compute.internal>
2023-09-20 13:32:22 +01:00
Mark Holt
3b45f53f3d
Milestone stage processing ( #8187 )
...
This is the second part of the bor milestone release it contains the
following changes:
* Initialize services
* This is a change from the initial pull request I have moved all of the
initialization to the bor engine. To facilitate this I have just passed
in the heimdall client interface, rather than the whole engine
* Stage processing
* This is also a change from the original PR - the code is contained in
the bor heimdall stage rather than in headers - the effect should be the
same, but this needs testing
---------
Co-authored-by: Mark Holt <mark@disributed.vision>
Co-authored-by: Anshal Shukla <shukla.anshal85@gmail.com>
2023-09-18 18:05:33 +01:00
Alex Sharov
eb747c042a
Downloader: add tests to protect from re-downloading ( #8191 )
2023-09-15 13:46:59 +07:00
Park Changwan
ef84972e7c
Add addPeer RPC ( #7804 )
...
This PR mirrors https://github.com/testinprod-io/op-erigon/pull/54 .
Actual implementation for `admin_addPeer` method.
RPC Spec: Refer to
https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-admin .
> The addPeer administrative method requests adding a new remote node to
the list of tracked static nodes. The node will try to maintain
connectivity to these nodes at all times, reconnecting every once in a
while if the remote connection goes down.
Requires https://github.com/ledgerwatch/erigon-lib/pull/1033/
After https://github.com/ledgerwatch/erigon-lib/pull/1033 is merged,
will update erigon-lib version, removing replace at go.mod.
Note that even if RPC response returns `true`, it does not guarantee
that RLPx protocol is established between peers. It just adds node
entrypoint to its static peer list, and periodically tries and tests
connections.
## Testing
This RPC needs integration testing, so I made some scenario.
Use below command for testing:
Spin up two dev nodes which p2p enabled:
Start Node 1: RPC running at port 8545:
```sh
./build/bin/erigon --datadir=dev --chain=dev --port=30303 --http.port=8545 --authrpc.port=8551 --torrent.port=42069 --no-downloader --nodiscover --private.api.addr=127.0.0.1:9090 --http --ws --http.api=admin --p2p.allowed-ports=30306,30307,30308 --authrpc.jwtsecret=/tmp/jwt1 --p2p.protocol=67,68 --log.console.verbosity=5
```
Start Node 2: RPC running at port 8546:
```sh
./build/bin/erigon --datadir=dev2 --chain=dev --port=30304 --http.port=8546 --authrpc.port=8552 --torrent.port=42068 --no-downloader --nodiscover --private.api.addr=127.0.0.1:9091 --http --ws --http.api=admin --p2p.allowed-ports=30309,30310,30311 --authrpc.jwtsecret=/tmp/jwt2 --p2p.protocol=67,68 --log.console.verbosity=5
```
Get nodeInfo of node 1 using `admin_nodeInfo` RPC:
```sh
curl --location 'localhost:8545/' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc":"2.0",
"method":"admin_nodeInfo",
"params":[],
"id":1
}'
```
Example response:
```
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"id": "b75e0c4d2113b6f144ea8fd356a8f90e612a2a5f48a13c78d7e0e176e5724eb2",
"name": "erigon/v2.47.0-dev-5d86cdb5/darwin-arm64/go1.19.6",
"enode": "enode://05ab575d947f2d73065ea0f795dc2d96ed0ad603f3e730ab90dc881122d552c9f59ffcb148fe50546bec8b319daeb3c22ec02e7d12a7c4f2ac4cd26456a04a7c@127.0.0.1:30303?discport=0",
...
```
Get nodeInfo of node 2 using `admin_nodeInfo` RPC:
```sh
curl --location 'localhost:8546/' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc":"2.0",
"method":"admin_nodeInfo",
"params":[],
"id":2
}'
```
Example response:
```
{
"jsonrpc": "2.0",
"id": 2,
"result": {
"id": "32d721e4d75219b021d7f83235f1f1eb8b705d6f85e634bccde564b8f7f94d78",
"name": "erigon/v2.47.0-dev-5d86cdb5/darwin-arm64/go1.19.6",
"enode": "enode://1abb8579647779e13b7f68d18f9c776cbd29281841c7f950e9cf9afa996e31120a6f481cea8e90e0f42a0eb1aa00aeafee81c4bae6c31aa16810b795c6d6e069@127.0.0.1:30304?discport=0",
...
```
Call `admin_addPeer` RPC to node 2:
```sh
curl --location 'localhost:8546/' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc":"2.0",
"method":"admin_addPeer",
"params":["enode://05ab575d947f2d73065ea0f795dc2d96ed0ad603f3e730ab90dc881122d552c9f59ffcb148fe50546bec8b319daeb3c22ec02e7d12a7c4f2ac4cd26456a04a7c@127.0.0.1:30303"],
"id":2
}'
```
Example response:
```
{
"jsonrpc": "2.0",
"id": 2,
"result": true
}
```
Check peer info of node 1 using `admin_peers` RPC:
```sh
curl --location 'localhost:8545/' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc":"2.0",
"method":"admin_peers",
"params":[],
"id":1
}'
```
Example response:
```
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"enode": "enode://1abb8579647779e13b7f68d18f9c776cbd29281841c7f950e9cf9afa996e31120a6f481cea8e90e0f42a0eb1aa00aeafee81c4bae6c31aa16810b795c6d6e069@127.0.0.1:55426",
"id": "32d721e4d75219b021d7f83235f1f1eb8b705d6f85e634bccde564b8f7f94d78",
"name": "erigon/v2.47.0-dev-5d86cdb5/darwin-arm64/go1.19.6",
"caps": [
"eth/66",
"eth/67"
],
"network": {
"localAddress": "127.0.0.1:30303",
"remoteAddress": "127.0.0.1:55426",
"inbound": true,
"trusted": false,
"static": false
},
"protocols": null
}
]
}
```
---------
Co-authored-by: alex.sharov <AskAlexSharov@gmail.com>
2023-09-06 15:31:02 +07:00
Alex Sharov
8983128d24
Restore genesis reads code - remote rpc case. Remove ctx parameter from baseApi func (tx already has internal ctx) ( #8122 )
2023-09-04 12:42:08 +07:00
lupin012
5a9f430c5a
RPCdaemon: fix to work also with snapshot ( #8111 )
...
The FIX is necessary to permit to use API also in case block is in the
snapshot files
2023-09-02 09:55:48 +07:00
banteg
5fbb9e2f87
fix: correctly process extcodecopy in vmtrace ( #8108 )
...
vmtrace routine wasn't outputting the memory extcodecopy has written.
2023-09-01 07:10:34 +07:00
Andrew Ashikhmin
9b63764b16
Move ApplyDAOHardFork & UpgradeBuildInSystemContract to engine.Initialize ( #8095 )
...
Now all protocol-stipulated changes at the beginning of the block (AuRa
stuff,
[DAO](https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/dao-fork.md )
irregular state change, Calcutta system contract upgrade,
[EIP-4788](https://eips.ethereum.org/EIPS/eip-4788 ) beacon root) are
handled by consensus engine `Initialize()`.
2023-08-30 15:51:19 +02:00
Alex Sharov
d1d348211f
add flag --force.partial.commit: to workaround problem "start from backup takes long time and can't save partial progress" ( #8090 )
2023-08-30 08:49:16 +07:00
Andrew Ashikhmin
6bc0ca9e85
Correctly compute fork id when timestamp fork is activated in genesis ( #8046 )
...
See https://github.com/ethereum/go-ethereum/pull/27895
2023-08-21 15:35:13 +02:00
ledgerwatch
6b6c0caad0
Snapshots of Bor events ( #7901 )
...
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
Co-authored-by: Alex Sharp <alexsharp@alexs-mbp-2.home>
2023-08-18 17:10:35 +01:00
Somnath Banerjee
143ff4695c
Fix 17 hive tests ( #8014 )
2023-08-14 09:24:59 +02:00
Andrew Ashikhmin
03927d3e27
Call InitializeBlockExecution in SpawnMiningExecStage (EIP-4788) ( #7999 )
...
This fixes the trie state root issue that was occurring in the Hive
tests for Cancun.
2023-08-11 14:04:53 +02:00
banteg
63ecbf88ba
fix: show stack for push0 ( #7970 )
...
this fixes vmtrace after shanghai
before:
```python
VMOperation(pc=24, cost=2, ex=VMExecutedOperation(used=1942085, push=[], mem=None, store=None), sub=None, op='PUSH0', idx='14-644-13')
```
after:
```python
VMOperation(pc=24, cost=2, ex=VMExecutedOperation(used=1942085, push=[HexBytes('0x00')], mem=None, store=None), sub=None, op='PUSH0', idx='14-644-13')
```
2023-08-05 23:37:51 +02:00
Giulio rebuffo
0e4e36b142
Replaced old version of Engine API with newer version ( #7972 )
2023-08-05 23:33:10 +02:00
Andrew Ashikhmin
bd9e8b9b56
Fix eth_getTransactionByHash for EIP-4844 transactions ( #7960 )
...
Also pick https://github.com/ledgerwatch/erigon-lib/pull/1063 and
https://github.com/ledgerwatch/erigon-lib/pull/1065
2023-08-02 18:25:15 +02:00
Andrew Ashikhmin
03ac80ad2d
EIP-4844: rename "data hash" to "blob hash" ( #7947 )
...
See https://github.com/ethereum/EIPs/pull/7001
2023-07-31 10:12:53 +02:00
Andrew Ashikhmin
7d35c6b737
EIP-4844: Rename "data gas" to "blob gas" ( #7937 )
...
See https://github.com/ethereum/EIPs/pull/7354 &
https://github.com/ethereum/consensus-specs/pull/3461 . Prerequisite:
https://github.com/ledgerwatch/erigon-lib/pull/1058
2023-07-28 12:12:05 +02:00
Willian Mitsuda
d3f8b5861c
Max cap search results for ots API by default + cli flag to override it ( #7924 )
...
Otterscan API search methods allow the user to inform the page size.
This PR adds an internal max (default == 25 results) to cap the page
size, regardless of what the user asks.
It also adds a `--ots.search.max.pagesize` CLI args to override this max
(either in erigon and rpcdaemon binaries).
2023-07-28 08:29:17 +07:00
Delweng
dec2f5a3b3
turbo/jsonrpc: eth_getBlockReceipts support by by hash ( #7886 )
...
Signed-off-by: jsvisa <delweng@gmail.com>
2023-07-14 08:57:09 +01:00
ledgerwatch
035a6f867c
Simplifications for bor tx code ( #7889 )
...
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
2023-07-14 08:49:10 +01:00
Giulio rebuffo
b2442a7b41
Removed unused stages (Cumulative index + Translation) ( #7884 )
2023-07-13 16:55:48 +02:00
Giulio rebuffo
bd63cb7c8c
Removed GRPC layer from Engine API ( #7878 )
2023-07-12 18:11:41 +02:00
Giulio rebuffo
6272559fb7
Separated PendingBlock behaviour to be chain agnostic ( #7859 )
...
Instead of getting the pending block with latest payload id, we just
store the latest block built and serve it in remote backend
2023-07-10 19:22:03 +02:00
Giulio rebuffo
20b8e156db
moved cmd/rpcdaemon/commands -> turbo/jsonrpc ( #7858 )
2023-07-08 19:01:26 +02:00