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

zoneconcierge: repurpose heartbeat mechanism to a generic function #233

Merged
merged 3 commits into from
Dec 5, 2022

Conversation

SebastianElvis
Copy link
Member

Fixes BM-341

This PR removes the heartbeat packet functionality, and repurposes the SendHeartbeatIBCPacket function to a generic function for sending any IBC packets.

Instead, we will make the relayer to solely update light clients for the phase-1 integration, without using any IBC channel or packet. The phase-1 integration will only require a CZ to establish an IBC connection with Babylon.

Copy link
Contributor

@gitferry gitferry left a comment

Choose a reason for hiding this comment

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

LGTM! Only left a minor question. Please help me recall why we want heartbeat in the first place and why we do not need it now. Did I miss something?

Instead, we will make the relayer to solely update light clients for the phase-1 integration, without using any IBC channel or packet. The phase-1 integration will only require a CZ to establish an IBC connection with Babylon.

Just wanted to understand more about the context. Does it mean we will have a modified relayer that only does CZ -> Babylon updates?

@@ -62,9 +59,9 @@ func (k Keeper) SendHeartbeatIBCPacket(ctx sdk.Context, channel channeltypes.Ide
// send packet
if err := k.ics4Wrapper.SendPacket(ctx, channelCap, packet); err != nil {
// Failed/timeout packet should not make the system crash
k.Logger(ctx).Error(fmt.Sprintf("failed to send heartbeat IBC packet to channel %v port %s: %v", destinationChannel, destinationPort, err))
k.Logger(ctx).Error(fmt.Sprintf("failed to send IBC packet %v to channel %v port %s: %v", packet, destinationChannel, destinationPort, err))
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this pollute the log if the packet is very big?

Copy link
Member Author

Choose a reason for hiding this comment

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

Agree. Changed to the sequence number that uniquely identifies a packet.

} else {
k.Logger(ctx).Info(fmt.Sprintf("successfully sent heartbeat IBC packet to channel %v port %s", destinationChannel, destinationPort))
k.Logger(ctx).Info(fmt.Sprintf("successfully sent IBC packet %v to channel %v port %s", packet, destinationChannel, destinationPort))
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here

@SebastianElvis
Copy link
Member Author

LGTM! Only left a minor question. Please help me recall why we want heartbeat in the first place and why we do not need it now. Did I miss something?

Good question, this was a long story 🤣

As we know, the relayer is lazy in the sense that it updates the light clients only when there exists an IBC packet. Previously, the integration was assumed to work in a way that the partner CZs are responsible for maintaining the relayers and establishing IBC channels. Since we have no control on how they will use the relayer, we provide the heartbeat mechanism to ease their jobs.

When we started the integration process in the previous two weeks, we however ended up establishing everything by ourselves, partially due to the Thanksgiving long weekend in the US. The relayer provides a command rly update-clients solely for updating the IBC light clients. We then used this command for everything, without establishing IBC channels or relaying IBC packets.

Then you may remember that in the last engineering meeting, we thought the heartbeat packet mechanism costs extra complexity and increases cost for maintaining a relayer. Thus we decided to remove the heartbeat mechanism and repurposed the code for sending IBC packets (in preparation of phase-2 integration).

Just wanted to understand more about the context. Does it mean we will have a modified relayer that only does CZ -> Babylon updates?

Yep exactly. Currently the demo is using a very simple (and dirty) script for IBC stuff. We hope to make it more robust in the future 🤣

while true
do
	echo "Relaying headers between Babylon and $1..."
	rly --home data/relayer tx update-clients $1
	sleep 10
done

@SebastianElvis SebastianElvis merged commit ec0429a into dev Dec 5, 2022
@SebastianElvis SebastianElvis deleted the zoneconcierge-repurpose-heartbeat branch December 5, 2022 09:26
@gitferry
Copy link
Contributor

gitferry commented Dec 5, 2022

I see. It makes sense. Thanks for answering my questions!

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