Commit Graph

503 Commits

Author SHA1 Message Date
Fridrik Asmundsson
dda2d7e023 Refactor EthBlockNumberOrHash and remove the number field 2023-06-22 17:18:50 +00:00
Fridrik Asmundsson
f358160cd5 Add EIP-1898 support needed for The Graph compatibility
Fixes: #10814

This PR updates the following RPC methods according to EIP-1898
specs.

The following RPC methods are affected:

- eth_getBalance
- eth_getStorageAt
- eth_getTransactionCount
- eth_getCode
- eth_call

Note that eth_getBlockByNumber was not included in this list in
the spec although it seems it should be affected also?

Currently these methods all accept a blkParam string which can be
one of "latest", "earliest", "pending", or a block number (decimal
or hex). The spec enables caller to additionally specify a json
hash which can include the following fields:

- blockNumber EthUint64: A block number (decimal or hex) which is
  similar to the original use of the blkParam string
- blockHash EthHash: The block hash
- requireCanonical bool) If true we should make sure the block is
  in the canonical chain

Since the blkParam needs to support both being a number/string and
a json hash then this to properly work we need to introduce a new
struct with pointer fields to check if they exist. This is done
in the EthBlockParamByNumberOrHash struct which first tries to
unmarshal as a json hash (according to eip-1898) and then fallback
to unmarshal as string/number.
2023-06-20 09:38:00 +00:00
Yolan Romailler
00e34436b3
Addressing code review comments
Signed-off-by: Yolan Romailler <AnomalRoil@users.noreply.github.com>
2023-05-22 21:47:55 +02:00
Yolan Romailler
0d7d906abf
Adding extra data check on DecodeBlockMsg
fix: types: error out on decoding BlockMsg with extraneous data
Fixes OSS-fuzz issue 48208: lotus:fuzz_block_msg

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>
2023-05-12 21:32:44 +02:00
Fridrik Asmundsson
2bc205ed62 feat: Add eth_syncing RPC method
This commit adds eth_syncing RPC method which returns an object
with data about the sync status or false.
2023-05-10 16:08:18 -04:00
Friðrik Ásmundsson
ceb3f1e41e
Validate that FromBlock/ToBlock epoch is indeed a hex value (#10780)
* Validate that FromBlock/ToBlock epoch is indeed a hex value

* Adding tests
2023-05-09 17:17:23 -04:00
Aayush Rajasekaran
ff0fa3471f
chore: refactor: drop unused IsTicketWinner (#10801) 2023-05-02 11:22:02 -07:00
ychiao
9ae48022ff
fix: Eth JSON-RPC api: handle messages with gasFeeCap less than baseFee (#10614) 2023-04-24 16:03:04 +01:00
Jorropo
fe42d974a2 chore: all: migrate from go-libipfs to boxo
github.com/ipfs/libipfs/blocks was unmigrated to github.com/ipfs/go-block-format due to compatibility issues with the rest of the IPLD stack.
2023-04-18 17:22:18 +02:00
Łukasz Magiera
7e414ac390 Merge remote-tracking branch 'origin/master' into feat/go-data-transfer-v2 2023-03-15 11:37:53 +01:00
Raúl Kripalani
f7a979d825 eth_feeHistory: migrate to using TipSetState. 2023-03-11 17:25:00 +00:00
Steven Allen
92bca485b6 feat: stmgr: skip tipset execution when possible 2023-03-10 13:21:17 -08:00
Steven Allen
f7603f6c13 feat: eth API: reject masked ID addresses embedded in f410f payloads
We'll never get an actor/account deployed to one of these
addresses (although we might get a placeholder). However, converting
such an address to an f4 address is definitely wrong.
2023-03-10 10:57:39 -08:00
Steven Allen
58900a7033
feat: mempool: Reduce minimum replace fee from 1.25x to 1.1x (#10416)
However, we're leaving the default at 1.25x for backwards compatibility, for now.

Also:

1. Actually use the configured replace fee ratio.
2. Store said ratios as percentages instead of floats. 1.25, or 1+1/(2^2),
can be represented as a float. 1.1, or 1 + 1/(2 * 5), cannot.

fixes #10415
2023-03-09 13:17:17 -08:00
Łukasz Magiera
d114d8fe7e deprecate MarketListRetrievalDeals, make gen 2023-03-08 17:15:16 +01:00
Steven Allen
dbbcf4b2ee
feat: vm: switch to the new exec trace format (#10372)
This is now "FVM" native. Changes include:

1. Don't treat "trace" messages like off-chain messages. E.g., don't
include CIDs, versions, etc.
2. Include IPLD codecs where applicable.
3. Remove fields that aren't filled by the FVM (timing, some errors,
code locations, etc.).
2023-03-01 16:02:18 -08:00
Aayush
19f1ad2762 Merge branch 'releases' into asr/merge-release-into-master 2023-03-01 14:18:35 -05:00
Steven Allen
68b401a895 fix: cli: better handle sending from EthAccount actors
This will make `lotus send` mostly just "do what the user wants" in this
case:

1. The user may not explicitly specify a method number.
2. Parameters are automatically cbor-encoded where applicable.
3. The method number is automatically selected based on the
   recipient (CreateExternal if sent to the EAM, InvokeEVM otherwise).
2023-02-24 15:15:41 -08:00
Aayush
984b4c78cb Merge branch 'release/v1.20.0' into asr/merge-release-into-master 2023-02-17 16:08:22 -05:00
Jorropo
2d3065ae8e chore: all: bump go-libipfs to replace go-block-format
Includes changes from:
- https://github.com/ipfs/go-block-format/pull/37
- https://github.com/ipfs/go-libipfs/pull/58

(cherry picked from commit f572852d06)
2023-02-17 18:46:11 +01:00
Steven Allen
00b6d06041
feat: eth: parse revert data (#10295)
We don't really want to do this in the FVM because it's Ethereum
specific, but this makes sense to do in the Ethereum API.

See:

See https://docs.soliditylang.org/en/latest/control-structures.html#panic-via-assert-and-error-via-require
2023-02-17 01:18:03 +00:00
Aayush
75c744a438 Merge branch 'release/v1.20.0' 2023-02-14 20:29:14 -05:00
ychiao
0d92c746bd
Eth JSON-RPC: populate reward in eth_feeHistory (#10245)
Co-authored-by: Łukasz Magiera <magik6k@users.noreply.github.com>
Co-authored-by: Raúl Kripalani <raul@protocol.ai>
2023-02-14 01:02:37 +00:00
Steven Allen
a16c54051c
fix: eth: rename yParity to v in transaction return values (#10264)
fixes https://github.com/filecoin-project/ref-fvm/issues/1662
2023-02-13 23:29:13 +00:00
Steven Allen
f427c2b566
fix: eth: correctly convert filecoin message <-> eth txn (#10257)
1. We do allow deploying with empty initcode.
2. Make sure that the encoded "code" is non-empty, if specified.

Basically, this makes everything consistent (and it's how I specified it
in the FIP).
2023-02-13 10:33:59 -08:00
Raúl Kripalani
8ff55c027e Merge branch 'release/v1.20.0' into asr/merge-release-into-master 2023-02-13 11:45:09 +00:00
raulk
37e1ac5d93
eth: FIP-0055: implement final version of transitory delegated signature. (#10239) 2023-02-12 21:08:42 +00:00
Aayush
63b03a48d0 Merge branch 'release/v1.20.0' into asr/merge-release-into-master 2023-02-10 18:39:51 -05:00
ychiao
db749b8fc7 Merge branch 'release/v1.20.0' into fix/EthUint64-args 2023-02-10 17:26:38 -05:00
ychiao
5e56af33df fix typo 2023-02-10 13:52:25 -05:00
ychiao
3c580403c1 implement itest and handle optional params 2023-02-10 13:33:59 -05:00
ychiao
37044ed3c3
Apply suggestions from code review
Co-authored-by: raulk <raul@protocol.ai>
2023-02-10 10:42:19 -05:00
Steven Allen
ece8f25511 fix: eth: strict event parsing
We now enforce the following rules:

1. No duplicate topics or data.
2. Topics must have 32 byte keys.
3. Topics may not be skipped. (e.g., no t1 & t3 without a t2).
4. Raw codecs.

We _don't_ require that topics/data be emitted in any specific order.

We _skip_ events with unknown keys. We _drop_ events that violate the
above rules.
2023-02-10 07:41:29 -08:00
Steven Allen
f1381ad535 refactor: use EthHash for event topics
This ensures they're always 32 bytes and padded, as required.
2023-02-10 07:41:29 -08:00
Raúl Kripalani
e06e3a0654 Merge branch 'release/v1.20.0' into fix/EthUint64-args 2023-02-10 12:49:02 +00:00
Łukasz Magiera
0f05232199
Merge pull request #10224 from filecoin-project/feat/ethcli-strip-spaces
feat: eth cli: Strip out empty spaces around contract bytes
2023-02-09 19:24:49 +01:00
Łukasz Magiera
b0fa75f13e feat: eth cli: Strip out empty spaces around contract bytes 2023-02-09 18:49:08 +01:00
Łukasz Magiera
cb8e2836bb
Merge pull request #10184 from filecoin-project/asr/merge-release-into-master
chore: merge release/v1.20.0 into master
2023-02-09 16:41:58 +01:00
Łukasz Magiera
e321761a72 ethrpc: Add missing fields to EthTx 2023-02-09 14:26:13 +01:00
Łukasz Magiera
9339267e6e
fix: ethrpc: emit correct bloom filters (#10194) 2023-02-08 23:14:53 +00:00
Steven Allen
89499bfd40 fvm: chore: update FVM
This:

1. Updates the builtin actors bundle (for actors v10).
2. Updates the event entry type to include the codec.
3. Removes the cbor encoding and zero trimming from event data.

I've chose to:

1. _Not_ add codec handling to the event filtering system for now.
2. _Skip_ events with unexpected codecs.

We don't actually _allow_ these events in the FVM right now, and it
simplifies the implementation.

However, I _am_ recording the codecs in the database so we don't have to
migrate it later.
2023-02-07 18:15:40 -08:00
Aayush Rajasekaran
693f230fbb Merge branch 'release/v1.20.0' into asr/merge-release-into-master 2023-02-07 11:03:01 -05:00
Aayush Rajasekaran
6a268cfb63 chain: explicitly check that gasLimit is above zero 2023-02-06 17:53:00 -05:00
Łukasz Magiera
5dc56841ea fix: ethtypes: Correct 'no transactions' hash in NewEthBlock 2023-02-06 17:17:19 +01:00
Łukasz Magiera
424824019b fix: ethtypes: Correct 'no uncles' hash in NewEthBlock 2023-02-06 14:38:48 +01:00
Łukasz Magiera
6851b6a523 Merge remote-tracking branch 'origin/release/v1.20.0' into fix/eth-orpc-validate 2023-02-06 10:41:52 +01:00
Aayush
f291572b4a Merge branch 'release/v1.20.0' into asr/merge-release-into-master 2023-02-03 09:27:04 -05:00
raulk
b46258d0bf
feat: evm: align events implementation with FIP-0049 and FIP-0054. (#10152)
- Event keys are now t1, t2, t3, t4 for topics; and d for data.
- ref-fvm no longer stores events in the blockstore for us. It just
  returns events to the client, who is now responsible for handling
  them as it wishes / according to its configuration.
- Add a flag to VMOpts to have the events AMT be written in the blockstore.
- Add a flag to the ChainStore to advertise to the rest of the system
  if the ChainStore is storing events.
- Enable that flag if the EthRPC is enabled (can also add an explicit
  configuration flag if wanted).
2023-02-02 19:10:30 -08:00
Łukasz Magiera
fe1e0974cb feat: ethrpc: Support filtering by address in subscribe 2023-02-02 14:46:36 +01:00
Ian Davis
d29a244064 Merge remote-tracking branch 'origin/release/v1.20.0' into iand/eth-openrpc-validate 2023-02-01 16:19:17 +00:00