Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PRT-432 adding rpc consumer to main.go, fixing pairing updater issue updating pairing twice. #294

Merged
merged 7 commits into from
Feb 12, 2023
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
68 changes: 68 additions & 0 deletions .github/workflows/consensus_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Lava Consensus Tests

on: [pull_request]

jobs:
go:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- uses: actions/setup-go@v3
with:
go-version: 1.18.2

# Install Ignite
- name: ignite install
run: git clone --depth 1 --branch v0.22.2 https://github.com/ignite/cli && cd cli && make install
# run: curl https://get.ignite.com/cli! | bash
- name: ignite version
run: ignite version

# 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 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

# Pre-build with ignite
- name: ignite build
uses: nick-fields/retry@v2
with:
max_attempts: 3
retry_on: error
timeout_minutes: 20
command: ignite chain build -v

######################################################
### Run Consensus unitests
######################################################
- name: lava pairing unit Tests
run: go test ./x/pairing/ ./x/pairing/keeper ./x/pairing/types -v

- name: lava epochstorage unit Tests
run: go test ./x/epochstorage/ ./x/epochstorage/keeper ./x/epochstorage/types -v

- name: lava spec unit Tests
run: go test ./x/spec/ ./x/spec/keeper ./x/spec/types -v

- name: lava conflict unit Tests
run: go test ./x/conflict/ ./x/conflict/keeper ./x/conflict/types -v

55 changes: 8 additions & 47 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Lava e2e Tests
name: Lava E2E Tests

on: [push, pull_request]
on: [pull_request]

jobs:
go:
Expand Down Expand Up @@ -57,29 +57,6 @@ jobs:
timeout_minutes: 20
command: ignite chain build -v

######################################################
### Run lava unitests
######################################################
- name: lava pairing unit Tests
run: go test ./x/pairing/ ./x/pairing/keeper ./x/pairing/types -v

- name: lava epochstorage unit Tests
run: go test ./x/epochstorage/ ./x/epochstorage/keeper ./x/epochstorage/types -v

- name: lava spec unit Tests
run: go test ./x/spec/ ./x/spec/keeper ./x/spec/types -v

- name: lava conflict unit Tests
run: go test ./x/conflict/ ./x/conflict/keeper ./x/conflict/types -v

######################################################
### Run relayer unitests
######################################################
- name: Run Relayer unit Tests
run: go test ./protocol/lavasession/ ./protocol/chaintracker/ ./relayer/chainproxy/ -v
- name: Run Relayer Metrics Unit Tests
run: go test ./relayer/metrics/ -v

######################################################
### Run Lava E2E Tests IGNITE VERSION:0.22.1
######################################################
Expand Down Expand Up @@ -135,15 +112,6 @@ jobs:
continue-on-error: true
run: grep "" testutil/e2e/logs/05_tendermintProvider* --include="*errors*"

- name: Tendermint Consumer All Logs
if: always()
run: cat testutil/e2e/logs/06_tendermintConsumer.log

- name: Tendermint Consumer Error Only Logs
if: always()
continue-on-error: true
run: cat testutil/e2e/logs/06_tendermintConsumer_errors.log

- name: Lava over Lava All Logs
if: always()
run: cat testutil/e2e/logs/07_lavaOverLava.log
Expand All @@ -162,15 +130,6 @@ jobs:
continue-on-error: true
run: grep "" testutil/e2e/logs/08_restProvider* --include="*errors*"

- name: Rest Consumer All Logs
if: always()
run: cat testutil/e2e/logs/09_restConsumer.log

- name: Rest Consumer Error Only Logs
if: always()
continue-on-error: true
run: cat testutil/e2e/logs/09_restConsumer_errors.log

- name: GRPC Provider All Logs
if: always()
run: grep "" testutil/e2e/logs/10_grpcProvider* --exclude="*errors*"
Expand All @@ -180,11 +139,13 @@ jobs:
continue-on-error: true
run: grep "" testutil/e2e/logs/10_grpcProvider* --include="*errors*"

- name: GRPC Consumer All Logs
- name: RPCConsumer Consumer All Logs
if: always()
run: cat testutil/e2e/logs/11_grpcConsumer.log
run: cat testutil/e2e/logs/06_RPCConsumer.log

- name: GRPC Consumer Error Only Logs
- name: RPCConsumer Consumer Error Only Logs
if: always()
continue-on-error: true
run: cat testutil/e2e/logs/11_grpcConsumer_errors.log
run: cat testutil/e2e/logs/06_RPCConsumer_errors.log


70 changes: 70 additions & 0 deletions .github/workflows/protocol_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Lava Protocol Tests

on: [pull_request]

jobs:
go:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- uses: actions/setup-go@v3
with:
go-version: 1.18.2

# Install Ignite
- name: ignite install
run: git clone --depth 1 --branch v0.22.2 https://github.com/ignite/cli && cd cli && make install
# run: curl https://get.ignite.com/cli! | bash
- name: ignite version
run: ignite version
# - name: starport install
# run: curl https://get.starport.network/starport@v0.19.2! | bash
# - name: starport version
# run: starport version

# 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

# Pre-build with ignite
- name: ignite build
uses: nick-fields/retry@v2
with:
max_attempts: 3
retry_on: error
timeout_minutes: 20
command: ignite chain build -v

######################################################
### Run protocol unitests
######################################################
- name: Run Lava Session Tests
run: go test ./protocol/lavasession/ -v
- name: Run Lava Chain Tracker Tests
run: go test ./protocol/chaintracker/ -v
- name: Run Lava Chain Proxy Tests
run: go test ./relayer/chainproxy/ -v
- name: Run Relayer Metrics Unit Tests
run: go test ./relayer/metrics/ -v
2 changes: 1 addition & 1 deletion cmd/lavad/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ func main() {
cmdRPCConsumer.Flags().Bool("secure", false, "secure sends reliability on every message")
cmdRPCConsumer.Flags().String(performance.PprofAddressFlagName, "", "pprof server address, used for code profiling")
cmdRPCConsumer.Flags().String(performance.CacheFlagName, "", "address for a cache server to improve performance")
// rootCmd.AddCommand(cmdRPCConsumer) // TODO: DISABLE COMMAND SO IT'S NOT EXPOSED ON MAIN YET
rootCmd.AddCommand(cmdRPCConsumer)

// RPCProvider command flags
flags.AddTxFlagsToCmd(cmdRPCProvider)
Expand Down
63 changes: 43 additions & 20 deletions docs/static/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30433,6 +30433,9 @@ paths:
type: string
QoSWeight:
type: string
recommendedEpochNumToCollectPayment:
type: string
format: uint64
description: >-
QueryParamsResponse is response type for the Query/Params RPC
method.
Expand Down Expand Up @@ -30476,14 +30479,17 @@ paths:
epoch:
type: string
format: uint64
unresponsiveness_complaints:
type: array
items:
type: string
uniquePaymentStorageClientProviderKeys:
type: array
items:
type: string
complainersTotalCu:
type: string
format: uint64
title: >-
total CU that were supposed to be served by the provider
but didn't because he was unavailable (so consumers
complained about him)
pagination:
type: object
properties:
Expand Down Expand Up @@ -30606,14 +30612,17 @@ paths:
epoch:
type: string
format: uint64
unresponsiveness_complaints:
type: array
items:
type: string
uniquePaymentStorageClientProviderKeys:
type: array
items:
type: string
complainersTotalCu:
type: string
format: uint64
title: >-
total CU that were supposed to be served by the provider
but didn't because he was unavailable (so consumers
complained about him)
default:
description: An unexpected error response.
schema:
Expand Down Expand Up @@ -53600,6 +53609,9 @@ definitions:
type: string
QoSWeight:
type: string
recommendedEpochNumToCollectPayment:
type: string
format: uint64
description: Params defines the parameters for the module.
lavanet.lava.pairing.ProviderPaymentStorage:
type: object
Expand All @@ -53609,14 +53621,16 @@ definitions:
epoch:
type: string
format: uint64
unresponsiveness_complaints:
type: array
items:
type: string
uniquePaymentStorageClientProviderKeys:
type: array
items:
type: string
complainersTotalCu:
type: string
format: uint64
title: >-
total CU that were supposed to be served by the provider but didn't
because he was unavailable (so consumers complained about him)
lavanet.lava.pairing.QueryAllEpochPaymentsResponse:
type: object
properties:
Expand Down Expand Up @@ -53669,14 +53683,17 @@ definitions:
epoch:
type: string
format: uint64
unresponsiveness_complaints:
type: array
items:
type: string
uniquePaymentStorageClientProviderKeys:
type: array
items:
type: string
complainersTotalCu:
type: string
format: uint64
title: >-
total CU that were supposed to be served by the provider but
didn't because he was unavailable (so consumers complained about
him)
pagination:
type: object
properties:
Expand Down Expand Up @@ -53878,14 +53895,17 @@ definitions:
epoch:
type: string
format: uint64
unresponsiveness_complaints:
type: array
items:
type: string
uniquePaymentStorageClientProviderKeys:
type: array
items:
type: string
complainersTotalCu:
type: string
format: uint64
title: >-
total CU that were supposed to be served by the provider but
didn't because he was unavailable (so consumers complained about
him)
lavanet.lava.pairing.QueryGetUniquePaymentStorageClientProviderResponse:
type: object
properties:
Expand Down Expand Up @@ -53932,6 +53952,9 @@ definitions:
type: string
QoSWeight:
type: string
recommendedEpochNumToCollectPayment:
type: string
format: uint64
description: QueryParamsResponse is response type for the Query/Params RPC method.
lavanet.lava.pairing.QueryProvidersResponse:
type: object
Expand Down
3 changes: 2 additions & 1 deletion protocol/statetracker/pairing_updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ func NewPairingUpdater(consumerAddress sdk.AccAddress, stateQuery *ConsumerState

func (pu *PairingUpdater) RegisterPairing(ctx context.Context, consumerSessionManager *lavasession.ConsumerSessionManager) error {
chainID := consumerSessionManager.RPCEndpoint().ChainID
pairingList, epoch, _, err := pu.stateQuery.GetPairing(context.Background(), chainID, -1)
pairingList, epoch, nextBlockForUpdate, err := pu.stateQuery.GetPairing(context.Background(), chainID, -1)
if err != nil {
return err
}
pu.updateConsummerSessionManager(ctx, pairingList, consumerSessionManager, epoch)
pu.nextBlockForUpdate = nextBlockForUpdate // make sure we don't update twice when launching.
consumerSessionsManagersList, ok := pu.consumerSessionManagersMap[chainID]
if !ok {
pu.consumerSessionManagersMap[chainID] = []*lavasession.ConsumerSessionManager{consumerSessionManager}
Expand Down
Loading