Commit Graph

524 Commits

Author SHA1 Message Date
Steven Allen
156a3a400c
fix: Eth API: accept input data in call arguments under field 'input' (#11505)
The correct name for this field is 'input' according to the Ethereum specs [0].
However, for the longest time, clients have been using 'data' and servers have been
lenient to accept both, preferring 'input' over 'data' when both appear.

Our lack of support for 'input' had gone unnoticed until go-ethereum decided
to adjust their ethclient implementation to issue eth_call and eth_estimateGas
requests with the 'input' field instead of 'data' [1]. This suddenly broke apps
using this client against Lotus' Eth API.

[0]: https://github.com/ethereum/execution-apis/blob/main/src/schemas/transaction.yaml#L33-L35
[1]: ethereum/go-ethereum#28078

Co-authored-by: raulk <raul.kripalani@gmail.com>
2024-01-06 15:42:52 -08:00
Andrew Jackson (Ajax)
e102e4f31f
Merge branch 'master' into feat/sturdypost 2023-11-29 17:15:42 -06:00
Fridrik Asmundsson
a3417e7488 Make block param to EthEstimateGas optional 2023-11-29 10:26:22 +00:00
Andrew Jackson (Ajax)
37d5d59ecc lp: fix: migrate 0 panic 2023-11-24 11:00:32 -06:00
Steven Allen
9b4df6a4d0
fix: eth: use the correct state-tree when resolving addresses (#11387)
We need to always use the state-tree from the tipset _after_ the message
executed. If we use any other state-tree, we might not find the address
we're trying to resolve.

This change also has some implication for pending messages: there's no
guarantee we'll be able to generate a 0x-style address for a pending
native message. So, instead of trying, I've removed support for pending
native messages from the Eth API. Messages from EthAccounts will still
work, and native messages will still show up in blocks/traces, they just
won't show up as "pending". Which should affect exactly nobody.

I'm also taking this opportunity to cleanup some edge-cases:

1. Pass contexts where appropriate.
2. Remove all state access from `ethTxHashFromSignedMessage`.

Part of #11355
2023-11-17 18:20:31 +01:00
Alejandro Criado-Pérez
b6a77dfafc
Fix/texts (#11298)
* documentation text corrections

* Text corrections in go files

* make docsgen-cli
2023-10-27 11:32:42 -07:00
Aayush
5e76b05b17 Merge branch 'feat/nv21' into asr/merge-feat-nv21 2023-10-16 11:13:33 -04:00
Steven Allen
c6debaadf0 make gen 2023-09-23 17:54:44 -04:00
Łukasz Magiera
3f076bfc16 fix exec traces with new ffi 2023-09-19 11:58:13 +02:00
Mikers
5e5a81bf23
add go linter - "unused" (#11235)
* add go linter - "unused"

* use _ to name unused but needed padding variable

* remove unused code

* add queue test to appease unused linter

* remove unused code in test

* remove unused func

* remove unused struct identified by linter

* remove unused variable

* remove unused code

* remove unused file

* remove unused struct

* remove unused function

* remove unused observe peers function in raft

* remove unused declareFaults function

* annotate nolint:unused on needed methods
2023-09-05 12:19:43 -10:00
Fridrik Asmundsson
ed407689e6 Parse input/output for delegate call + other smaller things 2023-08-28 17:48:22 +00:00
Fridrik Asmundsson
029a4a72b8 Address most recent comments 2023-08-28 17:48:22 +00:00
Fridrik Asmundsson
ee3cdf0e97 Fix use filecoin addr + other small refactor
After changing in prev commit to use to ethereum addresses the
comparison does not make sense against builtin actors. This
fixes that by storing also the filecoin addresses in each trace

Also renamed filecoin related fields to Filecoin prefix.

Also remove requirement call to InvokeContract needed to come
from a evm actor
2023-08-28 17:48:22 +00:00
Fridrik Asmundsson
cf255127a4 Decode eth param/return values and change them to ethbytes type 2023-08-28 17:48:22 +00:00
Fridrik Asmundsson
8d8891a431 Moved tracing types to ethtypes to address circular dependencies 2023-08-28 17:48:22 +00:00
Fridrik Asmundsson
ef7bcfec06 Do not compute message index as traces should be in message execution order 2023-08-28 17:48:22 +00:00
Fridrik Asmundsson
4068e0710d Do not return interface{} from trace api methods 2023-08-28 17:48:22 +00:00
Fridrik Asmundsson
1b0f54a61b Add new tracing API 2023-08-28 17:48:22 +00:00
Aayush
990b5a0bad fix: ethtypes: handle length overflow case 2023-07-21 12:26:29 -04:00
Fridrik Asmundsson
871d1ba547 fix: DecodeRLP can panic 2023-07-14 11:49:50 +00:00
Aayush
07965467ee feat: fvm: apply a max length when decoding events 2023-07-08 11:05:01 -04:00
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