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

BlockSize === 0 when creating an empty object #2271

Closed
daviddias opened this issue Jan 31, 2016 · 2 comments
Closed

BlockSize === 0 when creating an empty object #2271

daviddias opened this issue Jan 31, 2016 · 2 comments
Labels
kind/bug A bug in existing code (including security flaws) kind/support A question or request for support

Comments

@daviddias
Copy link
Member

When a new empty object is created, it's data size makes sense to be 0, however, its block size should be > 0, since the block size is the size of the serialized version of the object, which packs some protobuf encoding.

» ipfs object new | ipfs object stat
NumLinks: 0
BlockSize: 0
LinksSize: 0
DataSize: 0
CumulativeSize: 0

Could someone confirm this? I'm getting some inconsistency between go and js interop, in the JS impl, we get block size equals 2 bytes for an empty obj

@daviddias daviddias added kind/support A question or request for support kind/bug A bug in existing code (including security flaws) labels Jan 31, 2016
@whyrusleeping
Copy link
Member

an empty object should probably serialize to zero bytes. Are you sure you are setting the links and data to null in your javascript implementation?

@daviddias daviddias changed the title BlockSize === 0 when creating an empty block BlockSize === 0 when creating an empty object Feb 1, 2016
daviddias added a commit to ipfs/js-ipfs-merkle-dag that referenced this issue Feb 1, 2016
@daviddias
Copy link
Member Author

@whyrusleeping I was creating an empty array for links and a 0 byte buffer for data. All good now with https://github.com/vijayee/js-ipfs-merkle-dag/pull/15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws) kind/support A question or request for support
Projects
None yet
Development

No branches or pull requests

2 participants