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

refactor: grpc base structure #16

Merged
merged 9 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 9 additions & 5 deletions gcosmos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,23 @@ echo -n "abandon abandon abandon abandon abandon abandon abandon abandon abandon
./gcosmos genesis gentx val 1000000stake --keyring-backend=test --chain-id=gcosmos
./gcosmos genesis collect-gentxs

# Run the following to reset the application state without having to reset the base data directory.
# (This is required until Gordian can start from a >0 height)
# rm -rf ~/.simappv2/data/application.db/

./gcosmos start --g-http-addr 127.0.0.1:26657 --g-grpc-addr 127.0.0.1:9092
```

# Interact
```bash
# Install the grpcurl binary in your relative directory to interact with the GRPC server.
# GOBIN="$PWD" go install github.com/fullstorydev/grpcurl/cmd/grpcurl@v1

./grpcurl -plaintext localhost:9092 list
./grpcurl -plaintext localhost:9092 server.GordianGRPC/GetBlocksWatermark
./grpcurl -plaintext localhost:9092 server.GordianGRPC/GetValidators
./grpcurl -plaintext localhost:9092 gordian.server.v1.GordianGRPC/GetBlocksWatermark
./grpcurl -plaintext localhost:9092 gordian.server.v1.GordianGRPC/GetValidators

./grpcurl -plaintext -d '{"address":"cosmos1r5v5srda7xfth3hn2s26txvrcrntldjumt8mhl","denom":"stake"}' localhost:9092 server.GordianGRPC/QueryAccountBalance
./grpcurl -plaintext -d '{"address":"cosmos1r5v5srda7xfth3hn2s26txvrcrntldjumt8mhl","denom":"stake"}' localhost:9092 gordian.server.v1.GordianGRPC/QueryAccountBalance
```

# Transaction Testing
Expand All @@ -73,7 +77,7 @@ echo -n "abandon abandon abandon abandon abandon abandon abandon abandon abandon
# TODO: get account number
./gcosmos tx sign ./example-tx.json --offline --from=val --sequence=1 --account-number=1 --chain-id=TODO:TEMPORARY_CHAIN_ID --keyring-backend=test > example-tx-signed.json

./grpcurl -plaintext -emit-defaults -d '{"tx":"'$(cat example-tx-signed.json | base64 | tr -d '\n')'"}' localhost:9092 server.GordianGRPC/SimulateTransaction
./grpcurl -plaintext -emit-defaults -d '{"tx":"'$(cat example-tx-signed.json | base64 | tr -d '\n')'"}' localhost:9092 gordian.server.v1.GordianGRPC/SimulateTransaction

./grpcurl -plaintext -emit-defaults -d '{"tx":"'$(cat example-tx-signed.json | base64 | tr -d '\n')'"}' localhost:9092 server.GordianGRPC/SubmitTransaction
./grpcurl -plaintext -emit-defaults -d '{"tx":"'$(cat example-tx-signed.json | base64 | tr -d '\n')'"}' localhost:9092 gordian.server.v1.GordianGRPC/SubmitTransaction
```
8 changes: 4 additions & 4 deletions gcosmos/gserver/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,16 +257,16 @@ func (c *Component) Start(ctx context.Context) error {
c.grpcServer = ggrpc.NewGordianGRPCServer(ctx, c.log.With("sys", "grpc"), ggrpc.GRPCServerConfig{
Listener: c.grpcLn,

FinalizationStore: c.fs,
MirrorStore: c.ms,
FinalizationStore: c.fs,

CryptoRegistry: reg,

// debug:
TxCodec: c.txc,
AppManager: am,
TxBuf: txBuf,
TxCodec: c.txc,
Codec: c.codec,

TxBuffer: txBuf,
})
}

Expand Down
Loading
Loading