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

Use single protobuf generator and runtime #325

Closed
felicio opened this issue Jan 5, 2023 · 3 comments · Fixed by #337
Closed

Use single protobuf generator and runtime #325

felicio opened this issue Jan 5, 2023 · 3 comments · Fixed by #337

Comments

@felicio
Copy link
Collaborator

felicio commented Jan 5, 2023

No description provided.

@felicio
Copy link
Collaborator Author

felicio commented Jan 5, 2023

@felicio
Copy link
Collaborator Author

felicio commented Feb 6, 2023

Even after upgrading protons dependencies to latest versions which included support for map type at https://github.com/felicio/status-web/tree/66a5d9e5587ea7b7247b55fb38a394529b94cef5, decoding of CommunityDescription would still fail, specifically on:

Error: invalid wire type 4 at offset 5454
    at Reader.skipType (/Users/felicio/Projects/status-im/status-web/packages/status-js/node_modules/protons-runtime/node_modules/protobufjs/src/reader.js:377:19)
    at Object.decode (/Users/felicio/Projects/status-im/status-web/packages/status-js/src/protos/communities.ts:313:24)
    at Object.decode (/Users/felicio/Projects/status-im/status-web/packages/status-js/src/protos/communities.ts:499:91)
    at Module.decodeMessage (file:///Users/felicio/Projects/status-im/status-web/packages/status-js/node_modules/protons-runtime/dist/src/decode.js:4:18)
    at CommunityDescription2.decode (/Users/felicio/Projects/status-im/status-web/packages/status-js/src/protos/communities.ts:543:34)
    at Module.handleWakuMessage (/Users/felicio/Projects/status-im/status-web/packages/status-js/src/client/community/handle-waku-message.ts:60:75)
    at Client.handleWakuMessage (/Users/felicio/Projects/status-im/status-web/packages/status-js/src/client/client.ts:56:30)
    at /Users/felicio/Projects/status-im/status-web/packages/status-js/src/client/community/community.ts:29:21
    at file:///Users/felicio/Projects/status-im/status-web/node_modules/js-waku/dist/lib/waku_store/index.js:59:43
    at Array.map (<anonymous>)

Thrown from:

// packages/status-js/src/protos/communities.ts
...
            case 6: {
              const entry = CommunityDescription.CommunityDescription$chatsEntry.codec().decode(reader, reader.uint32())
              obj.chats.set(entry.key, entry.value)
              break
...

Possibly due to lack support for nested maps?

Also, oneof type isn't yet supported per https://github.com/ipfs/protons/blob/c7b136e704a6c5463e884c3d46673fe01e888077/packages/protons/README.md?plain=1#L77, which is used in ChatMessage.

@felicio
Copy link
Collaborator Author

felicio commented Feb 6, 2023

Reduction in status-js's bundle size using @bufbuild dependencies,

before

$ vite build
vite v2.9.13 building for production...
✓ 36 modules transformed.
dist/index.es.js   175.32 KiB / gzip: 34.27 KiB
dist/index.es.js.map 332.63 KiB

and after

$ vite build
vite v2.9.13 building for production...
✓ 34 modules transformed.
dist/index.es.js   146.16 KiB / gzip: 30.79 KiB
dist/index.es.js.map 302.86 KiB

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 a pull request may close this issue.

1 participant