Skip to content

Commit

Permalink
Merge 313ee9a into d7264d1
Browse files Browse the repository at this point in the history
  • Loading branch information
talekhinezh committed May 10, 2024
2 parents d7264d1 + 313ee9a commit 00d71f3
Show file tree
Hide file tree
Showing 108 changed files with 905 additions and 991 deletions.
2 changes: 1 addition & 1 deletion radix-engine-interface/src/api/actor_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ bitflags! {
}

/// Api which exposes methods in the context of the actor
pub trait ClientActorApi<E: Debug> {
pub trait SystemActorApi<E: Debug> {
/// Retrieve the current blueprint id
fn actor_get_blueprint_id(&mut self) -> Result<BlueprintId, E>;

Expand Down
2 changes: 1 addition & 1 deletion radix-engine-interface/src/api/actor_index_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use sbor::rust::prelude::*;
use sbor::rust::vec::Vec;

/// Api to manage an iterable index
pub trait ClientActorIndexApi<E> {
pub trait SystemActorIndexApi<E> {
/// Inserts an entry into an index
fn actor_index_insert(
&mut self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use radix_engine_interface::api::{ActorStateHandle, CollectionIndex, LockFlags};
use sbor::rust::fmt::Debug;
use sbor::rust::vec::Vec;

pub trait ClientActorKeyValueEntryApi<E: Debug> {
pub trait SystemActorKeyValueEntryApi<E: Debug> {
/// If the key value entry doesn't exist, it uses the default "Option::None"
fn actor_open_key_value_entry(
&mut self,
Expand Down
2 changes: 1 addition & 1 deletion radix-engine-interface/src/api/actor_sorted_index_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use sbor::rust::vec::Vec;
pub trait SortedIndexKeyPayloadMarker {}
pub trait SortedIndexEntryPayloadMarker {}

pub trait ClientActorSortedIndexApi<E> {
pub trait SystemActorSortedIndexApi<E> {
/// Inserts an entry into a sorted index
fn actor_sorted_index_insert(
&mut self,
Expand Down
2 changes: 1 addition & 1 deletion radix-engine-interface/src/api/blueprint_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use radix_common::types::*;
use sbor::rust::prelude::*;
use sbor::rust::vec::Vec;

pub trait ClientBlueprintApi<E> {
pub trait SystemBlueprintApi<E> {
/// Calls a function on a blueprint
fn call_function(
&mut self,
Expand Down
2 changes: 1 addition & 1 deletion radix-engine-interface/src/api/costing_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::blueprints::resource::LiquidFungibleResource;
use crate::types::*;
use radix_common::math::Decimal;

pub trait ClientCostingApi<E> {
pub trait SystemCostingApi<E> {
/// Check if costing is enabled.
fn start_lock_fee(&mut self, amount: Decimal) -> Result<bool, E>;

Expand Down
30 changes: 0 additions & 30 deletions radix-engine-interface/src/api/crypto_utils_api.rs

This file was deleted.

2 changes: 1 addition & 1 deletion radix-engine-interface/src/api/execution_trace_api.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pub trait ClientExecutionTraceApi<E> {
pub trait SystemExecutionTraceApi<E> {
fn update_instruction_index(&mut self, new_index: usize) -> Result<(), E>;
}
2 changes: 1 addition & 1 deletion radix-engine-interface/src/api/field_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub trait FieldPayloadMarker {}
impl<T: FieldPayloadMarker> FieldPayloadMarker for &T {}

/// A high level api to read/write fields
pub trait ClientFieldApi<E: Debug> {
pub trait SystemFieldApi<E: Debug> {
fn field_read(&mut self, handle: FieldHandle) -> Result<Vec<u8>, E>;

fn field_read_typed<S: ScryptoDecode>(&mut self, handle: FieldHandle) -> Result<S, E> {
Expand Down
2 changes: 1 addition & 1 deletion radix-engine-interface/src/api/key_value_entry_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub type KeyValueEntryHandle = u32;
pub trait KeyValueKeyPayloadMarker {}
pub trait KeyValueEntryPayloadMarker {}

pub trait ClientKeyValueEntryApi<E> {
pub trait SystemKeyValueEntryApi<E> {
fn key_value_entry_get(&mut self, handle: KeyValueEntryHandle) -> Result<Vec<u8>, E>;

fn key_value_entry_get_typed<S: ScryptoDecode>(
Expand Down
2 changes: 1 addition & 1 deletion radix-engine-interface/src/api/key_value_store_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ impl KeyValueStoreDataSchema {
}
}

pub trait ClientKeyValueStoreApi<E> {
pub trait SystemKeyValueStoreApi<E> {
/// Creates a new key value store with a given schema
fn key_value_store_new(&mut self, data_schema: KeyValueStoreDataSchema) -> Result<NodeId, E>;

Expand Down
29 changes: 13 additions & 16 deletions radix-engine-interface/src/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pub mod actor_key_value_entry_api;
pub mod actor_sorted_index_api;
pub mod blueprint_api;
pub mod costing_api;
pub mod crypto_utils_api;
pub mod execution_trace_api;
pub mod field_api;
pub mod key_value_entry_api;
Expand All @@ -19,7 +18,6 @@ pub use actor_key_value_entry_api::*;
pub use actor_sorted_index_api::*;
pub use blueprint_api::*;
pub use costing_api::*;
pub use crypto_utils_api::*;
pub use execution_trace_api::*;
pub use field_api::*;
pub use key_value_entry_api::*;
Expand All @@ -45,19 +43,18 @@ pub type CollectionIndex = u8;
/// Interface of the system, for blueprints and Node modules.
///
/// For WASM blueprints, only a subset of the API is exposed at the moment.
pub trait ClientApi<E: sbor::rust::fmt::Debug>:
ClientActorApi<E>
+ ClientActorKeyValueEntryApi<E>
+ ClientObjectApi<E>
+ ClientKeyValueStoreApi<E>
+ ClientKeyValueEntryApi<E>
+ ClientActorSortedIndexApi<E>
+ ClientActorIndexApi<E>
+ ClientFieldApi<E>
+ ClientBlueprintApi<E>
+ ClientCostingApi<E>
+ ClientTransactionRuntimeApi<E>
+ ClientExecutionTraceApi<E>
+ ClientCryptoUtilsApi<E>
pub trait SystemApi<E: sbor::rust::fmt::Debug>:
SystemActorApi<E>
+ SystemActorKeyValueEntryApi<E>
+ SystemObjectApi<E>
+ SystemKeyValueStoreApi<E>
+ SystemKeyValueEntryApi<E>
+ SystemActorSortedIndexApi<E>
+ SystemActorIndexApi<E>
+ SystemFieldApi<E>
+ SystemBlueprintApi<E>
+ SystemCostingApi<E>
+ SystemTransactionRuntimeApi<E>
+ SystemExecutionTraceApi<E>
{
}
2 changes: 1 addition & 1 deletion radix-engine-interface/src/api/object_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ pub struct KVEntry {
}

/// A high level interface to manipulate objects in the actor's call frame
pub trait ClientObjectApi<E> {
pub trait SystemObjectApi<E> {
/// Creates a new simple blueprint object of a given blueprint type
fn new_simple_object(
&mut self,
Expand Down
2 changes: 1 addition & 1 deletion radix-engine-interface/src/api/transaction_runtime_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::types::Level;
use radix_common::crypto::Hash;
use radix_common::types::GlobalAddress;

pub trait ClientTransactionRuntimeApi<E> {
pub trait SystemTransactionRuntimeApi<E> {
fn bech32_encode_address(&mut self, address: GlobalAddress) -> Result<String, E>;

fn get_transaction_hash(&mut self) -> Result<Hash, E>;
Expand Down
16 changes: 16 additions & 0 deletions radix-engine-interface/src/types/costing_reason.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,20 @@ pub enum ClientCostingEntry<'a> {
PrepareWasmCode {
size: usize,
},
Bls12381V1Verify {
size: usize,
},
Bls12381V1AggregateVerify {
sizes: &'a [usize],
},
Bls12381V1FastAggregateVerify {
size: usize,
keys_cnt: usize,
},
Bls12381G2SignatureAggregate {
signatures_cnt: usize,
},
Keccak256Hash {
size: usize,
},
}
4 changes: 2 additions & 2 deletions radix-engine-monkey-tests/src/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use radix_engine::errors::RuntimeError;
use radix_engine::kernel::kernel_api::{KernelNodeApi, KernelSubstateApi};
use radix_engine::system::system_callback::SystemLockData;
use radix_engine::vm::{VmApi, VmInvoke};
use radix_engine_interface::api::{AttachedModuleId, ClientApi, LockFlags, ACTOR_STATE_SELF};
use radix_engine_interface::api::{AttachedModuleId, LockFlags, SystemApi, ACTOR_STATE_SELF};
use radix_engine_interface::prelude::*;
use radix_engine_interface::prelude::{
Bucket, FieldValue, FungibleResourceManagerMintInput,
Expand Down Expand Up @@ -41,7 +41,7 @@ impl VmInvoke for ResourceTestInvoke {
_vm_api: &V,
) -> Result<IndexedScryptoValue, RuntimeError>
where
Y: ClientApi<RuntimeError> + KernelNodeApi + KernelSubstateApi<SystemLockData>,
Y: SystemApi<RuntimeError> + KernelNodeApi + KernelSubstateApi<SystemLockData>,
V: VmApi,
{
match export_name {
Expand Down
Loading

0 comments on commit 00d71f3

Please sign in to comment.