Skip to content

Commit

Permalink
Reverted back to uin64 for rev_share
Browse files Browse the repository at this point in the history
  • Loading branch information
Olshansk committed Jan 17, 2025
1 parent 0643ea0 commit 389f24a
Show file tree
Hide file tree
Showing 13 changed files with 95 additions and 101 deletions.
57 changes: 31 additions & 26 deletions api/poktroll/shared/service.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 config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -229,23 +229,23 @@ genesis:
url: http://relayminer1:8545
rev_share:
- address: pokt19a3t4yunp0dlpfjrp7qwnzwlrzd5fzs2gjaaaj
rev_share_percentage: "100"
rev_share_percentage: 100
- service_id: rest
endpoints:
- configs: []
rpc_type: REST
url: http://relayminer1:8545
rev_share:
- address: pokt19a3t4yunp0dlpfjrp7qwnzwlrzd5fzs2gjaaaj
rev_share_percentage: "100"
rev_share_percentage: 100
- service_id: ollama
endpoints:
- configs: []
rpc_type: REST
url: http://relayminer1:8545
rev_share:
- address: pokt19a3t4yunp0dlpfjrp7qwnzwlrzd5fzs2gjaaaj
rev_share_percentage: "100"
rev_share_percentage: 100
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 Down
4 changes: 2 additions & 2 deletions localnet/poktrolld/config/supplier1_stake_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ owner_address: pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4
operator_address: pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4
stake_amount: 1000069upokt
default_rev_share_percent:
pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4: 80.5
pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw: 19.5
pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4: 80
pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw: 20
services:
- service_id: anvil
endpoints:
Expand Down
4 changes: 2 additions & 2 deletions localnet/poktrolld/config/supplier_stake_config_example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ stake_amount: 1000069upokt
# or include at least one item.
default_rev_share_percent:
# The sum of all shares MUST equal 100%. Staking will fail otherwise.
pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4: 80.5
pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw: 19.5
pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4: 80
pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw: 20
services:
# The endpoint URL for the Anvil service is provided via the RelayMiner.
# The RelayMiner acts as a proxy, forwarding requests to the actual Anvil data node behind it.
Expand Down
5 changes: 3 additions & 2 deletions proto/poktroll/shared/service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,12 @@ message SupplierEndpoint {

// ServiceRevenueShare message to hold revenue share configuration details
message ServiceRevenueShare {
// 2 was reserved in #1028 during the change of rev_share_percentage from float to double
// 2 was reserved in #1028 during the change of rev_share_percentage from float to uint64
// TODO_TECHDEBT: Investigate why we can't use a double or float: https://github.com/pokt-network/poktroll/actions/runs/12832899448/job/35787150432?pr=1028
reserved 2;

string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the revenue share recipient
double rev_share_percentage = 3; // The percentage of revenue share the recipient will receive
uint64 rev_share_percentage = 3; // The percentage of revenue share the recipient will receive
}

// Enum to define RPC types
Expand Down
2 changes: 1 addition & 1 deletion testutil/integration/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ func (app *App) setupDefaultActorsState(
RevShare: []*sharedtypes.ServiceRevenueShare{
{
Address: sample.AccAddress(),
RevSharePercentage: 100,
RevSharePercentage: uint64(100),
},
},
ServiceId: defaultService.Id,
Expand Down
2 changes: 1 addition & 1 deletion testutil/keeper/tokenomics.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func TokenomicsKeeperWithActorAddrs(t testing.TB) (
RevShare: []*sharedtypes.ServiceRevenueShare{
{
Address: supplierOwnerAddr,
RevSharePercentage: 100,
RevSharePercentage: uint64(100),
},
},
},
Expand Down
66 changes: 36 additions & 30 deletions x/shared/types/service.pb.go

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

6 changes: 3 additions & 3 deletions x/shared/types/service_configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

const (
requiredRevSharePercentageSum = 100
requiredRevSharePercentageSum = uint64(100)
)

// ValidateAppServiceConfigs returns an error if any of the application service configs are invalid
Expand Down Expand Up @@ -95,7 +95,7 @@ func ValidateSupplierServiceConfigs(services []*SupplierServiceConfig) error {
// ensuring that the sum of the revenue share percentages is 100.
// NB: This function is unit tested via the supplier staking config tests.
func ValidateServiceRevShare(revShareList []*ServiceRevenueShare) error {
revSharePercentageSum := float64(0)
revSharePercentageSum := uint64(0)

if len(revShareList) == 0 {
return ErrSharedInvalidRevShare.Wrap("no rev share configurations")
Expand All @@ -106,7 +106,7 @@ func ValidateServiceRevShare(revShareList []*ServiceRevenueShare) error {
return ErrSharedInvalidRevShare.Wrap("rev share cannot be nil")
}

// Validate the revshare address
// Validate the revenue share address
if revShare.Address == "" {
return ErrSharedInvalidRevShare.Wrapf("rev share address cannot be empty: %v", revShare)
}
Expand Down
Loading

0 comments on commit 389f24a

Please sign in to comment.