diff --git a/.changeset/eight-icons-explain.md b/.changeset/eight-icons-explain.md deleted file mode 100644 index cff131305..000000000 --- a/.changeset/eight-icons-explain.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@snapshot-labs/sx": patch ---- - -fix evm slot value strategy cached_timestamps lookup diff --git a/.changeset/gentle-peas-nail.md b/.changeset/gentle-peas-nail.md deleted file mode 100644 index 0dbf65459..000000000 --- a/.changeset/gentle-peas-nail.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@snapshot-labs/sx": patch ---- - -remove networks with empty config diff --git a/.changeset/late-trees-compete.md b/.changeset/late-trees-compete.md deleted file mode 100644 index 231604766..000000000 --- a/.changeset/late-trees-compete.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@snapshot-labs/sx": patch ---- - -set ethsig offchain vote app property diff --git a/.changeset/neat-falcons-pay.md b/.changeset/neat-falcons-pay.md deleted file mode 100644 index cd0bdc466..000000000 --- a/.changeset/neat-falcons-pay.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@snapshot-labs/sx": patch ---- - -disable estimation for initialize EthTx calls diff --git a/.changeset/smooth-moose-smell.md b/.changeset/smooth-moose-smell.md deleted file mode 100644 index 4d6d5f0fb..000000000 --- a/.changeset/smooth-moose-smell.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@snapshot-labs/sx": patch ---- - -add updateSettings method to offchain EthereumSig client diff --git a/.changeset/strange-ducks-shake.md b/.changeset/strange-ducks-shake.md deleted file mode 100644 index 95f8ea166..000000000 --- a/.changeset/strange-ducks-shake.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@snapshot-labs/sx": minor ---- - -Support labels on proposals diff --git a/.changeset/sweet-papayas-provide.md b/.changeset/sweet-papayas-provide.md deleted file mode 100644 index 6d8253cbb..000000000 --- a/.changeset/sweet-papayas-provide.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@snapshot-labs/sx": patch ---- - -add deleteSpace method to offchain ethSig client diff --git a/.changeset/twenty-cups-hope.md b/.changeset/twenty-cups-hope.md deleted file mode 100644 index 7bcf0522f..000000000 --- a/.changeset/twenty-cups-hope.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@snapshot-labs/sx": patch ---- - -fix ethSig updateProposal call to properly include author diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a716d0b4d..f02164aa9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,10 +14,10 @@ jobs: steps: - name: Checkout Repo uses: actions/checkout@v3 - - name: Setup Node.js 16 + - name: Setup Node.js 22 uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 22 - name: Install Dependencies run: yarn - name: Create Release Pull Request or Publish to npm diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cd8d87a82..e5435a12c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,19 +2,34 @@ name: CI on: [push] +env: + STARKNET_DEVNET_VERSION: 0.2.3 + jobs: lint-build-test: runs-on: ubuntu-22.04 steps: - name: Checkout code uses: actions/checkout@v2 - - name: Setup Node.js + - name: Setup Node.js 22 uses: actions/setup-node@v2 with: - node-version: "18.x" + node-version: 22 cache: "yarn" + - name: Setup Rust Toolchain + uses: dtolnay/rust-toolchain@stable + - name: Restore Cargo + uses: actions/cache@v4 + with: + path: ~/.cargo + key: ${{ runner.os }}-cargo-${{ env.STARKNET_DEVNET_VERSION }} + - name: Install Starknet Devnet + run: cargo install starknet-devnet@${{ env.STARKNET_DEVNET_VERSION }} + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 - run: yarn --frozen-lockfile - run: yarn build - run: yarn typecheck - run: yarn lint - run: yarn test + - run: yarn test:integration diff --git a/README.md b/README.md index e3d240255..1acf2190d 100644 --- a/README.md +++ b/README.md @@ -19,13 +19,16 @@ yarn ### Compiles and hot-reloads for development +#### UI only + ```sh yarn dev - -# if you want to run full stack (including backend services) -yarn dev:full ``` +#### UI with backend services + +[See here.](./README.md#running-local-services) + ### Compiles and minifies for production ``` @@ -50,6 +53,36 @@ yarn test yarn typecheck ``` +## Running local services + +You can run all local services (api, subgraph-api, mana, ui) with single command assuming you have all necessary environment variables set up. +Local APIs will only be used for Ethereum Sepolia and Starknet Sepolia. + +``` +yarn dev:full +``` + +### Setup + +You need to have Docker running on your machine. + +In `apps/api` and `apps/mana` copy `.env.example` to `.env` files. + +In `apps/mana/.env` you need to fill in following empty variables: + +- `STARKNET_MNEMONIC` and `ETH_MNEMONIC` - if you want to use it as relayer. +- `HERODOTUS_API_KEY` and `HERODOTUS_LEGACY_API_KEY` - if you want to use L1<->L2 messaging (voting with strategies that use L1 proofs) + +### Getting it running faster + +If you run `yarn dev:full` it will take long time to sync all the blocks for the first time. To mitigate it you can just change starting block +for indexing here: + +- https://github.com/snapshot-labs/sx-monorepo/blob/0f767b8c69d6986d06c70eb4a1ed7cb33e235b5a/apps/api/src/overrrides.ts#L50 (for Starknet) +- https://github.com/snapshot-labs/sx-monorepo/blob/0f767b8c69d6986d06c70eb4a1ed7cb33e235b5a/apps/subgraph-api/networks.json#L12-L21 (for Ethereum) + +If you do that make sure to create a new space, because spaces created before the new starting block you picked won't be available. + ## Versioning packages Packages are versioned using [`changesets`](https://github.com/changesets/changesets). diff --git a/apps/api/package.json b/apps/api/package.json index 98670d6f3..62e78ef42 100644 --- a/apps/api/package.json +++ b/apps/api/package.json @@ -23,7 +23,7 @@ "@ethersproject/providers": "^5.7.2", "@ethersproject/units": "^5.6.1", "@faker-js/faker": "^7.4.0", - "@snapshot-labs/checkpoint": "^0.1.0-beta.39", + "@snapshot-labs/checkpoint": "^0.1.0-beta.44", "@snapshot-labs/sx": "^0.1.0", "@types/bn.js": "^5.1.0", "@types/mysql": "^2.15.21", diff --git a/apps/api/src/utils.ts b/apps/api/src/utils.ts index 116adea95..dd6d50ae6 100644 --- a/apps/api/src/utils.ts +++ b/apps/api/src/utils.ts @@ -168,10 +168,10 @@ export async function handleExecutionStrategy( const [l1Destination] = payload; if (!l1Destination) throw new Error('Invalid payload for EthRelayer execution strategy'); - destinationAddress = l1Destination; + destinationAddress = formatAddress('Ethereum', l1Destination); const SimpleQuorumExecutionStrategyContract = new EthContract( - l1Destination, + destinationAddress, SimpleQuorumExecutionStrategyAbi, ethProvider ); diff --git a/apps/mana/src/db.ts b/apps/mana/src/db.ts index 59ef3a79f..386a77579 100644 --- a/apps/mana/src/db.ts +++ b/apps/mana/src/db.ts @@ -113,3 +113,10 @@ export async function markProposalProcessed(id: string) { export async function getProposal(id: string) { return knex(REGISTERED_PROPOSALS).select('*').where({ id }).first(); } + +export async function getDataByMessageHash(hash: string) { + return knex(REGISTERED_TRANSACTIONS) + .select(['sender', 'type', 'data', 'hash', 'network']) + .where({ hash }) + .first(); +} diff --git a/apps/mana/src/eth/rpc.ts b/apps/mana/src/eth/rpc.ts index cb64930cc..1c9e6d522 100644 --- a/apps/mana/src/eth/rpc.ts +++ b/apps/mana/src/eth/rpc.ts @@ -1,7 +1,6 @@ import { clients, evmArbitrum, - evmLineaGoerli, evmMainnet, EvmNetworkConfig, evmOptimism, @@ -18,8 +17,7 @@ export const NETWORKS = new Map([ [137, evmPolygon], [42161, evmArbitrum], [1, evmMainnet], - [11155111, evmSepolia], - [59140, evmLineaGoerli] + [11155111, evmSepolia] ]); export const createNetworkHandler = (chainId: number) => { diff --git a/apps/mana/src/stark/index.ts b/apps/mana/src/stark/index.ts index 9a86bd5eb..1c957bf66 100644 --- a/apps/mana/src/stark/index.ts +++ b/apps/mana/src/stark/index.ts @@ -15,7 +15,8 @@ const jsonRpcRequestSchema = z.object({ 'send', 'execute', 'registerTransaction', - 'registerProposal' + 'registerProposal', + 'getDataByMessageHash' ]), params: z.any() }); diff --git a/apps/mana/src/stark/rpc.ts b/apps/mana/src/stark/rpc.ts index 2b2bcb2ed..c240df5c5 100644 --- a/apps/mana/src/stark/rpc.ts +++ b/apps/mana/src/stark/rpc.ts @@ -137,11 +137,25 @@ export const createNetworkHandler = (chainId: string) => { } } + async function getDataByMessageHash(id: number, params: any, res: Response) { + try { + const { hash } = params; + + const transaction = await db.getDataByMessageHash(hash); + + return rpcSuccess(res, transaction, id); + } catch (e) { + console.log('Failed', e); + return rpcError(res, 500, e, id); + } + } + return { send, execute, registerTransaction, registerProposal, - getAccount + getAccount, + getDataByMessageHash }; }; diff --git a/apps/subgraph-api/networks.json b/apps/subgraph-api/networks.json index c7a9f0cd0..456e9b59f 100644 --- a/apps/subgraph-api/networks.json +++ b/apps/subgraph-api/networks.json @@ -48,15 +48,5 @@ "address": "0x0000000000021210000000000000000000000000", "startBlock": 157825417 } - }, - "linea-testnet": { - "ProxyFactory": { - "address": "0x12A1FfFFfd70677939D61d641eA043bc9060c718", - "startBlock": 858097 - }, - "L1AvatarExecutionStrategyFactory": { - "address": "0x0000000000021210000000000000000000000000", - "startBlock": 858097 - } } } diff --git a/apps/subgraph-api/package.json b/apps/subgraph-api/package.json index 4235bd966..e44bb5304 100644 --- a/apps/subgraph-api/package.json +++ b/apps/subgraph-api/package.json @@ -1,7 +1,7 @@ { "name": "api-subgraph", "private": true, - "version": "0.0.42", + "version": "0.0.43", "scripts": { "test": "graph test", "codegen": "graph codegen", @@ -11,7 +11,6 @@ "create-local": "graph create --node http://localhost:8020/ snapshot-labs/sx-subgraph", "remove-local": "graph remove --node http://localhost:8020/ snapshot-labs/sx-subgraph", "deploy-local": "yarn create-local && graph deploy --node http://localhost:8020/ --network sepolia -l `LC_ALL=C tr -dc a-z0-9 import defaultRoutes from '@/routes/default'; import whiteLabelRoutes from '@/routes/whiteLabel'; -import { startIntercom } from './helpers/intercom'; const route = useRoute(); const router = useRouter(); @@ -31,7 +30,6 @@ watch( resolved => { if (!resolved) return; - if (!isWhiteLabel.value) startIntercom(); if (isCustomDomain.value && !whiteLabelFailed.value) { mountCustomDomainRoutes(); } @@ -48,4 +46,5 @@ onMounted(() => { + diff --git a/apps/ui/src/components/App/Topnav.vue b/apps/ui/src/components/App/Topnav.vue index a5032afe3..fc7aa8c26 100644 --- a/apps/ui/src/components/App/Topnav.vue +++ b/apps/ui/src/components/App/Topnav.vue @@ -85,6 +85,10 @@ watch( searchQuery => (searchValue.value = searchQuery), { immediate: true } ); + +onUnmounted(() => { + resetAccountModal(); +});