Commit Graph

953 Commits

Author SHA1 Message Date
Alex Sharov
223fcd178c
e3: domain range api simplify (#7158) 2023-03-22 07:36:03 +00:00
Alex Sharov
753a680cbd
e3: union limit (#7156) 2023-03-22 06:38:04 +00:00
Andrew Ashikhmin
56a3844656
Drop Default from GenesisBlock* functions (#7147)
Small cosmetic changes and clean-ups
2023-03-20 15:44:22 +00:00
alex.sharov
e4b2072a16 --rpc.returndata.limit 2023-03-17 11:21:14 +07:00
Jason Yellick
b21569ccc5
Backfill eth getproof tests (#7092)
This PR adds missing tests for eth_getProof and does some mild
refactoring with switching from strings to more strict types. It's
likely best/most easily reviewed commit by commit.

Note, the tests include quite a number of helper types and functions for
doing the proof validation. This is largely because unlike Geth,
Erigon's approach to trie computations only requires serializing the
trie nodes, not deserializing them. Consequently, it wasn't obvious how
to leverage the existing trie code for doing deserialization and proof
checks. I checked on Discord, but, there were no suggestions. Of course,
any feedback is welcome and I'd be happy to remove this code if it can
be avoided.

Additionally, I've opted to change the interface type for `GetProof` to
use a `common.Hash` for the storage keys instead of a `string`. I
_think_ this should be fairly safe, as until very recently it was
unimplemented. That being said, since it's an interface, it has the
potential to break other consumers, anyone who was generating mocks
against it etc. There's additionally a `GetStorageAt` that follows the
same parameter. I'd be happy to submit a PR modifying this one as well
if desired.

Also, as a small note, there is test code for checking storage proofs,
but, storage proofs aren't currently supported by the implementation. My
hope is to add storage proofs and historic proofs in a followup PR.

---------

Co-authored-by: Jason Yellick <jason@enya.ai>
2023-03-14 00:04:52 +00:00
Alex Sharov
f2d99f9d85
e3: split "changed keys" iterator to simplify (#7086) 2023-03-13 08:06:50 +00:00
hexoscott
9f6b842d03
check for free messages when calling trace_transaction (#7073)
Gateway reported an issue with a trace returning an odd result, similar
to the recent problem we'd seen with gnosis. I found that
debug_traceTransaction worked fine so found where the differences were.
trace_transaction wasn't checking for service transactions so the trace
failed around fees when it shouldn't.

A number of code paths use callManyTransactions so they should all now
check for service messages where needed.
2023-03-13 07:36:40 +00:00
Kevin Ingersoll
ec071b4195
fix typo in eth_call error (#7084)
Spotted this typo when poking at Cloudflare's public gateway and mapped
it back here 🙈
2023-03-13 02:12:08 +00:00
Michael Montour
d5fbc5011e
Partial EIP1186 eth_getProof implementation (#6560)
This is a partial implementation of eth_getProof (see issue #1349),
supporting only a request for the latest block and an empty list of
storage keys (i.e. Account proof only). I don't know if there's a better
way of implementing this, but this was what I could come up with.
Posting it here in case it's useful.

Example output:
```
> eth.getProof("0x67b1d87101671b127f5f8714789C7192f7ad340e", [], 'latest')
{
  accountProof: ["0xf90131a0252c9d4ed347b4cf3fdccaea3ccef0a507e6bd4dbe4dcd98609b7195347c4062a0ab8cdb808c8303bb61fb48e276217be9770fa83ecf3f90f2234d558885f5abf18080a01a697e814758281972fcd13bc9707dbcd2f195986b05463d7b78426508445a04a0b5d7a91be5ee273cce27e2ad9a160d2faadd5a6ba518d384019b68728a4f62f4a0c2c799b60a0cd6acd42c1015512872e86c186bcf196e85061e76842f3b7cf86080a0e73919d9f472eec11f6da95518503f5527a98b9428f7a02c4f55bf51854214e480a06301b39b2ea8a44df8b0356120db64b788e71f52e1d7a6309d0d2e5b86fee7cb8080a01b7779e149cadf24d4ffb77ca7e11314b8db7097e4d70b2a173493153ca2e5a0a066a7662811491b3d352e969506b420d269e8b51a224f574b3b38b3463f43f0098080", "0xf8518080808080a0a00135c9ec2655cb6a47ab7ad27d6fc150d9cba8b3d4a702e879179116a68a60808080808080a02fb46956347985b9870156b5747712899d213b1636ad4fe553c63e33521d567a80808080", "0xf873a02056274a27dd7524955417c11ecd917251cc7c4c8310f4c7e4bd3c304d3d9a79b850f84e808a021e19e0c9bab2400000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"],
  address: "0x67b1d87101671b127f5f8714789c7192f7ad340e",
  balance: "0x21e19e0c9bab2400000",
  codeHash: "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
  nonce: "0x0",
  storageHash: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
  storageProof: []
}
> eth.getBlock('latest').stateRoot
"0x6a0673c691edfa4c4528323986bb43c579316f436ff6f8b4ac70854bbd95340b"
```
2023-03-09 03:04:09 +00:00
Alex Sharov
d19fcd870b
e3: use iterators composition in invIndex.Range (#7056) 2023-03-09 02:26:40 +00:00
Stéphane Loeuillet
fd1a971384
graphql: add Tx Receipts Logs to output (#7059) 2023-03-09 02:22:41 +00:00
Stéphane Loeuillet
e59d37e61d
graphql: protect against nil pointer deref on cases like TX with nil … (#7047)
…To address (contract creation)
2023-03-07 12:20:18 +00:00
Alex Sharov
7868782186
nil ptr in checkPruneHistory (#7042) 2023-03-07 08:37:21 +00:00
Stéphane Loeuillet
16973ec185
graphql: add missing fields in block.transaction (#7034) 2023-03-06 18:58:10 +00:00
Alex Sharov
a4f69abb97
e3: less locks, less casts (#6991) 2023-03-01 07:59:56 +00:00
Alex Sharov
98cc4535d1
RPC: chainConfig field use atomic pointer instead of mutex (#6960) 2023-02-26 10:24:52 +00:00
hexoscott
fd49965932
check prune history on trace calls (#6932)
Not sure if this is too aggressive or not, but return early once we have
a block number if state history has been pruned for that block number.
2023-02-26 09:10:46 +07:00
Jason Yellick
7b62bede1e
Log bound addresses instead of configured ones (#6948)
The CLI logging currently emits the configured address when noting that
the HTTP or Engine RPC services are started. This is _usually_ the same
as the listening address, but not always. In particular, when the bind
directive specifies an ambiguous parameter, like port 0 for an ephemeral
port, the actually bound address will differ.

This change will help users to operate Erigon while binding to ephemeral
ports. This is especially helpful for developers trying to run multiple
instances of Erigon concurrently in tests which may or may not be
executing in parallel.

Co-authored-by: Jason Yellick <jason@enya.ai>
2023-02-25 02:29:48 +00:00
nanevardanyan
ab6239b30f
WIP: cmd, turbo, core, eth: TransactionsV3 flag and persist in new table (#6754) 2023-02-24 18:49:25 +00:00
Alex Sharov
a19d1b59c5
Pool and RPCBlocksCache: to use generic lru (#6928) 2023-02-22 07:50:00 +00:00
alex.sharov
3a4ad0c614 GraphQL docs 2023-02-21 08:25:06 +07:00
ledgerwatch
f09fd51083
Skip the graphQL test which is not unit test (#6912)
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
2023-02-20 22:51:46 +00:00
Anshal Shukla
62a890df93
Remove miner address from eth_getBlockByNumber for bor RPC calls (#6898)
Makes it consistent with response of bor. Fixes
[Issue#735](https://github.com/maticnetwork/bor/issues/735).
2023-02-20 22:04:42 +00:00
Stéphane Loeuillet
195a72bf74
Initial GraphQL interface implementation (#6821)
That's an initial PR mostly for code review, not ready for production
use

Got basic GraphQL working when querying a single block

---------

Co-authored-by: Alex Sharov <AskAlexSharov@gmail.com>
2023-02-20 11:23:06 +00:00
Alex Sharov
c7a654cf05
E3: trace_filter to support of pos (#6909) 2023-02-20 09:42:40 +00:00
Anshal Shukla
7ce3f7b158
State sync transactions added to debug_traceBlockByNumber call (#6830)
State sync transactions can be enabled using `"borTraceEnabled": true`
parameter, this is to ensure that the current behaviour is unchanged.
2023-02-20 08:04:11 +00:00
Andrew Ashikhmin
58fcc04575
blockValue should use gasUsed rather than gasLimit (#6875)
Fees going to the gas fee recipient should be based on the actual gas
used (available in the receipt) rather than the gas limit in a
transaction. This fixes Hive test "GetPayloadV2 Block Value".

Also `engine_getPayloadBodiesByRangeV1` params should be encoded as hex
strings.
2023-02-14 15:05:27 +00:00
mmsqe
add5f80f43
doc: fix typo for ReturnDataLimit (#6874) 2023-02-14 14:35:51 +00:00
Alex Sharov
999899d66d
e3: read files list from db (#6833) 2023-02-13 05:17:01 +00:00
ledgerwatch
ee83447fa1
CL lightclient to create memdb in the tmpdir which gets cleaned up on… (#6829)
… startup

---------

Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
2023-02-11 20:44:51 +00:00
Alex Sharov
7c9f30d25b
e3: return list of e3 files by grpc (#6827) 2023-02-10 13:45:33 +07:00
Alex Sharov
ec52990c43
e3: Thread safe reopen folder (#6810) 2023-02-09 12:11:40 +07:00
Kian
72c01b2d88
Fix getBlockTransactionCount returning null (#6793)
So... for blocks that don't exist, the eth_getBlockTransactionCount RPCs
should return `null`. Erigon does this correctly right now and this is
covered by the unit test in
[rpcdaemon/commands/corner_cases_support_test.go](https://github.com/ledgerwatch/erigon/blob/devel/cmd/rpcdaemon/commands/corner_cases_support_test.go).

But, for blocks that don't have any transactions, like
[703696](https://etherscan.io/block/703696), the RPC also returns
`null`.

I've changed this to correctly return `0` and have added 2 new tests to
handle it. (I had to add another block to the test chain in
rpcdaemon/rpcdaemontest/test_util.go and had to fix a few other tests
that broke as a result.)

Resolves #6775
2023-02-07 18:32:42 +07:00
Andrew Ashikhmin
2fa448c45f
Validate params of GetPayloadBodiesByHash and ByRange (#6785)
See https://github.com/ethereum/execution-apis/pull/366 and
https://github.com/ethereum/execution-apis/pull/370.

Also fix a couple of issues so that the Hive tests pass.
2023-02-06 18:38:45 +01:00
a
966be04e6d
add eth_getFilterLogs, fix filter subscription ids (#6514)
this pr does the following:

1. adds new function to ApiImpl `GetFilterLogs` which should implement
`eth_getFilterLogs` (eth_getFilterChanges except with only logs filters)

2. changes the ID generator of rpchelper.Filters to use crypto/rand.

3. switched logs subscriptions to use the secure ID instead of number

4. changes subcription ids from an 8 byte hex string to a 16 byte
2023-02-06 10:18:10 +07:00
Anshal Shukla
a4f8175136
Bor file structure updated (#6167)
Updated bor consensus folder structure
2023-01-31 14:00:57 +05:30
Andrew Ashikhmin
de5a061fdf
Remove StarknetTransaction and friends (#6745) 2023-01-30 16:56:58 +01:00
ledgerwatch
8c2713b0b8
Fix lint (#6737)
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
2023-01-29 10:16:05 +00:00
Alex Sharov
9287a2202b
e3: eth_getModifiedAccountsByNumber (#6733) 2023-01-29 10:10:39 +07:00
Marc-André Dumas
407cfef9e7
rpc: move receipts length check after bor logic (#6731)
Fixing issue #6730
2023-01-28 21:21:57 +00:00
farwayer
00390a974f
Fix retrieving Bor transactions from the pool (#6689)
At the moment erigon does not try to look for bor transactions inside
the pool
2023-01-28 21:20:08 +00:00
Alex Sharov
2998aa6386
e3: debug_accountRange (#6726) 2023-01-28 12:03:24 +07:00
Alex Sharov
1583cdb068
e3: debug_accountAt, read from history instead of block exec (#6723) 2023-01-27 19:09:51 +07:00
Alex Sharov
13d6415de8
e3: ots system txn handle 2023-01-27 16:05:09 +07:00
Alex Sharov
5b703749bd
e3: ots underflow fixes (#6721) 2023-01-27 14:41:11 +07:00
Alex Sharov
171a965faa
e3: ots some underflow fixes (#6720) 2023-01-27 14:16:09 +07:00
Alex Sharov
b99e4abb3e
move math big constants to erigon-lib (#6719) 2023-01-27 11:39:34 +07:00
Alex Sharov
081e59311d
e3: ots_getTransactionBySenderAndNonce (#6718) 2023-01-27 11:34:04 +07:00
Max Revitt
6559c15ebb
feat(trace): use specific error string (#6696)
In v2.36.0 we correctly trace this transaction, however due to a code
ordering issue in previous releases, there was an 'out of gas' response,
because we fell through to the code here where
ErrContractAddressCollision will be returned as such. This change isn't
the fix, but ensures the actual error is returned.
2023-01-26 15:10:51 +01:00
Andrew Ashikhmin
d12fda5cbd
Switch AccessList, IntrinsicGas, SafeAdd/Mul to erigon-lib (#6709)
Reduce code duplication.
2023-01-26 12:26:12 +01:00