DidUpdate

Storage Plain v101 → current

Whether the timestamp has been updated in the current block .

Explore chain
Queried by: developers

The Big Picture

This is internal infrastructure ensuring timestamp integrity. Every block must have exactly one timestamp set. The Timestamp.set call sets this to true; block finalization checks it's true and panics if not. You rarely need to query this directly.

Why This Matters

Mostly you don't need this. It's internal bookkeeping. If you're debugging why blocks are failing to finalize, checking this can reveal if the timestamp inherent is missing.

Example Scenario

Query DidUpdate() during a block returns true if Timestamp.set was already called in this block, false otherwise. At block finalization, it must be true or the block fails.

Common Questions

When is this reset?
At the start of each new block via on_finalize taking the value, which resets it to default (false).
What if it's false at finalization?
The block fails to finalize. This indicates a critical bug - the block author didn't include the timestamp inherent.

Use Cases

  • Debug block production issues
  • Verify timestamp inherent was included
  • Build block validation tools

From Chain Metadata

Did the timestamp get updated in this block?

Purpose & Usage

Purpose

Internal flag ensuring timestamp is set exactly once per block during finalization.

Common Query Patterns

  • Checked during block finalization
  • Query to verify timestamp was set in current block

Notes

  • This is primarily for internal runtime consistency
  • Value is reset to false at start of each block
  • Block finalization panics if this is false

Stored Value

Whether timestamp was set in current block

Relationships

Modified By

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 });

// Query DidUpdate storage (no keys - plain value)
const result = await api.query
  [stringCamelCase("Timestamp")]
  [stringCamelCase("DidUpdate")]();
console.log("DidUpdate:", result.toHuman());

On-Chain Activity

Write Source Runtime Hook

Modified by runtime hooks (e.g., epoch transitions), not directly by user extrinsics

As of block 7,429,232

Runtime Info

Pallet
Timestamp
Storage Kind
Plain
First Version
v101
Current Version
v393