Sudid
Event v101 → current #0Emitted when a sudo call completes, reporting success or failure.
View events on chainThe Big Picture
Sudid is the audit trail for administrative actions. Every sudo call - whether it succeeds or fails - emits this event. It's crucial for transparency and governance, showing when and how administrative powers are used. Monitoring Sudid events is essential for anyone wanting to track network governance activity.
Why This Matters
In a trustless system, transparency is key. Sudid events record every use of admin power, letting anyone verify that administrators act responsibly. If you're evaluating a network's governance, reviewing Sudid history tells you a lot.
Example Scenario
The sudo key executes a runtime upgrade via sudo(call=set_code(new_wasm)). Sudid fires with sudo_result=Ok(()), confirming the upgrade succeeded. Observers can see this event and verify the admin action occurred.
Common Questions
- What does sudo_result contain?
- It's a Result type - Ok(()) for success, Err(error) for failure. Check the error variant to understand why an inner call failed.
- Does Sudid fire for failed calls?
- Yes - Sudid always fires after a sudo call, reporting the result. A failed inner call means sudo_result contains an error, but the event still records the attempt.
Use Cases
- Track administrative actions on the network
- Audit sudo usage for governance transparency
- Monitor for unauthorized sudo activity
- Build admin action dashboards
How to Use This Event
- → Subscribe to all Sudid events to track admin activity
- → Alert on Sudid events for governance monitoring
- → Index for historical admin action analysis
From Chain Metadata
A sudo just took place. \[result\]
Triggers
Emitted by
Preconditions
- Caller is the current sudo key
- A sudo or sudo_unchecked_weight call was executed
Effects
Postconditions
- Inner call result is recorded
- Any state changes from successful inner call are persisted
Side Effects
- If inner call succeeded, its effects are now on-chain
- If inner call failed, state is rolled back but Sudid still fires
Event Data
| # | Name | Type | Description |
|---|---|---|---|
| 0 | sudo_result | Result | Result of the inner call execution (Ok or Err with error details) |
Code Examples
import { ApiPromise, WsProvider } from "@polkadot/api";
import { stringCamelCase } from "@polkadot/util";
const provider = new WsProvider("wss://entrypoint-finney.opentensor.ai:443");
const api = await ApiPromise.create({ provider });
// Subscribe to Sudid events
api.query.system.events((events) => {
events
.filter(({ event }) =>
event.section === stringCamelCase("Sudo") &&
event.method === "Sudid"
)
.forEach(({ event }) => {
console.log("Sudid:", event.data.toHuman());
});
});Runtime Info
- Pallet Index
- 12
- Event Index
- 0
- First Version
- v101
- Current Version
- v393