diff --git a/pop-api/src/lib.rs b/pop-api/src/lib.rs index a785aebe..e78aff9e 100644 --- a/pop-api/src/lib.rs +++ b/pop-api/src/lib.rs @@ -13,7 +13,7 @@ pub mod primitives; pub mod v0; type AccountId = AccountId32; -// TODO: do the same as above and check expanded code. +// TODO: do the same as above and check expanded macro code. type Balance = ::Balance; type BlockNumber = ::BlockNumber; type StringLimit = u32; diff --git a/pop-api/src/v0/assets/pallets/assets.rs b/pop-api/src/v0/assets/pallets/assets.rs index 7a575e08..b28d3086 100644 --- a/pop-api/src/v0/assets/pallets/assets.rs +++ b/pop-api/src/v0/assets/pallets/assets.rs @@ -1,4 +1,3 @@ -// TODO: what to put in this file? #![allow(dead_code)] use crate::{Balance, RuntimeCall, *}; @@ -412,6 +411,8 @@ pub(crate) enum AssetsCall { Block { id: AssetIdParameter, who: MultiAddress }, } +// TODO: do we want add this. Not being used atm but necessary if we want to provide access to the +// rest of the pallet. #[derive(Debug, Copy, Clone, PartialEq, Eq, Encode, scale::Decode)] #[cfg_attr(feature = "std", derive(scale_info::TypeInfo))] pub enum AssetsError { diff --git a/pop-api/src/v0/balances.rs b/pop-api/src/v0/balances.rs index 5d38d851..c9759a45 100644 --- a/pop-api/src/v0/balances.rs +++ b/pop-api/src/v0/balances.rs @@ -1,4 +1,3 @@ -// TODO: what to put in this file? use crate::{dispatch, error::PopApiError, primitives::MultiAddress, v0::RuntimeCall, AccountId}; type Result = core::result::Result; @@ -24,6 +23,8 @@ pub enum BalancesCall { }, } +// TODO: do we want add this. Not being used atm but necessary if we want to provide access to the +// rest of the pallet. #[derive(Debug, Copy, Clone, PartialEq, Eq, scale::Encode, scale::Decode)] #[cfg_attr(feature = "std", derive(scale_info::TypeInfo))] pub enum BalancesError { diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml index 1098b557..e7237b51 100644 --- a/primitives/Cargo.toml +++ b/primitives/Cargo.toml @@ -12,11 +12,6 @@ scale-decode = { version = "0.10.0", default-features = false, features = ["deri scale-encode = { version = "0.5.0", default-features = false, features = ["derive"], optional = true } scale-info = { version = "2.6", default-features = false, features = ["derive"], optional = true } -#scale = { workspace = true, features = ["max-encoded-len"] } -#scale-decode = { workspace = true, features = ["derive"], optional = true } -#scale-encode = { workspace = true, features = ["derive"], optional = true } -#scale-info = { workspace = true, features = ["derive"], optional = true } - [features] default = ["std"] std = [ diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs index 7c1672b8..1e008c31 100644 --- a/primitives/src/lib.rs +++ b/primitives/src/lib.rs @@ -3,12 +3,7 @@ pub use bounded_collections::{BoundedBTreeMap, BoundedBTreeSet, BoundedVec, ConstU32}; use scale::{Decode, Encode, MaxEncodedLen}; #[cfg(feature = "std")] -use { - scale_decode::DecodeAsType, - scale_encode::EncodeAsType, - scale_info::TypeInfo, -}; - +use {scale_decode::DecodeAsType, scale_encode::EncodeAsType, scale_info::TypeInfo}; pub mod cross_chain; pub mod storage_keys; diff --git a/runtime/devnet/src/tests/local_fungibles.rs b/runtime/devnet/src/tests/local_fungibles.rs index bc13fbde..b1ddda2e 100644 --- a/runtime/devnet/src/tests/local_fungibles.rs +++ b/runtime/devnet/src/tests/local_fungibles.rs @@ -1,3 +1,11 @@ +// Todo - errors: +// - Badorigin: contract is always signed +// - Lookup: is a valid AccountId due to the contract +// - Many errors can occur from calling a dispatchable. As of now, most of the DispatchErrors are +// handled by the pop api but not all of them are tested. How should I approach this? I.e.: +// - Arithmetic errors +// - Token errors +// - others (besides Module errors) that I might haven't found yet. #![cfg(test)] use super::*; @@ -251,16 +259,6 @@ fn asset_exists_works() { }); } -// Todo - errors: -// - Badorigin: contract is always signed -// - Lookup: is a valid AccountId due to the contract -// - reserve(): Overflow, LiquidityRestrictions; frozen -// - Callback -// - StorageDepositLimitExhausted -// todo: errors: -// - TokenErrors -// - Arithmetic -// - https://github.com/paritytech/polkadot-sdk/blob/3977f389cce4a00fd7100f95262e0563622b9aa4/substrate/frame/assets/src/functions.rs#L125 #[test] #[ignore] fn create_works() { @@ -407,10 +405,6 @@ fn transfer_from_mint_works() { }); } -// Todo: error: -// - https://github.com/paritytech/polkadot-sdk/blob/2460cddf57660a88844d201f769eb17a7accce5a/substrate/frame/assets/src/functions.rs#L161 -// - ArithmeticError: Underflow, Overflow -// - https://github.com/paritytech/polkadot-sdk/blob/master/substrate/frame/assets/src/functions.rs#L125 #[test] #[ignore] fn transfer_works() { diff --git a/runtime/testnet/src/extensions.rs b/runtime/testnet/src/extensions.rs index 6bbfaa36..4e7402a7 100644 --- a/runtime/testnet/src/extensions.rs +++ b/runtime/testnet/src/extensions.rs @@ -86,6 +86,7 @@ impl TryFrom for v0::FuncId { 0x1 => Self::ReadState, _ => { log::error!("called an unregistered `func_id`: {:}", func_id); + // TODO: Other error. return Err(DispatchError::Other("unimplemented func_id")); }, }; @@ -206,6 +207,7 @@ where RuntimeStateKeys::ParachainSystem(key) => { read_parachain_system_state::(key, &mut env) }, + _ => Err(DispatchError::Other("Unknown state keys")), }? .encode(); @@ -215,7 +217,8 @@ where ); env.write(&result, false, None).map_err(|e| { log::trace!(target: LOG_TARGET, "{:?}", e); - DispatchError::Other("unable to write results to contract memory") + // TODO: Other error. + DispatchError::Other("Unable to write results to contract memory") }) }