Skip to content

Commit

Permalink
Merge branch 'main' into lint-code
Browse files Browse the repository at this point in the history
  • Loading branch information
tkxkd0159 committed Jun 17, 2024
2 parents e24fc0f + 2ed0e6c commit 561c630
Show file tree
Hide file tree
Showing 59 changed files with 1,189 additions and 4,870 deletions.
18 changes: 0 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -232,24 +232,6 @@ jobs:
name: "${{ github.sha }}-${{ matrix.part }}-race-output"
path: ./${{ matrix.part }}-race-output.txt

# TODO finschia: enable this test
# test-rosetta:
# runs-on: ubuntu-latest
# timeout-minutes: 10
# steps:
# - uses: actions/checkout@v2
# - uses: technote-space/get-diff-action@v4
# id: git_diff
# with:
# PATTERNS: |
# **/**.go
# go.mod
# go.sum
# - name: test rosetta
# run: |
# make test-rosetta
# if: env.GIT_DIFF

# TODO ebony: enable this test
# liveness-test:
# runs-on: ubuntu-latest
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (x/fbridge) [\#1395](https://github.com/Finschia/finschia-sdk/pull/1395) Return error instead of panic for behaviors triggered by client
* (x/fswap) [\#1396](https://github.com/Finschia/finschia-sdk/pull/1396) refactor to use snake_case in proto
* (x/fswap) [\#1391](https://github.com/Finschia/finschia-sdk/pull/1391) add cli_test for fswap module
* (x/fswap) [\#1415](https://github.com/Finschia/finschia-sdk/pull/1415) add more testcases for fswap module

### Bug Fixes
* chore(deps) [\#1141](https://github.com/Finschia/finschia-sdk/pull/1141) Bump github.com/cosmos/ledger-cosmos-go from 0.12.2 to 0.13.2 to fix ledger signing issue
Expand Down Expand Up @@ -100,7 +101,8 @@ Ref: https://keepachangelog.com/en/1.0.0/
### Removed

### Breaking Changes
* (consensus) [\#1178](https://github.com/Finschia/finschia-sdk/pull/1178) change the consensus from Ostracon to Tendermint v0.34.24
* (consensus) [\#1178](https://github.com/Finschia/finschia-sdk/pull/1178) change the consensus from Ostracon to Tendermint v0.34.24
* (server) [\#1418](https://github.com/Finschia/finschia-sdk/pull/1418) Remove grpc-web/rosetta and modify grpc-gateway

### State Machine Breaking

Expand Down
13 changes: 0 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -517,19 +517,6 @@ localnet-debug: localnet-stop localnet-build-dlv localnet-build-nodes
.PHONY: localnet-start localnet-stop localnet-debug localnet-build-env \
localnet-build-dlv localnet-build-nodes

###############################################################################
### rosetta ###
###############################################################################

rosetta-data:
-docker container rm data_dir_build
docker build -t rosetta-ci:latest -f contrib/rosetta/node/Dockerfile .
docker run --name data_dir_build -t rosetta-ci:latest sh /rosetta/data.sh
docker cp data_dir_build:/tmp/data.tar.gz "$(CURDIR)/contrib/rosetta/node/data.tar.gz"
docker container rm data_dir_build

.PHONY: rosetta-data

###############################################################################
### tools ###
###############################################################################
Expand Down
9 changes: 9 additions & 0 deletions client/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/pkg/errors"
"github.com/spf13/viper"
rpcclient "github.com/tendermint/tendermint/rpc/client"
"google.golang.org/grpc"
"gopkg.in/yaml.v2"

"github.com/Finschia/finschia-sdk/codec"
Expand All @@ -23,6 +24,7 @@ import (
type Context struct {
FromAddress sdk.AccAddress
Client rpcclient.Client
GRPCClient *grpc.ClientConn
ChainID string
// Deprecated: Codec codec will be changed to Codec: codec.Codec
JSONCodec codec.JSONCodec
Expand Down Expand Up @@ -145,6 +147,13 @@ func (ctx Context) WithClient(client rpcclient.Client) Context {
return ctx
}

// WithGRPCClient returns a copy of the context with an updated GRPC client
// instance.
func (ctx Context) WithGRPCClient(grpcClient *grpc.ClientConn) Context {
ctx.GRPCClient = grpcClient
return ctx
}

// WithUseLedger returns a copy of the context with an updated UseLedger flag.
func (ctx Context) WithUseLedger(useLedger bool) Context {
ctx.UseLedger = useLedger
Expand Down
10 changes: 8 additions & 2 deletions client/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ var fallBackCodec = codec.NewProtoCodec(failingInterfaceRegistry{})
func (ctx Context) Invoke(grpcCtx gocontext.Context, method string, req, reply interface{}, opts ...grpc.CallOption) (err error) {
// Two things can happen here:
// 1. either we're broadcasting a Tx, in which call we call Tendermint's broadcast endpoint directly,
// 2. or we are querying for state, in which case we call ABCI's Query.
// 2-1. or we are querying for state, in which case we call grpc if grpc client set.
// 2-2. or we are querying for state, in which case we call ABCI's Query if grpc client not set.

// In both cases, we don't allow empty request args (it will panic unexpectedly).
if reflect.ValueOf(req).IsNil() {
Expand All @@ -55,7 +56,12 @@ func (ctx Context) Invoke(grpcCtx gocontext.Context, method string, req, reply i
return err
}

// Case 2. Querying state.
if ctx.GRPCClient != nil {
// Case 2-1. Invoke grpc.
return ctx.GRPCClient.Invoke(grpcCtx, method, req, reply, opts...)
}

// Case 2-2. Querying state via abci query.
reqBz, err := ctx.gRPCCodec().Marshal(req)
if err != nil {
return err
Expand Down
29 changes: 0 additions & 29 deletions contrib/rosetta/README.md

This file was deleted.

12 changes: 0 additions & 12 deletions contrib/rosetta/configuration/bootstrap.json

This file was deleted.

59 changes: 0 additions & 59 deletions contrib/rosetta/configuration/data.sh

This file was deleted.

25 changes: 0 additions & 25 deletions contrib/rosetta/configuration/faucet.py

This file was deleted.

51 changes: 0 additions & 51 deletions contrib/rosetta/configuration/rosetta.json

This file was deleted.

17 changes: 0 additions & 17 deletions contrib/rosetta/configuration/run_tests.sh

This file was deleted.

5 changes: 0 additions & 5 deletions contrib/rosetta/configuration/send_funds.sh

This file was deleted.

Loading

0 comments on commit 561c630

Please sign in to comment.