Skip to content

Commit

Permalink
Merge pull request #892 from YuyaAbo/fix-misspell
Browse files Browse the repository at this point in the history
style: fix some misspells
  • Loading branch information
jiuhuche120 authored Jul 7, 2022
2 parents 4c8866d + 28fc47e commit 3dc5af8
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions cmd/bitxhub/client/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ func httpGet(ctx *cli.Context, url string) ([]byte, error) {

c, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, fmt.Errorf("read reponse body error: %w", err)
return nil, fmt.Errorf("read response body error: %w", err)
}

err = resp.Body.Close()
if err != nil {
return nil, fmt.Errorf("close reponse body failed: %w", err)
return nil, fmt.Errorf("close response body failed: %w", err)
}

return c, nil
Expand All @@ -65,7 +65,7 @@ func httpPost(ctx *cli.Context, url string, data []byte) ([]byte, error) {
/* #nosec */
resp, err := client.Post(url, "application/json", buffer)
if err != nil {
return nil, fmt.Errorf("get reponse from http POST request failed: %w", err)
return nil, fmt.Errorf("get response from http POST request failed: %w", err)
}
c, err := ioutil.ReadAll(resp.Body)
if err != nil {
Expand All @@ -74,7 +74,7 @@ func httpPost(ctx *cli.Context, url string, data []byte) ([]byte, error) {

err = resp.Body.Close()
if err != nil {
return nil, fmt.Errorf("close reponse body failed: %w", err)
return nil, fmt.Errorf("close response body failed: %w", err)
}

return c, nil
Expand Down
12 changes: 6 additions & 6 deletions cmd/bitxhub/client/node_manage.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func registerNode(ctx *cli.Context) error {
pid := ctx.String("pid")
vpNodeId := ctx.Uint64("id")
name := ctx.String("name")
permisssion := ctx.String("permission")
permission := ctx.String("permission")
reason := ctx.String("reason")

receipt, err := invokeBVMContract(ctx, constant.NodeManagerContractAddr.Address().String(), "RegisterNode",
Expand All @@ -162,11 +162,11 @@ func registerNode(ctx *cli.Context) error {
pb.String(pid),
pb.Uint64(vpNodeId),
pb.String(name),
pb.String(permisssion),
pb.String(permission),
pb.String(reason))
if err != nil {
return fmt.Errorf("invoke BVM contract failed when register node \" account=%s,typ=%s,pid=%s,vpNodeId=%d,name=%s,permission=%s,reason=%s \": %w",
account, typ, pid, vpNodeId, name, permisssion, reason, err)
account, typ, pid, vpNodeId, name, permission, reason, err)
}

if receipt.IsSuccess() {
Expand All @@ -181,17 +181,17 @@ func registerNode(ctx *cli.Context) error {
func updateNode(ctx *cli.Context) error {
account := ctx.String("account")
name := ctx.String("name")
permisssion := ctx.String("permission")
permission := ctx.String("permission")
reason := ctx.String("reason")

receipt, err := invokeBVMContract(ctx, constant.NodeManagerContractAddr.Address().String(), "UpdateNode",
pb.String(account),
pb.String(name),
pb.String(permisssion),
pb.String(permission),
pb.String(reason))
if err != nil {
return fmt.Errorf("invoke BVM contract failed when update node \" account=%s,name=%s, permission=%s,reason=%s \": %w",
account, name, permisssion, reason, err)
account, name, permission, reason, err)
}

if receipt.IsSuccess() {
Expand Down
2 changes: 1 addition & 1 deletion internal/executor/contracts/dapp_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func (d *Dapp) setFSM(lastStatus governance.GovernanceStatus) {
)
}

// GovernancePre checks if the dapp can do the event. (only check, not modify infomation)
// GovernancePre checks if the dapp can do the event. (only check, not modify information)
func (dm *DappManager) governancePre(dappID string, event governance.EventType) (*Dapp, *boltvm.BxhError) {
dapp := &Dapp{}
if ok := dm.GetObject(DappKey(dappID), dapp); !ok {
Expand Down
2 changes: 1 addition & 1 deletion internal/executor/contracts/dapp_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func TestDappManager_RegisterDapp(t *testing.T) {
res = dm.RegisterDapp(dapps[1].Name, string(dapps[0].Type), dapps[0].Desc, "url", "123", "-", reason)
assert.Equal(t, false, res.Ok, string(res.Result))
res = dm.RegisterDapp(dapps[1].Name, string(dapps[0].Type), dapps[0].Desc, "url", conAddr2, "-", reason)
// premission
// permission
res = dm.RegisterDapp(dapps[1].Name, string(dapps[0].Type), dapps[0].Desc, "url", conAddr1, "-", reason)
assert.Equal(t, false, res.Ok, string(res.Result))

Expand Down
6 changes: 3 additions & 3 deletions internal/executor/contracts/proposal_strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ func (g *GovStrategy) governancePre(module, event string) (*ProposalStrategy, *b

// update proposal strategy for a proposal type
func (g *GovStrategy) UpdateProposalStrategy(module string, typ string, strategyExtra string, reason string) *boltvm.Response {
// 1. check premission
// 1. check permission
if err := g.checkPermission([]string{string(PermissionAdmin)}, module, g.CurrentCaller(), nil); err != nil {
return boltvm.Error(boltvm.ProposalStrategyNoPermissionCode, fmt.Sprintf(string(boltvm.ProposalStrategyNoPermissionMsg), g.CurrentCaller(), fmt.Sprintf("check permission error:%v", err)))
}
Expand Down Expand Up @@ -294,7 +294,7 @@ func (g *GovStrategy) UpdateProposalStrategy(module string, typ string, strategy
func (g *GovStrategy) UpdateAllProposalStrategy(typ string, strategyExtra string, reason string) *boltvm.Response {
pt := repo.AllMgr

// 1. check premission
// 1. check permission
if err := g.checkPermission([]string{string(PermissionAdmin)}, pt, g.CurrentCaller(), nil); err != nil {
return boltvm.Error(boltvm.ProposalStrategyNoPermissionCode, fmt.Sprintf(string(boltvm.ProposalStrategyNoPermissionMsg), g.CurrentCaller(), fmt.Sprintf("check permission error:%v", err)))
}
Expand Down Expand Up @@ -380,7 +380,7 @@ func (g *GovStrategy) UpdateAllProposalStrategy(typ string, strategyExtra string

// update proposal strategy for a proposal type
func (g *GovStrategy) UpdateProposalStrategyByRolesChange(availableNum uint64) *boltvm.Response {
// 1. check premission
// 1. check permission
specificAddrs := []string{constant.RoleContractAddr.Address().String()}
addrsData, err := json.Marshal(specificAddrs)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/executor/contracts/role.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func (role *Role) setFSM(lastStatus governance.GovernanceStatus) {
)
}

// GovernancePre checks if the role can do the event. (only check, not modify infomation)
// GovernancePre checks if the role can do the event. (only check, not modify information)
func (rm *RoleManager) governancePre(roleId string, event governance.EventType) (*Role, *boltvm.BxhError) {
role := &Role{}

Expand Down

0 comments on commit 3dc5af8

Please sign in to comment.