Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement gRPC Simulate endpoint #7035

Merged
merged 33 commits into from
Aug 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
1c03e2e
Implement simulate endpoint
amaury1093 Aug 13, 2020
0694663
Merge branch 'master' into am-5922-tx-sim
amaury1093 Aug 13, 2020
f122966
Add GetProtoTx()
amaury1093 Aug 13, 2020
044d4b2
Add signing in test
amaury1093 Aug 13, 2020
551d710
Merge branch 'master' of ssh://github.com/cosmos/cosmos-sdk into am-5…
amaury1093 Aug 13, 2020
702f518
Merge branch 'master' of ssh://github.com/cosmos/cosmos-sdk into am-5…
amaury1093 Aug 14, 2020
2d0f2fd
Add txBuilderFromProto
amaury1093 Aug 14, 2020
7986573
Remove stray println
amaury1093 Aug 14, 2020
e4325e1
Merge branch 'master' of ssh://github.com/cosmos/cosmos-sdk into am-5…
amaury1093 Aug 17, 2020
1329ace
Update to master
amaury1093 Aug 17, 2020
0b66255
Merge branch 'master' of ssh://github.com/cosmos/cosmos-sdk into am-5…
amaury1093 Aug 18, 2020
feffc4a
Merge master
amaury1093 Aug 18, 2020
2b09adf
Fix tests
amaury1093 Aug 18, 2020
816ab5e
Make tests pass
amaury1093 Aug 18, 2020
cd5cda1
Integrate in router
amaury1093 Aug 18, 2020
ad7ecf1
Make proto-gen
amaury1093 Aug 18, 2020
5bb49f6
Merge branch 'master' into am-5922-tx-sim
amaury1093 Aug 18, 2020
c8accd2
Fix lint
amaury1093 Aug 18, 2020
483d577
Really fix lint
amaury1093 Aug 18, 2020
06cff77
Merge branch 'master' of ssh://github.com/cosmos/cosmos-sdk into am-5…
amaury1093 Aug 18, 2020
0636f19
Refactor to fix import cycles
amaury1093 Aug 18, 2020
043cfe8
Rename builder -> wrapper
amaury1093 Aug 18, 2020
2195a56
Update proto/cosmos/base/reflection/v1beta1/reflection.proto
amaury1093 Aug 19, 2020
37f4312
Merge branch 'master' into am-5922-tx-sim
amaury1093 Aug 19, 2020
eff67d2
Merge branch 'master' into am-5922-tx-sim
amaury1093 Aug 21, 2020
8edb708
Merge branch 'master' of ssh://github.com/cosmos/cosmos-sdk into am-5…
amaury1093 Aug 21, 2020
6fb4385
Merge branch 'am-5922-tx-sim' of ssh://github.com/cosmos/cosmos-sdk i…
amaury1093 Aug 21, 2020
0f5a377
Fix after merge
amaury1093 Aug 22, 2020
a61122f
Merge branch 'master' into am-5922-tx-sim
amaury1093 Aug 24, 2020
d401630
Merge branch 'master' into am-5922-tx-sim
alexanderbez Aug 24, 2020
b866838
t->w
amaury1093 Aug 24, 2020
875a454
Merge branch 'am-5922-tx-sim' of ssh://github.com/cosmos/cosmos-sdk i…
amaury1093 Aug 24, 2020
ea08841
Merge branch 'master' of ssh://github.com/cosmos/cosmos-sdk into am-5…
amaury1093 Aug 24, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions baseapp/grpcrouter.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import (
"google.golang.org/grpc/encoding/proto"

"github.com/cosmos/cosmos-sdk/client/grpc/reflection"
"github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/client/grpc/simulate"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
sdk "github.com/cosmos/cosmos-sdk/types"
)

Expand All @@ -19,7 +21,7 @@ var protoCodec = encoding.GetCodec(proto.Name)
// GRPCQueryRouter routes ABCI Query requests to GRPC handlers
type GRPCQueryRouter struct {
routes map[string]GRPCQueryHandler
interfaceRegistry types.InterfaceRegistry
interfaceRegistry codectypes.InterfaceRegistry
serviceData []serviceData
}

Expand Down Expand Up @@ -69,7 +71,7 @@ func (qrt *GRPCQueryRouter) RegisterService(sd *grpc.ServiceDesc, handler interf
return err
}
if qrt.interfaceRegistry != nil {
return types.UnpackInterfaces(i, qrt.interfaceRegistry)
return codectypes.UnpackInterfaces(i, qrt.interfaceRegistry)
}
return nil
}, nil)
Expand Down Expand Up @@ -97,14 +99,27 @@ func (qrt *GRPCQueryRouter) RegisterService(sd *grpc.ServiceDesc, handler interf
})
}

// SetInterfaceRegistry sets the interface registry for the router.
func (qrt *GRPCQueryRouter) SetInterfaceRegistry(interfaceRegistry types.InterfaceRegistry) {
// SetInterfaceRegistry sets the interface registry for the router. This will
// also register the interface reflection gRPC service.
func (qrt *GRPCQueryRouter) SetInterfaceRegistry(interfaceRegistry codectypes.InterfaceRegistry) {
qrt.interfaceRegistry = interfaceRegistry

// Once we have an interface registry, we can register the interface
// registry reflection gRPC service.
reflection.RegisterReflectionServiceServer(
qrt,
reflection.NewReflectionServiceServer(qrt.interfaceRegistry),
reflection.NewReflectionServiceServer(interfaceRegistry),
)
}

// RegisterSimulateService registers the simulate service on the gRPC router.
func (qrt *GRPCQueryRouter) RegisterSimulateService(
simulateFn simulate.BaseAppSimulateFn,
interfaceRegistry codectypes.InterfaceRegistry,
pubkeyCodec cryptotypes.PublicKeyCodec,
) {
simulate.RegisterSimulateServiceServer(
qrt,
simulate.NewSimulateServer(simulateFn, qrt.interfaceRegistry, pubkeyCodec),
)
}
50 changes: 27 additions & 23 deletions client/grpc/reflection/reflection.pb.go

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

245 changes: 245 additions & 0 deletions client/grpc/reflection/reflection.pb.gw.go

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

Loading