Skip to content

Commit

Permalink
Merge pull request #24 from lightlink-network/bugfix/keep-celestia-cl…
Browse files Browse the repository at this point in the history
…ients-open

bugfix – no longer closing clients when creating new celestia client
  • Loading branch information
Sledro authored Feb 23, 2024
2 parents 0489b9c + b2e728c commit ebedd19
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 449 deletions.
19 changes: 5 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ SYSTEM_PATH=$(shell echo $$PATH)

all: build ## Build hummingbird


build: ## Build binaries
@echo "--> Starting build for all OS into $(BUILD_DIR) directory"
@rm -rf $(BUILD_DIR)
@mkdir -p $(BUILD_DIR)
@$(MAKE) darwin
@$(MAKE) linux
@$(MAKE) windows
Expand All @@ -26,30 +27,20 @@ linux: $(LINUX) ## Build for Linux
darwin: $(DARWIN) ## Build for Darwin (macOS)

$(WINDOWS):
@mkdir -p $(BUILD_DIR)
@env GOOS=windows GOARCH=amd64 go build -o $(BUILD_DIR)/$(WINDOWS) -ldflags="-X main.Version=$(VERSION)" ./cli/main.go

$(LINUX):
@mkdir -p $(BUILD_DIR)
@env GOOS=linux GOARCH=amd64 go build -o $(BUILD_DIR)/$(LINUX) -ldflags="-X main.Version=$(VERSION)" ./cli/main.go

$(DARWIN):
@mkdir -p $(BUILD_DIR)
@env GOOS=darwin GOARCH=amd64 go build -o $(BUILD_DIR)/$(DARWIN) -ldflags="-X main.Version=$(VERSION)" ./cli/main.go

install: ## Install binary (mac or linux)
@echo "--> Installing Hummingbird on your system"
ifeq ($(shell uname -s),Darwin)
@cp $(BUILD_DIR)/$(DARWIN) $(shell go env GOPATH)/bin/$(EXECUTABLE)
@echo "--> Installation complete. Run '$(EXECUTABLE) --help' to get started."
@echo "--> NOTE: Your go path must be in your system path to run the binary via '$(EXECUTABLE)' command."
@go install -ldflags="-X main.Version=$(VERSION)" ./cli
@echo "--> Installation complete. Run 'cli --help' to get started."
@echo "--> NOTE: Your go path must be in your system path to run the binary via 'cli' command."
@echo "--> Otherwise, you can run the binary via '$(BUILD_DIR)/$(DARWIN) --help' command."
else ifeq ($(shell uname -s),Linux)
@cp $(BUILD_DIR)$(LINUX) /usr/local/bin/$(EXECUTABLE)
@echo "--> Installation complete. Run '$(EXECUTABLE) --help' to get started."
else
@echo "Unsupported operating system. Please install manually."
endif

clean: ## Remove previous build
@rm -d -r -f $(BUILD_DIR)
Expand Down
34 changes: 19 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,31 @@

![Test, Build Image & Push to ECR](https://github.com/lightlink-network/hummingbird-client/actions/workflows/build_and_publish.yml/badge.svg?branch=main)

> [!NOTE]
> Hummingbird is a work in progress and is not yet ready for production use.
![LightLink Hummingbird preview screenshot](<preview.png>)

Hummingbird is a light client for interacting with the [LightLink Protocol](https://lightlink.io).

It is designed to work in unison with the [hummingbird-contracts](https://github.com/lightlink-network/hummingbird-contracts) repository.

Documentation can be found [here](https://docs.lightlink.io/lightlink-protocol/achitecture-and-design/lightlink-protocol-deep-dive)

## Usage

```bash
hb rollup info # Get the current rollup state
hb rollup info --num <rblock_number> --bundle # View the bundled L2 block hashes in an L1 rblock
hb rollup next # [Publisher Only] Generate the next rollup block
hb rollup start # [Publisher Only] Start the rollup loop to generate and submit bundles
hb challenger challenge-da <rblock_number> # Challenge data availability
hb defender defend-da <rblock_hash> # Defend data availability
hd defender info-da <rblock_hash> # Provides info on an existing challenge
hb defender prove-da <rblock_hash> # Prove data availability
hb defender start # Start the defender loop to watch and defend challenges
hb defender provide --type=header <rblock_hash> <l2_block_hash> # Provide will download header for the given <l2_block_hash> from Celestia and provide it to Layer 1 ChainOracle
hb defender provide --type=tx <rblock_hash> <l2_block_hash> # Provide will download tx for the given <l2_tx_hash> from Celestia and provide it to Layer 1 ChainOracle
cli rollup info # Get the current rollup state
cli rollup info --num <rblock_number> --bundle # View the bundled L2 block hashes in an L1 rblock
cli rollup next # [Publisher Only] Generate the next rollup block
cli rollup start # [Publisher Only] Start the rollup loop to generate and submit bundles
cli challenger challenge-da <rblock_number> # Challenge data availability
cli defender defend-da <rblock_hash> # Defend data availability
cli defender info-da <rblock_hash> # Provides info on an existing challenge
cli defender prove-da <rblock_hash> # Prove data availability
cli defender start # Start the defender loop to watch and defend challenges
cli defender provide --type=header <rblock_hash> <l2_block_hash> # Provide will download header for the given <l2_block_hash> from Celestia and provide it to Layer 1 ChainOracle
cli defender provide --type=tx <rblock_hash> <l2_tx_hash> # Provide will download tx for the given <l2_tx_hash> from Celestia and provide it to Layer 1 ChainOracle
```

The following root flags are available for all commands:
Expand All @@ -48,21 +53,20 @@ cd $HOME
rm -rf hummingbird-client
git clone https://github.com/lightlink-network/hummingbird-client.git
cd hummingbird-client
git checkout tags/v0.0.3 -b v0.0.3
git checkout tags/v0.1.0 -b v0.1.0
make build
```

Install the binary to your `$GOPATH/bin`:


```bash
make install
```

Check the installation was successful:

```bash
hb --help
cli --help
```

Note: If your go path is not set in your system path, the binary can be run directly from the `./build` directory:
Expand Down Expand Up @@ -91,7 +95,7 @@ export ETH_KEY=0x...

**Note**: configuration file `config.yaml` path can be specified with the `--config-path` flag. If not specified, the default path is `./config.yaml`

see `hb --help` for more information
see `cli --help` for more information

<p align="center">
<img src="humming.png" style="size:50%" alt="HummingBird">
Expand Down
4 changes: 2 additions & 2 deletions defender/defender.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ func (d *Defender) ProvideL2Header(rblock common.Hash, l2Block common.Hash, skip

// TODO: remove this sleep hack and fix Ethereum.Wait
d.Opts.Logger.Info("Waiting for 3 seconds to ensure shares are available")
time.Sleep(3 * time.Second)
time.Sleep(10 * time.Second)
}

// Finally, provide the header
Expand Down Expand Up @@ -326,7 +326,7 @@ func (d *Defender) ProvideL2Tx(rblock common.Hash, l2Tx common.Hash, skipShares

// TODO: remove this sleep hack and fix Ethereum.Wait
d.Opts.Logger.Info("Waiting for 3 seconds to ensure shares are available")
time.Sleep(3 * time.Second)
time.Sleep(10 * time.Second)
}

// Finally, provide the transaction
Expand Down
Empty file removed ganache/a
Empty file.
50 changes: 0 additions & 50 deletions node/.example/common.go

This file was deleted.

83 changes: 0 additions & 83 deletions node/.example/main.go

This file was deleted.

87 changes: 0 additions & 87 deletions node/.example/proof.go

This file was deleted.

Loading

0 comments on commit ebedd19

Please sign in to comment.