-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Lotus: Provide a way to lookup messages by EthTxID #1029
Comments
This is a blocker for Hyperspace, unfortunately. It's a blocking usability/compatibility issue. |
After implementing this filecoin-project/lotus#9839, we can easily expose an API for it. |
It might not be very unreasonable to add support for calculating transaction hashes to popular libraries as most of them are user-extensible. For example:
Assuming there are similar solutions for web3.js, Foundry, and other libraries. @scotthconner committed to reviewing the state-of-the-art libraries and checking if we can plug in our own transaction formatter here: https://filecoinproject.slack.com/archives/CP50PPW2X/p1671741786941649?thread_ts=1671733951.808009&cid=CP50PPW2X Adding him as an assignee here. |
The root cause is workflows that assume they can counter-factually determine the transaction hash before submission to the network. This acts as a security feature and prevents signers from having to actively trust RPC end-points. In the case for all EVM chains and tools, this is a hash of the transaction inputs, including things like nonce, gas, function selector, call data, etc, but is not a function of the network or blockchain state (something that can only be computed once included in a block). Web3js, ethers, hardhat plugins, etc, all operate on the ability to check the transaction hash against expectations after submission. Foundry, a huge up-and-comer in EVM development space compared to hard hat - has had discussion on how they want to handle (and avoid) similar workflows and vendor additions here: foundry-rs/foundry#2279 Arbitrum, Optimism, Polygon, Avalanche, and associated test-nets are all fully compatible with Hardhat, Foundry, ethers, web3js, wagmi, WalletConnect, etc. as EVM compatible chains. Their tutorials, examples, corpus of cross-deployed products, and commit contributions to open source toolchains suggest most successful EVM compatible networks use the same tools in the same way. |
@scotthconner any AI needed from rpc api ep perspective from clients? |
We just need to make sure that gateway owners have this indexing turned on. |
ETA Monday |
@geoff-vball can you comment with your PR, how can one lookup message by EthTxID here and close the issue with that comment? |
I think we have a problem with the consistency of this index. We treat it as a cache (with GC and all), but we should focus on this index being strongly consistent with the chain and the mpool. Otherwise, if an entry drops we will being returning the wrong hash in a number of places. For example:
Furthermore, this lookup table must be compulsorily enabled if the Eth endpoint is enabled. It should not be an independent option. Sadly, it may also be time to phase out native message support from the Ethereum JSON-RPC API. That way, if an expected hash is not found, we can error due to a data consistency issue, instead of speculating that it might be a native message. In other words, the transaction hash must be deterministically handled and returned. Finally, because this needs to be strongly consistent, we will need to provide some way to reconcile chain/mpool data with the index. |
For the instances we handle the data in there incorrectly:
I tend to agree that the option should be on by default, and not something that is manually set. I also tend to agree that trying to mix in native message support into the ETH API is likely more trouble than its worth, unless we can identify critical use cases, Deterministic behavior, much like Ethereum itself, is obviously desired. The question I have is about the trade-offs. The current implementation enables clients to handle ethereum and FEVM transactions in the same manner, using all the same assumptions and toolchains. The current implementation however does not cover cases where transactions are not included into blocks in the same manner that Ethereum does. IMO, it seems worthwhile to gain happy-path parity with ethereum-based developer experience at the expense of failure cases behaving differently when transactions aren't included, as long as the results aren't dangerous or insecure. |
@raulk The first bullet is not correct. If we don't find the mapping in the database, we'll do the reversible conversion, and then look up that message to see if it exists. Otherwise we return nil. I don't think the third point is correct either. If we have all the messages in the block, we recalculate the hashes from the messages. We will never return the wrong hash. At every point we will either say "The correct hash is X" or "not found". This is how nodes work today for the majority of our data. Operators are given the option to store all mappings for as long as they want. I'm not sure why we would force all node operators to disable the entire Eth API if they don't want to store a massive index. |
I think @geoff-vball is correct, there's a middle ground as long as we never blindly convert a tx hash into a CID. We can:
Some nodes will want to keep an index of every message ever seen, most will likely only care about a few days worth of history. IMO, whether or not we want to continue to support "native" messages in the Ethereum API is an orthogonal question. |
👍
That's right. I checked the implementation and given that we have fetched the message from the store, we process the message to calculate the EthTxHash -- makes sense! However, I do think the second point stands:
And this applies to Taking this into account:
If the answer is yes, then my concern is resolved as there is no ambiguity possible around transaction IDs. However, I would still advise to turn on the index automatically with the Eth API. Having nodes return different hashes depending on configuration is very confusing. |
Fully aligned @raulk |
I think the best course of action is to have some top-level config variable that turns on all Eth API functionality including events and the tx hash lookup with no GC. We can then include finer configuration options if users want to turn one off, or set some policy for GC. With the top level config, we can release new functionality that will work out of the box without users having to turn things on individually. This also saves us from having to set the default of the DB to "on" for all users, which is unnecessary for users that don't want to deal with FEVM. |
I also think there is currently ambiguity in |
No description provided.
The text was updated successfully, but these errors were encountered: