Skip to content

Commit

Permalink
PRT-987 SDK - Implement batch requests (#948)
Browse files Browse the repository at this point in the history
* Add a package.json command for jsonRPC badge test

* Move JsonrpcVersion to consts

* Add JsonRPCBatchMessage

* Add some helper methods

* Add support for batches for tendermint

* Remove protos and compiled protos

* Make the protoc generation script work

* Update the github job to generate protos

* added batches to test

* stringify

* add better error handling in batches when timing out

* Add batch support for jsonrpc

* Fix SDK tests github action

* Fix package.json commands

* Fix URL parsing

* Improve the SDK examples

* Fix SDK setup scripts

* Update gitignore

* Fix spec

* Small fix to the lava SDK tests GH action

* Fix attempt to the e2e gh action

+ some logs

* Forgotten merge conflict

* Clean up E2E gh action

* Small fix to the jsonrpc.ts file

* Add tests to jsonrpc and tendermintrpc

* Fix e2e job

* CR Fix: Update the gelocation in the scripts

* Create a new script "init_sdk.sh" add updated the README

* CR Fix: Remove debug log

* CR Fix: Add tests to common's compareRequestedBlockInBatch function

* Update the SDK e2e job

* Fix lint

---------

Co-authored-by: omerlavanet <[email protected]>
  • Loading branch information
shleikes and omerlavanet authored Nov 16, 2023
1 parent f52eed8 commit 3fa9276
Show file tree
Hide file tree
Showing 148 changed files with 1,580 additions and 43,260 deletions.
365 changes: 145 additions & 220 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,178 +6,127 @@ jobs:
test-protocol-e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- uses: actions/setup-go@v3
with:
go-version: 1.20.5

# Setup Paths
- name: home
run: pwd && ls -l
- name: ls usr
run: ls -l /home/runner/work/lava/lava
- name: cp lava
run: cp -r ~/work/lava/lava ~/go/lava
- name: export PATH
run: export PATH=$PATH:/go:/go/bin:$(go env GOPATH)/bin:/usr/local:`pwd`:/home/runner/work/lava/lava/
# - name: export
# run: export PATH=$PATH:/go/lava
- name: export GOPATH
run: export GOPATH=$GOPATH:$(go env GOPATH):/go:/go/lava:/usr/local:`pwd`
- name: export LAVA
run: export LAVA=/home/runner/work/lava/lava
- name: go env
run: go env
- name: pwd
run: pwd
- name: tree
run: tree
- name: ls -l
run: ls -l

######################################################
### Run Lava E2E Tests
######################################################
- name: Run Lava E2E Tests -timeout 1200s
run: go test ./testutil/e2e/ -run ^TestLavaProtocol$ -v -timeout 1200s # 20mins

- name: tail -n 300 Lavad Logs
if: always()
run: tail -n 300 testutil/e2e/protocolLogs/00_StartLava.log

- name: Stake Lava All Logs
if: always()
run: cat testutil/e2e/protocolLogs/01_stakeLava.log

- name: Stake Lava Error Only Logs
if: always()
continue-on-error: true
run: cat testutil/e2e/protocolLogs/01_stakeLava_errors.log

- name: head -n 300 JSON Proxy Logs
if: always()
run: head -n 300 testutil/e2e/protocolLogs/02_jsonProxy.log

- name: tail -n 300 JSON Proxy Logs
if: always()
run: tail -n 300 testutil/e2e/protocolLogs/02_jsonProxy.log

- name: JSON Proxy Error Only Logs
if: always()
continue-on-error: true
run: cat testutil/e2e/protocolLogs/02_jsonProxy_errors.log

- name: JSON Provider All Logs
if: always()
run: grep "" testutil/e2e/protocolLogs/03_EthProvider* --exclude="*errors*"

- name: JSON Provider Error Only Logs
if: always()
continue-on-error: true
run: grep "" testutil/e2e/protocolLogs/03_EthProvider* --include="*errors*"

- name: JSON Consumer All Logs
if: always()
run: grep "" testutil/e2e/protocolLogs/04_jsonConsumer* --exclude="*errors*"

- name: JSON Consumer Error Only Logs
if: always()
continue-on-error: true
run: grep "" testutil/e2e/protocolLogs/04_jsonConsumer* --include="*errors*"

- name: Lava Provider All Logs
if: always()
run: grep "" testutil/e2e/protocolLogs/05_LavaProvider* --exclude="*errors*"

- name: Lava Provider Error Only Logs
if: always()
continue-on-error: true
run: grep "" testutil/e2e/protocolLogs/05_LavaProvider* --include="*errors*"

- name: Lava over Lava All Logs
if: always()
run: cat testutil/e2e/protocolLogs/07_lavaOverLava.log

- name: Lava over Lava Error Only Logs
if: always()
continue-on-error: true
run: cat testutil/e2e/protocolLogs/07_lavaOverLava_errors.log

- name: RPCConsumer Consumer All Logs
if: always()
run: grep "" testutil/e2e/protocolLogs/06_RPCConsumer* --exclude="*errors*"

- name: RPCConsumer Consumer Error Only Logs
if: always()
continue-on-error: true
run: grep "" testutil/e2e/protocolLogs/06_RPCConsumer* --include="*errors*"
- uses: actions/checkout@v3
with:
fetch-depth: "0"

- uses: actions/setup-go@v3
with:
go-version: 1.20.5

######################################################
### Run Lava Protocol E2E Tests
######################################################
- name: Run Lava E2E Tests -timeout 1200s
run: go test ./testutil/e2e/ -run ^TestLavaProtocol$ -v -timeout 1200s # 20mins

- name: tail -n 300 Lavad Logs
if: always()
run: tail -n 300 testutil/e2e/protocolLogs/00_StartLava.log

- name: Stake Lava All Logs
if: always()
run: cat testutil/e2e/protocolLogs/01_stakeLava.log

- name: Stake Lava Error Only Logs
if: always()
continue-on-error: true
run: cat testutil/e2e/protocolLogs/01_stakeLava_errors.log

- name: head -n 300 JSON Proxy Logs
if: always()
run: head -n 300 testutil/e2e/protocolLogs/02_jsonProxy.log

- name: tail -n 300 JSON Proxy Logs
if: always()
run: tail -n 300 testutil/e2e/protocolLogs/02_jsonProxy.log

- name: JSON Proxy Error Only Logs
if: always()
continue-on-error: true
run: cat testutil/e2e/protocolLogs/02_jsonProxy_errors.log

- name: JSON Provider All Logs
if: always()
run: grep "" testutil/e2e/protocolLogs/03_EthProvider* --exclude="*errors*"

- name: JSON Provider Error Only Logs
if: always()
continue-on-error: true
run: grep "" testutil/e2e/protocolLogs/03_EthProvider* --include="*errors*"

- name: JSON Consumer All Logs
if: always()
run: grep "" testutil/e2e/protocolLogs/04_jsonConsumer* --exclude="*errors*"

- name: JSON Consumer Error Only Logs
if: always()
continue-on-error: true
run: grep "" testutil/e2e/protocolLogs/04_jsonConsumer* --include="*errors*"

- name: Lava Provider All Logs
if: always()
run: grep "" testutil/e2e/protocolLogs/05_LavaProvider* --exclude="*errors*"

- name: Lava Provider Error Only Logs
if: always()
continue-on-error: true
run: grep "" testutil/e2e/protocolLogs/05_LavaProvider* --include="*errors*"

- name: Lava over Lava All Logs
if: always()
run: cat testutil/e2e/protocolLogs/07_lavaOverLava.log

- name: Lava over Lava Error Only Logs
if: always()
continue-on-error: true
run: cat testutil/e2e/protocolLogs/07_lavaOverLava_errors.log

- name: RPCConsumer Consumer All Logs
if: always()
run: grep "" testutil/e2e/protocolLogs/06_RPCConsumer* --exclude="*errors*"

- name: RPCConsumer Consumer Error Only Logs
if: always()
continue-on-error: true
run: grep "" testutil/e2e/protocolLogs/06_RPCConsumer* --include="*errors*"
test-sdk-e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
fetch-depth: "0"

- uses: actions/setup-go@v3
with:
go-version: 1.20.5

# Setup Paths
- name: home
run: pwd && ls -l
- name: ls usr
run: ls -l /home/runner/work/lava/lava
- name: cp lava
run: cp -r ~/work/lava/lava ~/go/lava
- name: export PATH
run: export PATH=$PATH:/go:/go/bin:$(go env GOPATH)/bin:/usr/local:`pwd`:/home/runner/work/lava/lava/
# - name: export
# run: export PATH=$PATH:/go/lava
- name: export GOPATH
run: export GOPATH=$GOPATH:$(go env GOPATH):/go:/go/lava:/usr/local:`pwd`
- name: export LAVA
run: export LAVA=/home/runner/work/lava/lava
- name: go env
run: go env
- name: pwd
run: pwd
- name: tree
run: tree
- name: ls -l
run: ls -l
go-version: "1.20.5"

# Install Node.js
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: 20

# install ts-node
node-version: "21"

- name: Init the SDK
run: GOPATH=~/go ./scripts/init_sdk.sh
working-directory: ./ecosystem/lava-sdk

- name: Build
run: yarn build
working-directory: ./ecosystem/lava-sdk

- name: Install ts-node
run: npm install -g ts-node

# Install dependencies and build
- name: Install dependencies and build
run: |
cd ecosystem/lava-sdk
npm install
npm run build
- name: Install telescope dependencies
run: |
go mod tidy
cd ecosystem/lavajs
npm install
npm run e2e-setup
run: yarn; yarn e2e-setup
working-directory: ./ecosystem/lavajs

- name: setup test environment
run: |
cd testutil/e2e/sdk/tests
npm install --save-dev @types/node
- name: Setup test environment
run: npm init --yes; npm install --save-dev @types/node

######################################################
### Run Lava E2E Tests
### Run Lava SDK E2E Tests
######################################################
- name: Run Lava E2E Tests -timeout 1200s
run: go test ./testutil/e2e/ -run ^TestLavaSDK -v -timeout 1200s # 20mins
Expand Down Expand Up @@ -246,70 +195,46 @@ jobs:
test-payment-e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- uses: actions/setup-go@v3
with:
go-version: 1.20.5

# Setup Paths
- name: home
run: pwd && ls -l
- name: ls usr
run: ls -l /home/runner/work/lava/lava
- name: cp lava
run: cp -r ~/work/lava/lava ~/go/lava
- name: export PATH
run: export PATH=$PATH:/go:/go/bin:$(go env GOPATH)/bin:/usr/local:`pwd`:/home/runner/work/lava/lava/
# - name: export
# run: export PATH=$PATH:/go/lava
- name: export GOPATH
run: export GOPATH=$GOPATH:$(go env GOPATH):/go:/go/lava:/usr/local:`pwd`
- name: export LAVA
run: export LAVA=/home/runner/work/lava/lava
- name: go env
run: go env
- name: pwd
run: pwd
- name: tree
run: tree
- name: ls -l
run: ls -l

######################################################
### Run Lava E2E Tests
######################################################
- name: Run Lava Payment E2E Tests -timeout 1200s
run: go test ./testutil/e2e/ -run ^TestLavaProtocolPayment$ -v -timeout 1200s # 20mins

- name: tail -n 300 Lavad Logs
if: always()
run: tail -n 300 testutil/e2e/protocolLogs/00_StartLava.log

- name: Stake Lava All Logs
if: always()
run: cat testutil/e2e/protocolLogs/01_stakeLavaForPayment.log

- name: Stake Lava Error Only Logs
if: always()
continue-on-error: true
run: cat testutil/e2e/protocolLogs/01_stakeLava_errors.log

- name: Lava Provider All Logs
if: always()
run: grep "" testutil/e2e/protocolLogs/05_LavaProvider* --exclude="*errors*"

- name: Lava Provider Error Only Logs
if: always()
continue-on-error: true
run: grep "" testutil/e2e/protocolLogs/05_LavaProvider* --include="*errors*"

- name: RPCConsumer Consumer All Logs
if: always()
run: grep "" testutil/e2e/protocolLogs/06_RPCConsumer* --exclude="*errors*"

- name: RPCConsumer Consumer Error Only Logs
if: always()
continue-on-error: true
run: grep "" testutil/e2e/protocolLogs/06_RPCConsumer* --include="*errors*"
- uses: actions/checkout@v3
with:
fetch-depth: "0"
- uses: actions/setup-go@v3
with:
go-version: 1.20.5

######################################################
### Run Lava Protocol Payment E2E Tests
######################################################
- name: Run Lava Payment E2E Tests -timeout 1200s
run: go test ./testutil/e2e/ -run ^TestLavaProtocolPayment$ -v -timeout 1200s # 20mins

- name: tail -n 300 Lavad Logs
if: always()
run: tail -n 300 testutil/e2e/protocolLogs/00_StartLava.log

- name: Stake Lava All Logs
if: always()
run: cat testutil/e2e/protocolLogs/01_stakeLavaForPayment.log

- name: Stake Lava Error Only Logs
if: always()
continue-on-error: true
run: cat testutil/e2e/protocolLogs/01_stakeLava_errors.log

- name: Lava Provider All Logs
if: always()
run: grep "" testutil/e2e/protocolLogs/05_LavaProvider* --exclude="*errors*"

- name: Lava Provider Error Only Logs
if: always()
continue-on-error: true
run: grep "" testutil/e2e/protocolLogs/05_LavaProvider* --include="*errors*"

- name: RPCConsumer Consumer All Logs
if: always()
run: grep "" testutil/e2e/protocolLogs/06_RPCConsumer* --exclude="*errors*"

- name: RPCConsumer Consumer Error Only Logs
if: always()
continue-on-error: true
run: grep "" testutil/e2e/protocolLogs/06_RPCConsumer* --include="*errors*"
Loading

0 comments on commit 3fa9276

Please sign in to comment.