-
Notifications
You must be signed in to change notification settings - Fork 11.4k
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
[indexer-alt] - add rpc api ingestion to indexer-alt #20787
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Skipped Deployments
|
8b65939
to
5d6f78d
Compare
5d6f78d
to
bf7ed0c
Compare
#[clap(long)] | ||
pub basic_auth: Option<String>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you include some documentation of the expected format of this CLI arg, below you can see that its expected to be <username>:<password>
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 on the docs here, and some other comments:
- Let's also clarify that it is only relevant if
--rpc-api-url
is set. - Consider accepting this value via an environment variable as well.
crates/sui-rpc-api/src/client/mod.rs
Outdated
let value: MetadataValue<Ascii> = format!("Basic {}", auth) | ||
.parse() | ||
.map_err(Into::into) | ||
.map_err(Status::from_error)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given this is a username/password lets make sure to set the sensitive flag on the MetadataValue:
https://docs.rs/tonic/latest/tonic/metadata/struct.MetadataValue.html#method.set_sensitive
crates/sui-rpc-api/src/client/mod.rs
Outdated
.tls_config( | ||
ClientTlsConfig::new() | ||
.with_enabled_roots() | ||
.assume_http2(true), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed? any TLS negotiation should include h2 in ALPN
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is needed for the full node we setup in the private net
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some high level thoughts but the change on the indexing framework side looks good here, I see that @bmwill has some unresolved comments on the RPC API side, so I will leave it with him for the final stamp.
Ok(Bytes::from( | ||
Blob::encode(&data, BlobEncoding::Bcs)?.to_bytes(), | ||
)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fairly sure we're going to decode this straight away, which is a little unfortunate -- is it worth changing the IngestionClientTrait
so that fetch
returns a CheckpointData
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added FetchData, which can be either raw bytes or CheckpointData
use sui_storage::blob::{Blob, BlobEncoding}; | ||
use url::Url; | ||
|
||
pub(crate) struct RpcIngestionClient { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm in two minds about this myself, but do we need this type? (As opposed to implementing IngestionClientTrait
directly on sui_rpc_api::Client
?
#[clap(long)] | ||
pub basic_auth: Option<String>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 on the docs here, and some other comments:
- Let's also clarify that it is only relevant if
--rpc-api-url
is set. - Consider accepting this value via an environment variable as well.
let basic_auth = args.basic_auth.map(|s| { | ||
let split = s.split(":").collect::<Vec<_>>(); | ||
assert_eq!(2, split.len()); | ||
(split[0].to_string(), split[1].to_string()) | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not accept this as two different flags to avoid hand-rolling the parser?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am now using the username and password encoded in the URL instead of having separated args
Note #20986 added support for configuring auth |
thanks! that's great! I will rebase and update this PR |
18cd4de
to
82b8fe2
Compare
1a47c37
to
c21b790
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indexing framework side looks good modulo that comment about how we expose auth for RPC, @bmwill, how are we on the RPC API side of things?
…eserilised CheckpointData * use username and password in URL instead of separated field * implement IngestionClientTrait for sui_rpc_api::Client instead of RpcIngestionClient
use grpc status code instead of scanning error message.
c21b790
to
b9dc42c
Compare
crates/sui-rpc-api/src/client/mod.rs
Outdated
.tls_config( | ||
ClientTlsConfig::new() | ||
.with_enabled_roots() | ||
.assume_http2(true), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was needed previously when connecting to a private full node via a basic auth proxy, ALPN negotiation wasn't working. But now we are connecting to the full node directly inside the VPC so it's not needed anymore, I will revert this change.
Description
add rpc api ingestion to indexer-alt, this is to unblock a private-net app indexer.
Test plan
How did you test the new or updated feature?
Release notes
Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.
For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.