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: exchange: change GetBlocks to always fetch the requested number of tipsets #11565

Merged
merged 1 commit into from
Jan 11, 2024

Conversation

arajasek
Copy link
Contributor

Related Issues

Fixes #11529

Proposed Changes

Change GetBlocks to always return count tipsets, unless we hit genesis. Partial responses are treated as correct, but the exchanger will still request more tipsets (instead of returning fewer than requested tipsets to the caller).

Additional Info

Checklist

Before you mark the PR ready for review, please make sure that:

  • Commits have a clear commit message.
  • PR title is in the form of of <PR type>: <area>: <change being made>
    • example: fix: mempool: Introduce a cache for valid signatures
    • PR type: fix, feat, build, chore, ci, docs, perf, refactor, revert, style, test
    • area, e.g. api, chain, state, market, mempool, multisig, networking, paych, proving, sealing, wallet, deps
  • If the PR affects users (e.g., new feature, bug fix, system requirements change), update the CHANGELOG.md and add details to the UNRELEASED section.
  • New features have usage guidelines and / or documentation updates in
  • Tests exist for new functionality or change in behavior
  • CI is green

}

return validRes.toFullTipSets()[0], nil
// If `doRequest` didn't fail we are guaranteed to have at least
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was true, but I still see no reason not to check this.

// tipset *backwards*, returning as many tipsets as the count parameter,
// or less.
// tipset *backwards*, returning as many tipsets as the count parameter.
// The ONLY case in which we return fewer than `count` tipsets is if we hit genesis.
GetBlocks(ctx context.Context, tsk types.TipSetKey, count int) ([]*types.TipSet, error)

// GetChainMessages fetches messages from the network, starting from the first provided tipset
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that we are NOT changing GetChainMessages behaviour -- it might still return fewer than count epochs worth of messages.

@jennijuju jennijuju merged commit 512c70b into master Jan 11, 2024
89 checks passed
@jennijuju jennijuju deleted the asr/harden-sync branch January 11, 2024 10:13
rjan90 pushed a commit that referenced this pull request Jan 11, 2024
feat: exchange: change GetBlocks to always fetch the requested number of tipsets
rjan90 pushed a commit that referenced this pull request Jan 11, 2024
feat: exchange: change GetBlocks to always fetch the requested number of tipsets
simlecode pushed a commit to ipfs-force-community/lotus that referenced this pull request Jan 12, 2024
…arden-sync

feat: exchange: change GetBlocks to always fetch the requested number of tipsets
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.

Syncer: Handle partial responses correctly
3 participants