sdk: renamed SlotCheckpoint to Slot

This commit is contained in:
aggstam
2023-06-24 18:18:08 +03:00
parent 2e8b956073
commit ec97e969c8
25 changed files with 465 additions and 520 deletions

View File

@@ -170,22 +170,22 @@ pub(crate) fn get_verifying_slot_epoch(ctx: FunctionEnvMut<Env>) -> u64 {
ctx.data().time_keeper.verifying_slot_epoch()
}
/// Will return requested slot checkpoint from `SlotCheckpointStore`.
pub(crate) fn get_slot_checkpoint(ctx: FunctionEnvMut<Env>, slot: u64) -> i64 {
/// Will return requested slot from `SlotStore`.
pub(crate) fn get_slot(ctx: FunctionEnvMut<Env>, slot: u64) -> i64 {
let env = ctx.data();
if env.contract_section != ContractSection::Deploy &&
env.contract_section != ContractSection::Exec &&
env.contract_section != ContractSection::Metadata
{
error!(target: "runtime::db::db_get_slot_checkpoint()", "db_get_slot_checkpoint called in unauthorized section");
error!(target: "runtime::db::db_get_slot()", "db_get_slot called in unauthorized section");
return CALLER_ACCESS_DENIED.into()
}
let ret = match env.blockchain.lock().unwrap().slot_checkpoints.get(slot) {
let ret = match env.blockchain.lock().unwrap().slots.get(slot) {
Ok(v) => v,
Err(e) => {
error!(target: "runtime::db::db_get_slot_checkpoint()", "Internal error getting from slot checkpoints tree: {}", e);
error!(target: "runtime::db::db_get_slot()", "Internal error getting from slots tree: {}", e);
return DB_GET_FAILED.into()
}
};

View File

@@ -275,10 +275,10 @@ impl Runtime {
import::util::get_verifying_slot_epoch,
),
"get_slot_checkpoint_" => Function::new_typed_with_env(
"get_slot_" => Function::new_typed_with_env(
&mut store,
&ctx,
import::util::get_slot_checkpoint,
import::util::get_slot,
),
"get_blockchain_time_" => Function::new_typed_with_env(