@latticexyz/gas-report
Advanced tools
Changelog
Version 2.0.0-next.12
Release date: Fri Oct 20 2023
feat(store): default off storeArgument (#1741) (@latticexyz/cli, @latticexyz/store, @latticexyz/world-modules, @latticexyz/world, create-mud)
Store config now defaults storeArgument: false
for all tables. This means that table libraries, by default, will no longer include the extra functions with the _store
argument. This default was changed to clear up the confusion around using table libraries in tests, PostDeploy
scripts, etc.
If you are sure you need to manually specify a store when interacting with tables, you can still manually toggle it back on with storeArgument: true
in the table settings of your MUD config.
If you want to use table libraries in PostDeploy.s.sol
, you can add the following lines:
import { Script } from "forge-std/Script.sol";
import { console } from "forge-std/console.sol";
import { IWorld } from "../src/codegen/world/IWorld.sol";
+ import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol";
contract PostDeploy is Script {
function run(address worldAddress) external {
+ StoreSwitch.setStoreAddress(worldAddress);
+
+ SomeTable.get(someKey);
feat(cli): declarative deployment (#1702) (@latticexyz/cli)
deploy
, test
, dev-contracts
were overhauled using a declarative deployment approach under the hood. Deploys are now idempotent and re-running them will introspect the world and figure out the minimal changes necessary to bring the world into alignment with its config: adding tables, adding/upgrading systems, changing access control, etc.
The following CLI arguments are now removed from these commands:
--debug
(you can now adjust CLI output with DEBUG
environment variable, e.g. DEBUG=mud:*
)--priorityFeeMultiplier
(now calculated automatically)--disableTxWait
(everything is now parallelized with smarter nonce management)--pollInterval
(we now lean on viem defaults and we don't wait/poll until the very end of the deploy)Most deployment-in-progress logs are now behind a debug flag, which you can enable with a DEBUG=mud:*
environment variable.
feat(world-modules): only install modules once (#1756) (@latticexyz/world-modules)
Modules now revert with Module_AlreadyInstalled
if attempting to install more than once with the same calldata.
This is a temporary workaround for our deploy pipeline. We'll make these install steps more idempotent in the future.
docs(world): add changeset for system call helpers (#1747) (@latticexyz/world)
Added TS helpers for calling systems dynamically via the World.
encodeSystemCall
for world.call
worldContract.write.call(encodeSystemCall({
abi: worldContract.abi,
systemId: resourceToHex({ ... }),
functionName: "registerDelegation",
args: [ ... ],
}));
encodeSystemCallFrom
for world.callFrom
worldContract.write.callFrom(encodeSystemCallFrom({
abi: worldContract.abi,
from: "0x...",
systemId: resourceToHex({ ... }),
functionName: "registerDelegation",
args: [ ... ],
}));
encodeSystemCalls
for world.batchCall
worldContract.write.batchCall(encodeSystemCalls(abi, [{
systemId: resourceToHex({ ... }),
functionName: "registerDelegation",
args: [ ... ],
}]));
encodeSystemCallsFrom
for world.batchCallFrom
worldContract.write.batchCallFrom(encodeSystemCallsFrom(abi, "0x...", [{
systemId: resourceToHex({ ... }),
functionName: "registerDelegation",
args: [ ... ],
}]));
feat(world-modules): only install modules once (#1756) (@latticexyz/world)
Added a Module_AlreadyInstalled
error to IModule
.
feat(common): add sendTransaction, add mempool queue to nonce manager (#1717) (@latticexyz/common)
sendTransaction
helper to mirror viem's sendTransaction
, but with our nonce managersendTransaction
and writeContract
for better nonce handlingpending
for transaction simulation and transaction count (when initializing the nonce manager)feat(cli): add --alwaysPostDeploy
flag to deploys (#1765) (@latticexyz/cli)
Added a --alwaysRunPostDeploy
flag to deploys (deploy
, test
, dev-contracts
commands) to always run PostDeploy.s.sol
script after each deploy. By default, PostDeploy.s.sol
is only run once after a new world is deployed.
This is helpful if you want to continue a deploy that may not have finished (due to an error or otherwise) or to run deploys with an idempotent PostDeploy.s.sol
script.
feat(abi-ts): move logs to debug (#1736) (@latticexyz/abi-ts)
Moves log output behind a debug flag. You can enable logging with DEBUG=abi-ts
environment variable.
feat(cli): remove forge clean from deploy (#1759) (@latticexyz/cli)
CLI deploy
, test
, dev-contracts
no longer run forge clean
before each deploy. We previously cleaned to ensure no outdated artifacts were checked into git (ABIs, typechain types, etc.). Now that all artifacts are gitignored, we can let forge use its cache again.
feat(common): clarify resourceId (hex) from resource (object) (#1706) (@latticexyz/common)
Renames resourceIdToHex
to resourceToHex
and hexToResourceId
to hexToResource
, to better distinguish between a resource ID (hex value) and a resource reference (type, namespace, name).
- resourceIdToHex({ type: 'table', namespace: '', name: 'Position' });
+ resourceToHex({ type: 'table', namespace: '', name: 'Position' });
- hexToResourceId('0x...');
+ hexToResource('0x...');
Previous methods still exist but are now deprecated to ease migration and reduce breaking changes. These will be removed in a future version.
Also removes the previously deprecated and unused table ID utils (replaced by these resource ID utils).
feat(cli): remove .mudtest file in favor of env var (#1722) (@latticexyz/cli, @latticexyz/common, @latticexyz/world)
Replaced temporary .mudtest
file in favor of WORLD_ADDRESS
environment variable when running tests with MudTest
contract
feat(faucet,store-indexer): add k8s healthcheck endpoints (#1739) (@latticexyz/faucet, @latticexyz/store-indexer)
Added /healthz
and /readyz
healthcheck endpoints for Kubernetes
feat(cli): add retries to deploy (#1766) (@latticexyz/cli)
Transactions sent via deploy will now be retried a few times before giving up. This hopefully helps with large deploys on some chains.
fix(cli): don't bail dev-contracts during deploy failure (#1808) (@latticexyz/cli)
dev-contracts
will no longer bail when there was an issue with deploying (e.g. typo in contracts) and instead wait for file changes before retrying.
feat(store): parallelize table codegen (#1754) (@latticexyz/store)
Parallelized table codegen. Also put logs behind debug flag, which can be enabled using the DEBUG=mud:*
environment variable.
fix(cli): handle module already installed (#1769) (@latticexyz/cli)
Deploys now continue if they detect a Module_AlreadyInstalled
revert error.
fix(cli): deploy systems/modules before registering/installing them (#1767) (@latticexyz/cli)
Changed deploy order so that system/module contracts are fully deployed before registering/installing them on the world.
fix(cli): run worldgen with deploy (#1807) (@latticexyz/cli)
Deploy commands (deploy
, dev-contracts
, test
) now correctly run worldgen
to generate system interfaces before deploying.
feat(store): parallelize table codegen (#1754) (@latticexyz/common)
Moved some codegen to use fs/promises
for better parallelism.
fix(cli): support enums in deploy, only deploy modules/systems once (#1749) (@latticexyz/cli)
Fixed a few issues with deploys:
feat(cli,create-mud): use forge cache (#1777) (@latticexyz/cli, create-mud)
Sped up builds by using more of forge's cache.
Previously we'd build only what we needed because we would check in ABIs and other build artifacts into git, but that meant that we'd get a lot of forge cache misses. Now that we no longer need these files visible, we can take advantage of forge's caching and greatly speed up builds, especially incremental ones.
feat(cli): declarative deployment (#1702) (@latticexyz/world)
With resource types in resource IDs, the World config no longer requires table and system names to be unique.
feat(common): clarify resourceId (hex) from resource (object) (#1706) (@latticexyz/cli, @latticexyz/dev-tools, @latticexyz/store-sync)
Moved to new resource ID utils.