Skip to content

WIP resource type#1498

Closed
frolic wants to merge 2 commits intomainfrom
holic/resource-type
Closed

WIP resource type#1498
frolic wants to merge 2 commits intomainfrom
holic/resource-type

Conversation

@frolic
Copy link
Member

@frolic frolic commented Sep 15, 2023

No description provided.

@changeset-bot
Copy link

changeset-bot bot commented Sep 15, 2023

⚠️ No Changeset found

Latest commit: 93f2b59

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

bytes2 constant RESOURCE_TABLE = "tb";
bytes2 constant RESOURCE_TABLE_OFFCHAIN = "tf";
bytes2 constant RESOURCE_SYSTEM = "sy";
bytes2 constant RESOURCE_MODULE = "md";
Copy link
Member Author

Choose a reason for hiding this comment

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

I wish Solidity had something like TypeScript's enums where you can define the value of each, e.g.

enum ResourceType {
  NAMESPACE = 'ns',
  TABLE = 'tb',
  ...
}

@frolic frolic force-pushed the holic/resource-type branch from a5d0da5 to b403f46 Compare September 15, 2023 09:09
@frolic frolic force-pushed the holic/resource-type branch from b403f46 to 362b348 Compare September 15, 2023 09:09
/**
* A ResourceSelector is a 32-byte value that uniquely identifies a resource
* - 2 bytes for the resource type
* - 14 bytes for the namespace
Copy link
Member Author

@frolic frolic Sep 15, 2023

Choose a reason for hiding this comment

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

decided to steal from the namespace rather than name, but we could also steal 1 byte each (bytes2+bytes15+bytes15) to avoid juggling three diff types

Copy link
Member Author

@frolic frolic Sep 16, 2023

Choose a reason for hiding this comment

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

from @alvrs in discord

feels right! agree with stealing from the namespace (I actually like two different types bytes14 and bytes16 to distinguish them better)


bytes2 constant RESOURCE_NAMESPACE = "ns";
bytes2 constant RESOURCE_TABLE = "tb";
bytes2 constant RESOURCE_TABLE_OFFCHAIN = "tf";
Copy link
Member

Choose a reason for hiding this comment

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

why not to or ot 👀

Copy link
Member Author

Choose a reason for hiding this comment

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

considered it but "offchain" and "onchain" are both "o"

also tb and to look too similar and wanted to visually differentiate

🤷

Copy link
Member

Choose a reason for hiding this comment

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

fair, f is the only diff between onchain and offchain 🙈

Copy link
Member Author

Choose a reason for hiding this comment

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

@dk1a in case you weren't following our chat, we probably want to define the table ID prefix separately and inside store, and the other resource prefixes here in world

@alvrs
Copy link
Member

alvrs commented Sep 20, 2023

closing in favor of #1544

@alvrs alvrs closed this Sep 20, 2023
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