Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Optimize return #1628

Merged
merged 3 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
* [1591](https://github.com/zeta-chain/node/pull/1591) - support lower gas limit for voting on inbound and outbound transactions
* [1592](https://github.com/zeta-chain/node/issues/1592) - check inbound tracker tx hash against Tss address and some refactor on inTx observation

### Refactoring

* [1628](https://github.com/zeta-chain/node/pull/1628) optimize return and simplify code

## Version: v12.0.0

### Breaking Changes
Expand Down
5 changes: 1 addition & 4 deletions common/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ type Chains []Chain

// IsEqual compare two chain to see whether they represent the same chain
func (chain Chain) IsEqual(c Chain) bool {
if chain.ChainId == c.ChainId {
return true
}
return false
return chain.ChainId == c.ChainId
}

func (chain Chain) IsZetaChain() bool {
Expand Down
6 changes: 1 addition & 5 deletions rpc/namespaces/ethereum/debug/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ import (
func isCPUProfileConfigurationActivated(ctx *server.Context) bool {
// TODO: use same constants as server/start.go
// constant declared in start.go cannot be imported (cyclical dependency)
const flagCPUProfile = "cpu-profile"
if cpuProfile := ctx.Viper.GetString(flagCPUProfile); cpuProfile != "" {
return true
}
return false
return ctx.Viper.GetString("cpu-profile") != ""
}

// ExpandHome expands home directory in file paths.
Expand Down
5 changes: 1 addition & 4 deletions x/crosschain/keeper/cctx_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,5 @@ func (k Keeper) GetRevertGasLimit(ctx sdk.Context, cctx types.CrossChainTx) (uin

func IsPending(cctx types.CrossChainTx) bool {
// pending inbound is not considered a "pending" state because it has not reached consensus yet
if cctx.CctxStatus.Status == types.CctxStatus_PendingOutbound || cctx.CctxStatus.Status == types.CctxStatus_PendingRevert {
return true
}
return false
return cctx.CctxStatus.Status == types.CctxStatus_PendingOutbound || cctx.CctxStatus.Status == types.CctxStatus_PendingRevert
}
5 changes: 1 addition & 4 deletions x/crosschain/keeper/msg_server_tss_voter.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,5 @@ func (k msgServer) CreateTSSVoter(goCtx context.Context, msg *types.MsgCreateTSS
// IsAuthorizedNodeAccount checks whether a signer is authorized to sign , by checking their address against the observer mapper which contains the observer list for the chain and type
func (k Keeper) IsAuthorizedNodeAccount(ctx sdk.Context, address string) bool {
_, found := k.zetaObserverKeeper.GetNodeAccount(ctx, address)
if found {
return true
}
return false
return found
}
Loading