difftreelog
CORE-345 Remove deprecated methods
in: master
6 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -989,9 +989,9 @@
[[package]]
name = "camino"
-version = "1.0.8"
+version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "07fd178c5af4d59e83498ef15cf3f154e1a6f9d091270cb86283c65ef44e9ef0"
+checksum = "869119e97797867fd90f5e22af7d0bd274bd4635ebb9eb68c04f3f513ae6c412"
dependencies = [
"serde",
]
@@ -6090,29 +6090,6 @@
"pallet-evm-coder-substrate",
"pallet-nonfungible",
"parity-scale-codec 3.1.2",
- "scale-info",
- "serde_json",
- "sp-core",
- "sp-runtime",
- "sp-std",
- "up-data-structs",
-]
-
-[[package]]
-name = "pallet-evm-collection"
-version = "0.1.0"
-dependencies = [
- "ethereum",
- "evm-coder",
- "fp-evm-mapping",
- "frame-support",
- "frame-system",
- "log",
- "pallet-common",
- "pallet-evm",
- "pallet-evm-coder-substrate",
- "pallet-nonfungible",
- "parity-scale-codec",
"scale-info",
"serde-json-core",
"sp-core",
pallets/evm-collection/src/eth.rsdiffbeforeafterboth27use sp_core::H160;27use sp_core::H160;28use up_data_structs::{28use up_data_structs::{29 CreateCollectionData, MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_TOKEN_PREFIX_LENGTH,29 CreateCollectionData, MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_TOKEN_PREFIX_LENGTH,30 MAX_COLLECTION_NAME_LENGTH, OFFCHAIN_SCHEMA_LIMIT, VARIABLE_ON_CHAIN_SCHEMA_LIMIT,30 MAX_COLLECTION_NAME_LENGTH,31 CONST_ON_CHAIN_SCHEMA_LIMIT,32};31};33use crate::{Config, Pallet};32use crate::{Config, Pallet};34use frame_support::traits::Get;33use frame_support::traits::Get;48}47}494850#[derive(ToLog)]49#[derive(ToLog)]51pub enum CollectionEvent {50pub enum EthCollectionEvent {52 CollectionCreated {51 CollectionCreated {53 #[indexed]52 #[indexed]54 owner: address,53 owner: address,959496 let address = pallet_common::eth::collection_id_to_address(collection_id);95 let address = pallet_common::eth::collection_id_to_address(collection_id);97 <PalletEvm<T>>::deposit_log(96 <PalletEvm<T>>::deposit_log(98 CollectionEvent::CollectionCreated {97 EthCollectionEvent::CollectionCreated {99 owner: *caller.as_eth(),98 owner: *caller.as_eth(),100 collection_id: address,99 collection_id: address,101 }100 }130 Ok(())129 Ok(())131 }130 }132133 fn set_offchain_schema(134 &self,135 caller: caller,136 collection_address: address,137 schema: string,138 ) -> Result<void> {139 let mut collection = collection_from_address(collection_address, &self.0)?;140 check_is_owner(caller, &collection)?;141142 let schema = schema143 .into_bytes()144 .try_into()145 .map_err(|_| error_feild_too_long(stringify!(shema), OFFCHAIN_SCHEMA_LIMIT))?;146 // collection.offchain_schema = schema;147 collection.save().map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;148 Ok(())149 }150151 fn set_variable_on_chain_schema(152 &self,153 caller: caller,154 collection_address: address,155 variable: string,156 ) -> Result<void> {157 let mut collection = collection_from_address(collection_address, &self.0)?;158 check_is_owner(caller, &collection)?;159160 let variable = variable.into_bytes().try_into().map_err(|_| {161 error_feild_too_long(stringify!(variable), VARIABLE_ON_CHAIN_SCHEMA_LIMIT)162 })?;163 // collection.variable_on_chain_schema = variable;164 collection.save().map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;165 Ok(())166 }167168 fn set_const_on_chain_schema(169 &self,170 caller: caller,171 collection_address: address,172 const_on_chain: string,173 ) -> Result<void> {174 let mut collection = collection_from_address(collection_address, &self.0)?;175 check_is_owner(caller, &collection)?;176177 let const_on_chain = const_on_chain.into_bytes().try_into().map_err(|_| {178 error_feild_too_long(stringify!(const_on_chain), CONST_ON_CHAIN_SCHEMA_LIMIT)179 })?;180 // collection.const_on_chain_schema = const_on_chain;181 collection.save().map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;182 Ok(())183 }184131185 fn set_limits(132 fn set_limits(186 &self,133 &self,primitives/data-structs/Cargo.tomldiffbeforeafterboth--- a/primitives/data-structs/Cargo.toml
+++ b/primitives/data-structs/Cargo.toml
@@ -40,6 +40,6 @@
"sp-std/std",
"pallet-evm/std",
]
-serde1 = ["serde"]
+serde1 = ["serde/alloc"]
limit-testing = []
runtime-benchmarks = []
\ No newline at end of file
primitives/rpc/src/lib.rsdiffbeforeafterboth--- a/primitives/rpc/src/lib.rs
+++ b/primitives/rpc/src/lib.rs
@@ -72,7 +72,6 @@
token: TokenId,
) -> Result<u128>;
- fn eth_contract_code(account: H160) -> Option<Vec<u8>>;
fn adminlist(collection: CollectionId) -> Result<Vec<CrossAccountId>>;
fn allowlist(collection: CollectionId) -> Result<Vec<CrossAccountId>>;
fn allowed(collection: CollectionId, user: CrossAccountId) -> Result<bool>;
runtime/opal/src/lib.rsdiffbeforeafterboth--- a/runtime/opal/src/lib.rs
+++ b/runtime/opal/src/lib.rs
@@ -50,6 +50,7 @@
pub use pallet_balances::Call as BalancesCall;
pub use pallet_evm::{
EnsureAddressTruncated, HashedAddressMapping, Runner, account::CrossAccountId as _, OnMethodCall,
+ Account as EVMAccount, FeeCalculator, GasWeightMapping,
};
pub use frame_support::{
construct_runtime, match_types,
@@ -79,7 +80,6 @@
};
use smallvec::smallvec;
use codec::{Encode, Decode};
-use pallet_evm::{Account as EVMAccount, FeeCalculator, GasWeightMapping, OnMethodCall};
use fp_rpc::TransactionStatus;
use sp_runtime::{
traits::{BlockNumberProvider, Dispatchable, PostDispatchInfoOf, Saturating},
tests/src/eth/createCollection.test.tsdiffbeforeafterboth--- a/tests/src/eth/createCollection.test.ts
+++ b/tests/src/eth/createCollection.test.ts
@@ -78,39 +78,6 @@
expect(collection.sponsorship.isConfirmed).to.be.true;
expect(collection.sponsorship.asConfirmed.toHuman()).to.be.eq(evmToAddress(sponsor));
});
-
- itWeb3('Set offchain schema', async ({api, web3}) => {
- const owner = await createEthAccountWithBalance(api, web3);
- const helper = collectionHelper(web3, owner);
- let result = await helper.methods.create721Collection('Schema collection', '2', '2').send();
- const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
- const schema = 'Some schema';
- result = await helper.methods.setOffchainSchema(collectionIdAddress, schema).send();
- const collection = (await getDetailedCollectionInfo(api, collectionId))!;
- expect(collection.offchainSchema.toHuman()).to.be.eq(schema);
- });
-
- itWeb3('Set variable on chain schema', async ({api, web3}) => {
- const owner = await createEthAccountWithBalance(api, web3);
- const helper = collectionHelper(web3, owner);
- let result = await helper.methods.create721Collection('Variable collection', '3', '3').send();
- const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
- const variable = 'Some variable';
- result = await helper.methods.setVariableOnChainSchema(collectionIdAddress, variable).send();
- const collection = (await getDetailedCollectionInfo(api, collectionId))!;
- expect(collection.variableOnChainSchema.toHuman()).to.be.eq(variable);
- });
-
- itWeb3('Set const on chain schema', async ({api, web3}) => {
- const owner = await createEthAccountWithBalance(api, web3);
- const helper = collectionHelper(web3, owner);
- let result = await helper.methods.create721Collection('Const collection', '4', '4').send();
- const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
- const constSchema = 'Some const';
- result = await helper.methods.setConstOnChainSchema(collectionIdAddress, constSchema).send();
- const collection = (await getDetailedCollectionInfo(api, collectionId))!;
- expect(collection.constOnChainSchema.toHuman()).to.be.eq(constSchema);
- });
itWeb3('Set limits', async ({api, web3}) => {
const owner = await createEthAccountWithBalance(api, web3);
@@ -245,27 +212,9 @@
const sponsorHelper = collectionHelper(web3, sponsor);
await expect(sponsorHelper.methods
.confirmSponsorship(collectionAddressWithBadPrefix)
- .call()).to.be.rejectedWith(EXPECTED_ERROR);
- }
- {
- const schema = 'Some schema';
- await expect(helper.methods
- .setOffchainSchema(collectionAddressWithBadPrefix, schema)
- .call()).to.be.rejectedWith(EXPECTED_ERROR);
- }
- {
- const variable = 'Some variable';
- await expect(helper.methods
- .setVariableOnChainSchema(collectionAddressWithBadPrefix, variable)
.call()).to.be.rejectedWith(EXPECTED_ERROR);
}
{
- const constData = 'Some const';
- await expect(helper.methods
- .setConstOnChainSchema(collectionAddressWithBadPrefix, constData)
- .call()).to.be.rejectedWith(EXPECTED_ERROR);
- }
- {
const limits = '{"account_token_ownership_limit":1000}';
await expect(helper.methods
.setLimits(collectionAddressWithBadPrefix, limits)
@@ -293,65 +242,11 @@
.call()).to.be.rejectedWith('Caller is not set as sponsor');
}
{
- const schema = 'Some schema';
- await expect(helperFromNotOwner.methods
- .setOffchainSchema(collectionIdAddress, schema)
- .call()).to.be.rejectedWith(EXPECTED_ERROR);
- }
- {
- const variable = 'Some variable';
- await expect(helperFromNotOwner.methods
- .setVariableOnChainSchema(collectionIdAddress, variable)
- .call()).to.be.rejectedWith(EXPECTED_ERROR);
- }
- {
- const constData = 'Some const';
- await expect(helperFromNotOwner.methods
- .setConstOnChainSchema(collectionIdAddress, constData)
- .call()).to.be.rejectedWith(EXPECTED_ERROR);
- }
- {
const limits = '{"account_token_ownership_limit":1000}';
await expect(helperFromNotOwner.methods
.setLimits(collectionIdAddress, limits)
.call()).to.be.rejectedWith(EXPECTED_ERROR);
}
- });
-
- itWeb3('(!negative test!) Set offchain schema (length limit)', async ({api, web3}) => {
- const owner = await createEthAccountWithBalance(api, web3);
- const helper = collectionHelper(web3, owner);
- const result = await helper.methods.create721Collection('Schema collection', 'A', 'A').send();
- const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
- const OFFCHAIN_SCHEMA_LIMIT = 8192;
- const schema = 'A'.repeat(OFFCHAIN_SCHEMA_LIMIT + 1);
- await expect(helper.methods
- .setOffchainSchema(collectionIdAddress, schema)
- .call()).to.be.rejectedWith('schema is too long. Max length is ' + OFFCHAIN_SCHEMA_LIMIT);
- });
-
- itWeb3('(!negative test!) Set variable on chain schema (length limit)', async ({api, web3}) => {
- const owner = await createEthAccountWithBalance(api, web3);
- const helper = collectionHelper(web3, owner);
- const result = await helper.methods.create721Collection('Schema collection', 'A', 'A').send();
- const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
- const VARIABLE_ON_CHAIN_SCHEMA_LIMIT = 8192;
- const variable = 'A'.repeat(VARIABLE_ON_CHAIN_SCHEMA_LIMIT + 1);
- await expect(helper.methods
- .setVariableOnChainSchema(collectionIdAddress, variable)
- .call()).to.be.rejectedWith('variable is too long. Max length is ' + VARIABLE_ON_CHAIN_SCHEMA_LIMIT);
- });
-
- itWeb3('(!negative test!) Set const on chain schema (length limit)', async ({api, web3}) => {
- const owner = await createEthAccountWithBalance(api, web3);
- const helper = collectionHelper(web3, owner);
- const result = await helper.methods.create721Collection('Schema collection', 'A', 'A').send();
- const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
- const CONST_ON_CHAIN_SCHEMA_LIMIT = 32768;
- const constData = 'A'.repeat(CONST_ON_CHAIN_SCHEMA_LIMIT + 1);
- await expect(helper.methods
- .setConstOnChainSchema(collectionIdAddress, constData)
- .call()).to.be.rejectedWith('const_on_chain is too long. Max length is ' + CONST_ON_CHAIN_SCHEMA_LIMIT);
});
itWeb3('(!negative test!) Set limits', async ({api, web3}) => {