Skip to content

Commit 0e12f8f

Browse files
authored
Merge pull request #224 from SarahDoma/fix/issue-170-173-174-167-doc-and-ci-fixes
Fix stale audit row, add missing refund test, run cargo doc in CI, commit lockfile
2 parents 21e136d + b7cb572 commit 0e12f8f

5 files changed

Lines changed: 587 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ jobs:
2525
- run: cargo clippy --workspace --all-targets -- -D warnings
2626
- run: cargo test --workspace
2727

28+
- name: Check documentation (catches broken intra-doc links)
29+
env:
30+
RUSTDOCFLAGS: "-D warnings"
31+
run: cargo doc --workspace --no-deps --document-private-items
32+
2833
- name: Generate and print code coverage
2934
run: cargo llvm-cov --workspace
3035

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,3 @@ test_snapshots/
2424

2525
# deploy script dependencies (scripts/)
2626
node_modules/
27-
package-lock.json

contracts/escrow/src/test.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,29 @@ fn test_contribute_rejects_after_already_paid() {
834834
assert_eq!(err, Err(Ok(Error::AlreadyPaid)));
835835
}
836836

837+
#[test]
838+
fn test_contribute_rejects_after_already_refunded() {
839+
let env = Env::default();
840+
env.mock_all_auths();
841+
let (_, _admin, _treasury, client) = setup(&env);
842+
843+
let token_admin = Address::generate(&env);
844+
let (token_addr, asset_client, _token_client) = create_token(&env, &token_admin);
845+
let alice = Address::generate(&env);
846+
let bob = Address::generate(&env);
847+
asset_client.mint(&alice, &10_000i128);
848+
asset_client.mint(&bob, &10_000i128);
849+
850+
env.ledger().set_timestamp(100);
851+
client.fund(&106u64, &alice, &token_addr, &5_000i128, &200u64, &None);
852+
853+
env.ledger().set_timestamp(200 + crate::GRACE_PERIOD);
854+
client.refund(&106u64);
855+
856+
let err = client.try_contribute(&106u64, &bob, &1_000i128);
857+
assert_eq!(err, Err(Ok(Error::AlreadyRefunded)));
858+
}
859+
837860
#[test]
838861
fn test_contribute_rejects_beyond_max_sponsors() {
839862
let env = Env::default();

docs/access-control-audit.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ signature requirement on any particular address.
1717
| `initialize` | Deployer/authorized setup only (implicit — not written down anywhere) | none | `admin.require_auth()` | **Mismatch, fixed** — see "`initialize` has no access control" below |
1818
| `fund` | Sponsor-only | `sponsor.require_auth()` | unchanged | Match |
1919
| `release` | Admin-only | `require_admin(&env)?.require_auth()` | unchanged | Match |
20-
| `refund` (before `deadline`) | Admin-only | `require_admin(&env)?.require_auth()` | unchanged | Match |
21-
| `refund` (at/after `deadline`) | Permissionless (deliberate) | none | unchanged | Match — see [refund analysis](./refund-permissionless-analysis.md) |
20+
| `refund` (before `deadline + GRACE_PERIOD`) | Admin-only | `require_admin(&env)?.require_auth()` | unchanged | Match |
21+
| `refund` (at/after `deadline + GRACE_PERIOD`) | Permissionless (deliberate) | none | unchanged | Match — see [refund analysis](./refund-permissionless-analysis.md). The permissionless window opens at `deadline + GRACE_PERIOD`, not at `deadline` itself; the 14-day `GRACE_PERIOD` was introduced by [#49](https://github.com/MergeFi/contracts/issues/49) to close a race where a sponsor could call permissionless `refund()` right at `deadline` to claw back funds from a contributor whose `release()` had already landed. |
2222
| `extend_deadline` (new, this PR) | Sponsor-only, monotonic | n/a | `escrow.sponsor.require_auth()` + `new_deadline` must strictly increase | Match (new function) |
2323
| `get_escrow` | Permissionless (view) | none | unchanged | Match |
2424
| `get_admin` | Permissionless (view) | none | unchanged | Match |

0 commit comments

Comments
 (0)