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

fix: dag|block put: do not allow blocks over BS limit #8696

Closed
3 of 4 tasks
lidel opened this issue Jan 24, 2022 · 5 comments · Fixed by #8751
Closed
3 of 4 tasks

fix: dag|block put: do not allow blocks over BS limit #8696

lidel opened this issue Jan 24, 2022 · 5 comments · Fixed by #8751
Assignees
Labels
effort/hours Estimated to take one or several hours exp/novice Someone with a little familiarity can pick up help wanted Seeking public contribution on this issue kind/bug A bug in existing code (including security flaws) P1 High: Likely tackled by core team if no one steps up topic/bootcamp Issues that could be useful in bootcamp process topic/commands Topic commands
Milestone

Comments

@lidel
Copy link
Member

lidel commented Jan 24, 2022

Update 2/23 (@schomatis): working on this.


Summary

TLDR: bigger blocks can't be exchanged over libp2p, so we want to make a loud error if that happens, but allow people to override it if they are ok with that.

We've introduced soft-limit in ipfs object API (#8414) but are missing the same behavior in modern ipfs dag|block put 🙈

Problem (go-ipfs 0.11)

With both dag|block put, I am able to create a block (eg. 10MB) that is too big to be exchanged over bitswap:

dag put

$ dd if=/dev/zero bs=10MB count=1 | ipfs dag put --input-codec=raw --store-codec=raw
1+0 records in
1+0 records out
10000000 bytes (10 MB, 9.5 MiB) copied, 0.0373717 s, 268 MB/s
bafkreihv4avkohth6qoxsar2ckgkgw5nq3hxwzswsz574ceewor4ims6v4

$ ipfs dag stat bafkreihv4avkohth6qoxsar2ckgkgw5nq3hxwzswsz574ceewor4ims6v4
Size: 10000000, NumBlocks: 1

block put

$ dd if=/dev/zero bs=10MB count=1 | ipfs block put
1+0 records in
1+0 records out
10000000 bytes (10 MB, 9.5 MiB) copied, 0.0331271 s, 302 MB/s
QmetSrEEUmD5z6wS5Eamn5KrizYsdkthqNioEoMepYFQte

$ ipfs block stat QmetSrEEUmD5z6wS5Eamn5KrizYsdkthqNioEoMepYFQte
Key: QmetSrEEUmD5z6wS5Eamn5KrizYsdkthqNioEoMepYFQte
Size: 10000000

Solution

  • reuse softBlockLimit, allowBigBlock from fix(cli): object add-link: do not allow blocks over BS limit #8414 (extract them to be public consts?)
  • add --allow-big-block behavior to ipfs dag put
  • add --allow-big-block behavior to ipfs block put
  • make dag and put return informative error, eg:

    produced block is over 1MB: big blocks can't be exchanged with other peers. consider using dag-pb for automatic chunking of bigger files, or pass --allow-big-block to override.

@lidel lidel added kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization effort/hours Estimated to take one or several hours exp/novice Someone with a little familiarity can pick up P1 High: Likely tackled by core team if no one steps up topic/commands Topic commands and removed need/triage Needs initial labeling and prioritization labels Jan 24, 2022
@lidel lidel added the help wanted Seeking public contribution on this issue label Feb 18, 2022
@aschmahmann aschmahmann added the topic/bootcamp Issues that could be useful in bootcamp process label Feb 18, 2022
@schomatis schomatis self-assigned this Feb 24, 2022
@schomatis
Copy link
Contributor

Working on this.

@schomatis
Copy link
Contributor

make dag and put return informative error, eg:
@lidel Will be pushing a PR with the first 3 items, leaving the most appropriate error wording up to you.

@BigLep
Copy link
Contributor

BigLep commented Mar 3, 2022

Internal note: we want this for 0.13

@BigLep
Copy link
Contributor

BigLep commented Mar 11, 2022

2022-03-11: we also want dag-import.

@finkbeca
Copy link

Let me see if I have the time to do it this weekend, will follow-up then about if I'll be able to get it done, or if I should pass the torch to someone else to finish :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort/hours Estimated to take one or several hours exp/novice Someone with a little familiarity can pick up help wanted Seeking public contribution on this issue kind/bug A bug in existing code (including security flaws) P1 High: Likely tackled by core team if no one steps up topic/bootcamp Issues that could be useful in bootcamp process topic/commands Topic commands
Projects
No open projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants