Skip to content

Commit

Permalink
Merge pull request #1012 from SundaeSwap-finance/offline-mode-adr
Browse files Browse the repository at this point in the history
Initial offline mode ADR
  • Loading branch information
Arnaud Bailly authored Oct 13, 2023
2 parents 3d825b2 + 8d259e2 commit ba04f39
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
33 changes: 33 additions & 0 deletions docs/adr/2023-07-05_024-offline-mode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
slug: 28. Offline mode
title: |
1. Offline mode
authors: [cardenaso11]
tags: []
---
## Status
Proposed

## Context
Currently, the Hydra node requires a Layer 1 Cardano node running in order to operate; The L1 node is needed to submit and watch for L1 transactions. Generally speaking, the transactions watched are for learning the state of the Hydra node, as reflected by the L1 chain. The transactions submitted are to transition between states (e.g. after submitting a Commit tx to the L1, a node watches to see when all other nodes have also Committed.)

There are applications for the Hydra node where interaction with an L1 chain is unnecessary. Offline mode will be a key component of the Gummiworm protocol, a Layer 2 protocol being built by Sundae Labs, which enables actors other than Hydra head participants to validate transactions that occur in the head.

The Hydra node offline mode would remove the dependency on the L1 Cardano node, for applications like Gummiworm where it is unneeded. It would also remove the dependency on the L1 Cardano node for peer-to-peer Hydra node communication. This would be useful for other Layer 2s that build on top of Hydra instead of duplicating its efforts, and for anyone who wants to easily validate a set of Cardano transactions.
## Decision
Hydra node will be executable in offline mode, as an alternative to the default online mode. When online, the Hydra node depends on querying a Cardano node for Era History information and Genesis parameters. When offline this is not necessary, because the Hydra node will not connect to any Layer 1 .

The initial state of the head will be specified in a flag, which makes any Commit redundant. The flag will specify a file for the starting Layer 2 UTXO. The Hydra node can be configured to write the current UTXO into a file, including the starting UTXO file.

A node running in offline mode will not be able to switch between offline and online modes once started, as it is an unlikely use-case that would likely add more complexity.

Commit endpoint will return 400 instead of building a transaction, in offline mode.

Support for peer Hydra nodes in offline mode is considered out of scope, as it doesn't seem immediately useful. A node running in offline mode will not be configurable with any peer nodes, nor will it make a network connection to any peer nodes.


## Consequences

The Hydra node would be usable offline, for transaction validation, and other custom L2 applications. The lifecycle & state machine associated with a Hydra would remain unchanged in both online, and offline mode.

The Hydra node can be deployed and run without an accompanying Cardano node, simplifying deployment and testing.
6 changes: 6 additions & 0 deletions docs/authors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,9 @@ v0d1ch:
title: Senior Software Engineer
url: https://github.com/v0d1ch
image_url: https://github.com/v0d1ch.png

cardenaso11:
name: Elaine Cardenas
title: Software Engineer
url: https://github.com/cardenaso11
image_url: https://github.com/cardenaso11.png

0 comments on commit ba04f39

Please sign in to comment.