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

grpc multiplexing integrate #255

Merged
merged 31 commits into from
Dec 22, 2023

Conversation

grooviegermanikus
Copy link
Collaborator

@grooviegermanikus grooviegermanikus commented Dec 19, 2023

Use auto-reconnect and multiplex utilities from https://github.com/blockworks-foundation/geyser-grpc-connector to allow a second gRPC connection.

Configuration

Up to 4 connections can be configured from config.json with overrides from ENV:

"use_grpc": true,
  "grpc_addr": "http://any.rpcpool.com",
  "grpc_x_token": "121212121212",
  "grpc_addr2": "http://some.rpcpool.com",
  "grpc_x_token2": null,

env variables:

....
GRPC_ADDR2=
GRPC_X_TOKEN2=mytoken

@grooviegermanikus grooviegermanikus marked this pull request as ready for review December 20, 2023 08:46
@@ -295,3 +308,11 @@ fn parse_host_port(host_port: &str) -> Result<SocketAddr, String> {
Ok(addrs[0])
}
}

// http://mango.rpcpool.com/c232ab232ba2323
fn obfuscate_rpcurl(rpc_addr: &str) -> String {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this

}
}

pub fn create_grpc_multiplex_subscription(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should take vector of gprc_add and grpc_x_token.

grpc_addr,
grpc_x_token.is_some()
);
if let Some(ref grpc_addr2) = grpc_addr2 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iterate and create the connections accordingly.

@@ -46,6 +46,10 @@ pub struct Config {
pub grpc_addr: String,
#[serde(default)]
pub grpc_x_token: Option<String>,
#[serde(default)]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make it Vec instead of adding another argument.
Example :

#[arg(short, long, value_delimiter = ',')]
 pub grpc_addr: Vec<String>,

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reworked it, but not as vector .. that's really an headache

Copy link
Collaborator

@godmodegalactus godmodegalactus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes as requested

@grooviegermanikus grooviegermanikus merged commit 5cfb6de into main Dec 22, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants