TLA+ specification of packet delay #446
Labels
I: spec
Internal: related to IBC specifications
O: security
Objective: cause to enhance security and improve safety
Milestone
Summary
We want the following invariant to hold: packet-related data should be accepted only after some delay has passed since the corresponding header is installed. This allows a correct relayer to intervene if the header is from a fork and shutdown the IBC handler, preventing damage at the app level.
Problem Definition
cosmos/cosmos-sdk#8069
cosmos/ibc#507
High level use case: users are making token transfer from Cosmos Hub to an exchange zone. Once a lot of tokens are moved to a zone, the zone validators create invalid packet to steal tokens from the user by making single transfer from a zone to a hub.
Proposal
First solution (wrong)
Add a packet delay field to the packet data structure so users can configure it based on needed security level. The verification function depends on the specified packet delay. The issue is the fact that an attacker can create fake packet with 0 delay specified.
Second solution
Packet delay is enforced at the connection level.
Let
t1
andt2
be BFT times of zone 1, witht2 >= t1
. These timestamps are part of blockchain headers of zone 1.Suppose
t1
is the time at which a headerh
is installed at zone 1, andt2
is the time at which a packet is verified using the headerh
. We need to ensure thatt2 - t1 > delay
, wheredelay
is some previously defined constant.When a packet
p
that can be verified using a headerh
installed at timet1
is sent to zone 1, a correct relayer should not submit aPacketRecv
datagram before it sees that on zone 1 the BFT time is greater thant1 + delay
.An attacker with more than 1/3 of voting power may:
While (1) cannot be prevented, we can prevent (2) by adding delay. In this case, a correct relayer can monitor the chain, and once it detects (1), it can submit evidence of misbehaviour and shut down the IBC handler, so no packet referencing the invalid consensus state is processed.
Proposed solution in TLA+
counterpartyClientHeights
to be a function from installed heights to timestamps instead of a set of installed heights.For Admin Use
The text was updated successfully, but these errors were encountered: