Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impl EthGetTransactionByHashLimited #4774

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

sudo-shashank
Copy link
Contributor

@sudo-shashank sudo-shashank commented Sep 18, 2024

Summary of changes

Changes introduced in this pull request:

  • Impl Filecoin.EthGetTransactionByHashLimited and add test
| RPC Method                                | Forest | Lotus |
|-------------------------------------------|--------|-------|
| Filecoin.EthGetTransactionByHashLimited   | Valid  | Valid |

Reference issue to close (if applicable)

Closes #4703

Other information and links

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation. All new code adheres to the team's documentation standards,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

@sudo-shashank sudo-shashank marked this pull request as ready for review September 19, 2024 05:17
@sudo-shashank sudo-shashank requested a review from a team as a code owner September 19, 2024 05:17
@sudo-shashank sudo-shashank requested review from ruseinov and elmattic and removed request for a team September 19, 2024 05:17
if let Ok(eth_tx) = EthTx::from_signed_message(ctx.chain_config().eth_chain_id, smsg) {
return Ok(Some(eth_tx.into()));
}
type Params = (EthHash, Option<ChainEpoch>);
Copy link
Contributor

@elmattic elmattic Sep 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you choose an Option<ChainEpoch> and not just a ChainEpoch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because look_back_limit is of type Option<i64> in search_for_message

forest_filecoin::state_manager::StateManager
impl<DB> StateManager<DB>
pub async fn search_for_message(self: &Arc<Self>, from: Option<Arc<Tipset>>, msg_cid: Cid, look_back_limit: Option<i64>, allow_replaced: Option<bool>) -> Result<Option<(Arc<Tipset>, Receipt)>, Error>
where
    // Bounds from impl:
    DB: Blockstore + Send + Sync + 'static,

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then let's add another test that checks the case where chain epoch is None.

Copy link
Contributor Author

@sudo-shashank sudo-shashank Sep 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None is tested by EthGetTransactionByHash https://github.com/ChainSafe/forest/pull/4774/files#r1766769807

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're speaking of testing get_eth_transaction_by_hash function which I think is not the same.

Adding the test:

            tests.push(RpcTest::identity(EthGetTransactionByHashLimited::request(
                (tx.hash.clone(), None),
            )?));

results in:

./forest-tool api compare --lotus /ip4/127.0.0.1/tcp/1234/http --forest /ip4/127.0.0.1/tcp/2345/http forest_snapshot_calibnet_2024-09-10_height_1954295.forest.car.zst --filter EthGetTransactionByHashLimited
| RPC Method                                  | Forest            | Lotus |
|---------------------------------------------|-------------------|-------|
| Filecoin.EthGetTransactionByHashLimited (4) | CustomCheckFailed | Valid |
| Filecoin.EthGetTransactionByHashLimited (8) | Valid             | Valid |
Error: Some tests failed

@@ -1557,7 +1557,9 @@ fn eth_state_tests_with_tipset<DB: Blockstore>(
tests.push(RpcTest::identity(EthGetTransactionByHash::request((tx
.hash
.clone(),))?));

tests.push(RpcTest::identity(EthGetTransactionByHashLimited::request(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I guess we need a test that has None epoch passed, as previously mentioned by @elmattic.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for EthGetTransactionByHash we use None

get_eth_transaction_by_hash(ctx, tx_hash, None).await

and for EthGetTransactionByHashLimited we use

get_eth_transaction_by_hash(ctx, tx_hash, limit).await

@ruseinov
Copy link
Contributor

The CI needs to be green, then we're ready to rumble.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EthGetTransactionByHashLimited
4 participants