SetOldestStoredRound

Event v301 → current #2

Emitted when the oldest stored round boundary has been updated.

View events on chain
Useful for: validatorsdevelopers

The Big Picture

The chain can't store infinite history - there must be limits on how far back pulse data is retained. This event fires when the oldest-kept round is updated, typically as part of storage management. Applications consuming randomness should be aware of this boundary.

Why This Matters

If you're building applications that reference historical randomness, you need to know how far back data is available. This event tells you when the boundary moves, so you can adjust your application's expectations accordingly.

Example Scenario

Storage management determines pulses older than round 12000000 can be pruned. Root calls set_oldest_stored_round(12000000). SetOldestStoredRound fires with the new boundary. Applications can no longer query pulses before round 12000000.

Common Questions

What happens to applications using old pulses?
They'll receive empty/default values for pruned rounds. Design applications to handle unavailability gracefully, or archive data off-chain if you need long-term history.
How is the oldest round determined?
Typically by chain governance or automatic pruning logic balancing storage costs against historical data needs. Most applications only need recent randomness.

Use Cases

  • Track storage management for randomness pulses
  • Monitor when historical randomness becomes unavailable
  • Plan applications around randomness availability windows

How to Use This Event

  • Monitor for changes to historical data availability
  • Plan data retention around oldest stored round

From Chain Metadata

Oldest Stored Round has been set.

Part of: Distributed Randomness

Triggers

Preconditions

  • Caller has root/sudo privileges
  • New oldest round is valid

Effects

Storage Modified

Postconditions

  • OldestStoredRound storage updated
  • Pulses older than this round may be pruned or unavailable

Side Effects

  • Old pulse data may become inaccessible if pruned
  • Reduces storage usage by limiting historical pulse retention

Event Data

#NameTypeDescription
0
arg0
→ oldest_round
u64 New oldest stored round number boundary

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 SetOldestStoredRound events
api.query.system.events((events) => {
  events
    .filter(({ event }) =>
      event.section === stringCamelCase("Drand") &&
      event.method === "SetOldestStoredRound"
    )
    .forEach(({ event }) => {
      console.log("SetOldestStoredRound:", event.data.toHuman());
    });
});

Runtime Info

View Source
Pallet Index
26
Event Index
2
First Version
v301
Current Version
v393