Skip to content

Techdebt consensus#87

Closed
dmitrylavrenov wants to merge 3 commits intomasterfrom
techdebt-consensus
Closed

Techdebt consensus#87
dmitrylavrenov wants to merge 3 commits intomasterfrom
techdebt-consensus

Conversation

@dmitrylavrenov
Copy link
Contributor

@dmitrylavrenov dmitrylavrenov commented Aug 16, 2021

@MOZGIII
Copy link
Contributor

MOZGIII commented Aug 16, 2021

Is #67 still a wip here?

@dmitrylavrenov
Copy link
Contributor Author

Is #67 still a wip here?

Yes, it is. Because there are no unit tests for it.

@MOZGIII MOZGIII marked this pull request as draft August 16, 2021 13:43
@MOZGIII
Copy link
Contributor

MOZGIII commented Aug 16, 2021

It looks like there are three commits, and they're fairly isolated. They should be submitted each as a separate PR. The only changes that are fine to go in a single PR are --dev and local chain loading support - although they can also be split more atomically.

@MOZGIII
Copy link
Contributor

MOZGIII commented Aug 16, 2021

Closing this in favor of split PRs.

@MOZGIII MOZGIII closed this Aug 16, 2021
@MOZGIII MOZGIII deleted the techdebt-consensus branch August 20, 2021 11:21
dmitrylavrenov added a commit that referenced this pull request Feb 7, 2025
* Sovereign EVM balances layer (#95)

* Sovereign EVM balances layer (#87)

* Frame EVM balances (#65)

* Add initital frame balances structure

* Add account data balances logic

* Define main types

* Add imbalances logic

* Add DustCleaner

* Implement balances related operations

* Implement currencies for the pallet

* Implement Inspect for the pallet

* Make account_data mod private

* Leave only free balance data for account

* Support try-runtime features

* Apply formatting

* Fix comment

* Add mock with evm, evm-system, evm-balances configs

* Add basic setup test

* Add fee deduction test

* Add issuance_after_tip test

* Add refunds_should_work test

* Add refunds_and_priority_should_work test

* Fix clippy in tests

* Fix basec setup works test with evm balances checks

* Remove redundant set block in tests

* Add call_should_fail_with_priority_greater_than_max_fee test

* Add call_should_succeed_with_priority_equal_to_max_fee test

* Use EvmSystem as AccountProvider in tests

* Add account_should_be_reaped test

* Add deposit_into_existing test

* Add balance_transfer_works test

* Add slashing_balance_works test

* Add withdraw_balance_works test

* Add transferring_too_high_value_should_not_panic test

* Rename test to transfer_works

* Add basic tests for currency

* Add burn and issue related tests

* Add deposit_creating_works test

* Add currency_make_free_balance_be test

* Rename evm logic related tests

* Fix comment

* Rename slashing related test

* Rename test with make free balance

* Rename test with transferring too high value

* Assert evm system account existence for currency_deposit_creating_works test

* Add EvmSystem events check

* Remove license

* Use workspace dep

* Fix mock

* Remove deprecated trait Store

* Remove deprecated storage getter

* Add Apache-2.0 license

* Fix tests

* Apply required changes for fungible inspect trait
dmitrylavrenov added a commit that referenced this pull request Feb 7, 2025
* Sovereign EVM balances layer (#95)

* Sovereign EVM balances layer (#87)

* Frame EVM balances (#65)

* Add initital frame balances structure

* Add account data balances logic

* Define main types

* Add imbalances logic

* Add DustCleaner

* Implement balances related operations

* Implement currencies for the pallet

* Implement Inspect for the pallet

* Make account_data mod private

* Leave only free balance data for account

* Support try-runtime features

* Apply formatting

* Fix comment

* Add mock with evm, evm-system, evm-balances configs

* Add basic setup test

* Add fee deduction test

* Add issuance_after_tip test

* Add refunds_should_work test

* Add refunds_and_priority_should_work test

* Fix clippy in tests

* Fix basec setup works test with evm balances checks

* Remove redundant set block in tests

* Add call_should_fail_with_priority_greater_than_max_fee test

* Add call_should_succeed_with_priority_equal_to_max_fee test

* Use EvmSystem as AccountProvider in tests

* Add account_should_be_reaped test

* Add deposit_into_existing test

* Add balance_transfer_works test

* Add slashing_balance_works test

* Add withdraw_balance_works test

* Add transferring_too_high_value_should_not_panic test

* Rename test to transfer_works

* Add basic tests for currency

* Add burn and issue related tests

* Add deposit_creating_works test

* Add currency_make_free_balance_be test

* Rename evm logic related tests

* Fix comment

* Rename slashing related test

* Rename test with make free balance

* Rename test with transferring too high value

* Assert evm system account existence for currency_deposit_creating_works test

* Add EvmSystem events check

* Remove license

* Use workspace dep

* Fix mock

* Remove deprecated trait Store

* Remove deprecated storage getter

* Add Apache-2.0 license

* Fix tests

* Apply required changes for fungible inspect trait
dmitrylavrenov added a commit that referenced this pull request Feb 7, 2025
…serving history (#1420)

* Sovereign accounts and EVM system layer (#94) (#99)

* Sovereign accounts and EVM system layer (#94)

* Sovereign accounts and EVM system layer (#86)

* Frame evm system (#62)

* Add initial impl of evm-system

* Check account existence

* Improve creation account logic

* Add new line

* Add default implementations

* Add mock

* Use DispatchResult instead of custom enums

* Basic create account tests

* Add simple tests with remove account and nonce update

* Remove default implementations for OnNewAccount and OnKilledAccount

* Add mock objects for OnNewAccount and OnKilledAccount

* Use mock logic in tests

* Some tests improvements

* Add docs to tests

* Check events in tests

* Add default implementation for OnNewAccount and OnKilledAccount for empty tuple (#63)

* Implement StoredMap for EvmSystem (#64)

* Add try-runtime feature into `pallet-evm-system` (#67)

Add try-runtime feature at pallet-evm-system

* Use `sp_std` library to add FromStr trait for tests at `pallet-evm-system` (#68)

Use sp_std library to add FromStr trait for tests at pallet-evm-system

* Rename FullAccount into Account at `pallet-evm-system` (#69)

Rename FullAccount into Account at pallet-evm-system

* Fix `try_mutate_exists` implementation and add tests to check it (#70)

* Fix try_mutate_exists logic

* Add tests

* Fix AccountData type at mock

* Remove redundant mock expectations

* Add comments for new tests

* More explicitly handle (none,false) case

* Rename some_data back to maybe_account_data

* Add data changes for try_mutate_exists_fails_without_changes test

* Add try_mutate_exists_account_not_created test

* Add assert_noop to check state chages

* Return success for try_mutate_exists_account_not_created test

* Use workspace deps

* Remove license

* Implement missed AccountProvider for EvmSystem

* Remove deprecated trait Store

* Add Apache-2.0 license

* Remove deprecated storage getter

* Remove redundant brackets

* Sovereign EVM balances layer (#100)

* Sovereign EVM balances layer (#95)

* Sovereign EVM balances layer (#87)

* Frame EVM balances (#65)

* Add initital frame balances structure

* Add account data balances logic

* Define main types

* Add imbalances logic

* Add DustCleaner

* Implement balances related operations

* Implement currencies for the pallet

* Implement Inspect for the pallet

* Make account_data mod private

* Leave only free balance data for account

* Support try-runtime features

* Apply formatting

* Fix comment

* Add mock with evm, evm-system, evm-balances configs

* Add basic setup test

* Add fee deduction test

* Add issuance_after_tip test

* Add refunds_should_work test

* Add refunds_and_priority_should_work test

* Fix clippy in tests

* Fix basec setup works test with evm balances checks

* Remove redundant set block in tests

* Add call_should_fail_with_priority_greater_than_max_fee test

* Add call_should_succeed_with_priority_equal_to_max_fee test

* Use EvmSystem as AccountProvider in tests

* Add account_should_be_reaped test

* Add deposit_into_existing test

* Add balance_transfer_works test

* Add slashing_balance_works test

* Add withdraw_balance_works test

* Add transferring_too_high_value_should_not_panic test

* Rename test to transfer_works

* Add basic tests for currency

* Add burn and issue related tests

* Add deposit_creating_works test

* Add currency_make_free_balance_be test

* Rename evm logic related tests

* Fix comment

* Rename slashing related test

* Rename test with make free balance

* Rename test with transferring too high value

* Assert evm system account existence for currency_deposit_creating_works test

* Add EvmSystem events check

* Remove license

* Use workspace dep

* Fix mock

* Remove deprecated trait Store

* Remove deprecated storage getter

* Add Apache-2.0 license

* Fix tests

* Apply required changes for fungible inspect trait

* Support `Mutate`, `Unbalanced`, `Balanced` fungible related traits for `pallet-evm-balances` (#102)

* Move currencies implementation into separate mod

* [substrate=apply] Deprecate Currency; introduce holds and freezing into fungible traits #12951

* Apply new balances logic to currency trait implementation

* Use DustRemoval over Credit instead of NegativeImbalance

* Implement Balanced, Unbalanced, Mutate fungible traits for pallet

* Revert using negative imbalance

* Apply formatter

* Fix withdraw_consequence method

* Move currency related tests to separate mod

* Add transfer_fails_funds_unavailable test to currency tests

* Add transfer_works_full_balance test to currency tests

* Fix slashing conditions

* Add slash_works_full_balance test to currency tests

* Add deposit_into_existing related fails tests

* Add withdraw_works_full_balance test to currency tests

* Add withdraw fails related tests to currency tests

* Add basic fungible tests

* Add reducable balance test to fungible tests

* Add can deposit related tests

* Fix can_withdraw logic

* Add can_withdraw related tests

* Add write_balance_works test

* Add set_total_issuance_works test

* Add decrease_balance related tests

* Add increase_balance related tests

* Add deactivate_reactivate_works test

* Add mint_into related tests

* Add burn_from related tests

* Add shelve related tests

* Add restored related tests

* Add transfer related tests

* Add balanced related tests

* Undo formatting

* Simplify reducible logic implementation

* Simplify can_deposit implementation

* Simplify can_withdraw implementation

* Properly use semantics of total and free balances

* Improve reducable_balance_works test

* Fix test race conditions

* Apply formatter for `pallet-evm-system` and `pallet-evm-balances` (#112) (#114)

Apply formatter for pallet-evm-system and pallet-evm-balances

* Use `execute_with_ext` in `pallet-evm-system` and `pallet-evm-balances` tests (#113) (#115)

Use execute_with_ext in pallet-evm-system and pallet-evm-balances tests

* Fix removing account logic at `pallet-evm-system` (#111) (#116)

* Add assert_total_issuance_invariant helper

* Add evm_system_removing_account_non_zero_balance test

* Fix removing account logic

* Undo redundant changes

* Redesign fix usage

* Undo try_mutate_exists_account_removed changes

* Rename Exists account removal status into Remains

* Improve docs

* Apply renaming at tests

* Use assert_storage_noop

* Remove rusttoolchain

* Add missing `on_created_account` logic usage for `inc_account_nonce` at `pallet-evm-system` (#147)

* Add on_created_account for new account at inc_account_nonce

* Add the corresponding event check at test

* Properly handle `on_created_account` related to `inc_account_nonce` logic (#151)

* Properly handle new account creation related to inc_account_nonce

* Move outside mutate

* Do the check inside mutate

* Use mutate_exists

* Use get_or_insert_default at mutate_exists

Co-authored-by: MOZGIII <mike-n@narod.ru>

* Remove redundant mut

---------

Co-authored-by: MOZGIII <mike-n@narod.ru>

* Properly manage contract accounts creation and removal logic (#140)

* Introduce has_code to AccountInfo at pallet-evm-system

* Improve AccountProvider related naming

* Rework tests logic

* Use had_code in tuple

* Apply fmt

* Set has_code to true in case account exists

* Some renaming

* Explicitly set has_code to true at create_contract_account_fails test

* Introduce evm managed terminologies

* Apply fmt

* Improve comments in tests

* Add create_evm_managed_account_works_already_exists test

* Add more data checks in tests

* Use assert_storage_noop

* Improve docs for create_evm_managed_account call

Co-authored-by: MOZGIII <mike-n@narod.ru>

* Improve docs for remove_evm_managed_account call

Co-authored-by: MOZGIII <mike-n@narod.ru>

* Improve some docs

* Properly unmark that account is not managed by EVM

* Unify tests naming semantic

* Apply fmt

* Add migrations logic (#148)

* Add STORAGE_VERSION usage

* Add migrations structure

* Implement OnRuntimeUpgrade for MigrationV0ToV1

* Some improvements

* Implement logic for pre_upgrade and post_upgrade

* Use reference in EvmProvider

* Fix vec usage at try-runtime

* Properly use translate

* Use u64 for counting at try-runtime

* Properly use old Account storage alias

* Ensure storafe data is updated correctly

* Some renaming

* Renaming after another iteration of investigations

* Return prev implementation

* Dissallow removing account as pub method

* Minor refactoring

* Don't use managed_by_evm field

* Remove storage version usage

* Migrations renaming

* Remove unused logic at migrations and leave todo for future implementations

* Working migrations with todo

* Properly use nonce related operations

* Apply introduced logic in tests

* Apply fmt

* Tests refactoring

* Minor improvements

* Remove unused error

* Use create_account at account provider

* More info to comment

* Remove migrations from current code changes

* Use on_account_self_destruct naming

---------

Co-authored-by: MOZGIII <mike-n@narod.ru>

* Move to crates

---------

Co-authored-by: MOZGIII <mike-n@narod.ru>
dmitrylavrenov added a commit that referenced this pull request Feb 8, 2025
* Sovereign EVM balances layer (#95)

* Sovereign EVM balances layer (#87)

* Frame EVM balances (#65)

* Add initital frame balances structure

* Add account data balances logic

* Define main types

* Add imbalances logic

* Add DustCleaner

* Implement balances related operations

* Implement currencies for the pallet

* Implement Inspect for the pallet

* Make account_data mod private

* Leave only free balance data for account

* Support try-runtime features

* Apply formatting

* Fix comment

* Add mock with evm, evm-system, evm-balances configs

* Add basic setup test

* Add fee deduction test

* Add issuance_after_tip test

* Add refunds_should_work test

* Add refunds_and_priority_should_work test

* Fix clippy in tests

* Fix basec setup works test with evm balances checks

* Remove redundant set block in tests

* Add call_should_fail_with_priority_greater_than_max_fee test

* Add call_should_succeed_with_priority_equal_to_max_fee test

* Use EvmSystem as AccountProvider in tests

* Add account_should_be_reaped test

* Add deposit_into_existing test

* Add balance_transfer_works test

* Add slashing_balance_works test

* Add withdraw_balance_works test

* Add transferring_too_high_value_should_not_panic test

* Rename test to transfer_works

* Add basic tests for currency

* Add burn and issue related tests

* Add deposit_creating_works test

* Add currency_make_free_balance_be test

* Rename evm logic related tests

* Fix comment

* Rename slashing related test

* Rename test with make free balance

* Rename test with transferring too high value

* Assert evm system account existence for currency_deposit_creating_works test

* Add EvmSystem events check

* Remove license

* Use workspace dep

* Fix mock

* Remove deprecated trait Store

* Remove deprecated storage getter

* Add Apache-2.0 license

* Fix tests

* Apply required changes for fungible inspect trait
dmitrylavrenov added a commit that referenced this pull request Feb 8, 2025
…serving history (#1429)

* Sovereign accounts and EVM system layer (#94) (#99)

* Sovereign accounts and EVM system layer (#94)

* Sovereign accounts and EVM system layer (#86)

* Frame evm system (#62)

* Add initial impl of evm-system

* Check account existence

* Improve creation account logic

* Add new line

* Add default implementations

* Add mock

* Use DispatchResult instead of custom enums

* Basic create account tests

* Add simple tests with remove account and nonce update

* Remove default implementations for OnNewAccount and OnKilledAccount

* Add mock objects for OnNewAccount and OnKilledAccount

* Use mock logic in tests

* Some tests improvements

* Add docs to tests

* Check events in tests

* Add default implementation for OnNewAccount and OnKilledAccount for empty tuple (#63)

* Implement StoredMap for EvmSystem (#64)

* Add try-runtime feature into `pallet-evm-system` (#67)

Add try-runtime feature at pallet-evm-system

* Use `sp_std` library to add FromStr trait for tests at `pallet-evm-system` (#68)

Use sp_std library to add FromStr trait for tests at pallet-evm-system

* Rename FullAccount into Account at `pallet-evm-system` (#69)

Rename FullAccount into Account at pallet-evm-system

* Fix `try_mutate_exists` implementation and add tests to check it (#70)

* Fix try_mutate_exists logic

* Add tests

* Fix AccountData type at mock

* Remove redundant mock expectations

* Add comments for new tests

* More explicitly handle (none,false) case

* Rename some_data back to maybe_account_data

* Add data changes for try_mutate_exists_fails_without_changes test

* Add try_mutate_exists_account_not_created test

* Add assert_noop to check state chages

* Return success for try_mutate_exists_account_not_created test

* Use workspace deps

* Remove license

* Implement missed AccountProvider for EvmSystem

* Remove deprecated trait Store

* Add Apache-2.0 license

* Remove deprecated storage getter

* Remove redundant brackets

* Sovereign EVM balances layer (#100)

* Sovereign EVM balances layer (#95)

* Sovereign EVM balances layer (#87)

* Frame EVM balances (#65)

* Add initital frame balances structure

* Add account data balances logic

* Define main types

* Add imbalances logic

* Add DustCleaner

* Implement balances related operations

* Implement currencies for the pallet

* Implement Inspect for the pallet

* Make account_data mod private

* Leave only free balance data for account

* Support try-runtime features

* Apply formatting

* Fix comment

* Add mock with evm, evm-system, evm-balances configs

* Add basic setup test

* Add fee deduction test

* Add issuance_after_tip test

* Add refunds_should_work test

* Add refunds_and_priority_should_work test

* Fix clippy in tests

* Fix basec setup works test with evm balances checks

* Remove redundant set block in tests

* Add call_should_fail_with_priority_greater_than_max_fee test

* Add call_should_succeed_with_priority_equal_to_max_fee test

* Use EvmSystem as AccountProvider in tests

* Add account_should_be_reaped test

* Add deposit_into_existing test

* Add balance_transfer_works test

* Add slashing_balance_works test

* Add withdraw_balance_works test

* Add transferring_too_high_value_should_not_panic test

* Rename test to transfer_works

* Add basic tests for currency

* Add burn and issue related tests

* Add deposit_creating_works test

* Add currency_make_free_balance_be test

* Rename evm logic related tests

* Fix comment

* Rename slashing related test

* Rename test with make free balance

* Rename test with transferring too high value

* Assert evm system account existence for currency_deposit_creating_works test

* Add EvmSystem events check

* Remove license

* Use workspace dep

* Fix mock

* Remove deprecated trait Store

* Remove deprecated storage getter

* Add Apache-2.0 license

* Fix tests

* Apply required changes for fungible inspect trait

* Support `Mutate`, `Unbalanced`, `Balanced` fungible related traits for `pallet-evm-balances` (#102)

* Move currencies implementation into separate mod

* [substrate=apply] Deprecate Currency; introduce holds and freezing into fungible traits #12951

* Apply new balances logic to currency trait implementation

* Use DustRemoval over Credit instead of NegativeImbalance

* Implement Balanced, Unbalanced, Mutate fungible traits for pallet

* Revert using negative imbalance

* Apply formatter

* Fix withdraw_consequence method

* Move currency related tests to separate mod

* Add transfer_fails_funds_unavailable test to currency tests

* Add transfer_works_full_balance test to currency tests

* Fix slashing conditions

* Add slash_works_full_balance test to currency tests

* Add deposit_into_existing related fails tests

* Add withdraw_works_full_balance test to currency tests

* Add withdraw fails related tests to currency tests

* Add basic fungible tests

* Add reducable balance test to fungible tests

* Add can deposit related tests

* Fix can_withdraw logic

* Add can_withdraw related tests

* Add write_balance_works test

* Add set_total_issuance_works test

* Add decrease_balance related tests

* Add increase_balance related tests

* Add deactivate_reactivate_works test

* Add mint_into related tests

* Add burn_from related tests

* Add shelve related tests

* Add restored related tests

* Add transfer related tests

* Add balanced related tests

* Undo formatting

* Simplify reducible logic implementation

* Simplify can_deposit implementation

* Simplify can_withdraw implementation

* Properly use semantics of total and free balances

* Improve reducable_balance_works test

* Fix test race conditions

* Apply formatter for `pallet-evm-system` and `pallet-evm-balances` (#112) (#114)

Apply formatter for pallet-evm-system and pallet-evm-balances

* Use `execute_with_ext` in `pallet-evm-system` and `pallet-evm-balances` tests (#113) (#115)

Use execute_with_ext in pallet-evm-system and pallet-evm-balances tests

* Fix removing account logic at `pallet-evm-system` (#111) (#116)

* Add assert_total_issuance_invariant helper

* Add evm_system_removing_account_non_zero_balance test

* Fix removing account logic

* Undo redundant changes

* Redesign fix usage

* Undo try_mutate_exists_account_removed changes

* Rename Exists account removal status into Remains

* Improve docs

* Apply renaming at tests

* Use assert_storage_noop

* Remove rusttoolchain

* Add missing `on_created_account` logic usage for `inc_account_nonce` at `pallet-evm-system` (#147)

* Add on_created_account for new account at inc_account_nonce

* Add the corresponding event check at test

* Properly handle `on_created_account` related to `inc_account_nonce` logic (#151)

* Properly handle new account creation related to inc_account_nonce

* Move outside mutate

* Do the check inside mutate

* Use mutate_exists

* Use get_or_insert_default at mutate_exists

Co-authored-by: MOZGIII <mike-n@narod.ru>

* Remove redundant mut

---------

Co-authored-by: MOZGIII <mike-n@narod.ru>

* Properly manage contract accounts creation and removal logic (#140)

* Introduce has_code to AccountInfo at pallet-evm-system

* Improve AccountProvider related naming

* Rework tests logic

* Use had_code in tuple

* Apply fmt

* Set has_code to true in case account exists

* Some renaming

* Explicitly set has_code to true at create_contract_account_fails test

* Introduce evm managed terminologies

* Apply fmt

* Improve comments in tests

* Add create_evm_managed_account_works_already_exists test

* Add more data checks in tests

* Use assert_storage_noop

* Improve docs for create_evm_managed_account call

Co-authored-by: MOZGIII <mike-n@narod.ru>

* Improve docs for remove_evm_managed_account call

Co-authored-by: MOZGIII <mike-n@narod.ru>

* Improve some docs

* Properly unmark that account is not managed by EVM

* Unify tests naming semantic

* Apply fmt

* Add migrations logic (#148)

* Add STORAGE_VERSION usage

* Add migrations structure

* Implement OnRuntimeUpgrade for MigrationV0ToV1

* Some improvements

* Implement logic for pre_upgrade and post_upgrade

* Use reference in EvmProvider

* Fix vec usage at try-runtime

* Properly use translate

* Use u64 for counting at try-runtime

* Properly use old Account storage alias

* Ensure storafe data is updated correctly

* Some renaming

* Renaming after another iteration of investigations

* Return prev implementation

* Dissallow removing account as pub method

* Minor refactoring

* Don't use managed_by_evm field

* Remove storage version usage

* Migrations renaming

* Remove unused logic at migrations and leave todo for future implementations

* Working migrations with todo

* Properly use nonce related operations

* Apply introduced logic in tests

* Apply fmt

* Tests refactoring

* Minor improvements

* Remove unused error

* Use create_account at account provider

* More info to comment

* Remove migrations from current code changes

* Use on_account_self_destruct naming

---------

Co-authored-by: MOZGIII <mike-n@narod.ru>

* Avoid using `get_or_insert_default` (#154)

* Avoid using get_or_insert_default

* Use get_or_insert_with

* Rename frame to crates

* Add pallet- prefix to crates names

* Apply fmt

---------

Co-authored-by: MOZGIII <mike-n@narod.ru>
github-merge-queue bot pushed a commit that referenced this pull request Feb 9, 2025
… to humanode repo (#1430)

* Move `pallet-evm-balances` and `pallet-evm-system` from frontier, preserving history (#1429)

* Sovereign accounts and EVM system layer (#94) (#99)

* Sovereign accounts and EVM system layer (#94)

* Sovereign accounts and EVM system layer (#86)

* Frame evm system (#62)

* Add initial impl of evm-system

* Check account existence

* Improve creation account logic

* Add new line

* Add default implementations

* Add mock

* Use DispatchResult instead of custom enums

* Basic create account tests

* Add simple tests with remove account and nonce update

* Remove default implementations for OnNewAccount and OnKilledAccount

* Add mock objects for OnNewAccount and OnKilledAccount

* Use mock logic in tests

* Some tests improvements

* Add docs to tests

* Check events in tests

* Add default implementation for OnNewAccount and OnKilledAccount for empty tuple (#63)

* Implement StoredMap for EvmSystem (#64)

* Add try-runtime feature into `pallet-evm-system` (#67)

Add try-runtime feature at pallet-evm-system

* Use `sp_std` library to add FromStr trait for tests at `pallet-evm-system` (#68)

Use sp_std library to add FromStr trait for tests at pallet-evm-system

* Rename FullAccount into Account at `pallet-evm-system` (#69)

Rename FullAccount into Account at pallet-evm-system

* Fix `try_mutate_exists` implementation and add tests to check it (#70)

* Fix try_mutate_exists logic

* Add tests

* Fix AccountData type at mock

* Remove redundant mock expectations

* Add comments for new tests

* More explicitly handle (none,false) case

* Rename some_data back to maybe_account_data

* Add data changes for try_mutate_exists_fails_without_changes test

* Add try_mutate_exists_account_not_created test

* Add assert_noop to check state chages

* Return success for try_mutate_exists_account_not_created test

* Use workspace deps

* Remove license

* Implement missed AccountProvider for EvmSystem

* Remove deprecated trait Store

* Add Apache-2.0 license

* Remove deprecated storage getter

* Remove redundant brackets

* Sovereign EVM balances layer (#100)

* Sovereign EVM balances layer (#95)

* Sovereign EVM balances layer (#87)

* Frame EVM balances (#65)

* Add initital frame balances structure

* Add account data balances logic

* Define main types

* Add imbalances logic

* Add DustCleaner

* Implement balances related operations

* Implement currencies for the pallet

* Implement Inspect for the pallet

* Make account_data mod private

* Leave only free balance data for account

* Support try-runtime features

* Apply formatting

* Fix comment

* Add mock with evm, evm-system, evm-balances configs

* Add basic setup test

* Add fee deduction test

* Add issuance_after_tip test

* Add refunds_should_work test

* Add refunds_and_priority_should_work test

* Fix clippy in tests

* Fix basec setup works test with evm balances checks

* Remove redundant set block in tests

* Add call_should_fail_with_priority_greater_than_max_fee test

* Add call_should_succeed_with_priority_equal_to_max_fee test

* Use EvmSystem as AccountProvider in tests

* Add account_should_be_reaped test

* Add deposit_into_existing test

* Add balance_transfer_works test

* Add slashing_balance_works test

* Add withdraw_balance_works test

* Add transferring_too_high_value_should_not_panic test

* Rename test to transfer_works

* Add basic tests for currency

* Add burn and issue related tests

* Add deposit_creating_works test

* Add currency_make_free_balance_be test

* Rename evm logic related tests

* Fix comment

* Rename slashing related test

* Rename test with make free balance

* Rename test with transferring too high value

* Assert evm system account existence for currency_deposit_creating_works test

* Add EvmSystem events check

* Remove license

* Use workspace dep

* Fix mock

* Remove deprecated trait Store

* Remove deprecated storage getter

* Add Apache-2.0 license

* Fix tests

* Apply required changes for fungible inspect trait

* Support `Mutate`, `Unbalanced`, `Balanced` fungible related traits for `pallet-evm-balances` (#102)

* Move currencies implementation into separate mod

* [substrate=apply] Deprecate Currency; introduce holds and freezing into fungible traits #12951

* Apply new balances logic to currency trait implementation

* Use DustRemoval over Credit instead of NegativeImbalance

* Implement Balanced, Unbalanced, Mutate fungible traits for pallet

* Revert using negative imbalance

* Apply formatter

* Fix withdraw_consequence method

* Move currency related tests to separate mod

* Add transfer_fails_funds_unavailable test to currency tests

* Add transfer_works_full_balance test to currency tests

* Fix slashing conditions

* Add slash_works_full_balance test to currency tests

* Add deposit_into_existing related fails tests

* Add withdraw_works_full_balance test to currency tests

* Add withdraw fails related tests to currency tests

* Add basic fungible tests

* Add reducable balance test to fungible tests

* Add can deposit related tests

* Fix can_withdraw logic

* Add can_withdraw related tests

* Add write_balance_works test

* Add set_total_issuance_works test

* Add decrease_balance related tests

* Add increase_balance related tests

* Add deactivate_reactivate_works test

* Add mint_into related tests

* Add burn_from related tests

* Add shelve related tests

* Add restored related tests

* Add transfer related tests

* Add balanced related tests

* Undo formatting

* Simplify reducible logic implementation

* Simplify can_deposit implementation

* Simplify can_withdraw implementation

* Properly use semantics of total and free balances

* Improve reducable_balance_works test

* Fix test race conditions

* Apply formatter for `pallet-evm-system` and `pallet-evm-balances` (#112) (#114)

Apply formatter for pallet-evm-system and pallet-evm-balances

* Use `execute_with_ext` in `pallet-evm-system` and `pallet-evm-balances` tests (#113) (#115)

Use execute_with_ext in pallet-evm-system and pallet-evm-balances tests

* Fix removing account logic at `pallet-evm-system` (#111) (#116)

* Add assert_total_issuance_invariant helper

* Add evm_system_removing_account_non_zero_balance test

* Fix removing account logic

* Undo redundant changes

* Redesign fix usage

* Undo try_mutate_exists_account_removed changes

* Rename Exists account removal status into Remains

* Improve docs

* Apply renaming at tests

* Use assert_storage_noop

* Remove rusttoolchain

* Add missing `on_created_account` logic usage for `inc_account_nonce` at `pallet-evm-system` (#147)

* Add on_created_account for new account at inc_account_nonce

* Add the corresponding event check at test

* Properly handle `on_created_account` related to `inc_account_nonce` logic (#151)

* Properly handle new account creation related to inc_account_nonce

* Move outside mutate

* Do the check inside mutate

* Use mutate_exists

* Use get_or_insert_default at mutate_exists

Co-authored-by: MOZGIII <mike-n@narod.ru>

* Remove redundant mut

---------

Co-authored-by: MOZGIII <mike-n@narod.ru>

* Properly manage contract accounts creation and removal logic (#140)

* Introduce has_code to AccountInfo at pallet-evm-system

* Improve AccountProvider related naming

* Rework tests logic

* Use had_code in tuple

* Apply fmt

* Set has_code to true in case account exists

* Some renaming

* Explicitly set has_code to true at create_contract_account_fails test

* Introduce evm managed terminologies

* Apply fmt

* Improve comments in tests

* Add create_evm_managed_account_works_already_exists test

* Add more data checks in tests

* Use assert_storage_noop

* Improve docs for create_evm_managed_account call

Co-authored-by: MOZGIII <mike-n@narod.ru>

* Improve docs for remove_evm_managed_account call

Co-authored-by: MOZGIII <mike-n@narod.ru>

* Improve some docs

* Properly unmark that account is not managed by EVM

* Unify tests naming semantic

* Apply fmt

* Add migrations logic (#148)

* Add STORAGE_VERSION usage

* Add migrations structure

* Implement OnRuntimeUpgrade for MigrationV0ToV1

* Some improvements

* Implement logic for pre_upgrade and post_upgrade

* Use reference in EvmProvider

* Fix vec usage at try-runtime

* Properly use translate

* Use u64 for counting at try-runtime

* Properly use old Account storage alias

* Ensure storafe data is updated correctly

* Some renaming

* Renaming after another iteration of investigations

* Return prev implementation

* Dissallow removing account as pub method

* Minor refactoring

* Don't use managed_by_evm field

* Remove storage version usage

* Migrations renaming

* Remove unused logic at migrations and leave todo for future implementations

* Working migrations with todo

* Properly use nonce related operations

* Apply introduced logic in tests

* Apply fmt

* Tests refactoring

* Minor improvements

* Remove unused error

* Use create_account at account provider

* More info to comment

* Remove migrations from current code changes

* Use on_account_self_destruct naming

---------

Co-authored-by: MOZGIII <mike-n@narod.ru>

* Avoid using `get_or_insert_default` (#154)

* Avoid using get_or_insert_default

* Use get_or_insert_with

* Rename frame to crates

* Add pallet- prefix to crates names

* Apply fmt

---------

Co-authored-by: MOZGIII <mike-n@narod.ru>

* Preparations for moving `pallet-evm-balances` and `pallet-evm-system` into humanode repo (#1422)

* Fix toml files

* Properly use codec

* Edit libs docs

* Fix features

* Update features snapshot

* Fix typo

* Allow missing_docs_in_private_items for pallets

* Fix missing docs at pallet-evm-system

* Fix math side affect at pallet-evm-system

* Fix clippy in tests at pallet-evm-system

* Edit tests related docs

* Fix clippy in tests at pallet-evm-balances

* Fix missing docs at pallet-evm-balances

* Fix math side affect at pallet-evm-balances

* Fix clippy

* Switch to local pallet-evm-balances and pallet-evm-system

* Fix fmt

* Prettify try_mutate_account_handling_dust usage

---------

Co-authored-by: MOZGIII <mike-n@narod.ru>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants