@@ -53,7 +53,11 @@ node "$ROOT_DIR/services/cli/dist/cli/src/index.js" create "$LOCAL_TARGET_DIR" \
5353 --sdk " file:$RFQ_TARBALL " \
5454 --toolkit " file:$TOOLKIT_TARBALL " \
5555 --cli " file:$CLI_TARBALL " > /dev/null
56- ./node_modules/.bin/corner-store create " $SANDBOX_DIR " --template sandbox > /dev/null
56+ ./node_modules/.bin/corner-store create " $SANDBOX_DIR " \
57+ --template sandbox \
58+ --sdk " file:$RFQ_TARBALL " \
59+ --toolkit " file:$TOOLKIT_TARBALL " \
60+ --cli " file:$CLI_TARBALL " > /dev/null
5761)
5862
5963test -f " $SANDBOX_DIR /sandbox/contracts/script/DeployStack.s.sol"
@@ -64,15 +68,89 @@ if command -v docker >/dev/null 2>&1 && docker compose version >/dev/null 2>&1;
6468 (cd " $SANDBOX_DIR " && docker compose config > /dev/null)
6569fi
6670
71+ (
72+ cd " $SANDBOX_DIR "
73+ npm install --prefer-offline --silent
74+ npm test
75+ npm run validate > /dev/null
76+ npm run simulate > /dev/null
77+ if npm run --silent doctor > " $WORK_DIR /sandbox-doctor.json" ; then
78+ : # A host with Compose v2 and a running daemon is sandbox-ready.
79+ else
80+ : # Missing Docker is an expected, actionable external-user state.
81+ fi
82+ )
83+ node -e '
84+ const result = require(process.argv[1]);
85+ const docker = result.checks.find((check) => check.name === "docker");
86+ const daemon = result.checks.find((check) => check.name === "docker-daemon");
87+ const unexpected = result.checks.filter((check) => check.required && !check.pass && !["docker", "docker-daemon"].includes(check.name));
88+ if (!docker || docker.required !== true || !docker.remediation) process.exit(1);
89+ if (!daemon || daemon.required !== true || !daemon.remediation) process.exit(1);
90+ if (unexpected.length > 0) process.exit(1);
91+ ' " $WORK_DIR /sandbox-doctor.json"
92+
6793(
6894 cd " $TARGET_DIR "
6995 npm install --prefer-offline --silent
7096 npm test
97+ npm run validate > /dev/null
98+ npm run simulate > /dev/null
7199 npm run policy:explain > /dev/null
72100 npm run doctor
73101 npm run deploy
102+
103+ mkdir -p deployments
104+ node - << 'NODE '
105+ const fs = require("fs");
106+ fs.writeFileSync("deployments/anvil-e2e.json", JSON.stringify({
107+ assetProfile: "reg-d",
108+ rwaToken: "0x1111111111111111111111111111111111111111",
109+ router: "0x2222222222222222222222222222222222222222",
110+ rfqAdapter: "0x3333333333333333333333333333333333333333",
111+ makerAuthorizer: "0x4444444444444444444444444444444444444444",
112+ rfqVenue: "0x5555555555555555555555555555555555555555"
113+ }, null, 2));
114+ NODE
115+ if npm run --silent verify > " $WORK_DIR /stale-artifact.log" 2>&1 ; then
116+ echo " stale artifact unexpectedly passed verification" >&2
117+ exit 1
118+ fi
119+ grep -q ' "remediation"' " $WORK_DIR /stale-artifact.log"
120+ grep -q ' same asset profile' " $WORK_DIR /stale-artifact.log"
121+
122+ node - << 'NODE '
123+ const fs = require("fs");
124+ const path = "deployments/anvil-e2e.json";
125+ const artifact = JSON.parse(fs.readFileSync(path, "utf8"));
126+ artifact.assetProfile = "buidl-like";
127+ fs.writeFileSync(path, `${JSON.stringify(artifact, null, 2)}\n`);
128+ NODE
129+ npm run --silent verify > " $WORK_DIR /recovered-artifact.log"
130+ grep -q ' "ready": true' " $WORK_DIR /recovered-artifact.log"
131+
132+ npm run --silent policy:explain > " $WORK_DIR /policy-before.json"
133+ node - << 'NODE '
134+ const fs = require("fs");
135+ const path = "corner-store.config.json";
136+ const config = JSON.parse(fs.readFileSync(path, "utf8"));
137+ config.venues.rfq = false;
138+ config.venues.orderBook = true;
139+ fs.writeFileSync(path, `${JSON.stringify(config, null, 2)}\n`);
140+ NODE
141+ npm run --silent policy:explain > " $WORK_DIR /policy-after.json"
74142)
75143
144+ node - << 'NODE ' "$WORK_DIR/policy-before.json" "$WORK_DIR/policy-after.json"
145+ const fs = require("fs");
146+ const before = JSON.parse(fs.readFileSync(process.argv[2], "utf8"));
147+ const after = JSON.parse(fs.readFileSync(process.argv[3], "utf8"));
148+ if (before.compiled.configHash === after.compiled.configHash) process.exit(1);
149+ if (before.explanation.decisions.rfq.allowed !== true) process.exit(1);
150+ if (after.explanation.decisions.rfq.allowed !== false) process.exit(1);
151+ if (after.explanation.decisions.rfq.reasonCode !== "VENUE_DISABLED") process.exit(1);
152+ NODE
153+
76154CLI_PACKAGE=" $BOOT_DIR /node_modules/@corner-store/cli"
77155if ! forge build --offline --root " $CLI_PACKAGE /bundle/contracts" > " $WORK_DIR /forge-build.log" 2>&1 ; then
78156 cat " $WORK_DIR /forge-build.log"
0 commit comments