Skip to content

Commit

Permalink
Merge pull request #8 from Switcheo/fix/oracle-blocking
Browse files Browse the repository at this point in the history
Fix/oracle blocking
  • Loading branch information
holyxiaoxin authored Dec 11, 2024
2 parents 532def2 + 5354f44 commit d13147f
Show file tree
Hide file tree
Showing 16 changed files with 565 additions and 462 deletions.
4 changes: 2 additions & 2 deletions abci/client/grpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ func (cli *grpcClient) ValidateOracleVotes(ctx context.Context, req *types.Reque
return cli.client.ValidateOracleVotes(ctx, types.ToRequestValidateOracleVotes(req).GetValidateOracleVotes(), grpc.WaitForReady(true))
}

func (cli *grpcClient) DoesOracleResultExist(ctx context.Context, req *types.RequestDoesOracleResultExist) (*types.ResponseDoesOracleResultExist, error) {
return cli.client.DoesOracleResultExist(ctx, types.ToRequestDoesOracleResultExist(req).GetDoesOracleResultExist(), grpc.WaitForReady(true))
func (cli *grpcClient) FetchOracleResults(ctx context.Context, req *types.RequestFetchOracleResults) (*types.ResponseFetchOracleResults, error) {
return cli.client.FetchOracleResults(ctx, types.ToRequestFetchOracleResults(req).GetFetchOracleResults(), grpc.WaitForReady(true))
}

func (cli *grpcClient) DoesSubAccountBelongToVal(ctx context.Context, req *types.RequestDoesSubAccountBelongToVal) (*types.ResponseDoesSubAccountBelongToVal, error) {
Expand Down
14 changes: 7 additions & 7 deletions abci/client/mocks/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions abci/client/socket_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,15 +445,15 @@ func (cli *socketClient) ValidateOracleVotes(ctx context.Context, req *types.Req
return reqRes.Response.GetValidateOracleVotes(), cli.Error()
}

func (cli *socketClient) DoesOracleResultExist(ctx context.Context, req *types.RequestDoesOracleResultExist) (*types.ResponseDoesOracleResultExist, error) {
reqRes, err := cli.queueRequest(ctx, types.ToRequestDoesOracleResultExist(req))
func (cli *socketClient) FetchOracleResults(ctx context.Context, req *types.RequestFetchOracleResults) (*types.ResponseFetchOracleResults, error) {
reqRes, err := cli.queueRequest(ctx, types.ToRequestFetchOracleResults(req))
if err != nil {
return nil, err
}
if err := cli.Flush(ctx); err != nil {
return nil, err
}
return reqRes.Response.GetDoesOracleResultExist(), cli.Error()
return reqRes.Response.GetFetchOracleResults(), cli.Error()
}

func (cli *socketClient) DoesSubAccountBelongToVal(ctx context.Context, req *types.RequestDoesSubAccountBelongToVal) (*types.ResponseDoesSubAccountBelongToVal, error) {
Expand Down
6 changes: 3 additions & 3 deletions abci/types/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type Application interface {
CreateOracleResultTx(context.Context, *RequestCreateOracleResultTx) (*ResponseCreateOracleResultTx, error)
FetchOracleVotes(context.Context, *RequestFetchOracleVotes) (*ResponseFetchOracleVotes, error)
ValidateOracleVotes(context.Context, *RequestValidateOracleVotes) (*ResponseValidateOracleVotes, error)
DoesOracleResultExist(context.Context, *RequestDoesOracleResultExist) (*ResponseDoesOracleResultExist, error)
FetchOracleResults(context.Context, *RequestFetchOracleResults) (*ResponseFetchOracleResults, error)
DoesSubAccountBelongToVal(context.Context, *RequestDoesSubAccountBelongToVal) (*ResponseDoesSubAccountBelongToVal, error)
}

Expand Down Expand Up @@ -139,8 +139,8 @@ func (BaseApplication) ValidateOracleVotes(_ context.Context, req *RequestValida
return &ResponseValidateOracleVotes{}, nil
}

func (BaseApplication) DoesOracleResultExist(_ context.Context, req *RequestDoesOracleResultExist) (*ResponseDoesOracleResultExist, error) {
return &ResponseDoesOracleResultExist{}, nil
func (BaseApplication) FetchOracleResults(_ context.Context, req *RequestFetchOracleResults) (*ResponseFetchOracleResults, error) {
return &ResponseFetchOracleResults{}, nil
}

func (BaseApplication) DoesSubAccountBelongToVal(_ context.Context, req *RequestDoesSubAccountBelongToVal) (*ResponseDoesSubAccountBelongToVal, error) {
Expand Down
4 changes: 2 additions & 2 deletions abci/types/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ func ToRequestValidateOracleVotes(req *RequestValidateOracleVotes) *Request {
}
}

func ToRequestDoesOracleResultExist(req *RequestDoesOracleResultExist) *Request {
func ToRequestFetchOracleResults(req *RequestFetchOracleResults) *Request {
return &Request{
Value: &Request_DoesOracleResultExist{req},
Value: &Request_FetchOracleResults{req},
}
}

Expand Down
14 changes: 7 additions & 7 deletions abci/types/mocks/application.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d13147f

Please sign in to comment.