Skip to content
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

fix: migration for earned fees #4733

Merged
merged 6 commits into from
Apr 8, 2024
Merged

fix: migration for earned fees #4733

merged 6 commits into from
Apr 8, 2024

Conversation

dandanlen
Copy link
Collaborator

Pull Request

Closes: PRO-1289

Checklist

Please conduct a thorough self-review before opening the PR.

  • I am confident that the code works.
  • I have updated documentation where appropriate.

Summary

Converted the stored AssetMap to a StorageDoubleMap to allow looking up the value directly. This makes storage writes more efficient (and the storage is accessed quite frequently - see the weights files).

This also makes adding new assets simpler: adding a new asset won't require storage migrations in future since the amount defaults to zero.

I also added utilites to build and AssetMap from a (possibly incomplete) list of (Asset, T) pairs. This allows backward-compatible defaulting of the value in the asset map.

@dandanlen dandanlen force-pushed the fix/asset-map-migration-arb branch from 54a31d9 to 7e5acb5 Compare April 5, 2024 09:12
Copy link

codecov bot commented Apr 5, 2024

Codecov Report

Attention: Patch coverage is 60.37736% with 21 lines in your changes are missing coverage. Please review.

Project coverage is 72%. Comparing base (82285bc) to head (af421e0).

Files Patch % Lines
state-chain/pallets/cf-lp/src/migrations/v2.rs 0% 20 Missing ⚠️
state-chain/runtime/src/lib.rs 0% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@          Coverage Diff           @@
##            main   #4733    +/-   ##
======================================
- Coverage     72%     72%    -0%     
======================================
  Files        421     422     +1     
  Lines      70683   70586    -97     
  Branches   70683   70586    -97     
======================================
- Hits       51220   51041   -179     
- Misses     17037   17112    +75     
- Partials    2426    2433     +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dandanlen dandanlen enabled auto-merge (squash) April 8, 2024 08:35
@dandanlen dandanlen merged commit a07a4c6 into main Apr 8, 2024
46 checks passed
@dandanlen dandanlen deleted the fix/asset-map-migration-arb branch April 8, 2024 09:05
syan095 added a commit that referenced this pull request Apr 8, 2024
…-validator

* origin/main:
  fix: broker flakiness on bouncer CI (#4736)
  fix: migration for earned fees (#4733)
  feat: handle prewitness deposits (#4698)
  Update Sdk with Arbitrum support (#4720)
  chore: remove insta deprecated warning (#4734)
  refactor: move vanity names to account roles pallet (#4719)
  Arbitrum backup rpc (#4730)

# Conflicts:
#	state-chain/pallets/cf-validator/src/lib.rs
#	state-chain/pallets/cf-validator/src/mock.rs
#	state-chain/pallets/cf-validator/src/tests.rs
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.

3 participants