Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

env:
CARGO_TERM_COLOR: always

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo check --all-targets

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo test

fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --check

clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- run: cargo clippy --all-targets -- -D warnings
95 changes: 95 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Release

on:
push:
tags:
- "v*"

permissions:
contents: write

env:
CARGO_TERM_COLOR: always

jobs:
build:
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
name: linux-amd64
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
name: linux-arm64
- target: x86_64-apple-darwin
os: macos-13
name: darwin-amd64
- target: aarch64-apple-darwin
os: macos-14
name: darwin-arm64

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}

- name: Install cross-compilation tools (Linux ARM64)
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV

- name: Build release binary
run: cargo build --release --target ${{ matrix.target }}

- name: Package binary
run: |
cd target/${{ matrix.target }}/release
tar -czf ../../../ghostguard-${{ matrix.name }}.tar.gz ghostguard
cd ../../..

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ghostguard-${{ matrix.name }}
path: ghostguard-${{ matrix.name }}.tar.gz

release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: artifacts/ghostguard-*.tar.gz
generate_release_notes: true
draft: false
prerelease: false

# Verify the install script works with the new release
verify-install:
needs: release
strategy:
matrix:
os: [ubuntu-latest, macos-14]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Test ghostguardup installer
run: |
bash ghostguardup
ghostguard --version
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ version = "0.1.0"
edition = "2021"
description = "Detect ghost fills on Polymarket CLOB"
license = "MIT"
repository = "https://github.com/libaice/GhostGuard"
homepage = "https://github.com/libaice/GhostGuard"
keywords = ["polymarket", "ghost-fill", "clob", "polygon", "trading"]
categories = ["command-line-utilities", "cryptography::cryptocurrencies"]
readme = "README.md"

[lib]
name = "ghostguard"
Expand Down
46 changes: 46 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
.PHONY: build install uninstall test fmt clippy clean release

# Default install location (same as ghostguardup)
INSTALL_DIR ?= $(HOME)/.ghostguard/bin

build:
cargo build --release

install: build
@mkdir -p $(INSTALL_DIR)
@cp target/release/ghostguard $(INSTALL_DIR)/ghostguard
@chmod +x $(INSTALL_DIR)/ghostguard
@echo "installed: $(INSTALL_DIR)/ghostguard"
@echo ""
@echo "Make sure $(INSTALL_DIR) is in your PATH:"
@echo ' export PATH="$$HOME/.ghostguard/bin:$$PATH"'

uninstall:
@rm -f $(INSTALL_DIR)/ghostguard
@echo "removed: $(INSTALL_DIR)/ghostguard"

test:
cargo test

test-live:
cargo test -- --ignored

fmt:
cargo fmt

clippy:
cargo clippy --all-targets -- -D warnings

clean:
cargo clean

# Create a release tarball for the current platform
release: build
@mkdir -p dist
@cd target/release && tar -czf ../../dist/ghostguard-$(shell uname -s | tr '[:upper:]' '[:lower:]')-$(shell uname -m | sed 's/x86_64/amd64/' | sed 's/aarch64/arm64/').tar.gz ghostguard
@echo "tarball: dist/"
@ls -lh dist/

# Quick verify with known ghost fill tx
verify-ghost:
cargo run --release -- --verify-tx 0x9e3230abde0f569da87511a6f8823076f7b211bb00d10689db3b7c50d6652df0
39 changes: 38 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,49 @@ Three known attack variants all produce the same on-chain result (status=0):

GhostGuard detects the **result**, not the method.

## Installation

### One-liner (recommended)

```bash
curl -L https://raw.githubusercontent.com/orderbooktrade/GhostGuard/main/ghostguardup | bash
```

This downloads the prebuilt binary for your platform to `~/.ghostguard/bin` and adds it to your PATH. Works on macOS (Intel/Apple Silicon) and Linux (x86_64/ARM64).

### From source (cargo)

```bash
cargo install --git https://github.com/OrderBookTrade/GhostGuard
```

### From source (clone + make)

```bash
git clone https://github.com/OrderBookTrade/GhostGuard
cd GhostGuard
make install
```

### As a Rust dependency

```toml
[dependencies]
ghostguard = { git = "https://github.com/OrderBookTrade/GhostGuard" }
```

### Verify installation

```bash
ghostguard --version
```

## Quick start

### Verify a single transaction

```bash
cargo run --release -- \
ghostguard \
--verify-tx 0x9e3230abde0f569da87511a6f8823076f7b211bb00d10689db3b7c50d6652df0
```

Expand Down
Loading
Loading