Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement abstract and mock IBC v2 components (#445)
* Add hermes-ibc-components crate * Scaffold IBC v2 packet types * Scaffold packet handlers * Draft outgoing packet handlers * Draft packet ack handlers * Rename PacketPayload to PacketEntry * Draft commitment verification * Draft packet commitment value builder * Add HasPacketType * Draft more commitment verification methods * Implement StorePacketAck and define CanQueryConsensusState * Implement VerifySendPacketCommitmentProof * Replace RawPacket-Entry/Ack with AnyApp * Implement DisallowDoubleReceive * Implement HandleIncomingPacketEntries * Define IbcChainComponents with IncomingPacketHandlerComponent * Implement DisallowTimedOutIncomingPacket * Generalize IncomingPacketHandler to work with generic App instead of AnyApp * Swap the generic order from <App, Counterparty> to <Counterparty, App> * Use HasCommitmentProofType from chain-type-components * WIP * Minor refactoring * Add IgnoreDoubleReceive * Implement EncodeAndHandlePacketEntry * Implement WrapHandlerErrorAsAck * Add IbcTransaction type * Draft IBC transaction and message handlers * Add CanAllocatePacketNonce * Implement CommitSendPacket * Add CanQuerySendPacketCommitment * Make PacketAck singular, and add PacketEntryAck as sub-list * Make WrapHandlerErrorAsAck a IncomingPacketHandler * Add <App> generic to FullIncomingPacketHandler * Add WrapHandlerErrorAsAck to FullIncomingPacketHandler * Add PacketAck getter and builder * Add CanBuildPacket * Implement HandleIbcTransactionMessages * Rename ClientId to ChannelId * Move builder traits to builder:: module * Add IbcMessageHeader type * Implement ValidateHeaderAppIds * Implement ConvertAndHandleIbcMessage * Implement IbcMessageHandler and IncomingPacketEntryHandler for UseContext * Rename HasPacketEntryHeaderType to HasPayloadType * Rename HasPacketDataType to HasPayloadDataType * Rename CanHandleIncomingPacketEntry to CanHandleIncomingPayload * Rename and redesign ack handlers * Replace more use of "entries" * Remove remaining use of "entries" * Move message and transaction handlers to outgoing::module * Add InHandler to HandleIbcTransactionMessages * Add new ibc-token-transfer-components crate * Move HasAddressType and HasDenomType to chain-type-components * Add HasQuantityType * Draft IBC transfer payload fields * Add HasAmountType * Draft mint traits * Draft mint registry * Draft implement HandleIncomingIbcTransfer * Check and update escrowed aamount for HandleIncomingIbcTransfer * Implement DispatchMintOrUnescrow * Use CanParseIncomingTransferData in DispatchMintOrUnescrow * Implement HandleIncomingMintTransfer * Implement HandleIncomingUnescrowTransfer * Remove HasIbcTransferAmount * Drafting SendIbcTransfer * Finish implementing SendIbcTransfer * Add ibc-mock-chain crate * Implement ProvideStringError * Implement MockChain with HasErrorType * Implement HasAppIdType for MockChain * Implement HasChannelId for MockChain * Implement HasPacketHeaderType and HasPacketChannelIds * Implement HasPacketNonce * Use upstream FieldGetter * Implement HasPacketPayloads * Implement HasPacketTimeout * Implement HasPayloadAppIds * Implement HasIbcMessageAppIds * Use delegated type map for PacketData * Add Transfer PacketData types * Implement HasDenomType and HasAmountType * Implement PacketData types for IBC transfer * Add tagging to MockChain * Add tags to all mock values * Add back phantom Chain generic to IbcTransferUnescrowPacketData * Implement custom provider types for ProvidePayloadDataType * Add custom providers for other generic IBC types * Use "Use" instead of "Provide" for name of type providers * Rename DelegateTo to UseDelegate * Add UseTaggedType to simplify provider impl for tagged types * imp: remove ack from incoming packet handlers * chore: remove further acks * chore: remove packet ack types * Add explicit tags to MockChain * Add state fields to mock chain * Implement clone for MockChain * Remove HasPayloadAckType * Add HasPayloadType and CanSendPacket * Use IbcPayload inside IbcPacket * Make IbcMessage handler return payload directly * Implement AllocateNonceAndBuildPacket * Implement CommitSendPacket * Implement HandleMessagesAndSendPacket * Remove transaction handlers replaced by packet senders * Make IbcMessageHandler return payload header and data separately again * Implement CheckSendPayloadPermission * Use chain-level caller instead of putting it in ibc-transaction * Add CanQueryClientIdFromChannelId * Move packet nonce field to packet instead of packet header * Replace IbcTransactionHeader with PacketHeader * Rename MockChainFields to MockChainState * Add some documentation for HasPacketType * Simplify implementation of token transfer dispatcher * Add direct tags to mock denom and amount * Put MockChainState behind Mutex * Add mock balances field * Implement mint on mock chain * Implement remaining TokenTransfer methods * Implement mint registry methods * Fix clippy * Implement amount methods * Implement CanHandleIncomingPayload for IbcTransferMintApp * Fix clippy * Implement UnescrowTokenRegistrar * Implement EscrowTokenRegistrar * Add documentation for escrow registry * Remove UnescrowAmountExceeded error * Implement CanHandleIncomingPayload for IbcTransferUnescrowApp and IbcTransferApp * Implement CanHandleIncomingPayload for AnyApp * Use HandleIncomingPacketPayloads * Refactor commitment path construction * Implement commitment path builders * Implement HasConsensusStateType * Implement commitment value builders * Implement ConsensusStateQuerier * Implement CommitmentVerifier * Implement CommitmentStorage * Use CommitReceivePacket * Add generic tag parameter to commitment type traits * Use different commitment types for mock send and receive packet * Implement HasCommitmentProofHeight * Implement ClientIdFromChannelIdQuerier * Use VerifySendPacketCommitmentProof * Implement HasPacketReceivedQuerier * Use DisallowDoubleReceive * Implement time methods * Use FullIncomingPacketHandler directly * Reformat imports * Fix clippy * Implement CanAllocatePacketNonce * Implement CanBuildPacket and CanSendPacket * Implement transfer payload builders * Implement HasIbcMessageType * Refine component wiring * Wire up IBC message handler * Use &mut self for handlers for state update * Remove mutex and update mock chain state directly * Implement HasCaller * Implement message handler for IbcTransferApp * Update cgp * Add changelog --------- Co-authored-by: Farhad Shabani <[email protected]>
- Loading branch information