Skip to content

Commit dc01ce4

Browse files
authored
Remove AccountStore from omni-account pallet and update omni-executor (#3570)
1 parent faec247 commit dc01ce4

File tree

22 files changed

+2466
-3452
lines changed

22 files changed

+2466
-3452
lines changed

parachain/pallets/omni-account/src/lib.rs

Lines changed: 22 additions & 398 deletions
Large diffs are not rendered by default.

parachain/pallets/omni-account/src/mock.rs

Lines changed: 2 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with Litentry. If not, see <https://www.gnu.org/licenses/>.
1616

17-
use crate::{self as pallet_omni_account, Decode, Encode, EnsureOmniAccount, MaxEncodedLen};
17+
use crate::{self as pallet_omni_account, Decode, Encode, EnsureOmniAccount};
1818
use frame_support::{
1919
assert_ok, derive_impl,
2020
pallet_prelude::EnsureOrigin,
2121
parameter_types,
22-
traits::{ConstU32, ConstU64, InstanceFilter},
22+
traits::{ConstU32, ConstU64},
2323
};
2424
use frame_system::EnsureRoot;
2525
use heima_primitives::{DefaultOmniAccountConverter, Identity, MemberAccount};
@@ -166,100 +166,13 @@ impl pallet_teebag::Config for Test {
166166
type WeightInfo = ();
167167
}
168168

169-
#[derive(
170-
Copy,
171-
Clone,
172-
PartialEq,
173-
Eq,
174-
Ord,
175-
PartialOrd,
176-
Encode,
177-
Decode,
178-
RuntimeDebug,
179-
MaxEncodedLen,
180-
scale_info::TypeInfo,
181-
)]
182-
pub enum OmniAccountPermission {
183-
All,
184-
AccountManagement,
185-
RequestNativeIntent,
186-
RequestEthereumIntent,
187-
RequestSolanaIntent,
188-
}
189-
190-
impl Default for OmniAccountPermission {
191-
fn default() -> Self {
192-
Self::All
193-
}
194-
}
195-
196-
impl InstanceFilter<RuntimeCall> for OmniAccountPermission {
197-
fn filter(&self, call: &RuntimeCall) -> bool {
198-
match self {
199-
Self::All => true,
200-
Self::AccountManagement => {
201-
matches!(
202-
call,
203-
RuntimeCall::OmniAccount(pallet_omni_account::Call::add_account { .. })
204-
| RuntimeCall::OmniAccount(
205-
pallet_omni_account::Call::remove_accounts { .. }
206-
) | RuntimeCall::OmniAccount(
207-
pallet_omni_account::Call::publicize_account { .. }
208-
) | RuntimeCall::OmniAccount(pallet_omni_account::Call::set_permissions { .. })
209-
)
210-
},
211-
Self::RequestNativeIntent => {
212-
if let RuntimeCall::OmniAccount(pallet_omni_account::Call::request_intent {
213-
intent,
214-
}) = call
215-
{
216-
matches!(
217-
intent,
218-
pallet_omni_account::Intent::SystemRemark(_)
219-
| pallet_omni_account::Intent::TransferNative(_)
220-
)
221-
} else {
222-
false
223-
}
224-
},
225-
Self::RequestEthereumIntent => {
226-
if let RuntimeCall::OmniAccount(pallet_omni_account::Call::request_intent {
227-
intent,
228-
}) = call
229-
{
230-
matches!(
231-
intent,
232-
pallet_omni_account::Intent::TransferEthereum(_)
233-
| pallet_omni_account::Intent::CallEthereum(_)
234-
)
235-
} else {
236-
false
237-
}
238-
},
239-
Self::RequestSolanaIntent => {
240-
if let RuntimeCall::OmniAccount(pallet_omni_account::Call::request_intent {
241-
intent,
242-
}) = call
243-
{
244-
matches!(intent, pallet_omni_account::Intent::TransferSolana(_))
245-
} else {
246-
false
247-
}
248-
},
249-
}
250-
}
251-
}
252-
253169
impl pallet_omni_account::Config for Test {
254170
type RuntimeOrigin = RuntimeOrigin;
255171
type RuntimeCall = RuntimeCall;
256172
type RuntimeEvent = RuntimeEvent;
257173
type TEECallOrigin = EnsureEnclaveSigner<Self>;
258-
type MaxAccountStoreLength = ConstU32<3>;
259174
type OmniAccountOrigin = EnsureOmniAccount<Self::AccountId>;
260175
type OmniAccountConverter = DefaultOmniAccountConverter;
261-
type MaxPermissions = ConstU32<4>;
262-
type Permission = OmniAccountPermission;
263176
}
264177

265178
pub fn get_tee_signer() -> SystemAccountId {

0 commit comments

Comments
 (0)