@@ -17,16 +17,21 @@ module ccv_types {
1717 id : VscId,
1818 // the new validator set. in the implementation, this would be a list of validator updates
1919 validatorSet : ValidatorSet,
20- // the time at which the packet was sent. used to check whether packets have timed out.
21- sendingTime : Time
20+ // the time at which the packet was sent.
21+ sendingTime : Time,
22+ // the time (on the receiver) at which the packet will time out
23+ timeoutTime : Time
24+
2225 }
2326
2427 type VscMaturedPacket =
2528 {
2629 // the id of the VscPacket that matured
2730 id : VscId,
28- // the time at which the packet was sent. used to check whether packets have timed out.
29- sendingTime : Time
31+ // the time at which the packet was sent.
32+ sendingTime : Time,
33+ // the time (on the receiver) at which the packet will time out
34+ timeoutTime : Time
3035 }
3136
3237
@@ -276,7 +281,7 @@ module ccv {
276281 ( Err( " No outstanding packets to deliver" ) , false)
277282 } else {
278283 val packet = currentState.consumerStates.get( sender) .outstandingPacketsToProvider.head()
279- if ( packet.sendingTime + CcvTimeout.get ( sender ) < currentState.providerState.chainState.runningTimestamp) {
284+ if ( packet.timeoutTime <= currentState.providerState.chainState.runningTimestamp) {
280285 // drop consumer
281286 val result = stopConsumers(
282287 currentState.providerState.consumerStatus,
@@ -325,7 +330,7 @@ module ccv {
325330 } else {
326331 val packet = currentState.providerState.outstandingPacketsToConsumer.get( receiver) .head()
327332 // check if the consumer timed out
328- if ( packet.sendingTime + CcvTimeout.get ( PROVIDER_CHAIN ) < currentState.consumerStates.get( receiver) .chainState.runningTimestamp) {
333+ if ( packet.timeoutTime <= currentState.consumerStates.get( receiver) .chainState.runningTimestamp) {
329334 // drop consumer
330335 val result = stopConsumers(
331336 currentState.providerState.consumerStatus,
@@ -492,7 +497,8 @@ module ccv {
492497 maturedPackets.transform(
493498 packet = > {
494499 id : packet.id,
495- sendingTime : newChainState.runningTimestamp
500+ sendingTime : newChainState.runningTimestamp,
501+ timeoutTime : newChainState.runningTimestamp + CcvTimeout.get( chain)
496502 }
497503 )
498504 )
@@ -632,7 +638,8 @@ module ccv {
632638 List ( {
633639 id : providerState.runningVscId,
634640 validatorSet : providerState.chainState.currentValidatorSet,
635- sendingTime : providerState.chainState.runningTimestamp
641+ sendingTime : providerState.chainState.runningTimestamp,
642+ timeoutTime : providerState.chainState.runningTimestamp + CcvTimeout.get( PROVIDER_CHAIN)
636643 } )
637644 } else {
638645 List ()
0 commit comments