Skip to content

Commit

Permalink
Added a WIP E2E test
Browse files Browse the repository at this point in the history
  • Loading branch information
Olshansk committed Feb 1, 2024
1 parent 3082237 commit 40a21f2
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 25 deletions.
26 changes: 8 additions & 18 deletions docs/static/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47184,7 +47184,7 @@ paths:
service:
title: >-
The Service for which the application is
configured
configured for
type: object
properties:
id:
Expand Down Expand Up @@ -47251,7 +47251,7 @@ paths:
service:
title: >-
The Service for which the supplier is
configured
configured for
type: object
properties:
id:
Expand Down Expand Up @@ -47287,14 +47287,12 @@ paths:
- GRPC
- WEBSOCKET
- JSON_RPC
- REST
default: UNKNOWN_RPC
description: |-
- UNKNOWN_RPC: Undefined RPC type
- GRPC: gRPC
- WEBSOCKET: WebSocket
- JSON_RPC: JSON-RPC
- REST: REST
configs:
type: array
items:
Expand Down Expand Up @@ -77918,7 +77916,7 @@ definitions:
type: object
properties:
service:
title: The Service for which the application is configured
title: The Service for which the application is configured for
type: object
properties:
id:
Expand Down Expand Up @@ -77982,7 +77980,7 @@ definitions:
type: object
properties:
service:
title: The Service for which the supplier is configured
title: The Service for which the supplier is configured for
type: object
properties:
id:
Expand Down Expand Up @@ -78017,14 +78015,12 @@ definitions:
- GRPC
- WEBSOCKET
- JSON_RPC
- REST
default: UNKNOWN_RPC
description: |-
- UNKNOWN_RPC: Undefined RPC type
- GRPC: gRPC
- WEBSOCKET: WebSocket
- JSON_RPC: JSON-RPC
- REST: REST
configs:
type: array
items:
Expand Down Expand Up @@ -78174,7 +78170,7 @@ definitions:
type: object
properties:
service:
title: The Service for which the application is configured
title: The Service for which the application is configured for
type: object
properties:
id:
Expand Down Expand Up @@ -78236,7 +78232,7 @@ definitions:
type: object
properties:
service:
title: The Service for which the supplier is configured
title: The Service for which the supplier is configured for
type: object
properties:
id:
Expand Down Expand Up @@ -78271,14 +78267,12 @@ definitions:
- GRPC
- WEBSOCKET
- JSON_RPC
- REST
default: UNKNOWN_RPC
description: |-
- UNKNOWN_RPC: Undefined RPC type
- GRPC: gRPC
- WEBSOCKET: WebSocket
- JSON_RPC: JSON-RPC
- REST: REST
configs:
type: array
items:
Expand Down Expand Up @@ -78425,7 +78419,6 @@ definitions:
- GRPC: gRPC
- WEBSOCKET: WebSocket
- JSON_RPC: JSON-RPC
- REST: REST
title: Enum to define RPC types
pocket.shared.Supplier:
type: object
Expand Down Expand Up @@ -78454,7 +78447,7 @@ definitions:
type: object
properties:
service:
title: The Service for which the supplier is configured
title: The Service for which the supplier is configured for
type: object
properties:
id:
Expand Down Expand Up @@ -78494,7 +78487,6 @@ definitions:
- GRPC: gRPC
- WEBSOCKET: WebSocket
- JSON_RPC: JSON-RPC
- REST: REST
configs:
type: array
items:
Expand Down Expand Up @@ -78553,7 +78545,6 @@ definitions:
- GRPC: gRPC
- WEBSOCKET: WebSocket
- JSON_RPC: JSON-RPC
- REST: REST
configs:
type: array
items:
Expand Down Expand Up @@ -78587,7 +78578,7 @@ definitions:
type: object
properties:
service:
title: The Service for which the supplier is configured
title: The Service for which the supplier is configured for
type: object
properties:
id:
Expand Down Expand Up @@ -78626,7 +78617,6 @@ definitions:
- GRPC: gRPC
- WEBSOCKET: WebSocket
- JSON_RPC: JSON-RPC
- REST: REST
configs:
type: array
items:
Expand Down
5 changes: 3 additions & 2 deletions e2e/tests/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ import (

tmcli "github.com/cometbft/cometbft/libs/cli"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/regen-network/gocuke"
"github.com/stretchr/testify/require"

"github.com/pokt-network/poktroll/app"
"github.com/pokt-network/poktroll/testutil/testclient"
apptypes "github.com/pokt-network/poktroll/x/application/types"
sessiontypes "github.com/pokt-network/poktroll/x/session/types"
sharedtypes "github.com/pokt-network/poktroll/x/shared/types"
suppliertypes "github.com/pokt-network/poktroll/x/supplier/types"
"github.com/regen-network/gocuke"
"github.com/stretchr/testify/require"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/session.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Feature: Session Namespace
Scenario: Supplier completes claim/proof lifecycle for a valid session
Given the user has the pocketd binary installed
When the supplier "supplier1" has serviced a session with "5" relays for service "svc1" for application "app1"
And after the supplier creates a claim for the session for service "svc1" for application "app1"
And the user should wait for "5" seconds
Then the claim created by supplier "supplier1" for service "svc1" for application "app1" should be persisted on-chain
# TODO_IMPROVE: ...
# And an event should be emitted...
Expand Down
13 changes: 13 additions & 0 deletions e2e/tests/tokenomics.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Feature: Tokenomics Namespaces

# This test
Scenario: Basic tokenomics validation that Supplier mint equals Application burn
Given the user has the pocketd binary installed
And an account exists for "supplier1"
And an account exists for "app1"
When the supplier "supplier1" has serviced a session with "20" relays for service "svc1" for application "app1"
And the user should wait for "5" seconds
# TODO_UPNEXT(@Olshansk, #359): Expand on the two expectations below after integrating the tokenomics module
# into the supplier module.
# Then the account balance of "supplier1" should be "1000" uPOKT "more" than before
# And the account balance of "app1" should be "1000" uPOKT "less" than before
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ require (
github.com/athanorlabs/go-dleq v0.1.0
github.com/cometbft/cometbft v0.37.2
github.com/cometbft/cometbft-db v0.8.0
github.com/cosmos/cosmos-proto v1.0.0-beta.2
github.com/cosmos/cosmos-sdk v0.47.5
github.com/cosmos/gogoproto v1.4.11
github.com/cosmos/ibc-go/v7 v7.3.1
Expand All @@ -50,6 +51,7 @@ require (
golang.org/x/crypto v0.15.0
golang.org/x/exp v0.0.0-20230905200255-921286631fa9
golang.org/x/sync v0.5.0
google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb
google.golang.org/grpc v1.59.0
gopkg.in/yaml.v2 v2.4.0
)
Expand Down Expand Up @@ -96,7 +98,6 @@ require (
github.com/containerd/cgroups v1.1.0 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/cosmos/btcutil v1.0.5 // indirect
github.com/cosmos/cosmos-proto v1.0.0-beta.2 // indirect
github.com/cosmos/go-bip39 v1.0.0 // indirect
github.com/cosmos/gogogateway v1.2.0 // indirect
github.com/cosmos/iavl v0.20.0 // indirect
Expand Down Expand Up @@ -293,7 +294,6 @@ require (
google.golang.org/api v0.143.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
Expand Down
1 change: 0 additions & 1 deletion x/tokenomics/keeper/settle_session_accounting.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const (
smstRootSize = 40
)

// TODO_IN_THIS_PR: Rollback state changes if we find out that this function is not
// atomic.if this function is not atomic.

// SettleSessionAccounting is responsible for all of the post-session accounting
Expand Down
3 changes: 2 additions & 1 deletion x/tokenomics/keeper/settle_session_accounting_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import (
"github.com/pokt-network/poktroll/x/tokenomics/types"
)

// TODO_IN_THIS_PR: Evaluate what other tests we need to add in this iteration.
// TODO_TEST(@bryanchriswhite, @Olshansk): Improve tokenomics tests (i.e. checking balances)
// once

func TestSettleSessionAccounting_ValidAccounting(t *testing.T) {
t.Skip("TODO_BLOCKER(@Olshansk): Add E2E and integration tests so we validate the actual state changes of the bank & account keepers.")
Expand Down

0 comments on commit 40a21f2

Please sign in to comment.