-
Notifications
You must be signed in to change notification settings - Fork 110
chore: Move bind URLs to sockets #2054
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
Open
sergerad
wants to merge
8
commits into
next
Choose a base branch
from
sergerad-bind-ports
base: next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c5586f7
Move bind URLs to ports
sergerad d00f9c5
Lint and changelog
sergerad 6d5ce36
Update compose usage.md and run-node.sh
sergerad 7c7ca09
Merge branch 'next' of github.com:0xMiden/miden-node into sergerad-bi…
sergerad 9ec725c
Move to socket env / args
sergerad ebe76f8
RM option for ntx builder arg
sergerad 6e7227d
Reword changelog
sergerad 25d7472
Update run script
sergerad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,3 +1,4 @@ | ||||||
| use std::net::SocketAddr; | ||||||
| use std::num::NonZeroUsize; | ||||||
| use std::time::Duration; | ||||||
|
|
||||||
|
|
@@ -10,12 +11,11 @@ use miden_node_block_producer::{ | |||||
| DEFAULT_MAX_TXS_PER_BATCH, | ||||||
| }; | ||||||
| use miden_node_utils::clap::{GrpcOptionsInternal, duration_to_human_readable_string}; | ||||||
| use miden_node_utils::grpc::UrlExt; | ||||||
| use url::Url; | ||||||
|
|
||||||
| use super::ENV_ENABLE_OTEL; | ||||||
|
|
||||||
| const ENV_URL: &str = "MIDEN_NODE_BLOCK_PRODUCER_URL"; | ||||||
| const ENV_SOCKET: &str = "MIDEN_NODE_BLOCK_PRODUCER_SOCKET"; | ||||||
| const ENV_STORE_URL: &str = "MIDEN_NODE_BLOCK_PRODUCER_STORE_URL"; | ||||||
| const ENV_VALIDATOR_URL: &str = "MIDEN_NODE_BLOCK_PRODUCER_VALIDATOR_URL"; | ||||||
| const ENV_MAX_TXS_PER_BATCH: &str = "MIDEN_NODE_BLOCK_PRODUCER_MAX_TXS_PER_BATCH"; | ||||||
|
|
@@ -30,9 +30,9 @@ const ENV_BATCH_PROVER_URL: &str = "MIDEN_NODE_BLOCK_PRODUCER_BATCH_PROVER_URL"; | |||||
| pub enum BlockProducerCommand { | ||||||
| /// Starts the block-producer component. | ||||||
| Start { | ||||||
| /// Url at which to serve the gRPC API. | ||||||
| #[arg(env = ENV_URL)] | ||||||
| url: Url, | ||||||
| /// Socket address at which to serve the gRPC API. | ||||||
| #[arg(long = "socket", env = ENV_SOCKET, value_name = "SOCKET")] | ||||||
| socket: SocketAddr, | ||||||
|
|
||||||
| /// The store's block-producer service gRPC url. | ||||||
| #[arg(long = "store.url", env = ENV_STORE_URL)] | ||||||
|
|
@@ -60,16 +60,15 @@ pub enum BlockProducerCommand { | |||||
| impl BlockProducerCommand { | ||||||
| pub async fn handle(self) -> anyhow::Result<()> { | ||||||
| let Self::Start { | ||||||
| url, | ||||||
| socket, | ||||||
| store_url, | ||||||
| validator_url, | ||||||
| block_producer, | ||||||
| enable_otel: _, | ||||||
| grpc_options, | ||||||
| } = self; | ||||||
|
|
||||||
| let block_producer_address = | ||||||
| url.to_socket().context("Failed to extract socket address from store URL")?; | ||||||
| let block_producer_address = socket; | ||||||
|
|
||||||
| // Runtime validation for protocol constraints | ||||||
| if block_producer.max_batches_per_block > miden_protocol::MAX_BATCHES_PER_BLOCK { | ||||||
|
|
@@ -123,7 +122,7 @@ mod tests { | |||||
| #[tokio::test] | ||||||
| async fn rejects_too_large_max_batches_per_block() { | ||||||
| let cmd = BlockProducerCommand::Start { | ||||||
| url: dummy_url(), | ||||||
| socket: "0.0.0.0:1234".parse().unwrap(), | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe these should be localhost with an arbitrary port?
Suggested change
|
||||||
| store_url: dummy_url(), | ||||||
| validator_url: dummy_url(), | ||||||
| block_producer: BlockProducerConfig { | ||||||
|
|
@@ -146,7 +145,7 @@ mod tests { | |||||
| #[tokio::test] | ||||||
| async fn rejects_too_large_max_txs_per_batch() { | ||||||
| let cmd = BlockProducerCommand::Start { | ||||||
| url: dummy_url(), | ||||||
| socket: "0.0.0.0:1234".parse().unwrap(), | ||||||
| store_url: dummy_url(), | ||||||
| validator_url: dummy_url(), | ||||||
| block_producer: BlockProducerConfig { | ||||||
|
|
||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Nit:
socketnaming feels a bit awkward because a socket is what you get after binding to this host+port.This shouldn't hold up the PR, but some alternatives
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.
Its short for socket address
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 understand that, but that isn't something I've seen used before in a CLI, and
socketalready has a meaning so having it be shortened from something else isn't great.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 think --socket or --listen are clearest
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.
See what
--listenlooks like and then make a call 👍 (endpointmakes more sense as the client I think).