-
Notifications
You must be signed in to change notification settings - Fork 759
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent behaviour of repatriate_reserved
after introducing account reference provider when ED is 0
#337
Comments
since paritytech/substrate#7363 you should use Thus Do I miss something ? Feel free to re-open if it doesn't solve your issue EDIT: I missed the point, issue is re-opened |
@thiolliere Thanks for looking into this, but that does not solve this issue at all. Please help reopen it as I can't.
Yeah, I know
I'm guessing you don't run the test actually, Alice does exist but with all zero balances,
And again, this must be a breaking change of this API since it behaves differently after the commit, making the project(ChainX) based on Substrate broken in this particular use case. This issue either needs to be really fixed to act like before or needs some explanation of why it behaves differently now. Before paritytech/substrate#7363:
After paritytech/substrate#7363:
|
sorry I read to fast. Indeed the current implementation doesn't support existential deposit of 0 for balance using system account data. the StoredMap implementation for
(note that if you use don't use system account info but balance storage to store the balance then it works). If you have existential deposit of 0 then every time an account gets back and forth to balance 0 the provider will be incremented. also reading from the code, To solve this issue I feel like there is 2 solutions:
|
Using |
repatriate_reserved
after introducing account reference providerrepatriate_reserved
after introducing account reference provider when ED is 0
Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions. |
still relevant |
I have tried literally modified test and with the latest |
@Mr-Leshiy Thanks for trying that. You should add the test in |
@liuchengxu , Thank you I see, I have missed it. |
I am not sure with the solution that I have provided, but what if we will just ask that account is exist and => it is consumed by others and this account has providers. At least such solution will not lead to using |
I got an idea. Instead of trying to find an implementation of StoredMap with AccountData being stored in system. Chain that have a ED of 0 will want to use this new data and will have to migrate their account in case they launched already. But existing chain with ED != 0 will not have to migrate and keep the current implementation. I gave some snippet in this message paritytech/substrate#10117 (comment) This seems to be the correct direction to pursue. |
Looks like a practical workaround, but can't say it's the ultimate solution as the framework has to maintain a guide somewhere for this edge case. When people wants to use 0 ED on their chain, they'd better learn about this history. |
I mean we will just 2 implementation of StoredMap in frame-system. One which stored the balance and cannot be used when ED is 0 the other which stored |
Hmm, does this mean it will be recommended to always use |
* Utility function to build custom block weights * Generate node weights for DB read/write, base block + extrinsic * Integrate weights into runtimes
* First pass at Modexp precompile gas calculation * Incremental WIP adding modexp-eip2565.json tests * Include Modexp in precompile set * Working impl for ethereum test cases * Cleanup * Add Ethereum consensus tests in Modexp unit tests * Return gas cost from Modexp::execute() * Add (not very DRY) ethereum tests for Blake2 precompile * Fixes for Blake2F precompile * Implement EIP1108 gas costs for bn128 precompiles * Make precompile consensus test generic * Move test_precompile_consensus_tests to fp_evm * Clean up precompile testdata * Improve test_precompile_consensus_tests error handling * Change ECRecover to return "" on error; add related tests * Add clarifying comment * Add sha256 and ripem160 precompile test vectors * Add bn128 test vectors * Remove non-existent mod declaration * Implement Blake2 gas cost * Remove ecrecover tests that expect bytes 33-63 to matter * editorconfig * Remove version specification from local crate references * Remove modexp_eip2565 ts-tests (now redundant) * Use 'core::cmp::max' * Resolve compilation warnings * Handle target_gas properly * Revert from_ne_bytes -> from_le_bytes with comment about the logic * Bump precompile versions * Use 1.1.0 instead of 1.0.1 for new precompile versions Co-authored-by: Wei Tang <[email protected]> * Bump fp-evm to 1.0.1-dev * Reflect new fp-evm version in crates which depend on it * Remove unused log dependency in modexp precompile * Move eth "consensus tests" utility to its own crate * Modify remaining precompile tests to use pallet_evm_test_vector_support * Leave primitives/evm/src/precompile.r untouched * Add missing files * Use 1.0.1-dev as version for pallet-evm-test-vector-support * Chain 'std' for 'fp-evm' * Specify paritytech/frontier as the repo in all Cargo.toml files * Bump versions * Bump fp-storage to 1.0.1-dev * Bump fp-rpc to 1.0.1-dev * Bump fc-consensus to 1.0.1-dev Co-authored-by: Wei Tang <[email protected]>
Problem description
I found this when I was updating Substrate to bb0fb29 which includes the PR paritytech/substrate#7363 in ChainX chainx-org/ChainX@b097d6e . After fixing the compilation, there are still four tests that failed, I later found out they failed because of
repatriate_reserved
no longer works like before, see https://github.com/chainx-org/ChainX/blob/9394bef6f88521715a724ff6407f238e6698cf48/xpallets/dex/spot/src/execution/asset.rs#L116-L121, the details will be explained later.The interesting thing is that when I replace
repatriate_reserved()
withunreserve()
+transfer()
, the tests pass, see chainx-org/ChainX@f12cfa6.Reproduction
Then I try to reproduce this issue in Substrate.
Test case:
reserved
to Alice, the balance of Alice is all 0 but has non-zero consumers and providers.test.patch:
The beneficiary account Alice(zero balances with non-zero providers and consumers) is somehow
None
herehttps://github.com/paritytech/substrate/blob/d0723f186662fd69ee37601367f51095d132df92/frame/balances/src/lib.rs#L655
The text was updated successfully, but these errors were encountered: