-
Notifications
You must be signed in to change notification settings - Fork 196
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: protocol-parser in go #1116
Conversation
🦋 Changeset detectedLatest commit: 4d76fba The changes in this PR will be included in the next version bump. This PR includes changesets to release 26 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
c9da625
to
4734861
Compare
4734861
to
128d0db
Compare
128d0db
to
12368e1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is great! just added some minor comments. for completeness, can we add a port for decodeKeyTuple
?
.github/workflows/services.yml
Outdated
- name: Build | ||
working-directory: ./packages/services | ||
run: go build -v ./... | ||
|
||
- name: Test | ||
working-directory: ./packages/services |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we add this to the build
and test
scripts in the package.json
it will automatically run when running pnpm build
/ pnpm test
at the root, so we don't need this separate action
ADDRESS_ARRAY, | ||
BOOL_ARRAY: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ultra tiny nit but my OCD brain wants these to be switched (first BOOL_ARRAY, then ADDRESS_ARRAY) to match the schema type enum
BYTES30, | ||
BYTES31, | ||
BYTES32: | ||
// TODO: should we return a fixed size array per bytes size or a slice? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good q, in the ts version we return a hex string padded to the size of the bytes. In go, is it possible to pass a fixed size byte array to a function that accepts variable size byte arrays? if so, I think returning a fixed size byte array here would be a nice touch
package schematype | ||
|
||
func ArrayAbiTypeToStaticAbiType(schemaType SchemaType) SchemaType { | ||
return (schemaType - UINT8_ARRAY) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we add a check here that the input type is actually an array type and throw an error else? thinking of cases where users incorrectly input BYTES
, STRING
or a static type
also let's add a changeset! (run |
f86a685
to
2261ca7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it be better to move schema-type stuff from packages/services/pkg/schema-type
to packages/schema-type/go
?
Agree! not blocking for this PR though imo, can also do that in a follow up |
Implements the same api in the most consistent way possible (including file structure) as https://github.com/latticexyz/mud/tree/main/packages/protocol-parser