Skip to content

Commit

Permalink
Merge pull request #48 from EspressoSystems/jh/hotshot-liveness
Browse files Browse the repository at this point in the history
Fetch hotshot liveness with a given L1 height
  • Loading branch information
ImJeremyHe authored Aug 5, 2024
2 parents 654fc0a + bf80828 commit 8e47e5d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# later match takes precedence, they will be requested for review when someone
# opens a pull request.

* @nomaxg @ImJeremyHe @sveitser
* @nomaxg @ImJeremyHe @sveitser @zacshowa @Sneh1999
11 changes: 11 additions & 0 deletions light-client/light_client_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type LightClientReaderInterface interface {
FetchMerkleRoot(hotShotHeight uint64, opts *bind.CallOpts) (types.BlockMerkleSnapshot, error)

IsHotShotLive(delayThreshold uint64) (bool, error)
IsHotShotLiveAtHeight(height, delayThreshold uint64) (bool, error)
}

type LightClientReader struct {
Expand Down Expand Up @@ -79,3 +80,13 @@ func (l *LightClientReader) IsHotShotLive(delayThreshold uint64) (bool, error) {
}
return !isDown, nil
}

func (l *LightClientReader) IsHotShotLiveAtHeight(h, delayThreshold uint64) (bool, error) {
threshold := new(big.Int).SetUint64(delayThreshold)
height := new(big.Int).SetUint64(h)
isDown, err := l.LightClient.LagOverEscapeHatchThreshold(&bind.CallOpts{}, height, threshold)
if err != nil {
return false, err
}
return !isDown, nil
}

0 comments on commit 8e47e5d

Please sign in to comment.