Skip to content

Commit

Permalink
Reply to all review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Olshansk committed Jul 30, 2024
1 parent 34c4984 commit cabb40e
Show file tree
Hide file tree
Showing 9 changed files with 128 additions and 131 deletions.
125 changes: 63 additions & 62 deletions api/poktroll/service/tx.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions proto/poktroll/service/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ message MsgUpdateParamsResponse {}
// permissionless.
// TODO_BETA: Add Champions / Sources once its fully defined.
message MsgAddService {
option (cosmos.msg.v1.signer) = "address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the service supplier using cosmos' ScalarDescriptor
poktroll.shared.Service service = 2 [(gogoproto.nullable) = false]; // The Service for which the supplier is adding to the network
option (cosmos.msg.v1.signer) = "owner_address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries
string owner_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the service owner using cosmos' ScalarDescriptor
poktroll.shared.Service service = 2 [(gogoproto.nullable) = false]; // The Service being added to the network
}

message MsgAddServiceResponse {}
Expand Down
6 changes: 3 additions & 3 deletions proto/poktroll/shared/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ option go_package = "github.com/pokt-network/poktroll/x/shared/types";
// Msg defines the Msg service.
service Msg {
option (cosmos.msg.v1.service) = true;

// UpdateParams defines a (governance) operation for updating the module
// parameters. The authority defaults to the x/gov module account.
rpc UpdateParams (MsgUpdateParams) returns (MsgUpdateParamsResponse);
Expand All @@ -23,12 +23,12 @@ service Msg {
message MsgUpdateParams {
option (cosmos.msg.v1.signer) = "authority";
option (amino.name) = "poktroll/x/shared/MsgUpdateParams";

// authority is the address that controls the module (defaults to x/gov unless overwritten).
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

// params defines the module parameters to update.

// NOTE: All parameters must be supplied.
Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
}
Expand Down
10 changes: 5 additions & 5 deletions x/service/keeper/msg_server_add_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,23 @@ func (k msgServer) AddService(
foundService, found := k.GetService(ctx, msg.Service.Id)
if found {
if foundService.OwnerAddress != msg.Service.OwnerAddress {
logger.Error(fmt.Sprintf("Owner address of existing service (%q) does not match the owner address %q", foundService.OwnerAddress, msg.Address))
logger.Error(fmt.Sprintf("Owner address of existing service (%q) does not match the owner address %q", foundService.OwnerAddress, msg.OwnerAddress))
return nil, types.ErrServiceInvalidOwnerAddress.Wrapf(
"existing owner address %q does not match the new owner address %q",
foundService.OwnerAddress, msg.Service.OwnerAddress,
)
}
return nil, types.ErrServiceAlreadyExists.Wrapf(
"TODO: Don't have for updating existing service ID: %s", msg.Service.Id,
"TODO(@adshmh): This is an ephemeral state of the code. Once we s/AddService/UpdateService/g, add the business logic here for updates here.",
)
}

// Retrieve the address of the actor adding the service; the owner of the service.
serviceOwnerAddr, err := sdk.AccAddressFromBech32(msg.Address)
serviceOwnerAddr, err := sdk.AccAddressFromBech32(msg.OwnerAddress)
if err != nil {
logger.Error(fmt.Sprintf("could not parse address %s", msg.Address))
logger.Error(fmt.Sprintf("could not parse address %s", msg.OwnerAddress))
return nil, types.ErrServiceInvalidAddress.Wrapf(
"%s is not in Bech32 format", msg.Address,
"%s is not in Bech32 format", msg.OwnerAddress,
)
}

Expand Down
Loading

0 comments on commit cabb40e

Please sign in to comment.