Skip to content

fix: fix out of gas problems with getClientDataSets #734

Open
hugomrdias wants to merge 2 commits intomasterfrom
hugomrdias/datasets-gas
Open

fix: fix out of gas problems with getClientDataSets #734
hugomrdias wants to merge 2 commits intomasterfrom
hugomrdias/datasets-gas

Conversation

@hugomrdias
Copy link
Copy Markdown
Member

@hugomrdias hugomrdias commented Apr 14, 2026

Should fix filecoin-project/filecoin-pin#362

Adds p-queue to getPdpDataSets its should only run into rate limits error now, getClientDataSetsWithDetails in the sdk many need to use something like this.

@rvagg the hasMore pattern from pdp-verifier would have been better for these methods

@hugomrdias hugomrdias requested a review from rvagg as a code owner April 14, 2026 18:32
@github-project-automation github-project-automation bot moved this to 📌 Triage in FOC Apr 14, 2026
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
synapse-dev 78c1674 Commit Preview URL

Branch Preview URL
Apr 14 2026, 06:48 PM

Comment on lines +171 to +173
for (const dataSet of data) {
yield dataSet
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

before yielding, you could start the next readContract.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

yeah, not a bad suggestion although it does complicate the code a little when you're promise juggling and potentially means more calls than necessary if you're iterating for a search but it would be quicker collection if the consumer is doing more than just appending to an array
up to you Hugo

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this would only save time if the p-queue is full so it's probably not worth it

const queue = new PQueue({
concurrency: 10,
interval: 1000,
intervalCap: 20,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

20 seems low to me. In geth I could do 3k-12k calls per second. Are we enforcing someone's rate limit?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yeah glif public nodes, which i just discover have a 100req/min token bucket type rate limit...

but to be honest, its mostly an experiment as this action is not used in the sdk and we want to introduce this style of handling in other places

address: options.address,
offset: options.offset,
})) {
await queue.onSizeLessThan(20)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think this line is necessary, and people might think it's enforcing the concurrency limit when it's actually limiting the size of the pending task queue

Comment thread packages/synapse-core/src/warm-storage/get-pdp-data-sets.ts
Comment thread packages/synapse-core/src/warm-storage/get-pdp-data-sets.ts
@github-project-automation github-project-automation bot moved this from 📌 Triage to ✔️ Approved by reviewer in FOC Apr 14, 2026
@rvagg
Copy link
Copy Markdown
Collaborator

rvagg commented Apr 15, 2026

so you're pushing the complexity from the sdk into core? does this create inconsistencies in the patterns we've established so far where core is lower level?
(not an objection or blocking merge, just interested in the philosophical backing or whether we're making inconsistencies for ourselves; what's the rule here that we can embed going forward?)

@hugomrdias
Copy link
Copy Markdown
Member Author

hugomrdias commented Apr 15, 2026

so you're pushing the complexity from the sdk into core? does this create inconsistencies in the patterns we've established so far where core is lower level? (not an objection or blocking merge, just interested in the philosophical backing or whether we're making inconsistencies for ourselves; what's the rule here that we can embed going forward?)

yeah but theres already other actions depending on this method in core that would need to implement the pagination and without the hasMore it felt too much to keep duplicating all round.

my rule here would be if its as low level as ran "out of gas" problems we should guard against in the core action.

@hugomrdias
Copy link
Copy Markdown
Member Author

@rvagg whats do you think about the p-queue in getPdpDataSets handling for the resolve datasets from provider id in the sdk ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✔️ Approved by reviewer

Development

Successfully merging this pull request may close these issues.

Too many data sets make many commands unusable

3 participants