mirror of
https://github.com/serai-dex/serai.git
synced 2024-11-16 17:07:35 +00:00
Update substrate
Also removes the patch for zip since a new release was issued. Closes https://github.com/serai-dex/serai/issues/81. Contracts RPC purged as according to https://github.com/paritytech/substrate/pull/12358.
This commit is contained in:
parent
ec7d8ac67b
commit
6c996fb3cd
6 changed files with 696 additions and 795 deletions
1407
Cargo.lock
generated
1407
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -43,6 +43,3 @@ monero-serai = { opt-level = 3 }
|
|||
|
||||
[profile.release]
|
||||
panic = "unwind"
|
||||
|
||||
[patch.crates-io]
|
||||
zip = { version = "0.6.2", git = "https://github.com/zip-rs/zip", rev = "bb230ef56adc13436d1fcdfaa489249d119c498f" }
|
||||
|
|
|
@ -12,7 +12,7 @@ publish = false
|
|||
name = "serai-node"
|
||||
|
||||
[dependencies]
|
||||
clap = { version = "3.1.18", features = ["derive"] }
|
||||
clap = { version = "4", features = ["derive"] }
|
||||
|
||||
sc-cli = { git = "https://github.com/serai-dex/substrate", features = ["wasmtime"] }
|
||||
sp-core = { git = "https://github.com/serai-dex/substrate" }
|
||||
|
@ -32,7 +32,7 @@ frame-system = { git = "https://github.com/serai-dex/substrate" }
|
|||
pallet-transaction-payment = { git = "https://github.com/serai-dex/substrate", default-features = false }
|
||||
|
||||
# These dependencies are used for the node template's RPCs
|
||||
jsonrpsee = { version = "0.15.1", features = ["server"] }
|
||||
jsonrpsee = { version = "0.15", features = ["server"] }
|
||||
sc-rpc = { git = "https://github.com/serai-dex/substrate" }
|
||||
sp-api = { git = "https://github.com/serai-dex/substrate" }
|
||||
sc-rpc-api = { git = "https://github.com/serai-dex/substrate" }
|
||||
|
@ -40,7 +40,6 @@ sp-blockchain = { git = "https://github.com/serai-dex/substrate" }
|
|||
sp-block-builder = { git = "https://github.com/serai-dex/substrate" }
|
||||
substrate-frame-rpc-system = { git = "https://github.com/serai-dex/substrate" }
|
||||
pallet-transaction-payment-rpc = { git = "https://github.com/serai-dex/substrate" }
|
||||
pallet-contracts-rpc = { git = "https://github.com/serai-dex/substrate", package = "pallet-contracts-rpc" }
|
||||
|
||||
# These dependencies are used for runtime benchmarking
|
||||
frame-benchmarking = { git = "https://github.com/serai-dex/substrate" }
|
||||
|
|
|
@ -9,7 +9,7 @@ use sp_api::ProvideRuntimeApi;
|
|||
|
||||
pub use sc_rpc_api::DenyUnsafe;
|
||||
|
||||
use serai_runtime::{BlockNumber, Hash, opaque::Block, AccountId, Balance, Index};
|
||||
use serai_runtime::{opaque::Block, AccountId, Balance, Index};
|
||||
|
||||
pub struct FullDeps<C, P> {
|
||||
pub client: Arc<C>,
|
||||
|
@ -31,19 +31,16 @@ pub fn create_full<
|
|||
where
|
||||
C::Api: substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>
|
||||
+ pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>
|
||||
+ pallet_contracts_rpc::ContractsRuntimeApi<Block, AccountId, Balance, BlockNumber, Hash>
|
||||
+ BlockBuilder<Block>,
|
||||
{
|
||||
use substrate_frame_rpc_system::{System, SystemApiServer};
|
||||
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer};
|
||||
use pallet_contracts_rpc::{Contracts, ContractsApiServer};
|
||||
|
||||
let mut module = RpcModule::new(());
|
||||
let FullDeps { client, pool, deny_unsafe } = deps;
|
||||
|
||||
module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?;
|
||||
module.merge(TransactionPayment::new(client.clone()).into_rpc())?;
|
||||
module.merge(Contracts::new(client).into_rpc())?;
|
||||
|
||||
Ok(module)
|
||||
}
|
||||
|
|
|
@ -14,8 +14,8 @@ rustdoc-args = ["--cfg", "docsrs"]
|
|||
[dependencies]
|
||||
hex-literal = { version = "0.3.4", optional = true }
|
||||
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
|
||||
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
|
||||
codec = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
|
||||
scale-info = { version = "2", default-features = false, features = ["derive"] }
|
||||
|
||||
sp-core = { git = "https://github.com/serai-dex/substrate", default-features = false }
|
||||
sp-std = { git = "https://github.com/serai-dex/substrate", default-features = false }
|
||||
|
@ -39,7 +39,6 @@ pallet-transaction-payment = { git = "https://github.com/serai-dex/substrate", d
|
|||
|
||||
pallet-contracts-primitives = { git = "https://github.com/serai-dex/substrate", default-features = false }
|
||||
pallet-contracts = { git = "https://github.com/serai-dex/substrate", default-features = false }
|
||||
pallet-contracts-rpc-runtime-api = { git = "https://github.com/serai-dex/substrate", default-features = false }
|
||||
|
||||
# Used for the node template's RPCs
|
||||
frame-system-rpc-runtime-api = { git = "https://github.com/serai-dex/substrate", default-features = false }
|
||||
|
@ -81,7 +80,6 @@ std = [
|
|||
|
||||
"pallet-contracts/std",
|
||||
"pallet-contracts-primitives/std",
|
||||
"pallet-contracts-rpc-runtime-api/std",
|
||||
]
|
||||
|
||||
runtime-benchmarks = [
|
||||
|
|
|
@ -30,7 +30,6 @@ pub use frame_system::Call as SystemCall;
|
|||
pub use pallet_timestamp::Call as TimestampCall;
|
||||
pub use pallet_balances::Call as BalancesCall;
|
||||
use pallet_transaction_payment::CurrencyAdapter;
|
||||
use pallet_contracts::DefaultContractAccessWeight;
|
||||
|
||||
/// An index to a block.
|
||||
pub type BlockNumber = u32;
|
||||
|
@ -99,10 +98,6 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);
|
|||
/// We allow for 2 seconds of compute with a 6 second average block time.
|
||||
const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_ref_time(2 * WEIGHT_PER_SECOND.ref_time());
|
||||
|
||||
// Prints debug output of the `contracts` pallet to stdout if the node is
|
||||
// started with `-lruntime::contracts=debug`.
|
||||
const CONTRACTS_DEBUG_OUTPUT: bool = true;
|
||||
|
||||
// Unit = the base number of indivisible units for balances
|
||||
const UNIT: Balance = 1_000_000_000_000;
|
||||
const MILLIUNIT: Balance = 1_000_000_000;
|
||||
|
@ -236,7 +231,6 @@ impl pallet_contracts::Config for Runtime {
|
|||
type DeletionWeightLimit = DeletionWeightLimit;
|
||||
type Schedule = Schedule;
|
||||
type AddressGenerator = pallet_contracts::DefaultAddressGenerator;
|
||||
type ContractAccessWeight = DefaultContractAccessWeight<BlockWeights>;
|
||||
|
||||
type MaxCodeLen = ConstU32<{ 128 * 1024 }>;
|
||||
type MaxStorageKeyLen = ConstU32<128>;
|
||||
|
@ -388,63 +382,4 @@ sp_api::impl_runtime_apis! {
|
|||
TransactionPayment::query_fee_details(uxt, len)
|
||||
}
|
||||
}
|
||||
|
||||
impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash>
|
||||
for Runtime
|
||||
{
|
||||
fn call(
|
||||
origin: AccountId,
|
||||
dest: AccountId,
|
||||
value: Balance,
|
||||
gas_limit: u64,
|
||||
storage_deposit_limit: Option<Balance>,
|
||||
input_data: Vec<u8>,
|
||||
) -> pallet_contracts_primitives::ContractExecResult<Balance> {
|
||||
Contracts::bare_call(
|
||||
origin,
|
||||
dest,
|
||||
value,
|
||||
Weight::from_ref_time(gas_limit),
|
||||
storage_deposit_limit,
|
||||
input_data,
|
||||
CONTRACTS_DEBUG_OUTPUT
|
||||
)
|
||||
}
|
||||
|
||||
fn instantiate(
|
||||
origin: AccountId,
|
||||
value: Balance,
|
||||
gas_limit: u64,
|
||||
storage_deposit_limit: Option<Balance>,
|
||||
code: pallet_contracts_primitives::Code<Hash>,
|
||||
data: Vec<u8>,
|
||||
salt: Vec<u8>,
|
||||
) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, Balance> {
|
||||
Contracts::bare_instantiate(
|
||||
origin,
|
||||
value,
|
||||
Weight::from_ref_time(gas_limit),
|
||||
storage_deposit_limit,
|
||||
code,
|
||||
data,
|
||||
salt,
|
||||
CONTRACTS_DEBUG_OUTPUT
|
||||
)
|
||||
}
|
||||
|
||||
fn upload_code(
|
||||
origin: AccountId,
|
||||
code: Vec<u8>,
|
||||
storage_deposit_limit: Option<Balance>,
|
||||
) -> pallet_contracts_primitives::CodeUploadResult<Hash, Balance> {
|
||||
Contracts::bare_upload_code(origin, code, storage_deposit_limit)
|
||||
}
|
||||
|
||||
fn get_storage(
|
||||
address: AccountId,
|
||||
key: Vec<u8>,
|
||||
) -> pallet_contracts_primitives::GetStorageResult {
|
||||
Contracts::get_storage(address, key)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue