Skip to content

Commit ca44b3b

Browse files
committed
ci(account-contract): assert deployed==registered; harden workflow
Address codex review of the new account-contract CI: - deploy script now throws (non-zero exit) if the deployed address does not match the AccountManager-registered address, instead of just logging it — so the smoke test actually fails CI when the invariant breaks. - workflow fails fast if the local network never becomes ready. - use `yarn install --frozen-lockfile` (verified in sync) to catch lock drift.
1 parent c3d4f5d commit ca44b3b

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

.github/workflows/account-contract-tests.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,17 @@ jobs:
5757
for i in {1..30}; do
5858
if curl -s http://localhost:8080/status >/dev/null 2>&1; then
5959
echo "Local network is ready!"
60-
break
60+
exit 0
6161
fi
6262
echo "Waiting... ($i/30)"
6363
sleep 5
6464
done
65+
echo "Local network failed to become ready in time" >&2
66+
exit 1
6567
6668
- name: Install project dependencies
6769
working-directory: account-contract
68-
run: yarn install
70+
run: yarn install --frozen-lockfile
6971

7072
- name: Compile account contract and generate artifact
7173
working-directory: account-contract

account-contract/ts/deploy-account-contract.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ const { contract: deployedAccountContract } = await deployMethod.send({
5454

5555
console.log('PasswordAccount deployed at: ', deployedAccountContract.address.toString());
5656
console.log('Account registered at: ', accountManager.address.toString());
57-
console.log(
58-
'Deployed == registered: ',
59-
deployedAccountContract.address.equals(accountManager.address),
60-
);
57+
// The deployed contract IS the registered account (same secret key + salt), so the two must
58+
// match. Assert it (don't just log) so this doubles as a smoke test that fails loudly in CI.
59+
if (!deployedAccountContract.address.equals(accountManager.address)) {
60+
throw new Error(
61+
`Address mismatch: deployed ${deployedAccountContract.address.toString()} != registered ${accountManager.address.toString()}`,
62+
);
63+
}
64+
console.log('Deployed == registered: true');

0 commit comments

Comments
 (0)