Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix compiling errors
  • Loading branch information
jasl committed May 11, 2023
commit 64ab83e90310bf4beb68f16a9f2edf25cc30f965
699 changes: 430 additions & 269 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions crates/pink/capi/src/v1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ pub mod ecall {
pub gas_price: Balance,
pub deposit_per_item: Balance,
pub deposit_per_byte: Balance,
pub default_deposit_limit: Balance,
pub treasury_account: AccountId,
pub system_code: Vec<u8>,
}
Expand Down
4 changes: 2 additions & 2 deletions crates/pink/pink-extension-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ edition = "2021"
[dependencies]
pink-extension = { version = "0.4.2", path = "../pink-extension" }
reqwest-env-proxy = { version = "0.1", path = "../../reqwest-env-proxy" }
sp-core = { version = "7" }
sp-runtime-interface = { version = "7", features = ["disable_target_static_assertions"] }
sp-core = { version = "20", features = ["full_crypto"] }
sp-runtime-interface = { version = "16", features = ["disable_target_static_assertions"] }
reqwest = { version = "0.11", default-features = false, features = ["rustls-tls", "socks", "blocking"] }
log = "0.4"
ring = "0.16"
Expand Down
6 changes: 4 additions & 2 deletions crates/pink/runtime/src/capi/ecall_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,15 @@ impl ecall::ECalls for ECallImpl {
gas_price,
deposit_per_item,
deposit_per_byte,
default_deposit_limit,
treasury_account,
system_code,
} = config;
PalletPink::set_cluster_id(cluster_id);
PalletPink::set_gas_price(gas_price);
PalletPink::set_deposit_per_item(deposit_per_item);
PalletPink::set_deposit_per_byte(deposit_per_byte);
PalletPink::set_default_deposit_limit(default_deposit_limit);
PalletPink::set_treasury_account(&treasury_account);

self.deposit(owner.clone(), deposit);
Expand Down Expand Up @@ -145,9 +147,9 @@ impl ecall::ECalls for ECallImpl {
code,
None,
if deterministic {
Determinism::Deterministic
Determinism::Enforced
} else {
Determinism::AllowIndeterminism
Determinism::Relaxed
},
)
.map(|v| v.code_hash)
Expand Down
4 changes: 2 additions & 2 deletions crates/pink/runtime/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ pub fn bare_call(
} = tx_args;
let gas_limit = Weight::from_parts(gas_limit, 0).set_proof_size(u64::MAX);
let determinism = if mode.deterministic_required() {
Determinism::Deterministic
Determinism::Enforced
} else {
Determinism::AllowIndeterminism
Determinism::Relaxed
};
let result = contract_tx(origin.clone(), gas_limit, gas_free, move || {
Contracts::bare_call(
Expand Down
13 changes: 7 additions & 6 deletions crates/pink/runtime/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ impl pallet_balances::Config for PinkRuntime {
type MaxLocks = MaxLocks;
type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8];
type HoldIdentifier = ();
type FreezeIdentifier = ();
type MaxHolds = ();
type MaxFreezes = ();
}

impl frame_system::Config for PinkRuntime {
Expand Down Expand Up @@ -113,8 +117,7 @@ const MAX_CODE_LEN: u32 = 2 * 1024 * 1024;
parameter_types! {
pub DepositPerStorageByte: Balance = Pink::deposit_per_byte();
pub DepositPerStorageItem: Balance = Pink::deposit_per_item();
pub const DeletionQueueDepth: u32 = 1024;
pub const DeletionWeightLimit: Weight = Weight::from_parts(500_000_000_000, 0);
pub DefaultDepositLimit: Balance = Pink::default_deposit_limit();
pub const MaxCodeLen: u32 = MAX_CODE_LEN;
pub const MaxStorageKeyLen: u32 = 128;
pub const MaxDebugBufferLen: u32 = 128 * 1024;
Expand All @@ -141,11 +144,10 @@ impl Config for PinkRuntime {
type WeightPrice = Pink;
type WeightInfo = weights::PinkWeights<Self>;
type ChainExtension = extension::PinkExtension;
type DeletionQueueDepth = DeletionQueueDepth;
type DeletionWeightLimit = DeletionWeightLimit;
type Schedule = DefaultSchedule;
type DepositPerByte = DepositPerStorageByte;
type DepositPerItem = DepositPerStorageItem;
type DefaultDepositLimit = DefaultDepositLimit;
type AddressGenerator = Pink;
type MaxCodeLen = MaxCodeLen;
type MaxStorageKeyLen = MaxStorageKeyLen;
Expand All @@ -158,8 +160,7 @@ fn detect_parameter_changes() {
insta::assert_debug_snapshot!((
<PinkRuntime as frame_system::Config>::BlockWeights::get(),
<PinkRuntime as Config>::Schedule::get(),
<PinkRuntime as Config>::DeletionQueueDepth::get(),
<PinkRuntime as Config>::DeletionWeightLimit::get(),
<PinkRuntime as Config>::DefaultDepositLimit::get(),
<PinkRuntime as Config>::MaxCodeLen::get(),
<PinkRuntime as Config>::MaxStorageKeyLen::get(),
));
Expand Down
2 changes: 1 addition & 1 deletion crates/pink/runtime/src/runtime/extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ impl PinkExtBackend for CallInQuery {
payer.convert_to(),
system_code,
None,
pallet_contracts::Determinism::Deterministic,
pallet_contracts::Determinism::Enforced,
)?;
};
Ok(Some(code_hash))
Expand Down
8 changes: 8 additions & 0 deletions crates/pink/runtime/src/runtime/pallet_pink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ pub mod pallet {
#[pallet::getter(fn deposit_per_item)]
pub(crate) type DepositPerItem<T: Config> = StorageValue<_, BalanceOf<T>, ValueQuery>;

#[pallet::storage]
#[pallet::getter(fn default_deposit_limit)]
pub(crate) type DefaultDepositLimit<T: Config> = StorageValue<_, BalanceOf<T>, ValueQuery>;

#[pallet::storage]
pub(crate) type TreasuryAccount<T: Config> = StorageValue<_, T::AccountId>;

Expand Down Expand Up @@ -164,6 +168,10 @@ pub mod pallet {
<DepositPerByte<T>>::put(value);
}

pub fn set_default_deposit_limit(value: BalanceOf<T>) {
<DefaultDepositLimit<T>>::put(value);
}

pub fn set_treasury_account(account: &T::AccountId) {
<TreasuryAccount<T>>::put(account);
}
Expand Down
Loading