Skip to content

charge storage fee to support non native asset#2045

Merged
zqhxuyuan merged 37 commits intomasterfrom
charge_storage_fee
May 16, 2022
Merged

charge storage fee to support non native asset#2045
zqhxuyuan merged 37 commits intomasterfrom
charge_storage_fee

Conversation

@zqhxuyuan
Copy link
Copy Markdown
Contributor

@zqhxuyuan zqhxuyuan commented Apr 19, 2022

closes: #2039

change evm reserve_storage from T::Currency::reserve_named() to T::ChargeTransactionPayment::reserve_fee(), and we can add our own fee strategy in transaction payment module's reserve_fee(). That is, reserve_fee now can support none native token.

T::Currency::reserve_named(&RESERVE_ID_STORAGE_DEPOSIT, &user, amount)

we do not need to change unreserve_storage and charge_storage in evm, because reserve_storage happend before those two operation. That is, unreserve_storage and charge_storage always have native token.


If we have this feature, I think bodhi.js Metamask needs support this too, currently if an eth account not bind to substrate account, it have enough none-native token, but not enough native token, the transfer can't proceed
image

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 19, 2022

Codecov Report

Merging #2045 (1f2b6f1) into master (42f41c8) will decrease coverage by 86.45%.
The diff coverage is n/a.

❗ Current head 1f2b6f1 differs from pull request most recent head 53661fa. Consider uploading reports for the commit 53661fa to get more accurate results

@@            Coverage Diff             @@
##           master   #2045       +/-   ##
==========================================
- Coverage   86.45%       0   -86.46%     
==========================================
  Files          99       0       -99     
  Lines       21240       0    -21240     
==========================================
- Hits        18362       0    -18362     
+ Misses       2878       0     -2878     
Impacted Files Coverage Δ
modules/asset-registry/src/lib.rs
modules/cdp-engine/src/lib.rs
modules/cdp-engine/src/tests.rs
modules/evm-utility/macro/src/lib.rs
modules/evm/src/lib.rs
modules/evm/src/precompiles/blake2/mod.rs
modules/honzon/src/lib.rs
modules/honzon/src/tests.rs
modules/idle-scheduler/src/lib.rs
modules/support/src/evm.rs
... and 89 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7ca13ff...53661fa. Read the comment docs.

@zqhxuyuan zqhxuyuan marked this pull request as ready for review April 26, 2022 15:06
@xlc
Copy link
Copy Markdown
Member

xlc commented Apr 28, 2022

It is ok if Metamask can't handle it as that's basically the same behaviour of Ethereum. This however will be useful for polkadot.js extension user or dApp using EIP712 signature format.

Comment thread modules/transaction-payment/src/lib.rs Outdated
Comment thread modules/transaction-payment/src/lib.rs
Comment thread modules/transaction-payment/src/lib.rs Outdated
@zqhxuyuan zqhxuyuan changed the title charge storage fee charge storage fee to support non native asset May 6, 2022
Comment thread scripts/polkadot-launch/acala-launch.json Outdated
Comment thread modules/transaction-payment/src/lib.rs Outdated
xlc
xlc previously approved these changes May 9, 2022
Comment thread modules/evm/src/bench/mock.rs Outdated
Comment thread modules/evm/src/lib.rs
xlc
xlc previously approved these changes May 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

use ChargeTransactionPayment to charge the storage fee in evm

3 participants