Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions app/contract/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 9 additions & 26 deletions app/contract/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,38 +192,20 @@ stellar contract deploy \

## Events

### Reward Released
All events emitted by the `Folder` contract follow canonical schema definitions (`EVENT_SCHEMAS`) with stable event type IDs (`ETID_*`) and deterministic replay fields (`EVENT_REPLAY_FIELDS`: `event_type_id`, `ledger_sequence`, `schema_version`, `timestamp`).

```rust
(
"reward_released",
learner
)
```

### Certificate Minted

```rust
(
"certificate_minted",
learner
)
```

### Reputation Updated

```rust
(
"reputation_updated",
account
)
```
The contract enforces full runtime schema validation (`validate_event_schemas`) to guarantee:
- Uniqueness of event names and numeric event type IDs.
- Valid domain topic namespaces (`TOPIC_ADMIN`, `TOPIC_DISPUTE`, `TOPIC_ESCROW`, `TOPIC_PRIVACY`, `TOPIC_STEALTH`).
- Alphabetically sorted payload keys without duplicates.
- Presence of all required replay fields.
- Runtime cross-checking of all emitted events against `EVENT_SCHEMAS`.

---

## Metadata API

The `Folder` contract exposes a stable, read-only metadata surface for tooling, backends, and indexers (Issue #50). All calls are non-mutating and require no authorization.
The `Folder` contract exposes a stable, read-only metadata surface for tooling, backends, and indexers (Issue #50, Issue #312). All calls are non-mutating and require no authorization.

| Method | Purpose |
|--------|---------|
Expand All @@ -233,6 +215,7 @@ The `Folder` contract exposes a stable, read-only metadata surface for tooling,
| `get_upgrade_state()` | Upgrade window and in-progress state. |
| `get_supported_versions()` | Supported contract and event schema version ranges. |
| `check_schema_compatibility(contract_version, event_schema_version)` | Whether a caller-supplied version pair is compatible. |
| `validate_event_schemas()` | Validate all static `EVENT_SCHEMAS` definitions against canonical schema rules. |
| `get_pause_flags()` | Granular pause bitmask. |

Tooling should call `check_schema_compatibility` before sending writes to avoid version mismatches.
Expand Down
4 changes: 2 additions & 2 deletions app/contract/contracts/Folder/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub const BUILD_MANIFEST_SCHEMA_VERSION: u32 = {};

fn get_git_hash() -> String {
let output = Command::new("git")
.args(&["rev-parse", "HEAD"])
.args(["rev-parse", "HEAD"])
.output()
.unwrap_or_else(|_| {
panic!("Failed to get git hash");
Expand Down Expand Up @@ -84,7 +84,7 @@ fn hash_directory(hasher: &mut blake3::Hasher, path: &Path) -> std::io::Result<(
for entry in fs::read_dir(path)? {
let entry = entry?;
let path = entry.path();
if path.is_file() && path.extension().map_or(false, |ext| ext == "rs") {
if path.is_file() && path.extension().is_some_and(|ext| ext == "rs") {
let contents = fs::read(&path)?;
hasher.update(path.to_string_lossy().as_bytes());
hasher.update(&contents);
Expand Down
Loading
Loading