-
Notifications
You must be signed in to change notification settings - Fork 15
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
refactor: Remove RpcAsset (PRO-1187) #4491
Conversation
e629301
to
51ba969
Compare
squash Add back chain::Asset serde impls (Needed for GenesisConfig `dust_limits`) squash squash squash squash Serde squash serde
squash squash squash remove rpc asset
squash asssetmap squash
51ba969
to
4d19533
Compare
…ncodings where needed squash cargo fmt --all
4d19533
to
e6485ef
Compare
Note there is one other breaking change, to the ingress-egress tracker, but I agreed with @acdibble that this is ok. The change is moving from the OldAsset encoding to the new RpcAsset style encoding. |
Also I added the option to do "{"asset": "ETH"}", which I think makes sense while we allow the chain to be implicit. But happy to change back. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #4491 +/- ##
======================================
- Coverage 73% 73% -0%
======================================
Files 401 401
Lines 68276 68048 -228
Branches 68276 68048 -228
======================================
- Hits 49697 49445 -252
- Misses 15922 15972 +50
+ Partials 2657 2631 -26 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice.
Wen ChainMap 😆 ?
Would be good to talk about how this extends to new chains (ie. arbitrum: ArbEth vs (Arb, Eth) etc.
4c7acba
to
31f2039
Compare
…igned-error * origin/main: chore: fetch solana state from docker (#4538) feat: charge a fee for opening swap deposit addresses (#4512) refactor: Remove RpcAsset (PRO-1187) (#4491) fix: re-add version update (#4533) fix: pull first (#4526) feat: auto pick non-breaking changes (#4498) # Conflicts: # state-chain/pallets/cf-ingress-egress/src/lib.rs # state-chain/pallets/cf-ingress-egress/src/tests.rs
This changes the serde impls of any::Asset, to match those of the existing RpcAsset, and then replaces every usage of RpcAsset with Asset. Also in the places we previously used the serde impl of Asset, I've added a OldAsset type to provide matching behaviour (so we don't break the interfaces). The existing serde impl on Asset, only allowed "Eth"/"Usdc" etc, which is not what we want so we will need to replace those uses of OldAsset, with v2 rpcs etc at some point, which I will create a ticket to do.
This also introduces the AssetMap types, that provide compile time safe "asset->item" maps.
In a few of the CLI commands we allow parameters like source_asset, and source_chain. I removed this option, as I feel strongly using separate arguments to allow users to explicitly specify the chain is not the right approach. If we care about this functionality, I'd suggest we use something allow something like: "Ethereum:USDC" (Just for the CLI). (I can change this back, but I feel the current design doesn't work nicely with the direction we intend to go with always specifying the chain).
I'm going to replace
Asset
withForeignChainAndAsset
(of course renaming it toAsset
), but will do so later. As this PR makes sense on its own (And doing so will take abit more time then I'd like to spend atm).Note this is split into atomic commits:
Finally the only breaking change in this PR, is the change to the CLI mentioned above, all the other interfaces are unchanged, but I had to change one of the snapshots because in the unit tests previous in the HashMap<ForeignChain, HashMap<Asset, T>> we didn't include all the assets and chains, but my new AssetMaps always have all assets/chains, but in all the real interfaces this is true always anyway.