shape:chain
WORKFLOW CONTRACT STAGE CONTEXT: the stage produces implemented and tested contracts, ABI documentation and an independently reviewed launch.json. Each assignment contributes only within its own role and write scope. Source-producing assignments own implementation, tests and ABI exports at docs/abi/<Contract>.json where their scope permits. The generated manifest assignment writes only launch.json. Review assignments inspect accepted source and manifest and return findings without editing files; they do not implement contracts or generate ABI files. Use the supplied canonical manifest guidance: policy and signed artifact linkage belong to services, while concrete source, constructor, policy or authorization conflicts remain review findings. Services publish source, attest, admit and deploy after this stage, then start the frontend. Read .imd/reads/workflow.md for the complete approved requirements and apply them to your assigned contribution; later service outcomes are not prerequisites of this assignment.
ece0e3001b53fbfb58be3546422f3eaf6811c089VERDICT: all checks passed
VERDICT: all checks passed
I found no blocking defects in the contracts or the manifest. The two findings are a test-coverage gap and a non-blocking note, and they're written to `.imd-findings.json`. I ran `forge test`: all 9 tests pass. I checked these areas: - **Checks-effects-interactions:** state is set before the token calls in both `createPledge` and `withdraw`. - **Settlement accounting:** `returned + forfeited` always equals `stake`, and `stake % weeksCount == 0` means slices carry no rounding remainder. - **Timing:** `checkIn` reverts at `endTime`, and `withdraw` is allowed from `endTime`. - **Bitmap:** `MAX_WEEKS` of 52 fits in the 256-bit check-in bitmap. - **Roles and calls:** there is no owner or admin role, and no external calls other than the token. - **Token:** `Pledge` mints 10^27 to the deployer in its zero-argument constructor and has no mint function. `foundry.toml` sets `bytecode_hash = "none"`. - **Manifest:** `launch.json` uses only schema fields. Its one constructor argument is `$token`, and there is no `$owner`. **Findings, ranked:** 1. **Low — reentrancy is tested only through `createPledge`.** Removing `nonReentrant` from `withdraw` in `src/HabitPledge.sol` leaves all 9 tests passing. No test uses a token whose `transfer` calls back into `withdraw`, and none covers `checkIn`. The brief asks for reentrancy tests through a malicious token. 2. **Info — limits the brief doesn't state.** `MAX_WEEKS = 52` and the requirement that `stake` be divisible by `weeksCount` aren't in the brief. For example, `createPledge(goal, 53, b, 53e18)` reverts with `InvalidWeeks`. The `beneficiary != msg.sender` check is bypassed with a second address. Neither is exploitable.
Created [launch.json](/home/worker/.imd/seat2/work/7f4a53ba-5fd4-4ea3-b05a-d08e260aac70/4c9a5e78-2ac0-40c6-890b-960a2e26f54f/launch.json) with: - `Pledge` token metadata - `HabitPledge` with the `$token` constructor argument - Canonical native-ETH Sepolia pool settings - No unsupported supply, allocation, owner, or initialization fields Verification passed: - `forge build` - `forge test` — 9 passed, 0 failed - Only `launch.json` is changed/untracked.
I found no contract defect that puts funds at risk. The problems are in the tests, plus one low-severity input-validation gap. The findings are in `.imd-findings.json`, five in all, ranked by severity. **Findings** 1. **Medium, no event assertions.** The brief requires events for every state change, but no test checks any event. Deleting every `emit` line from `HabitPledge.sol` still leaves 9 of 9 tests passing. 2. **Medium, reentrancy tested on `createPledge` only.** The malicious token re-enters from `transferFrom`, and its `transfer()` never calls back. Removing `nonReentrant` from `withdraw` or `checkIn` still passes. 3. **Medium, validation branches untested.** Every mutation I tried survived the suite: - allowing a zero stake; - raising the week cap to 255; - allowing a zero-address beneficiary; - dropping the token-code check; - dropping the unknown-pledge check; - PLDG allowances that never decrease; - PLDG transfers to `address(0)` that burn tokens. 4. **Low, beneficiary can lock funds.** `createPledge` accepts the `HabitPledge` contract or the token contract as beneficiary. On `withdraw` the forfeited slice goes there and can never be moved. I reproduced this in a scratch test. Only the pledger's own stake is affected. 5. **Info, interface constraints.** The 52-week cap and settlement only at or after the end time are stricter than the brief. Both are documented, but the website must enforce them. **What I checked and found correct** - Window arithmetic is consistent at the boundaries, and the 52-bit check-in bitmap fits. - Conservation of funds holds with exact slices, and `settled` is set before the transfers. - The reentrancy guard and the false-return and revert handling on token transfers are correct. - The token mints the fixed 10^27 supply with 18 decimals and no admin path. - `docs/abi/*.json` matches the compiled ABI once `internalType` fields are ignored. - Neither the creation code nor the runtime code contains `DELEGATECALL`, `CALLCODE` or `SELFDESTRUCT`. - The constructor takes only the token address, which matches the `$token` manifest requirement. There is no `launch.json` yet, so I did not review one. **Scope** - All builds and mutation runs used `/tmp` output and scratch copies, so the repo has no other changes. - I did not edit any source, test, config or docs file. - The only file I wrote is `.imd-findings.json`, the deliverable you asked for. - Foundry downloaded solc 0.8.26 on first run.
Implemented the complete Foundry contract deliverable: - Fixed-supply [Pledge.sol](/Users/peterhucik/.identitymd/work/7f4a53ba-5fd4-4ea3-b05a-d08e260aac70/0ee1f9ec-e6ab-4c26-9e1a-79d025e9ee0f/src/Pledge.sol) - Custodial weekly-check-in [HabitPledge.sol](/Users/peterhucik/.identitymd/work/7f4a53ba-5fd4-4ea3-b05a-d08e260aac70/0ee1f9ec-e6ab-4c26-9e1a-79d025e9ee0f/src/HabitPledge.sol) - Nine success, failure, boundary, conservation, transfer-failure, and reentrancy tests - Canonical ABI exports under `docs/abi/` - Deployment assumptions and operational responsibilities in [contracts.html](/Users/peterhucik/.identitymd/work/7f4a53ba-5fd4-4ea3-b05a-d08e260aac70/0ee1f9ec-e6ab-4c26-9e1a-79d025e9ee0f/docs/contracts.html) - Vendored minimal `forge-std` compatibility for offline protected checks - Foundry configured with Solidity 0.8.26 and `bytecode_hash = "none"` Validation passed: - `forge build` - `forge test`: 9 passed, 0 failed - `forge fmt --check` - Protected test sources compile offline - ABI JSON validation and `git diff --check` No `launch.json` was created because it belongs to the separate manifest assignment.
Proof Of IMD pays $POI to the current owner of the seat whose submission passed verification. The owner is the ERC-721 holder reported by GET /seats/:tokenId.
No result files for this job.