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

feat(common): new utils, truncate table ID parts #1173

Merged
merged 10 commits into from
Jul 19, 2023
Merged

Conversation

holic
Copy link
Member

@holic holic commented Jul 18, 2023

Pulled out of #1113

@changeset-bot
Copy link

changeset-bot bot commented Jul 18, 2023

🦋 Changeset detected

Latest commit: f061394

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 26 packages
Name Type
@latticexyz/common Major
@latticexyz/block-logs-stream Major
@latticexyz/cli Major
@latticexyz/config Major
@latticexyz/dev-tools Major
@latticexyz/network Major
@latticexyz/protocol-parser Major
@latticexyz/std-client Major
@latticexyz/store-cache Major
@latticexyz/store-sync Major
@latticexyz/store Major
@latticexyz/utils Major
@latticexyz/world Major
@latticexyz/ecs-browser Major
@latticexyz/react Major
@latticexyz/phaserx Major
@latticexyz/recs Major
create-mud Major
@latticexyz/gas-report Major
@latticexyz/noise Major
@latticexyz/schema-type Major
@latticexyz/services Major
@latticexyz/solecs Major
solhint-config-mud Major
solhint-plugin-mud Major
@latticexyz/std-contracts Major

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

@holic holic changed the title feat: more common utils, truncate table ID parts feat(common): more utils, truncate table ID parts Jul 18, 2023
@holic holic changed the title feat(common): more utils, truncate table ID parts feat(common): new utils, truncate table ID parts Jul 18, 2023
@holic holic marked this pull request as ready for review July 18, 2023 15:50
@holic holic requested a review from alvrs as a code owner July 18, 2023 15:50
alvrs
alvrs previously approved these changes Jul 19, 2023
Copy link
Member

@alvrs alvrs left a comment

Choose a reason for hiding this comment

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

two nits, aside from that lgtm

.changeset/strange-ducks-float.md Outdated Show resolved Hide resolved
Comment on lines 14 to 25
expect(tableId.toHex()).toMatchInlineSnapshot(
'"0x41566572794c6f6e674e616d657370616e616d65000000000000000000000000"'
);
expect(TableId.fromHex(tableId.toHex()).namespace).toMatchInlineSnapshot('"AVeryLongNamespa"');
});

it("throws when converting names >16 bytes", () => {
const tableId = new TableId("namespace", "AnUnnecessarilyLongName");
expect(() => tableId.toHex()).toThrow("Size cannot exceed 16 bytes. Given size: 23 bytes.");
expect(tableId.toHex()).toMatchInlineSnapshot(
'"0x6e616d65737061636500000000000000416e556e6e65636573736172696c794c"'
);
expect(TableId.fromHex(tableId.toHex()).name).toMatchInlineSnapshot('"AnUnnecessarilyL"');
Copy link
Member

Choose a reason for hiding this comment

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

we should update the titles of both of these tests to reflect the new behavior

@holic holic merged commit 0c4f9fe into main Jul 19, 2023
@holic holic deleted the holic/more-common-utils branch July 19, 2023 15:07
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 this pull request may close these issues.

2 participants