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(world): change registerFunctionSelector signature to accept system signature as a single string #1574

Merged
merged 4 commits into from
Sep 22, 2023

Conversation

alvrs
Copy link
Member

@alvrs alvrs commented Sep 22, 2023

  • registerFunctionSelector now accepts the system function signature as a single string. There was no point in separating name and arguments.

@changeset-bot
Copy link

changeset-bot bot commented Sep 22, 2023

🦋 Changeset detected

Latest commit: d094f5b

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

This PR includes changesets to release 29 packages
Name Type
@latticexyz/cli Major
@latticexyz/world Major
@latticexyz/dev-tools Major
@latticexyz/store-sync Major
@latticexyz/store-indexer Major
@latticexyz/abi-ts Major
@latticexyz/block-logs-stream Major
@latticexyz/common Major
@latticexyz/config Major
create-mud Major
@latticexyz/ecs-browser Major
@latticexyz/faucet Major
@latticexyz/gas-report Major
@latticexyz/network Major
@latticexyz/noise Major
@latticexyz/phaserx Major
@latticexyz/protocol-parser Major
@latticexyz/react Major
@latticexyz/recs Major
@latticexyz/schema-type Major
@latticexyz/services Major
@latticexyz/solecs Major
solhint-config-mud Major
solhint-plugin-mud Major
@latticexyz/std-client Major
@latticexyz/std-contracts Major
@latticexyz/store-cache Major
@latticexyz/store Major
@latticexyz/utils 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

@alvrs
Copy link
Member Author

alvrs commented Sep 22, 2023

ResourceId systemId,
- string memory systemFunctionName,
- string memory systemFunctionArguments
+ string memory systemFunctionSignature
Copy link
Member

Choose a reason for hiding this comment

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

is it important to call this “system” here? I noticed the method doesn’t mention system

Copy link
Member

@holic holic Sep 22, 2023

Choose a reason for hiding this comment

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

I see now that there’s a difference between world and system function signatures/selectors so clarifying here makes sense. I suggested a change to the function name in the other PR

Copy link
Member Author

@alvrs alvrs Sep 22, 2023

Choose a reason for hiding this comment

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

there is a nuance here that the naming is trying to make explicit: you're passing the signature of the function in the system contract (e.g. increment()), but the resulting world function signature will be <namespace>_<systemName>_increment()! That's why the returned selector is called worldFunctionSelector

Edit: didn't see your second reply before posting my reply

@@ -26,7 +26,7 @@ contract PostDeploy is Script {
name: "ChatNamespaced"
});
IWorld(worldAddress).registerSystem(systemId, chatNamespacedSystem, true);
IWorld(worldAddress).registerFunctionSelector(systemId, "sendMessage", "(string)");
IWorld(worldAddress).registerFunctionSelector(systemId, "sendMessage(string)");
Copy link
Member

Choose a reason for hiding this comment

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

So much nicer

holic
holic previously approved these changes Sep 22, 2023
@alvrs alvrs merged commit 31ffc9d into main Sep 22, 2023
9 checks passed
@alvrs alvrs deleted the alvrs/func-selectors branch September 22, 2023 19:33
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