Skip to content

Commit

Permalink
json
Browse files Browse the repository at this point in the history
  • Loading branch information
JekaMas committed Aug 16, 2022
1 parent a203c27 commit 05ae430
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
7 changes: 3 additions & 4 deletions bor/client/cli/query.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package cli

import (
"encoding/json"
"errors"
"fmt"
"strconv"
Expand Down Expand Up @@ -306,7 +305,7 @@ func GetPreparedProposeSpan(cdc *codec.Codec) *cobra.Command {
}

var spanDuration uint64
if err := json.Unmarshal(res, &spanDuration); err != nil {
if err := jsoniter.Unmarshal(res, &spanDuration); err != nil {
return err
}

Expand All @@ -320,7 +319,7 @@ func GetPreparedProposeSpan(cdc *codec.Codec) *cobra.Command {
}

var seed common.Hash
if err := json.Unmarshal(res, &seed); err != nil {
if err := jsoniter.Unmarshal(res, &seed); err != nil {
return err
}

Expand All @@ -333,7 +332,7 @@ func GetPreparedProposeSpan(cdc *codec.Codec) *cobra.Command {
seed,
)

result, err := json.Marshal(&msg)
result, err := jsoniter.Marshal(&msg)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion bridge/setu/processor/checkpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func (cp *CheckpointProcessor) sendCheckpointToRootchain(eventBytes string, bloc
}

// var tx = sdk.TxResponse{}
// if err := json.Unmarshal([]byte(txBytes), &tx); err != nil {
// if err := jsoniter.Unmarshal([]byte(txBytes), &tx); err != nil {
// cp.Logger.Error("Error unmarshalling txResponse", "error", err)
// return err
// }
Expand Down
18 changes: 9 additions & 9 deletions checkpoint/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func GetCheckpointCount(cdc *codec.Codec) *cobra.Command {
return cmd
}

//Temporary Checkpoint struct to store the Checkpoint ID
// Temporary Checkpoint struct to store the Checkpoint ID
type CheckpointWithID struct {
ID uint64 `json:"id"`
Proposer hmTypes.HeimdallAddress `json:"proposer"`
Expand Down Expand Up @@ -238,7 +238,7 @@ func GetCheckpointLatest(cdc *codec.Codec) *cobra.Command {
}

var ackCount uint64
if err := json.Unmarshal(ackcountBytes, &ackCount); err != nil {
if err := jsoniter.Unmarshal(ackcountBytes, &ackCount); err != nil {
return nil
}

Expand All @@ -264,7 +264,7 @@ func GetCheckpointLatest(cdc *codec.Codec) *cobra.Command {
}

var checkpointUnmarshal hmTypes.Checkpoint
if err = json.Unmarshal(res, &checkpointUnmarshal); err != nil {
if err = jsoniter.Unmarshal(res, &checkpointUnmarshal); err != nil {
return err
}

Expand All @@ -278,7 +278,7 @@ func GetCheckpointLatest(cdc *codec.Codec) *cobra.Command {
TimeStamp: checkpointUnmarshal.TimeStamp,
}

resWithID, err := json.Marshal(checkpointWithID)
resWithID, err := jsoniter.Marshal(checkpointWithID)
if err != nil {
return err
}
Expand Down Expand Up @@ -386,7 +386,7 @@ func GetOverview(cdc *codec.Codec) *cobra.Command {
if err == nil {
// check content
if len(ackCountBytes) == 0 {
if err = json.Unmarshal(ackCountBytes, &ackCountInt); err != nil {
if err = jsoniter.Unmarshal(ackCountBytes, &ackCountInt); err != nil {
// log and ignore
fmt.Printf("Error while unmarshing no-ack count", "error", err)
}
Expand All @@ -403,7 +403,7 @@ func GetOverview(cdc *codec.Codec) *cobra.Command {
if err == nil {
if len(checkpointBufferBytes) != 0 {
_checkpoint = new(hmTypes.Checkpoint)
if err = json.Unmarshal(checkpointBufferBytes, _checkpoint); err != nil {
if err = jsoniter.Unmarshal(checkpointBufferBytes, _checkpoint); err != nil {
// log and ignore
fmt.Printf("Error while unmarshing checkpoint header", "error", err)
}
Expand All @@ -418,7 +418,7 @@ func GetOverview(cdc *codec.Codec) *cobra.Command {

validatorSetBytes, _, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/%s", stakingTypes.QuerierRoute, stakingTypes.QueryCurrentValidatorSet), nil)
if err == nil {
if err := json.Unmarshal(validatorSetBytes, &validatorSet); err != nil {
if err := jsoniter.Unmarshal(validatorSetBytes, &validatorSet); err != nil {
// log and ignore
fmt.Printf("Error while unmarshing validator set", "error", err)
}
Expand All @@ -438,7 +438,7 @@ func GetOverview(cdc *codec.Codec) *cobra.Command {
if err == nil {
// check content
if len(lastNoACKBytes) == 0 {
if err = json.Unmarshal(lastNoACKBytes, &lastNoACKTime); err != nil {
if err = jsoniter.Unmarshal(lastNoACKBytes, &lastNoACKTime); err != nil {
// log and ignore
fmt.Printf("Error while unmarshing last no-ack time", "error", err)
}
Expand All @@ -457,7 +457,7 @@ func GetOverview(cdc *codec.Codec) *cobra.Command {
LastNoACK: time.Unix(int64(lastNoACKTime), 0),
}

result, err := json.Marshal(state)
result, err := jsoniter.Marshal(state)
if err != nil {
return err
}
Expand Down

0 comments on commit 05ae430

Please sign in to comment.