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

Version Packages (next) #1313

Merged
merged 1 commit into from
Aug 21, 2023
Merged

Version Packages (next) #1313

merged 1 commit into from
Aug 21, 2023

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Aug 16, 2023

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

main is currently in pre mode so this branch has prereleases rather than normal releases. If you want to exit prereleases, run changeset pre exit on main.

⚠️⚠️⚠️⚠️⚠️⚠️

Releases

@latticexyz/[email protected]

Major Changes

  • #1174 952cd534 Thanks @alvrs! - All Store methods now require the table's value schema to be passed in as an argument instead of loading it from storage.
    This decreases gas cost and removes circular dependencies of the Schema table (where it was not possible to write to the Schema table before the Schema table was registered).

      function setRecord(
        bytes32 table,
        bytes32[] calldata key,
        bytes calldata data,
    +   Schema valueSchema
      ) external;

    The same diff applies to getRecord, getField, setField, pushToField, popFromField, updateInField, and deleteRecord.

    This change only requires changes in downstream projects if the Store methods were accessed directly. In most cases it is fully abstracted in the generated table libraries,
    so downstream projects only need to regenerate their table libraries after updating MUD.

  • #1208 c32a9269 Thanks @alvrs! - - All World function selectors that previously had bytes16 namespace, bytes16 name arguments now use bytes32 resourceSelector instead.
    This includes setRecord, setField, pushToField, popFromField, updateInField, deleteRecord, call, grantAccess, revokeAccess, registerTable,
    registerStoreHook, registerSystemHook, registerFunctionSelector, registerSystem and registerRootFunctionSelector.
    This change aligns the World function selectors with the Store function selectors, reduces clutter, reduces gas cost and reduces the World's contract size.

    • The World's registerHook function is removed. Use registerStoreHook or registerSystemHook instead.

    • The deploy script is updated to integrate the World interface changes

  • #1182 afaf2f5f Thanks @alvrs! - - Store's internal schema table is now a normal table instead of using special code paths. It is renamed to Tables, and the table ID changed from mudstore:schema to mudstore:Tables

    • Store's registerSchema and setMetadata are combined into a single registerTable method. This means metadata (key names, field names) is immutable and indexers can create tables with this metadata when a new table is registered on-chain.

      -  function registerSchema(bytes32 table, Schema schema, Schema keySchema) external;
      -
      -  function setMetadata(bytes32 table, string calldata tableName, string[] calldata fieldNames) external;
      
      +  function registerTable(
      +    bytes32 table,
      +    Schema keySchema,
      +    Schema valueSchema,
      +    string[] calldata keyNames,
      +    string[] calldata fieldNames
      +  ) external;
    • World's registerTable method is updated to match the Store interface, setMetadata is removed

    • The getSchema method is renamed to getValueSchema on all interfaces

      - function getSchema(bytes32 table) external view returns (Schema schema);
      + function getValueSchema(bytes32 table) external view returns (Schema valueSchema);
    • The store-sync and cli packages are updated to integrate the breaking protocol changes. Downstream projects only need to manually integrate these changes if they access low level Store or World functions. Otherwise, a fresh deploy with the latest MUD will get you these changes.

Patch Changes

@latticexyz/[email protected]

Major Changes

  • #1231 433078c5 Thanks @dk1a! - Reverse PackedCounter encoding, to optimize gas for bitshifts.
    Ints are right-aligned, shifting using an index is straightforward if they are indexed right-to-left.

    • Previous encoding: (7 bytes | accumulator),(5 bytes | counter 1),...,(5 bytes | counter 5)
    • New encoding: (5 bytes | counter 5),...,(5 bytes | counter 1),(7 bytes | accumulator)

Patch Changes

@latticexyz/[email protected]

Major Changes

  • #1231 433078c5 Thanks @dk1a! - Reverse PackedCounter encoding, to optimize gas for bitshifts.
    Ints are right-aligned, shifting using an index is straightforward if they are indexed right-to-left.

    • Previous encoding: (7 bytes | accumulator),(5 bytes | counter 1),...,(5 bytes | counter 5)
    • New encoding: (5 bytes | counter 5),...,(5 bytes | counter 1),(7 bytes | accumulator)
  • #1311 331f0d63 Thanks @alvrs! - Move createFaucetService from @latticexyz/network to @latticexyz/services/faucet.

    - import { createFaucetService } from "@latticexyz/network";
    + import { createFaucetService } from "@latticexyz/services/faucet";

@latticexyz/[email protected]

Major Changes

  • #1311 331f0d63 Thanks @alvrs! - Deprecate @latticexyz/std-client and remove v1 network dependencies.

    • getBurnerWallet is replaced by getBurnerPrivateKey from @latticexyz/common. It now returns a Hex string instead of an rxjs BehaviorSubject.

      - import { getBurnerWallet } from "@latticexyz/std-client";
      + import { getBurnerPrivateKey } from "@latticexyz/common";
      
      - const privateKey = getBurnerWallet().value;
      - const privateKey = getBurnerPrivateKey();
      
    • All functions from std-client that depended on v1 network code are removed (most notably setupMUDNetwork and setupMUDV2Network). Consumers should upgrade to v2 networking code from @latticexyz/store-sync.

    • The following functions are removed from std-client because they are very use-case specific and depend on deprecated code: getCurrentTurn, getTurnAtTime, getGameConfig, isUntraversable, getPlayerEntity, resolveRelationshipChain, findEntityWithComponentInRelationshipChain, findInRelationshipChain. Consumers should vendor these functions if they are still needed.

    • Remaining exports from std-client are moved to /deprecated. The package will be removed in a future release (once there are replacements for the deprecated exports).

      - import { ... } from "@latticexyz/std-client";
      + import { ... } from "@latticexyz/std-client/deprecated";

Patch Changes

@latticexyz/[email protected]

Major Changes

  • #1174 952cd534 Thanks @alvrs! - All Store methods now require the table's value schema to be passed in as an argument instead of loading it from storage.
    This decreases gas cost and removes circular dependencies of the Schema table (where it was not possible to write to the Schema table before the Schema table was registered).

      function setRecord(
        bytes32 table,
        bytes32[] calldata key,
        bytes calldata data,
    +   Schema valueSchema
      ) external;

    The same diff applies to getRecord, getField, setField, pushToField, popFromField, updateInField, and deleteRecord.

    This change only requires changes in downstream projects if the Store methods were accessed directly. In most cases it is fully abstracted in the generated table libraries,
    so downstream projects only need to regenerate their table libraries after updating MUD.

  • #1231 433078c5 Thanks @dk1a! - Reverse PackedCounter encoding, to optimize gas for bitshifts.
    Ints are right-aligned, shifting using an index is straightforward if they are indexed right-to-left.

    • Previous encoding: (7 bytes | accumulator),(5 bytes | counter 1),...,(5 bytes | counter 5)
    • New encoding: (5 bytes | counter 5),...,(5 bytes | counter 1),(7 bytes | accumulator)
  • #1182 afaf2f5f Thanks @alvrs! - - Store's internal schema table is now a normal table instead of using special code paths. It is renamed to Tables, and the table ID changed from mudstore:schema to mudstore:Tables

    • Store's registerSchema and setMetadata are combined into a single registerTable method. This means metadata (key names, field names) is immutable and indexers can create tables with this metadata when a new table is registered on-chain.

      -  function registerSchema(bytes32 table, Schema schema, Schema keySchema) external;
      -
      -  function setMetadata(bytes32 table, string calldata tableName, string[] calldata fieldNames) external;
      
      +  function registerTable(
      +    bytes32 table,
      +    Schema keySchema,
      +    Schema valueSchema,
      +    string[] calldata keyNames,
      +    string[] calldata fieldNames
      +  ) external;
    • World's registerTable method is updated to match the Store interface, setMetadata is removed

    • The getSchema method is renamed to getValueSchema on all interfaces

      - function getSchema(bytes32 table) external view returns (Schema schema);
      + function getValueSchema(bytes32 table) external view returns (Schema valueSchema);
    • The store-sync and cli packages are updated to integrate the breaking protocol changes. Downstream projects only need to manually integrate these changes if they access low level Store or World functions. Otherwise, a fresh deploy with the latest MUD will get you these changes.

Patch Changes

@latticexyz/[email protected]

Major Changes

  • #1231 433078c5 Thanks @dk1a! - Reverse PackedCounter encoding, to optimize gas for bitshifts.
    Ints are right-aligned, shifting using an index is straightforward if they are indexed right-to-left.

    • Previous encoding: (7 bytes | accumulator),(5 bytes | counter 1),...,(5 bytes | counter 5)
    • New encoding: (5 bytes | counter 5),...,(5 bytes | counter 1),(7 bytes | accumulator)
  • #1182 afaf2f5f Thanks @alvrs! - - Store's internal schema table is now a normal table instead of using special code paths. It is renamed to Tables, and the table ID changed from mudstore:schema to mudstore:Tables

    • Store's registerSchema and setMetadata are combined into a single registerTable method. This means metadata (key names, field names) is immutable and indexers can create tables with this metadata when a new table is registered on-chain.

      -  function registerSchema(bytes32 table, Schema schema, Schema keySchema) external;
      -
      -  function setMetadata(bytes32 table, string calldata tableName, string[] calldata fieldNames) external;
      
      +  function registerTable(
      +    bytes32 table,
      +    Schema keySchema,
      +    Schema valueSchema,
      +    string[] calldata keyNames,
      +    string[] calldata fieldNames
      +  ) external;
    • World's registerTable method is updated to match the Store interface, setMetadata is removed

    • The getSchema method is renamed to getValueSchema on all interfaces

      - function getSchema(bytes32 table) external view returns (Schema schema);
      + function getValueSchema(bytes32 table) external view returns (Schema valueSchema);
    • The store-sync and cli packages are updated to integrate the breaking protocol changes. Downstream projects only need to manually integrate these changes if they access low level Store or World functions. Otherwise, a fresh deploy with the latest MUD will get you these changes.

Patch Changes

  • #1315 bb6ada74 Thanks @holic! - Initial sync from indexer no longer blocks the promise returning from createStoreSync, syncToRecs, and syncToSqlite. This should help with rendering loading screens using the SyncProgress RECS component and avoid the long flashes of no content in templates.

    By default, syncToRecs and syncToSqlite will start syncing (via observable subscription) immediately after called.

    If your app needs to control when syncing starts, you can use the startSync: false option and then blockStoreOperations$.subscribe() to start the sync yourself. Just be sure to unsubscribe to avoid memory leaks.

    const { blockStorageOperations$ } = syncToRecs({
      ...
      startSync: false,
    });
    
    // start sync manually by subscribing to `blockStorageOperation# @latticexyz/store-sync
    const subcription = blockStorageOperation$.subscribe();
    
    // clean up subscription
    subscription.unsubscribe();
  • #1317 3e024fcf Thanks @holic! - add retry attempts and more logging to waitForTransaction

  • Updated dependencies [952cd534, bb6ada74, c32a9269, 331f0d63, d5b73b12, 433078c5, afaf2f5f, 0d12db8c, 331f0d63]:

@latticexyz/[email protected]

Major Changes

  • #1174 952cd534 Thanks @alvrs! - All Store methods now require the table's value schema to be passed in as an argument instead of loading it from storage.
    This decreases gas cost and removes circular dependencies of the Schema table (where it was not possible to write to the Schema table before the Schema table was registered).

      function setRecord(
        bytes32 table,
        bytes32[] calldata key,
        bytes calldata data,
    +   Schema valueSchema
      ) external;

    The same diff applies to getRecord, getField, setField, pushToField, popFromField, updateInField, and deleteRecord.

    This change only requires changes in downstream projects if the Store methods were accessed directly. In most cases it is fully abstracted in the generated table libraries,
    so downstream projects only need to regenerate their table libraries after updating MUD.

  • #1208 c32a9269 Thanks @alvrs! - - All World function selectors that previously had bytes16 namespace, bytes16 name arguments now use bytes32 resourceSelector instead.
    This includes setRecord, setField, pushToField, popFromField, updateInField, deleteRecord, call, grantAccess, revokeAccess, registerTable,
    registerStoreHook, registerSystemHook, registerFunctionSelector, registerSystem and registerRootFunctionSelector.
    This change aligns the World function selectors with the Store function selectors, reduces clutter, reduces gas cost and reduces the World's contract size.

    • The World's registerHook function is removed. Use registerStoreHook or registerSystemHook instead.

    • The deploy script is updated to integrate the World interface changes

  • #1311 331f0d63 Thanks @alvrs! - The SnapSyncModule is removed. The recommended way of loading the initial state of a MUD app is via the new store-indexer. Loading state via contract getter functions is not recommended, as it's computationally heavy on the RPC, can't be cached, and is an easy way to shoot yourself in the foot with exploding RPC costs.

    The @latticexyz/network package was deprecated and is now removed. All consumers should upgrade to the new sync stack from @latticexyz/store-sync.

  • #1182 afaf2f5f Thanks @alvrs! - - Store's internal schema table is now a normal table instead of using special code paths. It is renamed to Tables, and the table ID changed from mudstore:schema to mudstore:Tables

    • Store's registerSchema and setMetadata are combined into a single registerTable method. This means metadata (key names, field names) is immutable and indexers can create tables with this metadata when a new table is registered on-chain.

      -  function registerSchema(bytes32 table, Schema schema, Schema keySchema) external;
      -
      -  function setMetadata(bytes32 table, string calldata tableName, string[] calldata fieldNames) external;
      
      +  function registerTable(
      +    bytes32 table,
      +    Schema keySchema,
      +    Schema valueSchema,
      +    string[] calldata keyNames,
      +    string[] calldata fieldNames
      +  ) external;
    • World's registerTable method is updated to match the Store interface, setMetadata is removed

    • The getSchema method is renamed to getValueSchema on all interfaces

      - function getSchema(bytes32 table) external view returns (Schema schema);
      + function getValueSchema(bytes32 table) external view returns (Schema valueSchema);
    • The store-sync and cli packages are updated to integrate the breaking protocol changes. Downstream projects only need to manually integrate these changes if they access low level Store or World functions. Otherwise, a fresh deploy with the latest MUD will get you these changes.

Patch Changes

@latticexyz/[email protected]

Minor Changes

  • #1311 331f0d63 Thanks @alvrs! - Deprecate @latticexyz/std-client and remove v1 network dependencies.

    • getBurnerWallet is replaced by getBurnerPrivateKey from @latticexyz/common. It now returns a Hex string instead of an rxjs BehaviorSubject.

      - import { getBurnerWallet } from "@latticexyz/std-client";
      + import { getBurnerPrivateKey } from "@latticexyz/common";
      
      - const privateKey = getBurnerWallet().value;
      - const privateKey = getBurnerPrivateKey();
      
    • All functions from std-client that depended on v1 network code are removed (most notably setupMUDNetwork and setupMUDV2Network). Consumers should upgrade to v2 networking code from @latticexyz/store-sync.

    • The following functions are removed from std-client because they are very use-case specific and depend on deprecated code: getCurrentTurn, getTurnAtTime, getGameConfig, isUntraversable, getPlayerEntity, resolveRelationshipChain, findEntityWithComponentInRelationshipChain, findInRelationshipChain. Consumers should vendor these functions if they are still needed.

    • Remaining exports from std-client are moved to /deprecated. The package will be removed in a future release (once there are replacements for the deprecated exports).

      - import { ... } from "@latticexyz/std-client";
      + import { ... } from "@latticexyz/std-client/deprecated";

Patch Changes

  • #1315 bb6ada74 Thanks @holic! - Initial sync from indexer no longer blocks the promise returning from createStoreSync, syncToRecs, and syncToSqlite. This should help with rendering loading screens using the SyncProgress RECS component and avoid the long flashes of no content in templates.

    By default, syncToRecs and syncToSqlite will start syncing (via observable subscription) immediately after called.

    If your app needs to control when syncing starts, you can use the startSync: false option and then blockStoreOperations$.subscribe() to start the sync yourself. Just be sure to unsubscribe to avoid memory leaks.

    const { blockStorageOperations$ } = syncToRecs({
      ...
      startSync: false,
    });
    
    // start sync manually by subscribing to `blockStorageOperation# Change Log
    const subcription = blockStorageOperation$.subscribe();
    
    // clean up subscription
    subscription.unsubscribe();
  • Updated dependencies []:

@latticexyz/[email protected]

Patch Changes

@latticexyz/[email protected]

Patch Changes

[email protected]

Patch Changes

  • #1174 952cd534 Thanks @alvrs! - All Store methods now require the table's value schema to be passed in as an argument instead of loading it from storage.
    This decreases gas cost and removes circular dependencies of the Schema table (where it was not possible to write to the Schema table before the Schema table was registered).

      function setRecord(
        bytes32 table,
        bytes32[] calldata key,
        bytes calldata data,
    +   Schema valueSchema
      ) external;

    The same diff applies to getRecord, getField, setField, pushToField, popFromField, updateInField, and deleteRecord.

    This change only requires changes in downstream projects if the Store methods were accessed directly. In most cases it is fully abstracted in the generated table libraries,
    so downstream projects only need to regenerate their table libraries after updating MUD.

  • #1182 afaf2f5f Thanks @alvrs! - - Store's internal schema table is now a normal table instead of using special code paths. It is renamed to Tables, and the table ID changed from mudstore:schema to mudstore:Tables

    • Store's registerSchema and setMetadata are combined into a single registerTable method. This means metadata (key names, field names) is immutable and indexers can create tables with this metadata when a new table is registered on-chain.

      -  function registerSchema(bytes32 table, Schema schema, Schema keySchema) external;
      -
      -  function setMetadata(bytes32 table, string calldata tableName, string[] calldata fieldNames) external;
      
      +  function registerTable(
      +    bytes32 table,
      +    Schema keySchema,
      +    Schema valueSchema,
      +    string[] calldata keyNames,
      +    string[] calldata fieldNames
      +  ) external;
    • World's registerTable method is updated to match the Store interface, setMetadata is removed

    • The getSchema method is renamed to getValueSchema on all interfaces

      - function getSchema(bytes32 table) external view returns (Schema schema);
      + function getValueSchema(bytes32 table) external view returns (Schema valueSchema);
    • The store-sync and cli packages are updated to integrate the breaking protocol changes. Downstream projects only need to manually integrate these changes if they access low level Store or World functions. Otherwise, a fresh deploy with the latest MUD will get you these changes.

  • #1311 331f0d63 Thanks @alvrs! - Move createFaucetService from @latticexyz/network to @latticexyz/services/faucet.

    - import { createFaucetService } from "@latticexyz/network";
    + import { createFaucetService } from "@latticexyz/services/faucet";
  • #1311 331f0d63 Thanks @alvrs! - Deprecate @latticexyz/std-client and remove v1 network dependencies.

    • getBurnerWallet is replaced by getBurnerPrivateKey from @latticexyz/common. It now returns a Hex string instead of an rxjs BehaviorSubject.

      - import { getBurnerWallet } from "@latticexyz/std-client";
      + import { getBurnerPrivateKey } from "@latticexyz/common";
      
      - const privateKey = getBurnerWallet().value;
      - const privateKey = getBurnerPrivateKey();
      
    • All functions from std-client that depended on v1 network code are removed (most notably setupMUDNetwork and setupMUDV2Network). Consumers should upgrade to v2 networking code from @latticexyz/store-sync.

    • The following functions are removed from std-client because they are very use-case specific and depend on deprecated code: getCurrentTurn, getTurnAtTime, getGameConfig, isUntraversable, getPlayerEntity, resolveRelationshipChain, findEntityWithComponentInRelationshipChain, findInRelationshipChain. Consumers should vendor these functions if they are still needed.

    • Remaining exports from std-client are moved to /deprecated. The package will be removed in a future release (once there are replacements for the deprecated exports).

      - import { ... } from "@latticexyz/std-client";
      + import { ... } from "@latticexyz/std-client/deprecated";

@latticexyz/[email protected]

Patch Changes

@latticexyz/[email protected]

Patch Changes

@latticexyz/[email protected]

Patch Changes

@latticexyz/[email protected]

Patch Changes

@latticexyz/[email protected]

Patch Changes

@latticexyz/[email protected]

Patch Changes

@latticexyz/[email protected]

Patch Changes

@latticexyz/[email protected]

@latticexyz/[email protected]

@latticexyz/[email protected]

@latticexyz/[email protected]

[email protected]

[email protected]

@latticexyz/[email protected]

@latticexyz/[email protected]

@latticexyz/[email protected]

@github-actions github-actions bot requested a review from holic as a code owner August 16, 2023 08:56
@github-actions github-actions bot requested a review from a user August 16, 2023 08:56
@github-actions github-actions bot requested a review from alvrs as a code owner August 16, 2023 08:56
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.

1 participant