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

feat: implement Filecoin.StateLookupID RPC API #3744

Merged
merged 3 commits into from
Nov 23, 2023
Merged

Conversation

hanabi1224
Copy link
Contributor

@hanabi1224 hanabi1224 commented Nov 23, 2023

Summary of changes

As part of #3639

Changes introduced in this pull request:

  • implement Filecoin.StateLookupID RPC API
  • fix a typo and bug in Filecoin.StateAccountKey
     Running `target/debug/forest-tool api compare /home/me/fr/snapshots/calibnet/forest_snapshot_calibnet_2023-11-23_height_1113729.forest.car.zst --filter StateLook -n 500`
| RPC Method                   | Forest | Lotus |
|------------------------------|--------|-------|
| Filecoin.StateLookupID (341) | Valid  | Valid |

Lotus code:

func (m *StateModule) StateLookupID(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error) {
	ts, err := m.Chain.GetTipSetFromKey(ctx, tsk)
	if err != nil {
		return address.Undef, xerrors.Errorf("loading tipset %s: %w", tsk, err)
	}

	ret, err := m.StateManager.LookupID(ctx, addr, ts)
	if err != nil && xerrors.Is(err, types.ErrActorNotFound) {
		return address.Undef, &api.ErrActorNotFound{}
	}

	return ret, err
}

Reference issue to close (if applicable)

Closes

Other information and links

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation,
  • 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.

@hanabi1224 hanabi1224 marked this pull request as ready for review November 23, 2023 11:53
@hanabi1224 hanabi1224 requested a review from a team as a code owner November 23, 2023 11:53
@hanabi1224 hanabi1224 requested review from LesnyRumcajs and elmattic and removed request for a team November 23, 2023 11:53
src/rpc/state_api.rs Outdated Show resolved Hide resolved
@hanabi1224 hanabi1224 added this pull request to the merge queue Nov 23, 2023
Merged via the queue into main with commit 338f694 Nov 23, 2023
27 checks passed
@hanabi1224 hanabi1224 deleted the hm/state-lookup-id branch November 23, 2023 13:24
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.

None yet

3 participants