Skip to content

Commit

Permalink
fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
nkitlabs committed May 28, 2024
1 parent 7a4d5c9 commit 88c5478
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 32 deletions.
7 changes: 3 additions & 4 deletions client/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,13 +282,14 @@ func (c RPC) GetSignature(signingID uint64) (*SigningResult, error) {
)
failCh <- struct{}{}
return
}
if res.CurrentGroupSigningResult == nil {
} else if res.CurrentGroupSigningResult == nil {
c.logger.Warning(
"GetSignature",
"Failed to get signature from %s, signing ID: %d, no signing result from current group",
node.Remote(), signingID,
)
failCh <- struct{}{}
return
}

signingResult := SigningResult{
Expand All @@ -299,8 +300,6 @@ func (c RPC) GetSignature(signingID uint64) (*SigningResult, error) {
}(node)
}

// Return the first result that we found;
// If unable to get result from all nodes, return error.
for range c.nodes {
select {
case res := <-resultCh:
Expand Down
18 changes: 0 additions & 18 deletions client/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
bandtsstypes "github.com/bandprotocol/chain/v2/x/bandtss/types"
oracletypes "github.com/bandprotocol/chain/v2/x/oracle/types"
tsstypes "github.com/bandprotocol/chain/v2/x/tss/types"
tmbytes "github.com/cometbft/cometbft/libs/bytes"
)

// OracleResult stores the necessary information for an oracle query result.
Expand All @@ -26,20 +25,3 @@ type SigningInfo struct {
PubKey []byte
PubNonce []byte
}

// SingleProof represents a single proof in a response.
type SingleProof struct {
BlockHeight string `json:"block_height"`
}

// SingleProofResponse represents the response containing a SingleProof and the EVM proof bytes.
type SingleProofResponse struct {
Proof SingleProof `json:"proof"`
EVMProofBytes tmbytes.HexBytes `json:"evm_proof_bytes"`
}

// Proof represents a full proof in a response, containing a height and a SingleProofResponse.
type Proof struct {
Height string `json:"height"`
Result SingleProofResponse `json:"result"`
}
5 changes: 0 additions & 5 deletions requester/middleware/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"github.com/bandprotocol/go-band-sdk/client"
"github.com/bandprotocol/go-band-sdk/requester/sender"
"github.com/bandprotocol/go-band-sdk/requester/watcher/request"
"github.com/bandprotocol/go-band-sdk/requester/watcher/signing"
)

func IntoRequestWatcherTaskHandler(ctx sender.SuccessResponse) (request.Task, error) {
Expand All @@ -20,10 +19,6 @@ func IntoSenderTaskHandler(ctx sender.FailResponse) (sender.Task, error) {
return ctx.Task, nil
}

func IntoSigningWatcherTaskHandler(ctx signing.FailResponse) (signing.Task, error) {
return ctx.Task, nil
}

func IntoSenderTaskHandlerFromRequest(ctx request.FailResponse) (sender.Task, error) {
return sender.NewTask(ctx.ID(), ctx.Msg), nil
}
11 changes: 7 additions & 4 deletions requester/sender/sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,14 @@ func (s *Sender) request(task Task, key keyring.Record) {
if err != nil {
s.logger.Error("Sender", "failed to broadcast task ID(%d) with error: %s", task.ID(), err.Error())
if strings.Contains(err.Error(), "out-of-gas while executing the wasm script: bad wasm execution") {
s.failedRequestsCh <- FailResponse{task, sdk.TxResponse{}, types.ErrOutOfPrepareGas.Wrapf(err.Error())}
return
s.failedRequestsCh <- FailResponse{
task, sdk.TxResponse{}, types.ErrOutOfPrepareGas.Wrapf(err.Error()),
}
} else {
s.failedRequestsCh <- FailResponse{
task, sdk.TxResponse{}, types.ErrBroadcastFailed.Wrapf(err.Error()),
}
}

s.failedRequestsCh <- FailResponse{task, sdk.TxResponse{}, types.ErrBroadcastFailed.Wrapf(err.Error())}
return
} else if resp != nil && resp.Code != 0 {
s.logger.Error("Sender", "failed to broadcast task ID(%d) with code %d", task.ID(), resp.Code)
Expand Down
6 changes: 5 additions & 1 deletion requester/watcher/signing/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ func (w *Watcher) Start() {

func (w *Watcher) watch(task Task) {
if task.SigningID == 0 {
w.failedRequestsCh <- FailResponse{task, client.SigningResult{}, types.ErrUnknown.Wrapf("signing ID %d is invalid", task.SigningID)}
w.failedRequestsCh <- FailResponse{
task,
client.SigningResult{},
types.ErrUnknown.Wrapf("signing ID %d is invalid", task.SigningID),
}
return
}

Expand Down

0 comments on commit 88c5478

Please sign in to comment.