Skip to content
Open
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
5 changes: 1 addition & 4 deletions contracts/admin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -631,10 +631,7 @@ mod tests {
super::execute_role_proposal(&env, executor, proposal_id)
}

pub fn get_role_proposal(
env: Env,
proposal_id: u64,
) -> Option<RoleGrantProposalDetails> {
pub fn get_role_proposal(env: Env, proposal_id: u64) -> Option<RoleGrantProposalDetails> {
super::get_role_proposal(&env, proposal_id)
}

Expand Down
8 changes: 4 additions & 4 deletions contracts/admin/src/multisig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,9 +456,10 @@ pub fn create_role_proposal(
soroban_sdk::panic_with_error!(env, AdminError::RoleAlreadyGranted);
}
let id = create_proposal(env, creator, description);
env.storage()
.instance()
.set(&AdminKey::RoleGrantProposal(id), &RoleGrantAction { role, target });
env.storage().instance().set(
&AdminKey::RoleGrantProposal(id),
&RoleGrantAction { role, target },
);
extend_instance_ttl(env);
id
}
Expand Down Expand Up @@ -603,7 +604,6 @@ pub fn execute_role_proposal(
proposal_id: u64,
) -> Result<(), AdminError> {
let _reentrancy_guard = reentrancy_guard::enter(env);
executor.require_auth();
if !get_admin_pool(env).contains(&executor) {
return Err(AdminError::UnauthorizedRole);
}
Expand Down
4 changes: 3 additions & 1 deletion contracts/admin/src/tests/issue_914_918.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ fn test_role_proposal_requires_quorum_and_executes_the_bound_grant() {
);
assert_eq!(
client.try_mark_executed(&proposal_id),
Err(Ok(AdminError::RoleProposalRequiresExecution)),
Err(Ok(soroban_sdk::Error::from_contract_error(
AdminError::RoleProposalRequiresExecution as u32,
))),
);

client.approve_proposal(&second_admin, &proposal_id);
Expand Down
14 changes: 14 additions & 0 deletions docs/ACCESS_CONTROL.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ storage slot, domain-separated by Soroban's storage API.
| `Threshold` | `instance()` | `u32` | Approvals required for proposal |
| `Proposal(u64)` | `instance()` | `Proposal` | Governance proposal data |
| `ProposalIdCounter` | `instance()` | `u64` | Auto-incrementing proposal ID |
| `UpgradeProposal(u64)` | `instance()` | `UpgradeProposal` | Multi-sig WASM upgrade proposal |
| `UpgradeProposalIdCounter` | `instance()` | `u64` | Auto-incrementing upgrade proposal ID |
| `SuperAdmin(Address)` | `persistent()` | `bool` | Populated by `migrate_admin` |

`instance()` state lives on the contract instance ledger entry (shared TTL).
Expand Down Expand Up @@ -152,6 +154,8 @@ The table below lists every RBAC-guarded entrypoint across the workspace.
| `create_proposal` | Admin-pool member | pool membership + `require_auth` |
| `approve_proposal` | Admin-pool member | pool membership + `require_auth` |
| `mark_executed` | Admin | `admin.require_auth` (threshold check) |
| `submit_upgrade_proposal` | Admin-pool member | membership check (`Address::require_auth`) |
| `get_upgrade_proposal` | Public read | none |

### Lifecycle module (`contracts/lifecycle`)

Expand Down Expand Up @@ -309,6 +313,16 @@ if (isZeroAddress(someAddress)) {
}
```

## WASM upgrade proposals

`submit_upgrade_proposal` starts the multi-sig gated WASM upgrade flow. A
proposal records the submitting pool member, the target 32-byte WASM hash, and a
non-empty description; the creator is recorded as the first approval and the
proposal receives a unique auto-incrementing ID from its own counter (so generic
and upgrade proposal IDs never collide). Submissions by non-pool members, the
zero address, the all-zero WASM hash, or with an empty description are rejected
with typed errors.

## Source of truth

- Role definitions and guards:
Expand Down
Loading
Loading