Skip to content

Commit

Permalink
Merge pull request #391 from lavanet/CNS-337-e2e-subscription-pairing
Browse files Browse the repository at this point in the history
CNS-337: e2e testing for subscription pairing
  • Loading branch information
Yaroms authored May 2, 2023
2 parents e094676 + 223e74c commit 36018fe
Show file tree
Hide file tree
Showing 25 changed files with 385 additions and 340 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@ jobs:

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

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

- name: Lava Provider All Logs
if: always()
Expand All @@ -123,11 +123,9 @@ jobs:

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

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


run: grep "" testutil/e2e/logs/06_RPCConsumer* --include="*errors*"
11 changes: 8 additions & 3 deletions cookbook/plans/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
"overuse_rate": "0",
"plan_policy": {
"chain_policies": [
{
"chain_id": "LAV1",
"apis": [
]
},
{
"chain_id": "ETH1",
"apis": [
Expand All @@ -32,12 +37,12 @@
}
],
"geolocation_profile": "18446744073709551615",
"total_cu_limit": "1000",
"epoch_cu_limit": "10",
"total_cu_limit": "1000000",
"epoch_cu_limit": "20000",
"max_providers_to_pair": "3"
}
}
]
},
"deposit": "10000000ulava"
}
}
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ require (
github.com/ghodss/yaml v1.0.0 // indirect
github.com/gogo/googleapis v1.4.0 // indirect
github.com/golang/glog v1.0.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2 // indirect
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
golang.org/x/mod v0.7.0 // indirect
golang.org/x/tools v0.2.0 // indirect
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -781,8 +781,6 @@ github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t
github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo=
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2 h1:gDLXvp5S9izjldquuoAhDzccbskOL6tDC5jMSyx3zxE=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2/go.mod h1:7pdNwVWBBHGiCxa9lAszqCJMbfTISJ7oMftp8+UGV08=
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU=
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0=
github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s=
Expand Down
2 changes: 1 addition & 1 deletion protocol/lavasession/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var ( // Consumer Side Errors
UnreachableCodeError = sdkerrors.New("UnreachableCode Error", 666, "Should not get here.")
AllProviderEndpointsDisabledError = sdkerrors.New("AllProviderEndpointsDisabled Error", 667, "All endpoints are not available.") // a provider is completely unresponsive all endpoints are not available
MaximumNumberOfSessionsExceededError = sdkerrors.New("MaximumNumberOfSessionsExceeded Error", 668, "Provider reached maximum number of active sessions.")
MaxComputeUnitsExceededError = sdkerrors.New("MaxComputeUnitsExceeded Error", 669, "Consumer is trying to exceed the maximum number of compute uints available.")
MaxComputeUnitsExceededError = sdkerrors.New("MaxComputeUnitsExceeded Error", 669, "Consumer is trying to exceed the maximum number of compute units available.")
EpochMismatchError = sdkerrors.New("ReportingAnOldEpoch Error", 670, "Tried to Report to an older epoch")
AddressIndexWasNotFoundError = sdkerrors.New("AddressIndexWasNotFound Error", 671, "address index was not found in list")
LockMisUseDetectedError = sdkerrors.New("LockMisUseDetected Error", 672, "Faulty use of locks detected")
Expand Down
15 changes: 14 additions & 1 deletion scripts/init_e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@ __dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source $__dir/useful_commands.sh

GASPRICE="0.000000001ulava"

# Specs proposal
lavad tx gov submit-proposal spec-add ./cookbook/specs/spec_add_ethereum.json,./cookbook/specs/spec_add_ibc.json,./cookbook/specs/spec_add_cosmossdk.json,./cookbook/specs/spec_add_lava.json -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE
lavad tx gov vote 1 yes -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE
sleep 4

# Plans proposal
lavad tx gov submit-proposal plans-add ./cookbook/plans/default.json -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE
lavad tx gov vote 2 yes -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE
sleep 4

STAKE="500000000000ulava"
# Ethereum providers
lavad tx pairing stake-provider "ETH1" $STAKE "127.0.0.1:2221,jsonrpc,1" 1 -y --from servicer1 --provider-moniker "dummyMoniker" --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE
Expand All @@ -22,8 +29,14 @@ lavad tx pairing stake-provider "LAV1" $STAKE "127.0.0.1:2263,tendermintrpc,1 12
lavad tx pairing stake-provider "LAV1" $STAKE "127.0.0.1:2264,tendermintrpc,1 127.0.0.1:2274,rest,1 127.0.0.1:2284,grpc,1" 1 -y --from servicer9 --provider-moniker "dummyMoniker" --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE
lavad tx pairing stake-provider "LAV1" $STAKE "127.0.0.1:2265,tendermintrpc,1 127.0.0.1:2275,rest,1 127.0.0.1:2285,grpc,1" 1 -y --from servicer10 --provider-moniker "dummyMoniker" --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE

# staked clients
# (actually, only user1 is used in testutils/e2e/e2e.go, but having same count
# in both chains simplifies the e2e logic that expects same amount of staked
# clients in all tested chains)
lavad tx pairing stake-client "ETH1" $STAKE 1 -y --from user1 --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE
lavad tx pairing stake-client "LAV1" $STAKE 1 -y --from user2 --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE

lavad tx subscription buy "DefaultPlan" -y --from user3 --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE

# we need to wait for the next epoch for the stake to take action.
sleep_until_next_epoch
sleep_until_next_epoch
4 changes: 2 additions & 2 deletions testutil/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This E2E performs the steps below to test if the system is working as expected.

1. Start lava in developer mode (equivalent to running the command "ignite chain serve" ).
2. Check if lava is done booting up by sending a GRPC request.
3. Send Spec proposals and stake providers and clients.
3. Send Spec and Plan proposals and stake providers and clients.
4. Check if the proposals and stakes are properly executed.
5. Start the JSONRPC Proxy.
6. Start the JSONRPC Provider.
Expand All @@ -30,4 +30,4 @@ After the steps above are finished (even if a step fails and the E2E ends) the E

# Allowed Error List

The allowed error list contains a list of errors that is allowed to happen during tests. The key is the error substring that can be seen in the logs. The value is the description on why this error is allowed.
The allowed error list contains a list of errors that is allowed to happen during tests. The key is the error substring that can be seen in the logs. The value is the description on why this error is allowed.
Loading

0 comments on commit 36018fe

Please sign in to comment.