Skip to content

Commit 2becc9a

Browse files
emmazzzclaude
andcommitted
Use gRPC instead of JSON-RPC for Write API in sui-indexer-alt-jsonrpc
Replace the JSON-RPC HTTP client delegation with gRPC calls for executeTransactionBlock and dryRunTransactionBlock. The Write module now uses FullnodeClient from sui-indexer-alt-reader, which communicates with the fullnode via TransactionExecutionService gRPC. - Add configurable read_mask parameter to FullnodeClient's execute_transaction and simulate_transaction methods - Add --fullnode-grpc-url flag (separate from existing --fullnode-rpc-url which remains for DelegationGovernance JSON-RPC delegation) - Implement proto-to-JSON-RPC response conversion for effects, events, balance changes, and object changes - Build dynamic FieldMask based on SuiTransactionBlockResponseOptions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 4722b2a commit 2becc9a

File tree

8 files changed

+554
-33
lines changed

8 files changed

+554
-33
lines changed

Cargo.lock

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/sui-indexer-alt-e2e-tests/tests/jsonrpc_fn_delegation_tests.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ impl FnDelegationTestCluster {
5555
.build()
5656
.await;
5757

58-
// Unwrap since we know the URL should be valid.
5958
let fullnode_rpc_url = Url::parse(onchain_cluster.rpc_url())?;
59+
let fullnode_grpc_url = onchain_cluster.rpc_url().to_string();
6060

6161
let rpc_listen_address =
6262
SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), get_available_port());
@@ -80,6 +80,7 @@ impl FnDelegationTestCluster {
8080
rpc_args,
8181
NodeArgs {
8282
fullnode_rpc_url: Some(fullnode_rpc_url),
83+
fullnode_grpc_url: Some(fullnode_grpc_url),
8384
},
8485
SystemPackageTaskArgs::default(),
8586
RpcConfig::default(),

crates/sui-indexer-alt-graphql/src/api/mutation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ impl Mutation {
8181

8282
// Execute transaction via gRPC
8383
match fullnode_client
84-
.execute_transaction(tx_data.clone(), parsed_signatures.clone())
84+
.execute_transaction(tx_data.clone(), parsed_signatures.clone(), None)
8585
.await
8686
{
8787
Ok(response) => {

crates/sui-indexer-alt-graphql/src/api/query.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,7 @@ impl Query {
767767
proto_tx,
768768
checks_enabled.unwrap_or(true),
769769
do_gas_selection.unwrap_or(false),
770+
None,
770771
)
771772
.await
772773
{

crates/sui-indexer-alt-jsonrpc/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ tower-http.workspace = true
4747
tracing.workspace = true
4848
url.workspace = true
4949

50+
prost-types.workspace = true
51+
tonic.workspace = true
52+
5053
move-binary-format.workspace = true
5154
move-core-types.workspace = true
5255

@@ -64,6 +67,7 @@ sui-open-rpc.workspace = true
6467
sui-open-rpc-macros.workspace = true
6568
sui-package-resolver.workspace = true
6669
sui-protocol-config.workspace = true
70+
sui-rpc.workspace = true
6771
sui-sql-macro.workspace = true
6872
sui-types.workspace = true
6973

0 commit comments

Comments
 (0)