From 748c77c9b9e7e33830ff8a2a0c9f7157008b9fa6 Mon Sep 17 00:00:00 2001 From: Snigdha Singh Date: Fri, 3 Jan 2025 10:27:43 +0100 Subject: [PATCH] feat: use sdk for subgraph commands --- .vscode/tasks.json | 6 +++--- Dockerfile | 2 +- docs/subgraph.md | 20 ++++++++++++++++++-- lib/forge-std/README.md | 2 +- lib/forge-std/package.json | 2 +- lib/forge-std/src/Vm.sol | 26 ++++++++++++++++---------- lib/forge-std/test/Vm.t.sol | 2 +- 7 files changed, 41 insertions(+), 19 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 5c456b9..82536ad 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -96,13 +96,13 @@ { "label": "The Graph - Codegen the subgraph types", "type": "shell", - "command": "btp-scs subgraph codegen", + "command": "bunx settlemint scs subgraph codegen", "problemMatcher": [] }, { "label": "The Graph - Build the subgraph", "type": "shell", - "command": "btp-scs subgraph build", + "command": "bunx settlemint scs subgraph build", "problemMatcher": [], "group": { "kind": "build", @@ -112,7 +112,7 @@ { "label": "The Graph - Deploy or update the subgraph", "type": "shell", - "command": "btp-scs subgraph deploy", + "command": "bunx settlemint scs subgraph deploy", "problemMatcher": [] } ], diff --git a/Dockerfile b/Dockerfile index e429e21..79f8c26 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM node:22.12.0 AS build -COPY --from=oven/bun:1.1.41-debian --chmod=0777 /usr/local/bin/bun /bin/bun +COPY --from=oven/bun:1.1.42-debian --chmod=0777 /usr/local/bin/bun /bin/bun ENV BUN_RUNTIME_TRANSPILER_CACHE_PATH=0 ENV BUN_INSTALL_BIN=/bin diff --git a/docs/subgraph.md b/docs/subgraph.md index ee4e7ed..bf5d33c 100644 --- a/docs/subgraph.md +++ b/docs/subgraph.md @@ -6,5 +6,21 @@ To index your smart contract events, use The Graph middleware. First, edit `subgraph.config.json` to set the addresses of your smart contracts. You can find them in the deployment folder created under `ignation`. Then, run: ```shell -btp-scs subgraph deploy -``` \ No newline at end of file +bunx settlemint login +``` + +This logs you in to the platform. This command only needs to be run once, so you can skip it if you've already logged in. + +Then, run: + +```shell +bunx settlemint scs subgraph deploy +``` + +## Help + +To get info about the tasks, run: + +```shell +bunx settlemint scs subgraph --help +``` diff --git a/lib/forge-std/README.md b/lib/forge-std/README.md index 90af03b..2674dec 100644 --- a/lib/forge-std/README.md +++ b/lib/forge-std/README.md @@ -38,7 +38,7 @@ contract TestContract is Test { contract ErrorsTest { function arithmeticError(uint256 a) public { - uint256 a = a - 100; + a = a - 100; } } ``` diff --git a/lib/forge-std/package.json b/lib/forge-std/package.json index 14f3353..a0d4851 100644 --- a/lib/forge-std/package.json +++ b/lib/forge-std/package.json @@ -1,6 +1,6 @@ { "name": "forge-std", - "version": "1.9.4", + "version": "1.9.5", "description": "Forge Standard Library is a collection of helpful contracts and libraries for use with Forge and Foundry.", "homepage": "https://book.getfoundry.sh/forge/forge-std", "bugs": "https://github.com/foundry-rs/forge-std/issues", diff --git a/lib/forge-std/src/Vm.sol b/lib/forge-std/src/Vm.sol index cb3a9db..cb1d3b5 100644 --- a/lib/forge-std/src/Vm.sol +++ b/lib/forge-std/src/Vm.sol @@ -621,6 +621,12 @@ interface VmSafe { /// Gets all the recorded logs. function getRecordedLogs() external returns (Log[] memory logs); + /// Returns state diffs from current `vm.startStateDiffRecording` session. + function getStateDiff() external view returns (string memory diff); + + /// Returns state diffs from current `vm.startStateDiffRecording` session, in json format. + function getStateDiffJson() external view returns (string memory diff); + /// Gets the gas used in the last call from the callee perspective. function lastCallGas() external view returns (Gas memory gas); @@ -2189,6 +2195,12 @@ interface Vm is VmSafe { /// Expects an error on next call that exactly matches the revert data. function expectRevert(bytes4 revertData) external; + /// Expects a `count` number of reverts from the upcoming calls from the reverter address that match the revert data. + function expectRevert(bytes4 revertData, address reverter, uint64 count) external; + + /// Expects a `count` number of reverts from the upcoming calls from the reverter address that exactly match the revert data. + function expectRevert(bytes calldata revertData, address reverter, uint64 count) external; + /// Expects an error on next call that exactly matches the revert data. function expectRevert(bytes calldata revertData) external; @@ -2201,24 +2213,18 @@ interface Vm is VmSafe { /// Expects an error from reverter address on next call, that exactly matches the revert data. function expectRevert(bytes calldata revertData, address reverter) external; - /// Expects `count` number of reverts from the upcoming calls with any revert data or reverter. + /// Expects a `count` number of reverts from the upcoming calls with any revert data or reverter. function expectRevert(uint64 count) external; - /// Expects `count` number of reverts from the upcoming calls that match the revert data. + /// Expects a `count` number of reverts from the upcoming calls that match the revert data. function expectRevert(bytes4 revertData, uint64 count) external; - /// Expects `count` number of reverts from the upcoming calls that exactly match the revert data. + /// Expects a `count` number of reverts from the upcoming calls that exactly match the revert data. function expectRevert(bytes calldata revertData, uint64 count) external; - /// Expects `count` number of reverts from the upcoming calls from the reverter address. + /// Expects a `count` number of reverts from the upcoming calls from the reverter address. function expectRevert(address reverter, uint64 count) external; - /// Expects `count` number of reverts from the upcoming calls from the reverter address that match the revert data. - function expectRevert(bytes4 revertData, address reverter, uint64 count) external; - - /// Expects `count` number of reverts from the upcoming calls from the reverter address that exactly match the revert data. - function expectRevert(bytes calldata revertData, address reverter, uint64 count) external; - /// Only allows memory writes to offsets [0x00, 0x60) ∪ [min, max) in the current subcontext. If any other /// memory is written to, the test will fail. Can be called multiple times to add more ranges to the set. function expectSafeMemory(uint64 min, uint64 max) external; diff --git a/lib/forge-std/test/Vm.t.sol b/lib/forge-std/test/Vm.t.sol index 56d5fbe..e25e25b 100644 --- a/lib/forge-std/test/Vm.t.sol +++ b/lib/forge-std/test/Vm.t.sol @@ -13,6 +13,6 @@ contract VmTest is Test { } function test_VmSafeInterfaceId() public pure { - assertEq(type(VmSafe).interfaceId, bytes4(0x92fe99ad), "VmSafe"); + assertEq(type(VmSafe).interfaceId, bytes4(0xe76e7868), "VmSafe"); } }