Repository: paritytech/substrate
File: client/rpc-api/src/state/mod.rs (Rust)

Code before:
	#[pubsub(
		subscription = "state_runtimeVersion",
		unsubscribe,
		name = "state_unsubscribeRuntimeVersion",
		alias("chain_unsubscribeRuntimeVersion")
	)]
	fn unsubscribe_runtime_version(
		&self,
		metadata: Option<Self::Metadata>,
		id: SubscriptionId,
	) -> RpcResult<bool>;

	/// Subscribe to the changes in the storage.
	///
	/// This RPC endpoint has two modes of operation:
	///   1) When `keys` is not `None` you'll only be informed about the changes
	///      done to the specified keys; this is RPC-safe.
	///   2) When `keys` is `None` you'll be informed of *all* of the changes;
	///      **this is RPC-unsafe**.
	///
	/// When subscribed to all of the changes this API will emit every storage
	/// change for every block that is imported and will **not** send any fixup
	/// notifications when those changes end up being *not* finalized or if
	/// any of the previously unseen changes from before you've subscribed will
	/// get finalized. It is your responsibility to make sure your view of the
	/// storage is consistent, if you need that guarantee.
	#[pubsub(subscription = "state_storage", subscribe, name = "state_subscribeStorage")]
	fn subscribe_storage(
		&self,
		metadata: Self::Metadata,
		subscriber: Subscriber<StorageChangeSet<Hash>>,
		keys: Option<Vec<StorageKey>>,
	);

	/// Unsubscribe from storage subscription
	#[pubsub(subscription = "state_storage", unsubscribe, name = "state_unsubscribeStorage")]
	fn unsubscribe_storage(
		&self,
		metadata: Option<Self::Metadata>,
		id: SubscriptionId,
	) -> RpcResult<bool>;

	/// The `state_traceBlock` RPC provides a way to trace the re-execution of a single
	/// block, collecting Spans and Events from both the client and the relevant WASM runtime.
	/// The Spans and Events are conceptually equivalent to those from the [Tracing][1] crate.
	///
	/// The structure of the traces follows that of the block execution pipeline, so meaningful
	/// interpretation of the traces requires an understanding of the Substrate chain's block
	/// execution.
	///
	/// [Link to conceptual map of trace structure for Polkadot and Kusama block execution.][2]

Review comment (suggestion):
```suggestion
	/// change for every block that is imported. These changes will only be send
	/// after a block is imported. If you require a consistent view across all changes
	/// of every block, you need to take this into account.
```

Code after:
	#[pubsub(
		subscription = "state_runtimeVersion",
		unsubscribe,
		name = "state_unsubscribeRuntimeVersion",
		alias("chain_unsubscribeRuntimeVersion")
	)]
	fn unsubscribe_runtime_version(
		&self,
		metadata: Option<Self::Metadata>,
		id: SubscriptionId,
	) -> RpcResult<bool>;

	/// Subscribe to the changes in the storage.
	///
	/// This RPC endpoint has two modes of operation:
	///   1) When `keys` is not `None` you'll only be informed about the changes
	///      done to the specified keys; this is RPC-safe.
	///   2) When `keys` is `None` you'll be informed of *all* of the changes;
	///      **this is RPC-unsafe**.
	///
	/// When subscribed to all of the changes this API will emit every storage
	/// change for every block that is imported. These changes will only be sent
	/// after a block is imported. If you require a consistent view across all changes
	/// of every block, you need to take this into account.
	#[pubsub(subscription = "state_storage", subscribe, name = "state_subscribeStorage")]
	fn subscribe_storage(
		&self,
		metadata: Self::Metadata,
		subscriber: Subscriber<StorageChangeSet<Hash>>,
		keys: Option<Vec<StorageKey>>,
	);

	/// Unsubscribe from storage subscription
	#[pubsub(subscription = "state_storage", unsubscribe, name = "state_unsubscribeStorage")]
	fn unsubscribe_storage(
		&self,
		metadata: Option<Self::Metadata>,
		id: SubscriptionId,
	) -> RpcResult<bool>;

	/// The `state_traceBlock` RPC provides a way to trace the re-execution of a single
	/// block, collecting Spans and Events from both the client and the relevant WASM runtime.
	/// The Spans and Events are conceptually equivalent to those from the [Tracing][1] crate.
	///
	/// The structure of the traces follows that of the block execution pipeline, so meaningful
	/// interpretation of the traces requires an understanding of the Substrate chain's block
	/// execution.
	///
	/// [Link to conceptual map of trace structure for Polkadot and Kusama block execution.][2]
	///
	/// [1]: https://crates.io/crates/tracing