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

Custom TENET MUD fork changes #31

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
45d1c81
chore: export types
dhvanipa Feb 25, 2024
2c74cf7
chore: export types
dhvanipa Feb 25, 2024
de849b2
feat(world-modules): add haskeys module
dhvanipa Feb 25, 2024
3c917f4
fix: turn off turbo daemon
dhvanipa Feb 26, 2024
b8ed8ef
feat(cli): increase default anvil gas limit
dhvanipa Feb 29, 2024
2012a22
feat: compile to cjs
dhvanipa Mar 1, 2024
140b963
fix: add fallbacks for error instanceof
dhvanipa Mar 2, 2024
f2a8ff3
fix: cjs fallback for import.meta.url
dhvanipa Mar 3, 2024
91622fb
fix: merge changes
dhvanipa Mar 14, 2024
9f23b8a
fix: noise package
dhvanipa Mar 14, 2024
94e9dc7
fix: noise cjs
dhvanipa Mar 14, 2024
1f94e95
fix: remove module type from query package
dhvanipa Mar 18, 2024
741d4ef
feat: call unregister hook if exists on delegatee
dhvanipa Mar 18, 2024
b7e98b3
feat: add optional system hooks
dhvanipa Mar 18, 2024
45e679f
feat: change block time to 2
dhvanipa Mar 18, 2024
0e3f7a4
fix: merge removed files
dhvanipa Mar 21, 2024
db5e325
fix: update for new mud changes
dhvanipa Mar 21, 2024
4a3d878
fix: merge fixes
dhvanipa Mar 21, 2024
9cb8c41
feat: include extended registration system in init module
dhvanipa Mar 26, 2024
c338d0f
feat: keep re-retrying getting the latest block if it fails instead o…
dhvanipa Mar 31, 2024
b535597
feat: add store argument functions for optionalsystemhooks and userde…
dhvanipa Mar 31, 2024
085a053
fix: safe call unregister
dhvanipa Apr 5, 2024
1d6dbbc
feat: pass in msg sender to hooks and delegations
dhvanipa Apr 7, 2024
5f79b0a
fix: dont allow registering an optional hook if its already there
dhvanipa Apr 8, 2024
a2f7980
feat: pass down hook args
dhvanipa Apr 8, 2024
2e6ac8b
feat: update pnpm and node version
dhvanipa Apr 9, 2024
b99b8b7
Revert "feat: update pnpm and node version"
dhvanipa Apr 9, 2024
2304e74
fix: cjs types for arktype
dhvanipa Apr 19, 2024
40b865e
fix: remove unused
dhvanipa Apr 19, 2024
7656a85
chore: import unused
dhvanipa Apr 23, 2024
258a364
fix: cjs
dhvanipa Apr 25, 2024
f980256
fix: rebase
dhvanipa Apr 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"private": true,
"description": "mud.dev docs",
"license": "",
"type": "module",
"main": "index.js",
"scripts": {
"build": "next build",
Expand Down
1 change: 0 additions & 1 deletion e2e/packages/client-vanilla/.env

This file was deleted.

1 change: 0 additions & 1 deletion e2e/packages/client-vanilla/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"version": "0.0.0",
"private": true,
"license": "MIT",
"type": "module",
"scripts": {
"build": "vite build",
"clean": "rimraf dist",
Expand Down
5 changes: 0 additions & 5 deletions e2e/packages/contracts/.env

This file was deleted.

4 changes: 2 additions & 2 deletions e2e/packages/sync-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
"@latticexyz/world-modules": "link:../../../packages/world-modules",
"@viem/anvil": "^0.0.6",
"abitype": "1.0.0",
"chalk": "^5.2.0",
"chalk": "4.1.2",
"dotenv": "^16.0.3",
"drizzle-orm": "^0.28.5",
"execa": "^7.1.1",
"execa": "^5.1.1",
"happy-dom": "^12.10.3",
"postgres": "3.3.5",
"typescript": "5.4.2",
Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/sync-test/setup/deployContracts.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import chalk from "chalk";
import { execa } from "execa";
import execa from "execa";

export function deployContracts(rpc: string) {
const deploymentProcess = execa("pnpm", ["mud", "deploy", "--rpc", rpc], {
Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/sync-test/setup/startIndexer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import chalk from "chalk";
import { execa } from "execa";
import execa from "execa";
import { rmSync } from "node:fs";
import { cleanDatabase } from "@latticexyz/store-sync/postgres";
import { drizzle } from "drizzle-orm/postgres-js";
Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/test-data/generateLogs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { execa } from "execa";
import execa from "execa";
import {
ClientConfig,
GetContractReturnType,
Expand Down
3 changes: 1 addition & 2 deletions e2e/packages/test-data/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion examples/faucet-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"version": "0.0.0",
"private": true,
"license": "MIT",
"type": "module",
"scripts": {
"drip": "tsx index.ts"
},
Expand Down
1 change: 0 additions & 1 deletion examples/indexer-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"version": "0.0.0",
"private": true,
"license": "MIT",
"type": "module",
"scripts": {
"read-indexer": "tsx index.ts"
},
Expand Down
1 change: 0 additions & 1 deletion examples/minimal/packages/client-phaser/.env

This file was deleted.

1 change: 0 additions & 1 deletion examples/minimal/packages/client-phaser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"version": "0.0.0",
"private": true,
"license": "MIT",
"type": "module",
"scripts": {
"build": "vite build",
"dev": "vite",
Expand Down
1 change: 0 additions & 1 deletion examples/minimal/packages/client-react/.env

This file was deleted.

1 change: 0 additions & 1 deletion examples/minimal/packages/client-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"version": "0.0.0",
"private": true,
"license": "MIT",
"type": "module",
"scripts": {
"build": "vite build",
"dev": "wait-port localhost:8545 && vite",
Expand Down
1 change: 0 additions & 1 deletion examples/minimal/packages/client-vanilla/.env

This file was deleted.

1 change: 0 additions & 1 deletion examples/minimal/packages/client-vanilla/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"version": "0.0.0",
"private": true,
"license": "MIT",
"type": "module",
"scripts": {
"build": "vite build",
"dev": "wait-port localhost:8545 && vite",
Expand Down
11 changes: 0 additions & 11 deletions examples/minimal/packages/contracts/.env

This file was deleted.

1 change: 0 additions & 1 deletion examples/multiple-accounts/packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"version": "0.0.0",
"private": true,
"license": "MIT",
"type": "module",
"scripts": {
"build": "vite build",
"dev": "wait-port localhost:8545 && vite",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
"@typescript-eslint/eslint-plugin": "7.1.1",
"@typescript-eslint/parser": "7.1.1",
"bun": "^1.0.11",
"chalk": "^5.2.0",
"chalk": "4.1.2",
"eslint": "8.57.0",
"execa": "^7.0.0",
"execa": "^5.1.1",
"glob": "^8.0.3",
"husky": ">=6",
"lint-staged": ">=10",
Expand Down
5 changes: 2 additions & 3 deletions packages/abi-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"directory": "packages/abi-ts"
},
"license": "MIT",
"type": "module",
"exports": {
".": "./dist/index.js"
},
Expand All @@ -31,9 +30,9 @@
"test:ci": "pnpm run test"
},
"dependencies": {
"chalk": "^5.3.0",
"chalk": "4.1.2",
"debug": "^4.3.4",
"execa": "^7.0.0",
"execa": "^5.1.1",
"glob": "^8.0.3",
"yargs": "^17.7.1"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/abi-ts/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { defineConfig } from "tsup";
export default defineConfig({
entry: ["src/index.ts", "src/abi-ts.ts"],
target: "esnext",
format: ["esm"],
format: ["esm", "cjs"],
dts: !process.env.TSUP_SKIP_DTS,
sourcemap: true,
clean: true,
Expand Down
1 change: 0 additions & 1 deletion packages/block-logs-stream/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"directory": "packages/block-logs-stream"
},
"license": "MIT",
"type": "module",
"exports": {
".": "./dist/index.js"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/block-logs-stream/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { defineConfig } from "tsup";
export default defineConfig({
entry: ["src/index.ts"],
target: "esnext",
format: ["esm"],
format: ["esm", "cjs"],
dts: !process.env.TSUP_SKIP_DTS,
sourcemap: true,
clean: true,
Expand Down
9 changes: 4 additions & 5 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"directory": "packages/cli"
},
"license": "MIT",
"type": "module",
"exports": {
".": "./dist/index.js"
},
Expand Down Expand Up @@ -47,18 +46,18 @@
"@latticexyz/world": "workspace:*",
"@latticexyz/world-modules": "workspace:*",
"asn1.js": "^5.4.1",
"chalk": "^5.0.1",
"chalk": "4.1.2",
"chokidar": "^3.5.3",
"debug": "^4.3.4",
"dotenv": "^16.0.3",
"ejs": "^3.1.8",
"ethers": "^5.7.2",
"execa": "^7.0.0",
"execa": "^5.1.1",
"glob": "^8.0.3",
"nice-grpc-web": "^2.0.1",
"openurl": "^1.1.1",
"p-queue": "^7.4.1",
"p-retry": "^5.1.2",
"p-queue": "6.6.2",
"p-retry": "4.6.2",
"path": "^0.12.7",
"rxjs": "7.5.5",
"throttle-debounce": "^5.0.0",
Expand Down
8 changes: 5 additions & 3 deletions packages/cli/scripts/generate-test-tables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ const config = defineStore({
},
});

const srcDirectory = await getSrcDirectory();
const remappings = await getRemappings();
(async () => {
const srcDirectory = await getSrcDirectory();
const remappings = await getRemappings();

await tablegen(config, path.join(srcDirectory, config.codegen.outputDirectory), remappings);
await tablegen(config, path.join(srcDirectory, config.codegen.outputDirectory), remappings);
})();
2 changes: 1 addition & 1 deletion packages/cli/src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { World as WorldConfig } from "@latticexyz/world";
import { worldToV1 } from "@latticexyz/world/config/v2";
import { forge, getRemappings } from "@latticexyz/common/foundry";
import { getExistingContracts } from "./utils/getExistingContracts";
import { execa } from "execa";
import execa from "execa";

type BuildOptions = {
foundryProfile?: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/dev-contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const commandModule: CommandModule<typeof devOptions, InferredOptionTypes<typeof
const userHomeDir = homedir();
rmSync(path.join(userHomeDir, ".foundry", "anvil", "tmp"), { recursive: true, force: true });

const anvilArgs = ["--block-time", "1", "--block-base-fee-per-gas", "0"];
const anvilArgs = ["--block-time", "2", "--block-base-fee-per-gas", "0", "--gas-limit", "100000000"];
anvil(anvilArgs);
rpc = "http://127.0.0.1:8545";
}
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/devnode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { rmSync } from "fs";
import { homedir } from "os";
import path from "path";
import type { CommandModule } from "yargs";
import { execa } from "execa";
import execa from "execa";

type Options = {
blocktime: number;
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/deploy/ensureWorldFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ export async function ensureWorldFactory(
contracts: Object.values(contracts),
});
return contracts.WorldFactory.address;
}
}
16 changes: 15 additions & 1 deletion packages/cli/src/deploy/getWorldContracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import accessManagementSystemBuild from "@latticexyz/world/out/AccessManagementS
import balanceTransferSystemBuild from "@latticexyz/world/out/BalanceTransferSystem.sol/BalanceTransferSystem.json" assert { type: "json" };
import batchCallSystemBuild from "@latticexyz/world/out/BatchCallSystem.sol/BatchCallSystem.json" assert { type: "json" };
import registrationSystemBuild from "@latticexyz/world/out/RegistrationSystem.sol/RegistrationSystem.json" assert { type: "json" };
import extendedRegistrationSystemBuild from "@latticexyz/world/out/ExtendedRegistrationSystem.sol/ExtendedRegistrationSystem.json" assert { type: "json" };
import initModuleBuild from "@latticexyz/world/out/InitModule.sol/InitModule.json" assert { type: "json" };
import initModuleAbi from "@latticexyz/world/out/InitModule.sol/InitModule.abi.json" assert { type: "json" };
import { Hex, getCreate2Address, encodeDeployData, size } from "viem";
Expand Down Expand Up @@ -35,12 +36,19 @@ export function getWorldContracts(deployerAddress: Hex) {
bytecode: registrationBytecode,
salt,
});
const extendedRegistrationDeployedBytecodeSize = size(extendedRegistrationSystemBuild.deployedBytecode.object as Hex);
const extendedRegistrationBytecode = extendedRegistrationSystemBuild.bytecode.object as Hex;
const extendedRegistration = getCreate2Address({
from: deployerAddress,
bytecode: extendedRegistrationBytecode,
salt,
});

const initModuleDeployedBytecodeSize = size(initModuleBuild.deployedBytecode.object as Hex);
const initModuleBytecode = encodeDeployData({
bytecode: initModuleBuild.bytecode.object as Hex,
abi: initModuleAbi,
args: [accessManagementSystem, balanceTransferSystem, batchCallSystem, registration],
args: [accessManagementSystem, balanceTransferSystem, batchCallSystem, registration, extendedRegistration],
});
const initModule = getCreate2Address({ from: deployerAddress, bytecode: initModuleBytecode, salt });

Expand Down Expand Up @@ -69,6 +77,12 @@ export function getWorldContracts(deployerAddress: Hex) {
label: "core registration system",
address: registration,
},
ExteendedRegistrationSystem: {
bytecode: extendedRegistrationBytecode,
deployedBytecodeSize: extendedRegistrationDeployedBytecodeSize,
label: "extended core registration system",
address: extendedRegistration,
},
InitModule: {
bytecode: initModuleBytecode,
deployedBytecodeSize: initModuleDeployedBytecodeSize,
Expand Down
8 changes: 8 additions & 0 deletions packages/cli/src/utils/defaultModuleContracts.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import KeysWithValueModuleData from "@latticexyz/world-modules/out/KeysWithValueModule.sol/KeysWithValueModule.json" assert { type: "json" };
import KeysInTableModuleData from "@latticexyz/world-modules/out/KeysInTableModule.sol/KeysInTableModule.json" assert { type: "json" };
import HasKeysModuleData from "@latticexyz/world-modules/out/HasKeysModule.sol/HasKeysModule.json" assert { type: "json" };
import UniqueEntityModuleData from "@latticexyz/world-modules/out/UniqueEntityModule.sol/UniqueEntityModule.json" assert { type: "json" };
// eslint-disable-next-line max-len
import Unstable_CallWithSignatureModuleData from "@latticexyz/world-modules/out/Unstable_CallWithSignatureModule.sol/Unstable_CallWithSignatureModule.json" assert { type: "json" };
Expand All @@ -22,6 +23,13 @@ export const defaultModuleContracts = [
placeholders: findPlaceholders(KeysInTableModuleData.bytecode.linkReferences),
deployedBytecodeSize: size(KeysInTableModuleData.deployedBytecode.object as Hex),
},
{
name: "HasKeysModule",
abi: HasKeysModuleData.abi as Abi,
bytecode: HasKeysModuleData.bytecode.object as Hex,
placeholders: findPlaceholders(HasKeysModuleData.bytecode.linkReferences),
deployedBytecodeSize: size(HasKeysModuleData.deployedBytecode.object as Hex),
},
{
name: "UniqueEntityModule",
abi: UniqueEntityModuleData.abi as Abi,
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const mudPackages: MudPackages = Object.fromEntries(
export default defineConfig({
entry: ["src/index.ts", "src/mud.ts"],
target: "esnext",
format: ["esm"],
format: ["esm", "cjs"],
dts: !process.env.TSUP_SKIP_DTS,
sourcemap: true,
clean: true,
Expand Down
7 changes: 3 additions & 4 deletions packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"directory": "packages/common"
},
"license": "MIT",
"type": "module",
"exports": {
".": "./dist/index.js",
"./actions": "./dist/actions.js",
Expand Down Expand Up @@ -64,9 +63,9 @@
"@latticexyz/schema-type": "workspace:*",
"@solidity-parser/parser": "^0.16.0",
"debug": "^4.3.4",
"execa": "^7.0.0",
"p-queue": "^7.4.1",
"p-retry": "^5.1.2",
"execa": "^5.1.1",
"p-queue": "6.6.2",
"p-retry": "4.6.2",
"prettier": "3.2.5",
"prettier-plugin-solidity": "1.3.1",
"viem": "2.9.20"
Expand Down
9 changes: 6 additions & 3 deletions packages/common/src/createNonceManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,13 @@ export function createNonceManager({
debug("reset nonce to", nonceRef.current);
}

function shouldResetNonce(error: unknown): boolean {
function shouldResetNonce(error: any): boolean {
return (
error instanceof BaseError &&
error.walk((e) => e instanceof NonceTooLowError || e instanceof NonceTooHighError) != null
(error instanceof BaseError &&
error.walk((e) => e instanceof NonceTooLowError || e instanceof NonceTooHighError) != null) ||
error.name === "NonceTooLowError" ||
error.name === "NonceTooHighError" ||
(error.name === "TransactionExecutionError" && error.message && error.message.includes("nonce"))
);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/foundry/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { execa, Options } from "execa";
import execa, { Options } from "execa";

export interface ForgeConfig {
// project
Expand Down
Loading
Loading