-
Notifications
You must be signed in to change notification settings - Fork 86
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
Feat/lp v2 use gateway queue #1937
Conversation
* wip: add new msgs + reorder * refactor: apply renaming * fix: ITs * feat: UpdateRestriction message * fix: cancel_unprocessed_investment IT * fix: fmt * fix: clippy * tests: reanchor solidity to reorder branch * feat: apply hook to AddTranche msg * tests: fix pool_management ITs * wip: fix lp investments * fmt * fix: Tranche namespace * refactor: remove fulfilled from FulfilledRedeemRequest * chore: update lp submodule * minor cleanup * chore: update lp submodule * chore: add missing cleanup * fixes + ignore failing tests * fmt * tests: fix message indices
* add uts (#1905) * main changes for FI * fix correlation precission * minor renames * update investment UTs * update redemption UTs * miscelaneous UTs * minor renames * simplify correlation and embed to the only needed place * doc change * remove unused bound * swapping calls into entities.rs file * merge SwapDone methods into FulfilledSwapHook * fix events * working without pallet-swaps * remove boilerplate for removing entries * minor msg change * minor simplification * correct fulfilled sum after last collect * check OrderIdToSwapId storage * sending the message inside Info closure is not really a problem * send msgs from the entities * remove same currency check in impl.rs * unify hooks * remove pallet-swaps * minor fmt * add docs * add architecture diagram * return cancelled foreign amount from FI interface * update liquidity-pools * add messages to diagram * implement hooks * fix runtimes * adapt integration-tests * fix docs * fix clippy
* chore: update submodule to latest `main` 6d7f242c0dd83b1b5a4f6d506370a1f3ecbef9ce * wip: fix ITs * chore: update submodule * fix: remove sender param from `Transfer*` messages * chore: cleanup * docs: setup evm * fix: msg tests * fix: more ITs * fix: missing refactor after rebase * chore: update submodule to 223a0f36edabc675f8c74c47b20e366178df7ca3 * chore: improvements * fmt * Apply suggestions from code review * chore: bump spec_version * fmt: taplo
* custo serialize/deserialize for batch * compiling solution * serialization/deserialization working for batch message * remove gmpf changes * add batch nested protection * faster serialization for submessages * correct termination * add tests for deserialize batch of batch * add into_iter * remove unused Box and add pack methods * fix non_std compilation * non_std * fix max_encoded_len recursion issue * fix submodules * reduce batch limit
* refactor: add domain hook address storage * tests: add gateway lp admin account checks * refactor: use GetByKey * fix: outboundq mock * refactor: hook 20 bytes instead of 32
* pallets: Add LP Gateway queue pallet * lp-gateway-queue: Add benchmarks * integration-tests: Add LP gateway tests * docs: Update LP gateway queue entry * lp-gateway-queue: Use default weight for PostDispatchInfo * lp-gateway-queue: Add DEFAULT_WEIGHT_REF_TIME const, extract message processing logic, use BaseArithmetic for nonce * runtime: Add defensive weights for LP gateway queue * lint: Obey * taplo: Obey * pallet: Use DispatchResult for extrinsics * runtime: Update benchmarks and weight info * benchmarks: Add default for Message type (wip) * pallet: Add Default bound to Message type
* fix: add remark call to borrow proxy * fix: add missing message fields * chore: bump to v0.13.3 * chore: update submodule * chore: enable fixed tests --------- Co-authored-by: Frederik Gartenmeister <[email protected]>
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.
Everything looks pretty good! I think gateway is much more organized now and love how the gateway interacts with the queue.
For reference to other reviewers:
MessageQueue
trait is used by the gateway and implemented by the queue to enqueue both inbound and outbound messages.MesageProcessor
trait is used by the queue and implemented by the gateway to unqueue both inbound and outbound messagesOutboundMessageHandler
liquidity-pools sending a outbound message to the gatewayInboundMessageHandler
the gateway sending inbound messages to liquidity-pools
//TODO(cdamian): Migration? | ||
// #[pallet::storage] | ||
// #[pallet::getter(fn outbound_message_nonce_store)] | ||
// pub type OutboundMessageNonceStore<T: Config> = | ||
// StorageValue<_, T::OutboundMessageNonce, ValueQuery>; | ||
|
||
//TODO(cdamian): Migration? | ||
// /// Storage for outbound messages that will be processed during the | ||
// /// `on_idle` hook. | ||
// #[pallet::storage] | ||
// #[pallet::getter(fn outbound_message_queue)] | ||
// pub type OutboundMessageQueue<T: Config> = StorageMap< | ||
// _, | ||
// Blake2_128Concat, | ||
// T::OutboundMessageNonce, | ||
// (Domain, T::AccountId, T::Message), | ||
// >; | ||
|
||
//TODO(cdamian): Migration? | ||
// /// Storage for failed outbound messages that can be manually re-triggered. | ||
// #[pallet::storage] | ||
// #[pallet::getter(fn failed_outbound_messages)] | ||
// pub type FailedOutboundMessages<T: Config> = StorageMap< | ||
// _, | ||
// Blake2_128Concat, | ||
// T::OutboundMessageNonce, | ||
// (Domain, T::AccountId, T::Message, DispatchError), | ||
// >; |
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.
Good question, I would say no if we're sure we do not have any content on it when the RU is executed. The message nonce is just to identify the message in order to process any pending/failing, right? I would say we can reset that number too and save us from writing an annoying migration.
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.
Hmm, depends on how the RU update happens. I would imagine that it would happen after a block is produced, thus after an on_idle
hook is called.
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.
I meant over a human period of time. Basically we need to know if we need to maintain the message state because the users are using it at that moment or we can just assume that they will not be using it when the RU is enacted.
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.
Asumming there're no storage or just purge it
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.
@wischli, how do you see adding this to the current RU? THat way we avoid future migration problems because now we need to ensure we have not message there.
If we go with it, just we need to upgrade the version number of this pallet. And adding a reset migration to clean the Nonce storage. WDYT? Of course, I do not want to delay the RU, just if we have time to do it.
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.
Forgot the above, I think we can ensure the same conditions easily in the next RU
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.
My understanding was that we can assume there won't be any pending LP messages when we trigger the execution of the update. However, after triggering the RU, it takes one hour for it to be live. Right now, we cannot block those permissionless extrinsics which create outgoing messages. So theoretically, there is a chance. Let's discuss this in the Eng sync today.
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.
So we're safe if I understand that correctly in the sync 😆
runtime/integration-tests/src/cases/liquidity_pools_gateway_queue.rs
Outdated
Show resolved
Hide resolved
d9cac02
to
916c1e3
Compare
runtime/integration-tests/src/cases/liquidity_pools_gateway_queue.rs
Outdated
Show resolved
Hide resolved
runtime/integration-tests/src/cases/liquidity_pools_gateway_queue.rs
Outdated
Show resolved
Hide resolved
runtime/integration-tests/src/cases/liquidity_pools_gateway_queue.rs
Outdated
Show resolved
Hide resolved
runtime/integration-tests/src/cases/liquidity_pools_gateway_queue.rs
Outdated
Show resolved
Hide resolved
* increase version for foreign investments * fix investment issue * fix solidity call for transfers_tokens * fix tests * minimize required tranche investors for IT * fix docs * fix docs * docs: fix hyperlink * refactor: enable ITs for centrifuge + dev runtimes (#1938) * fix: enable ITs for centrifuge + dev runtimes * fmt * fix: revert some centrifuge ITs * fmt * revert centrifuge addition to ITs --------- Co-authored-by: William Freudenberger <[email protected]>
…d specific inbound tests
1e47f89
to
5b23d2a
Compare
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.
Really really love the test improvements here. Just one minor comment in order to be more DRY
GatewayMessage::Outbound { | ||
sender: <T as pallet_liquidity_pools_gateway::Config>::Sender::get(), | ||
destination: Domain::EVM(EVM_DOMAIN_CHAIN_ID), | ||
message: Message::FulfilledCancelDepositRequest { | ||
pool_id: POOL_A, | ||
tranche_id: pool_a_tranche_1_id::<T>(), | ||
investor: vec_to_fixed_array(lp::utils::remote_account_of::<T>( | ||
Keyring::TrancheInvestor(1) | ||
)), | ||
currency: utils::index_lp(evm, names::USDC), | ||
currency_payout: DEFAULT_INVESTMENT_AMOUNT, | ||
fulfilled_invest_amount: DEFAULT_INVESTMENT_AMOUNT, | ||
}, | ||
}, |
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.
Maybe here, the sender/destination can just be checked inside the process_outbound
method, leaving each test as before without that overhead
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.
I mean, I think for all cases the sender
and destination
are always the same
}); | ||
} | ||
|
||
#[test_runtimes(all)] | ||
fn submit_by_axelar_evm<T: Runtime + FudgeSupport>() { | ||
fn submit_by_axelar_evm<T: Runtime>() { |
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.
Thanks for realizing that this does not require xcm and then it can be done without fudge 💯
Tons-o-conflicts 🎉 Gonna close this PR and open a new one after I manage to rebase successfully... |
Description
Use the new Gateway Queue pallet in LP and LP gateway.
Changes and Descriptions
pallet-liquidity-pools-gateway-queue
for queueing inbound and outbound message in the LP gateway.Checklist: