Skip to content

Commit

Permalink
[Refactor] Replace embedded Service with ServiceId (#802)
Browse files Browse the repository at this point in the history
## Summary

This PR replaces all embedded `Service` entries with `ServiceId`.

Most of the changes are `Service` -> `ServiceId` replacements but
special attention has to be put on:
* x/session/types/session_header.go
* x/shared/helpers/service_configs.go
* x/shared/types/service.go
* x/service/types/message_add_service.go
* proto/poktroll/shared/service.proto
* proto/poktroll/session/types.proto
* proto/poktroll/session/query.proto

A follow-up to update `Shannon-SDK` is expected after approval.

E2E tests pass locally.

## Issue


![image](https://github.com/user-attachments/assets/c1feb50b-89c1-4b4f-b4cb-94cfb4ec5ade)

## Type of change

Select one or more from the following:

- [ ] New feature, functionality or library
- [ ] Consensus breaking; add the `consensus-breaking` label if so. See
#791 for details
- [ ] Bug fix
- [x] Code health or cleanup
- [ ] Documentation
- [ ] Other (specify)

## Testing

- [ ] **Documentation**: `make docusaurus_start`; only needed if you
make doc changes
- [x] **Unit Tests**: `make go_develop_and_test`
- [x] **LocalNet E2E Tests**: `make test_e2e`
- [ ] **DevNet E2E Tests**: Add the `devnet-test-e2e` label to the PR.

## Sanity Checklist

- [x] I have tested my changes using the available tooling
- [ ] I have commented my code
- [x] I have performed a self-review of my own code; both comments &
source code
- [ ] I create and reference any new tickets, if applicable
- [ ] I have left TODOs throughout the codebase, if applicable

---------

Co-authored-by: Daniel Olshansky <[email protected]>
  • Loading branch information
red-0ne and Olshansk authored Sep 11, 2024
1 parent 614ad77 commit 88a9197
Show file tree
Hide file tree
Showing 93 changed files with 947 additions and 1,253 deletions.
197 changes: 89 additions & 108 deletions api/poktroll/session/query.pulsar.go

Large diffs are not rendered by default.

198 changes: 90 additions & 108 deletions api/poktroll/session/types.pulsar.go

Large diffs are not rendered by default.

323 changes: 143 additions & 180 deletions api/poktroll/shared/service.pulsar.go

Large diffs are not rendered by default.

27 changes: 9 additions & 18 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,9 @@ genesis:
- address: pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4
delegatee_gateway_addresses: []
service_configs:
- service:
id: anvil
- service:
id: rest
- service:
id: ollama
- service_id: anvil
- service_id: rest
- service_id: ollama
stake:
# NB: This value should be exactly 1upokt smaller than the value in
# `supplier1_stake_config.yaml` so that the stake command causes a state change.
Expand All @@ -183,12 +180,9 @@ genesis:
- address: pokt1ad28jdap2zfanjd7hpkh984yveney6k9a42man
delegatee_gateway_addresses: []
service_configs:
- service:
id: anvil
- service:
id: rest
- service:
id: ollama
- service_id: anvil
- service_id: rest
- service_id: ollama
stake:
# NB: This value should be exactly 1upokt smaller than the value in
# `supplier1_stake_config.yaml` so that the stake command causes a state change.
Expand All @@ -199,26 +193,23 @@ genesis:
- owner_address: pokt19a3t4yunp0dlpfjrp7qwnzwlrzd5fzs2gjaaaj
operator_address: pokt19a3t4yunp0dlpfjrp7qwnzwlrzd5fzs2gjaaaj
services:
- service:
id: anvil
- service_id: anvil
endpoints:
- configs: []
rpc_type: JSON_RPC
url: http://relayminer1:8545
rev_share:
- address: pokt19a3t4yunp0dlpfjrp7qwnzwlrzd5fzs2gjaaaj
rev_share_percentage: "100"
- service:
id: rest
- service_id: rest
endpoints:
- configs: []
rpc_type: REST
url: http://relayminer1:8545
rev_share:
- address: pokt19a3t4yunp0dlpfjrp7qwnzwlrzd5fzs2gjaaaj
rev_share_percentage: "100"
- service:
id: ollama
- service_id: ollama
endpoints:
- configs: []
rpc_type: REST
Expand Down
6 changes: 3 additions & 3 deletions e2e/tests/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ func (s *suite) TheServiceRegisteredForApplicationHasAComputeUnitsPerRelayOf(ser
// CHeck if the application is registered for the service
isRegistered := false
for _, serviceConfig := range app.ServiceConfigs {
if serviceConfig.Service.Id == serviceId {
if serviceConfig.ServiceId == serviceId {
isRegistered = true
break
}
Expand All @@ -415,7 +415,7 @@ func (s *suite) TheForAccountIsStakedWithUpokt(actorType, accName string, amount

func (s *suite) TheApplicationIsStakedForService(appName string, serviceId string) {
for _, serviceConfig := range accNameToAppMap[appName].ServiceConfigs {
if serviceConfig.Service.Id == serviceId {
if serviceConfig.ServiceId == serviceId {
return
}
}
Expand All @@ -424,7 +424,7 @@ func (s *suite) TheApplicationIsStakedForService(appName string, serviceId strin

func (s *suite) TheSupplierIsStakedForService(supplierOperatorName string, serviceId string) {
for _, serviceConfig := range operatorAccNameToSupplierMap[supplierOperatorName].Services {
if serviceConfig.Service.Id == serviceId {
if serviceConfig.ServiceId == serviceId {
return
}
}
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/session_steps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func (s *suite) TheClaimCreatedBySupplierForServiceForApplicationShouldBeSuccess
claim := claimSettledEvent.Claim
require.Equal(s, app.Address, claim.SessionHeader.ApplicationAddress)
require.Equal(s, supplier.OperatorAddress, claim.SupplierOperatorAddress)
require.Equal(s, serviceId, claim.SessionHeader.Service.Id)
require.Equal(s, serviceId, claim.SessionHeader.ServiceId)
require.Greater(s, claimSettledEvent.NumComputeUnits, uint64(0), "compute units should be greater than 0")
return true
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ require (
// This is creating a circular dependency whereby exporting the protobufs into a separate
// repo is the first obvious idea, but has to be carefully considered, automated, and is not
// a hard blocker.
github.com/pokt-network/shannon-sdk v0.0.0-20240829123247-30d71ae84f4f
github.com/pokt-network/shannon-sdk v0.0.0-20240907012836-7172ed278f8b
github.com/pokt-network/smt v0.13.0
github.com/pokt-network/smt/kvstore/pebble v0.0.0-20240822175047-21ea8639c188
github.com/prometheus/client_golang v1.19.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1001,8 +1001,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRI
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pokt-network/ring-go v0.1.0 h1:hF7mDR4VVCIqqDAsrloP8azM9y1mprc99YgnTjKSSwk=
github.com/pokt-network/ring-go v0.1.0/go.mod h1:8NHPH7H3EwrPX3XHfpyRI6bz4gApkE3+fd0XZRbMWP0=
github.com/pokt-network/shannon-sdk v0.0.0-20240829123247-30d71ae84f4f h1:rS954qvNS61SVyDqwtJ6Dla4kc7Cjb/hsMpAFFqKJds=
github.com/pokt-network/shannon-sdk v0.0.0-20240829123247-30d71ae84f4f/go.mod h1:zLQZCtErH+bPOrFZ1PpYgcp+EfS+zMg/6JqG53apaWw=
github.com/pokt-network/shannon-sdk v0.0.0-20240907012836-7172ed278f8b h1:dTj9PG3p+72ycG1r7PqdZ04Iy42qoCydrveIjXIaMKA=
github.com/pokt-network/shannon-sdk v0.0.0-20240907012836-7172ed278f8b/go.mod h1:WznmqcNxQ7mdl/nACaf0faJbphX+5YtHcxHjCkhXbsc=
github.com/pokt-network/smt v0.13.0 h1:C2F8FlJh34aU+DVeRU/Bt8BOkFXn4QjWMK+nbT9PUj4=
github.com/pokt-network/smt v0.13.0/go.mod h1:S4Ho4OPkK2v2vUCHNtA49XDjqUC/OFYpBbynRVYmxvA=
github.com/pokt-network/smt/kvstore/pebble v0.0.0-20240822175047-21ea8639c188 h1:QK1WmFKQ/OzNVob/br55Brh+EFbWhcdq41WGC8UMihM=
Expand Down
6 changes: 3 additions & 3 deletions load-testing/tests/relays_stress_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ func (s *relaysSuite) addPendingStakeApplicationMsg(application *accountInfo) {
application.addPendingMsg(apptypes.NewMsgStakeApplication(
application.address,
application.amountToStake,
[]*sharedtypes.ApplicationServiceConfig{{Service: testedService}},
[]*sharedtypes.ApplicationServiceConfig{{ServiceId: testedServiceId}},
))
}

Expand Down Expand Up @@ -793,7 +793,7 @@ func (s *relaysSuite) addPendingStakeSupplierMsg(supplier *accountInfo) {
supplier.amountToStake,
[]*sharedtypes.SupplierServiceConfig{
{
Service: testedService,
ServiceId: testedServiceId,
Endpoints: []*sharedtypes.SupplierEndpoint{
{
Url: s.suppliersUrls[supplier.address],
Expand Down Expand Up @@ -1046,7 +1046,7 @@ func (s *relaysSuite) sendRelay(iteration uint64, relayPayload string) (appAddre
gatewayUrl.RawQuery = query.Encode()

// Use the pre-defined service ID that all application and suppliers are staking for.
gatewayUrl.Path = testedService.Id
gatewayUrl.Path = testedServiceId

// TODO_MAINNET: Capture the relay response to check for failing relays.
// Send the relay request within a goroutine to avoid blocking the test batches
Expand Down
6 changes: 3 additions & 3 deletions load-testing/tests/relays_stress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ var (
supplierStakeAmount sdk.Coin
// gatewayStakeAmount is the amount of tokens to stake by gateways.
gatewayStakeAmount sdk.Coin
// testedService is the service ID for that all applications and suppliers will
// testedServiceId is the service ID for that all applications and suppliers will
// be using in this test.
testedService *sharedtypes.Service
testedServiceId string
// blockDuration is the duration of a block in seconds.
// NB: This value SHOULD be equal to `timeout_propose` in `config.yml`.
blockDuration = int64(2)
Expand Down Expand Up @@ -312,7 +312,7 @@ func (s *relaysSuite) LocalnetIsRunning() {
loadTestParams := s.initializeLoadTestParams()

// Set the tested service ID from the load test manifest.
testedService = &sharedtypes.Service{Id: loadTestParams.ServiceId}
testedServiceId = loadTestParams.ServiceId

// If the test is run on a non-ephemeral chain, set the CometLocalTCPURL and
// CometLocalWebsocketURL to the TestNetNode URL. These variables are used
Expand Down
4 changes: 1 addition & 3 deletions pkg/client/query/sessionquerier.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (

"github.com/pokt-network/poktroll/pkg/client"
sessiontypes "github.com/pokt-network/poktroll/x/session/types"
sharedtypes "github.com/pokt-network/poktroll/x/shared/types"
)

var _ client.SessionQueryClient = (*sessionQuerier)(nil)
Expand Down Expand Up @@ -49,10 +48,9 @@ func (sessq *sessionQuerier) GetSession(
serviceId string,
blockHeight int64,
) (*sessiontypes.Session, error) {
service := &sharedtypes.Service{Id: serviceId}
req := &sessiontypes.QueryGetSessionRequest{
ApplicationAddress: appAddress,
Service: service,
ServiceId: serviceId,
BlockHeight: blockHeight,
}
res, err := sessq.sessionQuerier.GetSession(ctx, req)
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func NewTestApplicationServiceConfig(prefix string, count int) []*sharedtypes.Ap
for i := range appSvcCfg {
serviceId := fmt.Sprintf("%s%d", prefix, i)
appSvcCfg[i] = &sharedtypes.ApplicationServiceConfig{
Service: &sharedtypes.Service{Id: serviceId},
ServiceId: serviceId,
}
}
return appSvcCfg
Expand Down
4 changes: 2 additions & 2 deletions pkg/client/supplier/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (sClient *supplierClient) SubmitProofs(
"supplier_operator_addr": proofMsg.SupplierOperatorAddress,
"app_addr": sessionHeader.ApplicationAddress,
"session_id": sessionHeader.SessionId,
"service": sessionHeader.Service.Id,
"service_id": sessionHeader.ServiceId,
}).
Msg("submitted a new proof")
}
Expand Down Expand Up @@ -146,7 +146,7 @@ func (sClient *supplierClient) CreateClaims(
"supplier_operator_addr": claimMsg.SupplierOperatorAddress,
"app_addr": sessionHeader.ApplicationAddress,
"session_id": sessionHeader.SessionId,
"service": sessionHeader.Service.Id,
"service_id": sessionHeader.ServiceId,
}).
Msg("created a new claim")
}
Expand Down
9 changes: 2 additions & 7 deletions pkg/client/supplier/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"github.com/pokt-network/poktroll/testutil/testclient/testtx"
prooftypes "github.com/pokt-network/poktroll/x/proof/types"
sessiontypes "github.com/pokt-network/poktroll/x/session/types"
sharedtypes "github.com/pokt-network/poktroll/x/shared/types"
)

const (
Expand Down Expand Up @@ -107,9 +106,7 @@ func TestSupplierClient_CreateClaim(t *testing.T) {
ApplicationAddress: testAppAddr.String(),
SessionStartBlockHeight: 1,
SessionId: "",
Service: &sharedtypes.Service{
Id: testService,
},
ServiceId: testService,
}

msgClaim := &prooftypes.MsgCreateClaim{
Expand Down Expand Up @@ -170,9 +167,7 @@ func TestSupplierClient_SubmitProof(t *testing.T) {
ApplicationAddress: testAppAddr.String(),
SessionStartBlockHeight: 1,
SessionId: "",
Service: &sharedtypes.Service{
Id: testService,
},
ServiceId: testService,
}

kvStore, err := pebble.NewKVStore("")
Expand Down
2 changes: 1 addition & 1 deletion pkg/crypto/rings/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (rc *ringClient) VerifyRelayRequestSignature(
Fields(map[string]any{
"session_id": sessionHeader.GetSessionId(),
"application_address": sessionHeader.GetApplicationAddress(),
"service_id": sessionHeader.GetService().GetId(),
"service_id": sessionHeader.GetServiceId(),
}).
Msg("verifying relay request signature")

Expand Down
3 changes: 1 addition & 2 deletions pkg/relayer/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/pokt-network/poktroll/pkg/observable"
servicetypes "github.com/pokt-network/poktroll/x/service/types"
sessiontypes "github.com/pokt-network/poktroll/x/session/types"
sharedtypes "github.com/pokt-network/poktroll/x/shared/types"
)

// RelaysObservable is an observable which is notified with Relay values.
Expand Down Expand Up @@ -65,7 +64,7 @@ type RelayerProxy interface {
VerifyRelayRequest(
ctx context.Context,
relayRequest *servicetypes.RelayRequest,
service *sharedtypes.Service,
serviceId string,
) error

// SignRelayResponse is a shared method used by RelayServers to sign
Expand Down
7 changes: 2 additions & 5 deletions pkg/relayer/miner/gen/gen_fixtures.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"github.com/pokt-network/poktroll/testutil/sample"
servicetypes "github.com/pokt-network/poktroll/x/service/types"
sessiontypes "github.com/pokt-network/poktroll/x/session/types"
sharedtypes "github.com/pokt-network/poktroll/x/shared/types"
)

const (
Expand Down Expand Up @@ -158,10 +157,8 @@ func genRandomizedMinedRelayFixtures(
Req: &servicetypes.RelayRequest{
Meta: servicetypes.RelayRequestMetadata{
SessionHeader: &sessiontypes.SessionHeader{
ApplicationAddress: sample.AccAddress(),
Service: &sharedtypes.Service{
Id: flagSvcID,
},
ApplicationAddress: sample.AccAddress(),
ServiceId: flagSvcID,
SessionId: "session_id",
SessionStartBlockHeight: 1,
SessionEndBlockHeight: 2,
Expand Down
2 changes: 1 addition & 1 deletion pkg/relayer/miner/miner.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func (mnr *miner) getServiceRelayDifficultyTargetHash(ctx context.Context, req *
return nil, fmt.Errorf("invalid session header: %w", err)
}

serviceRelayDifficulty, err := mnr.tokenomicsQueryClient.GetServiceRelayDifficultyTargetHash(ctx, sessionHeader.Service.Id)
serviceRelayDifficulty, err := mnr.tokenomicsQueryClient.GetServiceRelayDifficultyTargetHash(ctx, sessionHeader.ServiceId)
if err != nil {
// TODO_IMPROVE: log the error and a message saying the default relay difficulty target hash
// is being used.
Expand Down
24 changes: 12 additions & 12 deletions pkg/relayer/miner/relay_fixtures_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ var (
// marshaledMinableRelaysHex are the hex encoded strings of serialized
// relayer.MinedRelays which have been pre-mined to difficulty 0000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff (or greater) by
// randomizing the application address and populating the signature with random bytes.
// The ID, starting block height, and ending block height of the session referenced in the relays.
// are hard-coded to "session_id", 1, and 2, respectively.
// The ID, starting block height, and ending block height of the session referenced
// in the relays are hard-coded to "session_id", 1, and 2, respectively.
// The resulting slice of minable relays is intended for use in tests.
marshaledMinableRelaysHex = []string{
"0a5d0a5b0a470a2d636f736d6f73317a387336676d6335306e6a38306e71367138356e66376c3663723477636a766b61643779386812060a04737663311a0a73657373696f6e5f6964200128021210db053f9e0abf922e6cddc648678d0a88",
"0a5d0a5b0a470a2d636f736d6f7331646d7139646e3077777677307a3872673930706e737532786835676c3963676c6c77786d6d3812060a04737663311a0a73657373696f6e5f6964200128021210a2e27cad60751773b2468483a7aabee4",
"0a5d0a5b0a470a2d636f736d6f733130746772796737336438763979707a68763779616e636174346d6b6473686c347078397a613312060a04737663311a0a73657373696f6e5f696420012802121078522b759b6ed8c0d2891d21dcaf4d74",
"0a5d0a5b0a470a2d636f736d6f7331637968727463337a65656e7a63616872306c396a37646d3865687a6b30776e75616b3574347912060a04737663311a0a73657373696f6e5f6964200128021210139f82fd26920aa23dea91dda0ee5954",
"0a5d0a5b0a470a2d636f736d6f73317a64666874346d793264783779736336343638656565336a7a7165636865793733756d77337a12060a04737663311a0a73657373696f6e5f69642001280212102f525aa98228d86ec92eb090dda16418",
"0a5b0a590a450a2d636f736d6f73316b716875327a3530396461756b37753778396134673935723834787534717767736865727a611204737663311a0a73657373696f6e5f696420012802121045c9492b1d49c37206eb5d4bbc302015",
"0a5b0a590a450a2d636f736d6f73316e72777a787a687433387a33797a3865336163756a7230373034613537743730756e743933351204737663311a0a73657373696f6e5f69642001280212101f26304d5a6d4caca48761fd4710e1f6",
"0a5b0a590a450a2d636f736d6f7331687564747072687777747a643379743633746b767263706672306d39396d6c736d7533757a6e1204737663311a0a73657373696f6e5f696420012802121033950975d04001d0d049e2d46ad2e61e",
"0a5b0a590a450a2d636f736d6f73316b676b77787261386877367977667035703267616b3061386878723830756a387234613464371204737663311a0a73657373696f6e5f696420012802121083397fed963fa8dd77743089b9eba5af",
"0a5b0a590a450a2d636f736d6f733172336d6a763635323532666636397a7a37726e6539787a6638753368326c767376686d73686a1204737663311a0a73657373696f6e5f69642001280212103b46c9e9e9fc6a2cc0f687ae0cfdb898",
}

// marshaledUnminableRelaysHex are the hex encoded strings of serialized
Expand All @@ -26,10 +26,10 @@ var (
// by populating the signature with random bytes. It is intended for use in
// tests.
marshaledUnminableRelaysHex = []string{
"0a5d0a5b0a470a2d636f736d6f733173726775717a6e3366376435753933366d39356c6d7577757a636b7461706b726d743477783712060a04737663311a0a73657373696f6e5f696420012802121025329160fdc25be9d2f1747c1ffb4e78",
"0a5d0a5b0a470a2d636f736d6f73317433306d796d3033736463386e766479793936776b78346e6d7672713565666432786836797212060a04737663311a0a73657373696f6e5f696420012802121060f8483a9c8ec7e94d16afda952dccf9",
"0a5d0a5b0a470a2d636f736d6f733163686e30677972667a346664666a7a7573676d356376636868726371373770327767716d376312060a04737663311a0a73657373696f6e5f69642001280212100674c9bd3b43f1d7520e6e33a62430ac",
"0a5d0a5b0a470a2d636f736d6f7331656573687932386e63376d6b736573713366636d6a77356e333761333234677267743466393712060a04737663311a0a73657373696f6e5f6964200128021210d4d45eb1ba69be25ccb217f5bdc0ddf5",
"0a5d0a5b0a470a2d636f736d6f733137366a683337726c6c75376e73726d736c7072327332763476723532383075326e323338306c12060a04737663311a0a73657373696f6e5f6964200128021210ad8281326ac760bc40e3c71d48b2bf51",
"0a5b0a590a450a2d636f736d6f73317439666874767433656e75726a6b787776333576747278377333636876366d3463706a33776e1204737663311a0a73657373696f6e5f6964200128021210ec9f210d105fcc078a6c5078cf3fae37",
"0a5b0a590a450a2d636f736d6f7331793877756b79333064663063397675783937763838716578746733727066726e366c733961721204737663311a0a73657373696f6e5f696420012802121097521a1cb00a28cdfac68ebb240ad613",
"0a5b0a590a450a2d636f736d6f733130793537336e727663786d766372326830666c666679633737386335743236356b32743877731204737663311a0a73657373696f6e5f6964200128021210e4d547434751191ac8615d337f2687b2",
"0a5b0a590a450a2d636f736d6f733175326175346679706c766377376b38326432616e6b6e79757a75396c787033337737786371761204737663311a0a73657373696f6e5f696420012802121024bda679bd52292fda09763c815c9320",
"0a5b0a590a450a2d636f736d6f73316172396861743375777075346c35356538677664746c396663736a6c796630666167383563641204737663311a0a73657373696f6e5f6964200128021210c6ec58023ae1e96d7cfa2eb384494ab5",
}
)
2 changes: 1 addition & 1 deletion pkg/relayer/proxy/error_reply.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (sync *synchronousRPCServer) replyWithError(

// Fill in the needed missing fields of the RelayRequest with empty values.
relayRequest = relayRequest.NullifyForObservability()
serviceId := relayRequest.Meta.SessionHeader.Service.Id
serviceId := relayRequest.Meta.SessionHeader.ServiceId

errorLogger := sync.logger.With().
Error().
Expand Down
7 changes: 3 additions & 4 deletions pkg/relayer/proxy/relay_verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ import (

"github.com/pokt-network/poktroll/x/service/types"
"github.com/pokt-network/poktroll/x/shared"
sharedtypes "github.com/pokt-network/poktroll/x/shared/types"
)

// VerifyRelayRequest is a shared method used by RelayServers to check the relay
// request signature and session validity.
func (rp *relayerProxy) VerifyRelayRequest(
ctx context.Context,
relayRequest *types.RelayRequest,
supplierService *sharedtypes.Service,
supplierServiceId string,
) error {
// Get the block height at which the relayRequest should be processed.
// Check if the relayRequest is on time or within the session's grace period
Expand Down Expand Up @@ -44,7 +43,7 @@ func (rp *relayerProxy) VerifyRelayRequest(
Fields(map[string]any{
"session_id": sessionHeader.GetSessionId(),
"application_address": appAddress,
"service_id": sessionHeader.GetService().GetId(),
"service_id": sessionHeader.GetServiceId(),
"supplier_operator_address": meta.GetSupplierOperatorAddress(),
}).
Msg("verifying relay request session")
Expand All @@ -54,7 +53,7 @@ func (rp *relayerProxy) VerifyRelayRequest(
session, err := rp.sessionQuerier.GetSession(
ctx,
appAddress,
supplierService.Id,
supplierServiceId,
sessionBlockHeight,
)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/relayer/proxy/server_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (rp *relayerProxy) BuildProvidedServices(ctx context.Context) error {
// Iterate over the server configs and check if `endpointUrl` is present
// in any of the server config's suppliers' service's PubliclyExposedEndpoints
for _, serverConfig := range rp.serverConfigs {
supplierService, ok := serverConfig.SupplierConfigsMap[service.Service.Id]
supplierService, ok := serverConfig.SupplierConfigsMap[service.ServiceId]
hostname := endpointUrl.Hostname()
if ok && slices.Contains(supplierService.PubliclyExposedEndpoints, hostname) {
found = true
Expand Down
Loading

0 comments on commit 88a9197

Please sign in to comment.