Compare commits

...
Author SHA1 Message Date
Ian be6fabc3a6 Update fixturenet-payments.yml (add newline) 2023-10-27 09:27:19 -04:00
iskay 2b76be0f57 add fixturenet-payments test 2023-10-24 16:39:39 +00:00
Zach ddebb9c690 bind only to 127.0.0.1 (#598) 2023-10-23 10:51:44 -04:00
Zach fe6c3f92ed typo (#596) 2023-10-21 13:37:21 -04:00
Zach c06be6da81 stack for the laconic.com website (#590)
* website stack

* use a release, update ports

* use deployments feature for website
2023-10-21 13:31:47 -04:00
telackey 3291c16466 Update stacks for migrated laconic repos. (#594) 2023-10-20 11:59:06 -05:00
nabarun 69b071ee7a Add example GQL queries made in Ponder indexers (#593)
* Add example GQL queries made in Ponder indexers

* Use fixturenet chainId in GQL query
2023-10-19 14:55:07 +05:30
13 changed files with 308 additions and 9 deletions
@@ -0,0 +1,48 @@
name: Fixturenet-Payments-Test
on:
push:
branches: '*'
paths:
- '!**'
- '.gitea/workflows/triggers/fixturenet-payments-test'
# Needed until we can incorporate docker startup into the executor container
env:
DOCKER_HOST: unix:///var/run/dind.sock
jobs:
test:
name: "Run a payments fixturenet test"
runs-on: ubuntu-latest
steps:
- name: "Clone project repository"
uses: actions/checkout@v3
# At present the stock setup-python action fails on Linux/aarch64
# Conditional steps below workaroud this by using deadsnakes for that case only
- name: "Install Python for ARM on Linux"
if: ${{ runner.arch == 'arm64' && runner.os == 'Linux' }}
uses: deadsnakes/action@v3.0.1
with:
python-version: '3.8'
- name: "Install Python cases other than ARM on Linux"
if: ${{ ! (runner.arch == 'arm64' && runner.os == 'Linux') }}
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: "Print Python version"
run: python3 --version
- name: "Install shiv"
run: pip install shiv
- name: "Generate build version file"
run: ./scripts/create_build_tag_file.sh
- name: "Build local shiv package"
run: ./scripts/build_shiv_package.sh
- name: Start dockerd # Also needed until we can incorporate into the executor
run: |
dockerd -H $DOCKER_HOST --userland-proxy=false &
sleep 5
- name: "Run fixturenet-payments tests"
run: ./tests/fixturenet-payments/run-test.sh
@@ -0,0 +1,2 @@
Change this file to trigger running the fixturenet-payments-test CI job
+30
View File
@@ -0,0 +1,30 @@
name: Fixturenet-Payments Test
on:
pull_request:
branches: '*'
push:
branches: '*'
jobs:
test:
name: "Run basic test suite"
runs-on: ubuntu-latest
steps:
- name: "Clone project repository"
uses: actions/checkout@v3
- name: "Install Python"
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: "Print Python version"
run: python3 --version
- name: "Install shiv"
run: pip install shiv
- name: "Generate build version file"
run: ./scripts/create_build_tag_file.sh
- name: "Build local shiv package"
run: ./scripts/build_shiv_package.sh
- name: "Run fixturenet-payments tests"
run: ./tests/fixturenet-payments/run-test.sh
+1 -1
View File
@@ -52,7 +52,7 @@ Version: 1.1.0-7a607c2-202304260513
Save the distribution url to `~/.laconic-so/config.yml`:
```bash
mkdir ~/.laconic-so
echo "distribution-url: https://github.com/cerc-io/stack-orchestrator/releases/latest/download/laconic-so" > ~/.laconic-so/config.yml"
echo "distribution-url: https://github.com/cerc-io/stack-orchestrator/releases/latest/download/laconic-so" > ~/.laconic-so/config.yml
```
### Update
@@ -0,0 +1,8 @@
version: "3.2"
services:
laconic-dot-com:
image: cerc/laconic-dot-com:local
restart: always
ports:
- "3000"
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
# Build the laconic.com image
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
docker build -t cerc/laconic-dot-com:local -f ${CERC_REPO_BASE_DIR}/laconic.com/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/laconic.com
@@ -2,14 +2,14 @@ version: "1.1"
name: fixturenet-laconic-loaded
description: "A full featured laconic fixturenet"
repos:
- github.com/cerc-io/laconicd
- git.vdb.to/cerc-io/laconicd
- github.com/lirewine/debug
- github.com/lirewine/crypto
- github.com/lirewine/gem
- github.com/lirewine/sdk
- github.com/cerc-io/laconic-sdk
- github.com/cerc-io/laconic-registry-cli
- github.com/cerc-io/laconic-console
- git.vdb.to/cerc-io/laconic-sdk
- git.vdb.to/cerc-io/laconic-registry-cli
- git.vdb.to/cerc-io/laconic-console
npms:
- laconic-sdk
- laconic-registry-cli
@@ -2,9 +2,9 @@ version: "1.0"
name: fixturenet-laconicd
description: "A laconicd fixturenet"
repos:
- github.com/cerc-io/laconicd
- github.com/cerc-io/laconic-sdk
- github.com/cerc-io/laconic-registry-cli
- git.vdb.to/cerc-io/laconicd
- git.vdb.to/cerc-io/laconic-sdk
- git.vdb.to/cerc-io/laconic-registry-cli
npms:
- laconic-sdk
- laconic-registry-cli
@@ -110,6 +110,56 @@ Stack components:
# ...
```
* Following are the example GQL queries (with payment headers) `ponder-indexer-2` makes to `ponder-indexer-1` for fetching data
```graphql
{
getEthLogs(
chainId: 1212,
address: "0x6325439389e0797ab35752b4f43a14c004f22a9c",
fromBlock: 100,
toBlock: 200,
) {
address
blockHash
blockNumber
data
logIndex
removed
topics
transactionHash
transactionIndex
}
getEthBlock(
chainId: 1212,
blockNumber: 150,
fullTransactions: false
) {
baseFeePerGas
difficulty
extraData
gasLimit
gasUsed
hash
logsBloom
miner
mixHash
nonce
number
parentHash
receiptsRoot
sha3Uncles
size
stateRoot
timestamp
totalDifficulty
transactionsRoot
txHashes
}
}
```
* In another terminal run the Ponder app in watcher mode:
```bash
@@ -139,6 +189,41 @@ Stack components:
# 08:02:37.849 DEBUG payment Verified payment for GQL queries getLogEvents
```
* Following are the example GQL queries (with payment headers) `ponder-watcher` makes to `ponder-indexer-2` for fetching data
```graphql
getLogEvents(
fromTimestamp: 1695303079,
toTimestamp: 1695304156,
filters: [
{
name: "AdventureGold"
chainId: 1212,
address: ["0x6325439389e0797ab35752b4f43a14c004f22a9c"],
fromBlock: 100,
toBlock: 200,
includeEventSelectors: ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]
}
]
) {
events {
transaction {
hash
}
log {
id
}
block {
number
}
}
metadata {
pageEndsAtTimestamp
isLastPage
}
}
```
* Open watcher Ponder app endpoint http://localhost:42069
* Try GQL query to see transfer events
@@ -0,0 +1,9 @@
# laconic-dot-com
```
laconic-so --stack laconic-dot-com setup-repositories
laconic-so --stack laconic-dot-com build-containers
laconic-so --stack laconic-dot-com deploy init --output laconic-website-spec.yml --map-ports-to-host localhost-same
laconic-so --stack laconic-dot-com deploy create --spec-file laconic-website-spec.yml --deployment-dir lx-website
laconic-so deployment --dir lx-website start
```
@@ -0,0 +1,8 @@
version: "0.1"
name: laconic-dot-com
repos:
- github.com/LaconicNetwork/laconic.com@v0.0.1
containers:
- cerc/laconic-dot-com
pods:
- laconic-dot-com
+1 -1
View File
@@ -2,7 +2,7 @@ version: "1.0"
name: test
description: "A test stack"
repos:
- github.com/cerc-io/laconicd
- git.vdb.to/cerc-io/laconicd
- git.vdb.to/cerc-io/test-project@test-branch
containers:
- cerc/test-container
+105
View File
@@ -0,0 +1,105 @@
#!/usr/bin/env bash
set -e
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
echo "$(date +"%Y-%m-%d %T"): Running stack-orchestrator Payments stack fixturenet test"
# Bit of a hack, test the most recent package
TEST_TARGET_SO=$( ls -t1 ./package/laconic-so* | head -1 )
# Set a new unique repo dir
export CERC_REPO_BASE_DIR=$(mktemp -d stack-orchestrator-fixturenet-payments-test.XXXXXXXXXX)
echo "$(date +"%Y-%m-%d %T"): Testing this package: $TEST_TARGET_SO"
echo "$(date +"%Y-%m-%d %T"): Test version command"
reported_version_string=$( $TEST_TARGET_SO version )
echo "$(date +"%Y-%m-%d %T"): Version reported is: ${reported_version_string}"
echo "$(date +"%Y-%m-%d %T"): Cloning repositories into: $CERC_REPO_BASE_DIR"
$TEST_TARGET_SO --stack fixturenet-payments setup-repositories --pull
echo "$(date +"%Y-%m-%d %T"): Building containers"
$TEST_TARGET_SO --stack fixturenet-payments build-containers
echo "$(date +"%Y-%m-%d %T"): Starting stack"
$TEST_TARGET_SO --stack fixturenet-payments deploy --cluster payments up
echo "$(date +"%Y-%m-%d %T"): Stack started"
# Verify that the fixturenet is up and running
$TEST_TARGET_SO --stack fixturenet-payments deploy --cluster payments ps
# get watcher payments channel id
timeout=600 # 10 minutes
echo "$(date +"%Y-%m-%d %T"): Waiting for watcher payment channel id. Timeout set to $timeout seconds"
start_time=$(date +%s)
elapsed_time=0
while [ -z "$WATCHER_UPSTREAM_PAYMENT_CHANNEL" ] && [ $elapsed_time -lt $timeout ]; do
sleep 10
echo "$(date +"%Y-%m-%d %T"): Waiting for channel..."
WATCHER_UPSTREAM_PAYMENT_CHANNEL=$(docker logs $(docker ps -aq --filter name="mobymask-watcher-server") 2>&1 | \
grep "payment channel created with id" | \
grep -o '0x[0-9a-fA-F]\+') \
|| true
current_time=$(date +%s)
elapsed_time=$((current_time - start_time))
done
echo "Watcher payment channel id: $WATCHER_UPSTREAM_PAYMENT_CHANNEL"
sleep 120
# check watcher payment channel status. Expected result: 'Open'
timeout=600 # 10 minutes
echo "$(date +"%Y-%m-%d %T"): Querying watcher payment channel status. Timeout set to $timeout seconds"
start_time=$(date +%s)
elapsed_time=0
query="Status:"
while [ -z "$watcher_query_result" ] && [ $elapsed_time -lt $timeout ]; do
sleep 10
echo "$(date +"%Y-%m-%d %T"): Waiting for channel..."
watcher_query_result=$(docker exec payments-nitro-rpc-client-1 npm exec -c "nitro-rpc-client get-payment-channel $WATCHER_UPSTREAM_PAYMENT_CHANNEL -s false -h ipld-eth-server-1 -p 4005" | \
grep "$query" | \
grep -o "'.*'") \
|| true
current_time=$(date +%s)
elapsed_time=$((current_time - start_time))
done
# run ponder indexer to get ponder payment channel id
timeout=600 # 10 minutes
echo "$(date +"%Y-%m-%d %T"): Starting Ponder indexer and waiting for payment channel id. Timeout set to $timeout seconds"
start_time=$(date +%s)
elapsed_time=0
docker exec -itd payments-ponder-app-indexer-1-1 bash -c "DEBUG=laconic:payments pnpm start > /output.log 2>&1"
while [ -z "$PONDER_UPSTREAM_PAYMENT_CHANNEL" ] && [ $elapsed_time -lt $timeout ]; do
sleep 10
echo "$(date +"%Y-%m-%d %T"): Waiting for channel id..."
PONDER_UPSTREAM_PAYMENT_CHANNEL=$(docker exec payments-ponder-app-indexer-1-1 bash -c "grep 'Using payment channel' /output.log" | grep -o '0x[0-9a-fA-F]\+' || true)
current_time=$(date +%s)
elapsed_time=$((current_time - start_time))
done
echo "Ponder payment channel id: $PONDER_UPSTREAM_PAYMENT_CHANNEL"
if [[ -z "$PONDER_UPSTREAM_PAYMENT_CHANNEL" ]]; then
echo "Ponder payment channel id not found."
ponder_query_result=0
else
echo "Ponder payment channel id: $PONDER_UPSTREAM_PAYMENT_CHANNEL"
# query ponder payment channel, Expected result: PaidSoFar is nonzero
query="PaidSoFar"
ponder_query_result=$(docker exec payments-nitro-rpc-client-1 npm exec -c "nitro-rpc-client get-payment-channel $PONDER_UPSTREAM_PAYMENT_CHANNEL -s false -h go-nitro -p 4006" | \
grep "$query" | \
grep -o '[0-9]\+') \
|| true
fi
if [[ "$watcher_query_result" == "'Open'" && "$ponder_query_result" -gt 0 ]]; then
echo "Test passed"
test_result=0
else
echo "Test failed: watcher_query_result was $watcher_query_result and ponder_query_result was $ponder_query_result"
echo "Logs from stack:"
$TEST_TARGET_SO --stack fixturenet-payments deploy logs
test_result=1
fi
$TEST_TARGET_SO --stack fixturenet-payments deploy --cluster payments down 30 --delete-volumes
echo "$(date +"%Y-%m-%d %T"): Removing cloned repositories"
rm -rf $CERC_REPO_BASE_DIR
echo "$(date +"%Y-%m-%d %T"): Test finished"
exit $test_result