set_oldest_stored_round
Call v301 → current #2Sets the oldest round number that the chain will retain in storage .
View calls on chainCall Workflow
Click items to navigate. Pan and zoom to explore.
The Big Picture
Storing every Drand pulse forever would consume unbounded storage. This call sets a floor - pulses below this round may be pruned or considered unavailable. It's a storage management tool that balances historical data availability against chain state size.
Why This Matters
If your application needs historical randomness, you need to know the availability window. This call defines that window. Pulses older than OldestStoredRound may not be queryable.
Example Scenario
Chain has been running for a year with millions of stored pulses. Governance decides to keep only the last month's worth. They calculate the oldest round for 30 days ago and call set_oldest_stored_round(that_round). Applications querying older rounds get defaults.
Common Questions
- Does this immediately delete old pulses?
- The semantic is 'oldest retained' - actual deletion may be lazy or triggered separately. The storage item marks intent; cleanup may follow.
- How do I know what rounds are available?
- Query OldestStoredRound and LastStoredRound to get the available range. Rounds outside this range return empty/default values.
Use Cases
- Manage storage costs by limiting historical pulse retention
- Set data retention policy for randomness history
- Coordinate with pruning or archival strategies
From Chain Metadata
allows the root user to set the oldest stored round
Input Parameters
| # | Name | Type | Description |
|---|---|---|---|
| 0 | oldest_round | u64 | oldest_round (u64) |
Permissions
Permission data inferred from metadata. May be incomplete.
Requirements
- Caller has root/sudo privileges
- New oldest round is valid (not greater than LastStoredRound)
Effects
Events Emitted
Storage Modified
Postconditions
- OldestStoredRound storage updated
- SetOldestStoredRound event emitted
Side Effects
- Pulses below this round may be pruned or become inaccessible
- Reduces storage requirements for historical randomness
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 });
// Build set_oldest_stored_round call
const oldest_round = 0;
const call = api.tx[stringCamelCase("Drand")][stringCamelCase("set_oldest_stored_round")](
oldest_round
);Runtime Info
View Source- Pallet Index
- 26
- Call Index
- 2
- First Version
- v301
- Current Version
- v393