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: rename key to keyTuple #1492

Merged
merged 33 commits into from
Sep 15, 2023
Merged

feat: rename key to keyTuple #1492

merged 33 commits into from
Sep 15, 2023

Conversation

alvrs
Copy link
Member

@alvrs alvrs commented Sep 14, 2023

@alvrs alvrs force-pushed the alvrs/rename-key-tuple branch from 3c2536f to c93145b Compare September 14, 2023 19:48
@changeset-bot
Copy link

changeset-bot bot commented Sep 14, 2023

🦋 Changeset detected

Latest commit: 95dc04c

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

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

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 14, 2023

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.


// If the key has not yet been set in the table...
// If the keyTuple has not yet been set in the table...
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// If the keyTuple has not yet been set in the table...
// If the key has not yet been set in the table...

}
}
}
}
}

// Update the index to avoid duplicating this key in the array
// Update the index to avoid duplicating this keyTuple in the array
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// Update the index to avoid duplicating this keyTuple in the array
// Update the index to avoid duplicating this key in the array

(bool has, uint40 index) = UsedKeysIndex.get(tableId, keysHash);

// If the key was part of the table...
// If the keyTuple was part of the table...
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// If the keyTuple was part of the table...
// If the key was part of the table...

if (has) {
// Delete the index as the key is not in the table
// Delete the index as the keyTuple is not in the table anymore
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// Delete the index as the keyTuple is not in the table anymore
// Delete the index as the key is not in the table anymore

@@ -112,15 +113,15 @@ contract KeysInTableHook is StoreHook {
}
}

// Update the index of lastKey after swapping it with the deleted key
// Update the index of lastKey after swapping it with the deleted keyTuple
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// Update the index of lastKey after swapping it with the deleted keyTuple
// Update the index of lastKey after swapping it with the deleted key

@@ -6,22 +6,22 @@ import { IStore } from "@latticexyz/store/src/IStore.sol";
import { UsedKeysIndex } from "./tables/UsedKeysIndex.sol";

/**
* Get whether the key is in the given table.
* Get whether the keyTuple is in the given table.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* Get whether the keyTuple is in the given table.
* Get whether the key is in the given table.


return UsedKeysIndex.getHas(tableId, keysHash);
}

/**
* Get whether the key is in the given table for the given store.
* Get whether the keyTuple is in the given table for the given store.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* Get whether the keyTuple is in the given table for the given store.
* Get whether the key is in the given table for the given store.

@alvrs alvrs changed the base branch from alvrs/rename-table-id-key-tuple to main September 15, 2023 11:35
@alvrs
Copy link
Member Author

alvrs commented Sep 15, 2023

re: keyTuple vs key in KeysInTable: i think keyTuple is correct in those instances, since we're working with the whole tuple (eg checking the existence of the key tuple in the table)

@alvrs
Copy link
Member Author

alvrs commented Sep 15, 2023

did another pass of self-review, gonna go ahead with merging this to unblock other PRs

@alvrs alvrs merged commit 6e66c5b into main Sep 15, 2023
@alvrs alvrs deleted the alvrs/rename-key-tuple branch September 15, 2023 12: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.

Rename table to tableId and key to keyTuple in Store events
2 participants