-
From Rasikh via Telegram: The deprecation of state_get_item breaks all of our stuff as the js sdk breaks with it. There's no backwards compatibility or easy way to migrate to query_global_state This breaks paradiso indexing, our offchain infra and all fm offchain infra |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
TL;DR; We'll put it back in for RC3 With regards to state_get_item, this method has been deprecated for quite some time now. To be precise, 16 months ago. However, in looking through the release notes, it appears that this change did not make it into any formal communication. Therefore we will be reinstating the function to the API surface, in the Condor RC3 release. That said, the function will still be marked as deprecated, and will be marked as obsolete in some future release, and eventually deleted. With that in mind, we are providing a short guide to effectively migrating from the deprecated function to the new one. In terms of the branch to use for migration, the branch for the second release candidate for 2.0 (i.e. the current one) is called release-2.0.0-rc2. https://github.com/casper-network/casper-node/tree/release-2.0.0-rc2 Future release candidates, including the aforementioned RC3, will follow the same naming convention. Migration of existing code: pub struct GetItemParams {
/// Hash of the state root.
pub state_root_hash: Digest,
/// casper_types::Key as formatted string.
pub key: String,
/// The path components starting from the key as base.
#[serde(default)]
pub path: Vec<String>,
} Here is the QueryGlobalStateParams struct, input to the query_global_state method: pub struct QueryGlobalStateParams {
/// The identifier used for the query. If none is passed
/// the tip of the chain will be used.
pub state_identifier: Option<GlobalStateIdentifier>,
/// casper_types::Key as formatted string.
pub key: String,
/// The path components starting from the key as base.
#[serde(default)]
pub path: Vec<String>,
} Here is the GlobalStateIdentifier enumeration pub enum GlobalStateIdentifier {
/// Query using a block hash.
BlockHash(BlockHash),
/// Query using a block height.
BlockHeight(u64),
/// Query using the state root hash.
StateRootHash(Digest),
} The main difference between the old GetItemParams and the new QueryGlobalStateParams is that there are now multiple ways to specify the global state identifier. This adds flexibility without removing any of the old functionality. To call the query_global_state method, using the state_root_hash, pass the root hash as follows state_identifier = Some(GlobalStateIdentifier::StateRootHash(<the hash>))
//Instead of:
state_root_hash = <the hash> N.B. |
Beta Was this translation helpful? Give feedback.
TL;DR; We'll put it back in for RC3
With regards to state_get_item, this method has been deprecated for quite some time now. To be precise, 16 months ago.
https://github.com/casper-network/casper-node/blob/bad6b5b35274ad1a66654f159ed56a3e6ff6c87e/resources/test/rpc_schema_hashing.json
However, in looking through the release notes, it appears that this change did not make it into any formal communication. Therefore we will be reinstating the function to the API surface, in the Condor RC3 release.
That said, the function will still be marked as deprecated, and will be marked as obsolete in some future release, and eventually deleted. With that in mind, we are providing a short guide to effe…