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.rsdiffbeforeafterboth--- a/pallets/evm-collection/src/eth.rs
+++ b/pallets/evm-collection/src/eth.rs
@@ -27,8 +27,7 @@
use sp_core::H160;
use up_data_structs::{
CreateCollectionData, MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_TOKEN_PREFIX_LENGTH,
- MAX_COLLECTION_NAME_LENGTH, OFFCHAIN_SCHEMA_LIMIT, VARIABLE_ON_CHAIN_SCHEMA_LIMIT,
- CONST_ON_CHAIN_SCHEMA_LIMIT,
+ MAX_COLLECTION_NAME_LENGTH,
};
use crate::{Config, Pallet};
use frame_support::traits::Get;
@@ -48,7 +47,7 @@
}
#[derive(ToLog)]
-pub enum CollectionEvent {
+pub enum EthCollectionEvent {
CollectionCreated {
#[indexed]
owner: address,
@@ -95,7 +94,7 @@
let address = pallet_common::eth::collection_id_to_address(collection_id);
<PalletEvm<T>>::deposit_log(
- CollectionEvent::CollectionCreated {
+ EthCollectionEvent::CollectionCreated {
owner: *caller.as_eth(),
collection_id: address,
}
@@ -126,58 +125,6 @@
if !collection.confirm_sponsorship(caller.as_sub()) {
return Err(Error::Revert("Caller is not set as sponsor".into()));
}
- collection.save().map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;
- Ok(())
- }
-
- fn set_offchain_schema(
- &self,
- caller: caller,
- collection_address: address,
- schema: string,
- ) -> Result<void> {
- let mut collection = collection_from_address(collection_address, &self.0)?;
- check_is_owner(caller, &collection)?;
-
- let schema = schema
- .into_bytes()
- .try_into()
- .map_err(|_| error_feild_too_long(stringify!(shema), OFFCHAIN_SCHEMA_LIMIT))?;
- // collection.offchain_schema = schema;
- collection.save().map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;
- Ok(())
- }
-
- fn set_variable_on_chain_schema(
- &self,
- caller: caller,
- collection_address: address,
- variable: string,
- ) -> Result<void> {
- let mut collection = collection_from_address(collection_address, &self.0)?;
- check_is_owner(caller, &collection)?;
-
- let variable = variable.into_bytes().try_into().map_err(|_| {
- error_feild_too_long(stringify!(variable), VARIABLE_ON_CHAIN_SCHEMA_LIMIT)
- })?;
- // collection.variable_on_chain_schema = variable;
- collection.save().map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;
- Ok(())
- }
-
- fn set_const_on_chain_schema(
- &self,
- caller: caller,
- collection_address: address,
- const_on_chain: string,
- ) -> Result<void> {
- let mut collection = collection_from_address(collection_address, &self.0)?;
- check_is_owner(caller, &collection)?;
-
- let const_on_chain = const_on_chain.into_bytes().try_into().map_err(|_| {
- error_feild_too_long(stringify!(const_on_chain), CONST_ON_CHAIN_SCHEMA_LIMIT)
- })?;
- // collection.const_on_chain_schema = const_on_chain;
collection.save().map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;
Ok(())
}
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.tsdiffbeforeafterboth79 expect(collection.sponsorship.asConfirmed.toHuman()).to.be.eq(evmToAddress(sponsor));79 expect(collection.sponsorship.asConfirmed.toHuman()).to.be.eq(evmToAddress(sponsor));80 });80 });81 82 itWeb3('Set offchain schema', async ({api, web3}) => {83 const owner = await createEthAccountWithBalance(api, web3);84 const helper = collectionHelper(web3, owner);85 let result = await helper.methods.create721Collection('Schema collection', '2', '2').send();86 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);87 const schema = 'Some schema';88 result = await helper.methods.setOffchainSchema(collectionIdAddress, schema).send();89 const collection = (await getDetailedCollectionInfo(api, collectionId))!;90 expect(collection.offchainSchema.toHuman()).to.be.eq(schema);91 });92 93 itWeb3('Set variable on chain schema', async ({api, web3}) => {94 const owner = await createEthAccountWithBalance(api, web3);95 const helper = collectionHelper(web3, owner);96 let result = await helper.methods.create721Collection('Variable collection', '3', '3').send();97 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);98 const variable = 'Some variable';99 result = await helper.methods.setVariableOnChainSchema(collectionIdAddress, variable).send();100 const collection = (await getDetailedCollectionInfo(api, collectionId))!;101 expect(collection.variableOnChainSchema.toHuman()).to.be.eq(variable);102 });103 104 itWeb3('Set const on chain schema', async ({api, web3}) => {105 const owner = await createEthAccountWithBalance(api, web3);106 const helper = collectionHelper(web3, owner);107 let result = await helper.methods.create721Collection('Const collection', '4', '4').send();108 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);109 const constSchema = 'Some const';110 result = await helper.methods.setConstOnChainSchema(collectionIdAddress, constSchema).send();111 const collection = (await getDetailedCollectionInfo(api, collectionId))!;112 expect(collection.constOnChainSchema.toHuman()).to.be.eq(constSchema);113 });11481115 itWeb3('Set limits', async ({api, web3}) => {82 itWeb3('Set limits', async ({api, web3}) => {116 const owner = await createEthAccountWithBalance(api, web3);83 const owner = await createEthAccountWithBalance(api, web3);247 .confirmSponsorship(collectionAddressWithBadPrefix)214 .confirmSponsorship(collectionAddressWithBadPrefix)248 .call()).to.be.rejectedWith(EXPECTED_ERROR);215 .call()).to.be.rejectedWith(EXPECTED_ERROR);249 }216 }250 {251 const schema = 'Some schema';252 await expect(helper.methods253 .setOffchainSchema(collectionAddressWithBadPrefix, schema)254 .call()).to.be.rejectedWith(EXPECTED_ERROR);255 }256 {257 const variable = 'Some variable';258 await expect(helper.methods259 .setVariableOnChainSchema(collectionAddressWithBadPrefix, variable)260 .call()).to.be.rejectedWith(EXPECTED_ERROR);261 }262 {263 const constData = 'Some const';264 await expect(helper.methods265 .setConstOnChainSchema(collectionAddressWithBadPrefix, constData)266 .call()).to.be.rejectedWith(EXPECTED_ERROR);267 }268 {217 {269 const limits = '{"account_token_ownership_limit":1000}';218 const limits = '{"account_token_ownership_limit":1000}';270 await expect(helper.methods219 await expect(helper.methods292 .confirmSponsorship(collectionIdAddress)241 .confirmSponsorship(collectionIdAddress)293 .call()).to.be.rejectedWith('Caller is not set as sponsor');242 .call()).to.be.rejectedWith('Caller is not set as sponsor');294 }243 }295 {296 const schema = 'Some schema';297 await expect(helperFromNotOwner.methods298 .setOffchainSchema(collectionIdAddress, schema)299 .call()).to.be.rejectedWith(EXPECTED_ERROR);300 }301 {302 const variable = 'Some variable';303 await expect(helperFromNotOwner.methods304 .setVariableOnChainSchema(collectionIdAddress, variable)305 .call()).to.be.rejectedWith(EXPECTED_ERROR);306 }307 {308 const constData = 'Some const';309 await expect(helperFromNotOwner.methods310 .setConstOnChainSchema(collectionIdAddress, constData)311 .call()).to.be.rejectedWith(EXPECTED_ERROR);312 }313 {244 {314 const limits = '{"account_token_ownership_limit":1000}';245 const limits = '{"account_token_ownership_limit":1000}';315 await expect(helperFromNotOwner.methods246 await expect(helperFromNotOwner.methods318 }249 }319 });250 });320321 itWeb3('(!negative test!) Set offchain schema (length limit)', async ({api, web3}) => {322 const owner = await createEthAccountWithBalance(api, web3);323 const helper = collectionHelper(web3, owner);324 const result = await helper.methods.create721Collection('Schema collection', 'A', 'A').send();325 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);326 const OFFCHAIN_SCHEMA_LIMIT = 8192;327 const schema = 'A'.repeat(OFFCHAIN_SCHEMA_LIMIT + 1);328 await expect(helper.methods329 .setOffchainSchema(collectionIdAddress, schema)330 .call()).to.be.rejectedWith('schema is too long. Max length is ' + OFFCHAIN_SCHEMA_LIMIT);331 });332333 itWeb3('(!negative test!) Set variable on chain schema (length limit)', async ({api, web3}) => {334 const owner = await createEthAccountWithBalance(api, web3);335 const helper = collectionHelper(web3, owner);336 const result = await helper.methods.create721Collection('Schema collection', 'A', 'A').send();337 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);338 const VARIABLE_ON_CHAIN_SCHEMA_LIMIT = 8192;339 const variable = 'A'.repeat(VARIABLE_ON_CHAIN_SCHEMA_LIMIT + 1);340 await expect(helper.methods341 .setVariableOnChainSchema(collectionIdAddress, variable)342 .call()).to.be.rejectedWith('variable is too long. Max length is ' + VARIABLE_ON_CHAIN_SCHEMA_LIMIT);343 });344345 itWeb3('(!negative test!) Set const on chain schema (length limit)', async ({api, web3}) => {346 const owner = await createEthAccountWithBalance(api, web3);347 const helper = collectionHelper(web3, owner);348 const result = await helper.methods.create721Collection('Schema collection', 'A', 'A').send();349 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);350 const CONST_ON_CHAIN_SCHEMA_LIMIT = 32768;351 const constData = 'A'.repeat(CONST_ON_CHAIN_SCHEMA_LIMIT + 1);352 await expect(helper.methods353 .setConstOnChainSchema(collectionIdAddress, constData)354 .call()).to.be.rejectedWith('const_on_chain is too long. Max length is ' + CONST_ON_CHAIN_SCHEMA_LIMIT);355 });356251357 itWeb3('(!negative test!) Set limits', async ({api, web3}) => {252 itWeb3('(!negative test!) Set limits', async ({api, web3}) => {358 const owner = await createEthAccountWithBalance(api, web3);253 const owner = await createEthAccountWithBalance(api, web3);