-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 230918-docker-indexer
- Loading branch information
Showing
333 changed files
with
5,327 additions
and
4,095 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
"@latticexyz/world": patch | ||
"@latticexyz/store": patch | ||
--- | ||
|
||
The `ResourceType` table is removed. | ||
It was previously used to store the resource type for each resource ID in a `World`. This is no longer necessary as the [resource type is now encoded in the resource ID](https://github.com/latticexyz/mud/pull/1544). | ||
|
||
To still be able to determine whether a given resource ID exists, a `ResourceIds` table has been added. | ||
The previous `ResourceType` table was part of `World` and missed tables that were registered directly via `StoreCore.registerTable` instead of via `World.registerTable` (e.g. when a table was registered as part of a root module). | ||
This problem is solved by the new table `ResourceIds` being part of `Store`. | ||
|
||
`StoreCore`'s `hasTable` function was removed in favor of using `ResourceIds.getExists(tableId)` directly. | ||
|
||
```diff | ||
- import { ResourceType } from "@latticexyz/world/src/tables/ResourceType.sol"; | ||
- import { StoreCore } from "@latticexyz/store/src/StoreCore.sol"; | ||
+ import { ResourceIds } from "@latticexyz/store/src/codegen/tables/ResourceIds.sol"; | ||
|
||
- bool tableExists = StoreCore.hasTable(tableId); | ||
+ bool tableExists = ResourceIds.getExists(tableId); | ||
|
||
- bool systemExists = ResourceType.get(systemId) != Resource.NONE; | ||
+ bool systemExists = ResourceIds.getExists(systemId); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
"@latticexyz/world": major | ||
--- | ||
|
||
All `World` methods acting on namespaces as resources have been updated to use `ResourceId namespaceId` as parameter instead of `bytes14 namespace`. | ||
The reason for this change is to make it clearer when a namespace is used as resource, as opposed to being part of another resource's ID. | ||
|
||
```diff | ||
+ import { ResourceId } from "@latticexyz/store/src/ResourceId.sol"; | ||
|
||
IBaseWorld { | ||
- function registerNamespace(bytes14 namespace) external; | ||
+ function registerNamespace(ResourceId namespaceId) external; | ||
|
||
- function transferOwnership(bytes14 namespace, address newOwner) external; | ||
+ function transferOwnership(ResourceId namespaceId, address newOwner) external; | ||
|
||
- function transferBalanceToNamespace(bytes14 fromNamespace, bytes14 toNamespace, uint256 amount) external; | ||
+ function transferBalanceToNamespace(ResourceId fromNamespaceId, ResourceId toNamespaceId, uint256 amount) external; | ||
|
||
- function transferBalanceToAddress(bytes14 fromNamespace, address toAddress, uint256 amount) external; | ||
+ function transferBalanceToAddress(ResourceId fromNamespaceId, address toAddress, uint256 amount) external; | ||
} | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
"@latticexyz/cli": minor | ||
"@latticexyz/common": minor | ||
"@latticexyz/gas-report": major | ||
"@latticexyz/noise": major | ||
"@latticexyz/schema-type": major | ||
"@latticexyz/store": major | ||
"@latticexyz/world": major | ||
"create-mud": minor | ||
--- | ||
|
||
Bump Solidity version to 0.8.21 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
"@latticexyz/block-logs-stream": patch | ||
"@latticexyz/cli": patch | ||
"@latticexyz/common": major | ||
"@latticexyz/dev-tools": patch | ||
"@latticexyz/store-sync": patch | ||
"@latticexyz/store": major | ||
"create-mud": minor | ||
--- | ||
|
||
What used to be known as `ephemeral` table is now called `offchain` table. | ||
The previous `ephemeral` tables only supported an `emitEphemeral` method, which emitted a `StoreSetEphemeralRecord` event. | ||
|
||
Now `offchain` tables support all regular table methods, except partial operations on dynamic fields (`push`, `pop`, `update`). | ||
Unlike regular tables they don't store data on-chain but emit the same events as regular tables (`StoreSetRecord`, `StoreSpliceStaticData`, `StoreDeleteRecord`), so their data can be indexed by offchain indexers/clients. | ||
|
||
```diff | ||
- EphemeralTable.emitEphemeral(value); | ||
+ OffchainTable.set(value); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
--- | ||
"@latticexyz/cli": major | ||
"@latticexyz/common": major | ||
"@latticexyz/config": major | ||
"@latticexyz/store": major | ||
--- | ||
|
||
- `ResourceSelector` is replaced with `ResourceId`, `ResourceIdLib`, `ResourceIdInstance`, `WorldResourceIdLib` and `WorldResourceIdInstance`. | ||
|
||
Previously a "resource selector" was a `bytes32` value with the first 16 bytes reserved for the resource's namespace, and the last 16 bytes reserved for the resource's name. | ||
Now a "resource ID" is a `bytes32` value with the first 2 bytes reserved for the resource type, the next 14 bytes reserved for the resource's namespace, and the last 16 bytes reserved for the resource's name. | ||
|
||
Previously `ResouceSelector` was a library and the resource selector type was a plain `bytes32`. | ||
Now `ResourceId` is a user type, and the functionality is implemented in the `ResourceIdInstance` (for type) and `WorldResourceIdInstance` (for namespace and name) libraries. | ||
We split the logic into two libraries, because `Store` now also uses `ResourceId` and needs to be aware of resource types, but not of namespaces/names. | ||
|
||
```diff | ||
- import { ResourceSelector } from "@latticexyz/world/src/ResourceSelector.sol"; | ||
+ import { ResourceId, ResourceIdInstance } from "@latticexyz/store/src/ResourceId.sol"; | ||
+ import { WorldResourceIdLib, WorldResourceIdInstance } from "@latticexyz/world/src/WorldResourceId.sol"; | ||
+ import { RESOURCE_SYSTEM } from "@latticexyz/world/src/worldResourceTypes.sol"; | ||
|
||
- bytes32 systemId = ResourceSelector.from("namespace", "name"); | ||
+ ResourceId systemId = WorldResourceIdLib.encode(RESOURCE_SYSTEM, "namespace", "name"); | ||
|
||
- using ResourceSelector for bytes32; | ||
+ using WorldResourceIdInstance for ResourceId; | ||
+ using ResourceIdInstance for ResourceId; | ||
|
||
systemId.getName(); | ||
systemId.getNamespace(); | ||
+ systemId.getType(); | ||
|
||
``` | ||
|
||
- All `Store` and `World` methods now use the `ResourceId` type for `tableId`, `systemId`, `moduleId` and `namespaceId`. | ||
All mentions of `resourceSelector` were renamed to `resourceId` or the more specific type (e.g. `tableId`, `systemId`) | ||
|
||
```diff | ||
import { ResourceId } from "@latticexyz/store/src/ResourceId.sol"; | ||
|
||
IStore { | ||
function setRecord( | ||
- bytes32 tableId, | ||
+ ResourceId tableId, | ||
bytes32[] calldata keyTuple, | ||
bytes calldata staticData, | ||
PackedCounter encodedLengths, | ||
bytes calldata dynamicData, | ||
FieldLayout fieldLayout | ||
) external; | ||
|
||
// Same for all other methods | ||
} | ||
``` | ||
|
||
```diff | ||
import { ResourceId } from "@latticexyz/store/src/ResourceId.sol"; | ||
|
||
IBaseWorld { | ||
function callFrom( | ||
address delegator, | ||
- bytes32 resourceSelector, | ||
+ ResourceId systemId, | ||
bytes memory callData | ||
) external payable returns (bytes memory); | ||
|
||
// Same for all other methods | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
dist | ||
**/.next | ||
.next | ||
templates/phaser/packages/art | ||
CODEOWNERS | ||
out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{ | ||
"solidity.monoRepoSupport": true | ||
"solidity.monoRepoSupport": true, | ||
"solidity.compileUsingRemoteVersion": "v0.8.21+commit.d9974bed" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[profile.default] | ||
solc_version = "0.8.13" | ||
solc = "0.8.21" | ||
ffi = false | ||
fuzz_runs = 256 | ||
optimizer = true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity >=0.8.0; | ||
pragma solidity >=0.8.21; | ||
|
||
struct Position { | ||
int32 x; | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.