Skip to content

Commit

Permalink
fix: infromational issues (#332)
Browse files Browse the repository at this point in the history
* fix: error registration

* fix: service lookups

* chore: remove redundant validations and code improvements

* chore: update changelog

* chore: update build flag
  • Loading branch information
shreyasbhat0 authored Feb 25, 2025
1 parent 0257aa7 commit 8a2b13b
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 114 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Contains all the PRs that improved the code without changing the behaviors.
- Fixed non deterministic map iteration to sorted iteration
- Fixed fee stuck in arkeo module by moving fees to arkeo-reserve
- Fixed signature replay on different network
- Fixed informational issues

---

Expand Down
2 changes: 1 addition & 1 deletion common/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ var ServiceLookup = map[string]int32{
"thorchain-mainnet-fullnode": 32,
"bch-mainnet-unchained": 33,
"btc-mainnet-unchained": 34,
"bnb-mainnet-unchained": 35,
"bsc-mainnet-unchained": 36,
"gaia-mainnet-unchained": 38,
"doge-mainnet-unchained": 39,
Expand Down Expand Up @@ -107,7 +108,6 @@ var ServiceReverseLookup = map[Service]string{
34: "btc-mainnet-unchained",
35: "bnb-mainnet-unchained",
36: "bsc-mainnet-unchained",
37: "bsc-mainnet-unchained",
38: "gaia-mainnet-unchained",
39: "doge-mainnet-unchained",
40: "eth-mainnet-unchained",
Expand Down
4 changes: 0 additions & 4 deletions x/arkeo/keeper/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,6 @@ func (mgr Manager) ValidatorPayout(ctx cosmos.Context, votes []abci.VoteInfo, bl
mgr.keeper.Logger().Info("unable to find validator", "validator", string(vote.Validator.Address))
continue
}
if !val.IsBonded() || val.IsJailed() {
mgr.keeper.Logger().Info("validator rewards skipped due to status or jailed", "validator", val.GetOperator())
continue
}

valBz, err := mgr.sk.ValidatorAddressCodec().StringToBytes(val.GetOperator())
if err != nil {
Expand Down
15 changes: 2 additions & 13 deletions x/arkeo/keeper/msg_server_close_contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ func (k msgServer) CloseContractValidate(ctx cosmos.Context, msg *types.MsgClose
return errors.Wrapf(types.ErrInvalidPubKey, "Cleint: %s", contract.Client.String())
}

signerAddreess := msg.MustGetSigner()
signerAddress := msg.MustGetSigner()

if !contractClientAddress.Equals(signerAddreess) {
if !contractClientAddress.Equals(signerAddress) {
return errors.Wrap(types.ErrCloseContractUnauthorized, "only the client can close the contract")
}

Expand All @@ -78,17 +78,6 @@ func (k msgServer) CloseContractHandle(ctx cosmos.Context, msg *types.MsgCloseCo
return err
}

contractClientAddress, err := contract.Client.GetMyAddress()
if err != nil {
return errors.Wrapf(types.ErrInvalidPubKey, "Cleint: %s", contract.Client.String())
}

signerAddreess := msg.MustGetSigner()

if !contractClientAddress.Equals(signerAddreess) {
return errors.Wrap(types.ErrCloseContractUnauthorized, "only the client can close the contract")
}

if contract.IsPayAsYouGo() {
k.RemoveContractExpirationSet(ctx, contract.Expiration())
// add a new expiration return deposit to user
Expand Down
2 changes: 1 addition & 1 deletion x/arkeo/keeper/msg_server_open_contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (k msgServer) OpenContractValidate(ctx cosmos.Context, msg *types.MsgOpenCo
return errors.Wrapf(types.ErrOpenContractMismatchRate, "provider rates is %d, client sent %d", cosmos.NewCoins(provider.SubscriptionRate...).AmountOf(msg.Rate.Denom).Int64(), msg.Rate.Amount.Int64())
}
if !cosmos.NewInt(msg.Rate.Amount.Int64() * msg.Duration * msg.QueriesPerMinute).Equal(msg.Deposit) {
return errors.Wrapf(types.ErrOpenContractMismatchRate, "mismatch of rate*duration and deposit: %d * %d * %d != %d", msg.Rate.Amount.Int64(), msg.Duration, msg.QueriesPerMinute, msg.Deposit.Int64())
return errors.Wrapf(types.ErrOpenContractMismatchRate, "mismatch of rate*duration*queriesPerMinute and deposit: %d * %d * %d != %d", msg.Rate.Amount.Int64(), msg.Duration, msg.QueriesPerMinute, msg.Deposit.Int64())
}
case types.ContractType_PAY_AS_YOU_GO:
if cosmos.NewCoins(provider.PayAsYouGoRate...).AmountOf(msg.Rate.Denom).IsZero() {
Expand Down
2 changes: 1 addition & 1 deletion x/arkeo/types/message_mod_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (msg *MsgModProvider) ValidateBasic() error {

payRate := cosmos.NewCoins(msg.PayAsYouGoRate...)
if err := payRate.Validate(); err != nil {
return errors.Wrapf(err, "invalid subscription rate")
return errors.Wrapf(err, "invalid pay-as-you-go rates")
}

if !payRate.IsAllPositive() {
Expand Down
2 changes: 0 additions & 2 deletions x/claim/keeper/msg_server_add_claim.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//go:build !testnet

package keeper

import (
Expand Down
38 changes: 0 additions & 38 deletions x/claim/keeper/msg_server_add_claim_testnet.go

This file was deleted.

48 changes: 0 additions & 48 deletions x/claim/keeper/msg_server_add_claim_testnet_test.go

This file was deleted.

12 changes: 6 additions & 6 deletions x/claim/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
)

var (
ErrAirdropEnded = errors.Register(ModuleName, 1, "Airdrop has ended")
ErrNoClaimableAmount = errors.Register(ModuleName, 2, "No Claimable Arkeo")
ErrInvalidSignature = errors.Register(ModuleName, 3, "Invalid signature")
ErrClaimRecordNotTransferrable = errors.Register(ModuleName, 4, "Claim record can not be transferred")
ErrInvalidCreator = errors.Register(ModuleName, 5, "Invalid Creator")
ErrInvalidAddress = errors.Register(ModuleName, 6, "Invalid Address")
ErrAirdropEnded = errors.Register(ModuleName, 2, "Airdrop has ended")
ErrNoClaimableAmount = errors.Register(ModuleName, 3, "No Claimable Arkeo")
ErrInvalidSignature = errors.Register(ModuleName, 4, "Invalid signature")
ErrClaimRecordNotTransferrable = errors.Register(ModuleName, 5, "Claim record can not be transferred")
ErrInvalidCreator = errors.Register(ModuleName, 6, "Invalid Creator")
ErrInvalidAddress = errors.Register(ModuleName, 7, "Invalid Address")
)

0 comments on commit 8a2b13b

Please sign in to comment.