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

Acknowledge packets asynchronously #1392

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
chore: changelog for #1392
sug0 committed Jan 17, 2025
commit 2adeb6b9133680a5dd60d0cffaadd95c8799619a
2 changes: 2 additions & 0 deletions .changelog/unreleased/features/1392-optional-ack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Support asynchronous packet acknowledgements.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Support asynchronous packet acknowledgements.
- [ibc-core] Support asynchronous packet acknowledgements.

([\#1392](https://github.com/cosmos/ibc-rs/pull/1392))

Unchanged files with check annotations Beta

let next_seq_recv = ctx_b.get_next_sequence_recv(&seq_recv_path_on_b)?;
ctx_b.store_next_sequence_recv(&seq_recv_path_on_b, next_seq_recv.increment())?;
}
_ => {}

Check warning on line 44 in ibc-core/ics04-channel/src/handler/acknowledgement.rs

Codecov / codecov/patch

ibc-core/ics04-channel/src/handler/acknowledgement.rs#L44

Added line #L44 was not covered by tests
}
Ok(())
}
pub fn commit_packet_sequence_number<ExecCtx>(
ctx_b: &mut ExecCtx,
packet: &Packet,
) -> Result<(), ChannelError>
where
ExecCtx: ExecutionContext,
{
let chan_end_path_on_b = ChannelEndPath::new(&packet.port_id_on_b, &packet.chan_id_on_b);
let chan_end_on_b = ctx_b.channel_end(&chan_end_path_on_b)?;

Check warning on line 58 in ibc-core/ics04-channel/src/handler/acknowledgement.rs

Codecov / codecov/patch

ibc-core/ics04-channel/src/handler/acknowledgement.rs#L50-L58

Added lines #L50 - L58 were not covered by tests
commit_packet_sequence_number_with_chan_end(ctx_b, &chan_end_on_b, packet)
}

Check warning on line 61 in ibc-core/ics04-channel/src/handler/acknowledgement.rs

Codecov / codecov/patch

ibc-core/ics04-channel/src/handler/acknowledgement.rs#L60-L61

Added lines #L60 - L61 were not covered by tests
pub fn commit_packet_acknowledgment<ExecCtx>(
ctx_b: &mut ExecCtx,
Ok(())
}
pub fn emit_packet_acknowledgement_event<ExecCtx>(
ctx_b: &mut ExecCtx,
packet: Packet,
acknowledgement: Acknowledgement,
) -> Result<(), ChannelError>
where
ExecCtx: ExecutionContext,
{
let chan_end_path_on_b = ChannelEndPath::new(&packet.port_id_on_b, &packet.chan_id_on_b);
let chan_end_on_b = ctx_b.channel_end(&chan_end_path_on_b)?;

Check warning on line 112 in ibc-core/ics04-channel/src/handler/acknowledgement.rs

Codecov / codecov/patch

ibc-core/ics04-channel/src/handler/acknowledgement.rs#L103-L112

Added lines #L103 - L112 were not covered by tests
emit_packet_acknowledgement_event_with_chan_end(ctx_b, &chan_end_on_b, packet, acknowledgement)
}

Check warning on line 115 in ibc-core/ics04-channel/src/handler/acknowledgement.rs

Codecov / codecov/patch

ibc-core/ics04-channel/src/handler/acknowledgement.rs#L114-L115

Added lines #L114 - L115 were not covered by tests
pub fn acknowledgement_packet_validate<ValCtx>(
ctx_a: &ValCtx,
msg.packet,
acknowledgement,
)?;
}

Check warning on line 105 in ibc-core/ics04-channel/src/handler/recv_packet.rs

Codecov / codecov/patch

ibc-core/ics04-channel/src/handler/recv_packet.rs#L105

Added line #L105 was not covered by tests
// module specific events/logs
for module_event in extras.events {
&mut self,
_packet: &Packet,
_relayer: &Signer,
) -> (ModuleExtras, Option<Acknowledgement>) {

Check warning on line 67 in ibc-testkit/src/testapp/ibc/applications/nft_transfer/module.rs

Codecov / codecov/patch

ibc-testkit/src/testapp/ibc/applications/nft_transfer/module.rs#L67

Added line #L67 was not covered by tests
(
ModuleExtras::empty(),
Some(Acknowledgement::try_from(vec![1u8]).expect("Never fails")),

Check warning on line 70 in ibc-testkit/src/testapp/ibc/applications/nft_transfer/module.rs

Codecov / codecov/patch

ibc-testkit/src/testapp/ibc/applications/nft_transfer/module.rs#L70

Added line #L70 was not covered by tests
)
}