Skip to content

Commit

Permalink
Add TransferKeepAlive to filter (#1167)
Browse files Browse the repository at this point in the history
* Added transferKeepAlive to Filter

* Allow transfer_all

* Allow transfer_allow_death
  • Loading branch information
PierreOssun authored Feb 8, 2024
1 parent 4b76262 commit 494eddb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion precompiles/dispatch-lockdrop/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ pub struct WhitelistedCalls;
impl Contains<RuntimeCall> for WhitelistedCalls {
fn contains(call: &RuntimeCall) -> bool {
match call {
RuntimeCall::Balances(pallet_balances::Call::transfer { .. }) => true,
RuntimeCall::Balances(pallet_balances::Call::transfer_keep_alive { .. }) => true,
RuntimeCall::System(frame_system::Call::remark { .. }) => true,
RuntimeCall::Utility(_) => true,
_ => false,
Expand Down
8 changes: 4 additions & 4 deletions precompiles/dispatch-lockdrop/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fn precompiles() -> TestPrecompileSet<TestRuntime> {
fn dispatch_calls_on_behalf_of_lockdrop_works() {
ExtBuilder::default().build().execute_with(|| {
// Transfer balance to Alice
let call = RuntimeCall::Balances(pallet_balances::Call::transfer {
let call = RuntimeCall::Balances(pallet_balances::Call::transfer_keep_alive {
dest: ALICE,
value: 15 * ONE,
});
Expand Down Expand Up @@ -74,7 +74,7 @@ fn dispatch_calls_on_behalf_of_lockdrop_works() {
#[test]
fn proper_gas_is_charged() {
ExtBuilder::default().build().execute_with(|| {
let call = RuntimeCall::Balances(pallet_balances::Call::transfer {
let call = RuntimeCall::Balances(pallet_balances::Call::transfer_keep_alive {
dest: ALICE,
value: 15 * ONE,
});
Expand Down Expand Up @@ -111,7 +111,7 @@ fn proper_gas_is_charged() {
fn pubkey_does_not_match_caller_address() {
ExtBuilder::default().build().execute_with(|| {
// Transfer balance to Alice
let call = RuntimeCall::Balances(pallet_balances::Call::transfer {
let call = RuntimeCall::Balances(pallet_balances::Call::transfer_keep_alive {
dest: ALICE,
value: 15 * ONE,
});
Expand Down Expand Up @@ -148,7 +148,7 @@ fn pubkey_does_not_match_caller_address() {
fn pubkey_derive_to_proper_ss58() {
ExtBuilder::default().build().execute_with(|| {
// Transfer balance to Alice
let call = RuntimeCall::Balances(pallet_balances::Call::transfer {
let call = RuntimeCall::Balances(pallet_balances::Call::transfer_keep_alive {
dest: ALICE,
value: 15 * ONE,
});
Expand Down
4 changes: 3 additions & 1 deletion runtime/local/src/precompiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ impl Contains<RuntimeCall> for WhitelistedLockdropCalls {
RuntimeCall::DappStaking(pallet_dapp_staking_v3::Call::withdraw_unbonded {
..
}) => true,
RuntimeCall::Balances(pallet_balances::Call::transfer { .. }) => true,
RuntimeCall::Balances(pallet_balances::Call::transfer_all { .. }) => true,
RuntimeCall::Balances(pallet_balances::Call::transfer_keep_alive { .. }) => true,
RuntimeCall::Balances(pallet_balances::Call::transfer_allow_death { .. }) => true,
RuntimeCall::Assets(pallet_assets::Call::transfer { .. }) => true,
_ => false,
}
Expand Down
4 changes: 3 additions & 1 deletion runtime/shibuya/src/precompiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ impl Contains<RuntimeCall> for WhitelistedLockdropCalls {
RuntimeCall::DappStaking(pallet_dapp_staking_v3::Call::withdraw_unbonded {
..
}) => true,
RuntimeCall::Balances(pallet_balances::Call::transfer { .. }) => true,
RuntimeCall::Balances(pallet_balances::Call::transfer_all { .. }) => true,
RuntimeCall::Balances(pallet_balances::Call::transfer_keep_alive { .. }) => true,
RuntimeCall::Balances(pallet_balances::Call::transfer_allow_death { .. }) => true,
RuntimeCall::Assets(pallet_assets::Call::transfer { .. }) => true,
_ => false,
}
Expand Down

0 comments on commit 494eddb

Please sign in to comment.