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
[Feature] Add --no-dev-txs flag #3132
Merged
Merged
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
cd9bad2
Add --dev-traffic flag
vicsn da475f7
Clean up where we warn about --dev-traffic
vicsn 71230f2
Re-order dev_traffic argument
vicsn d3cc72b
Explicitly set default --dev-traffic value
vicsn 281acb5
add --dev-traffic usage to README
vicsn de2bd05
Rename dev_traffic to no_dev_txs; ensure tx generation remains the de…
vicsn 8a0145c
Revert "add --dev-traffic usage to README"
vicsn File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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 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 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 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 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 |
---|---|---|
|
@@ -82,6 +82,7 @@ impl<N: Network, C: ConsensusStorage<N>> Validator<N, C> { | |
trusted_validators: &[SocketAddr], | ||
genesis: Block<N>, | ||
cdn: Option<String>, | ||
dev_traffic: bool, | ||
storage_mode: StorageMode, | ||
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. nit: can you swap the order between 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. 71230f2 Sure, though note |
||
) -> Result<Self> { | ||
// Prepare the shutdown flag. | ||
|
@@ -139,7 +140,7 @@ impl<N: Network, C: ConsensusStorage<N>> Validator<N, C> { | |
shutdown, | ||
}; | ||
// Initialize the transaction pool. | ||
node.initialize_transaction_pool(storage_mode)?; | ||
node.initialize_transaction_pool(storage_mode, dev_traffic)?; | ||
|
||
// Initialize the REST server. | ||
if let Some(rest_ip) = rest_ip { | ||
|
@@ -339,7 +340,7 @@ impl<N: Network, C: ConsensusStorage<N>> Validator<N, C> { | |
// } | ||
|
||
/// Initialize the transaction pool. | ||
fn initialize_transaction_pool(&self, storage_mode: StorageMode) -> Result<()> { | ||
fn initialize_transaction_pool(&self, storage_mode: StorageMode, dev_traffic: bool) -> Result<()> { | ||
use snarkvm::console::{ | ||
program::{Identifier, Literal, ProgramID, Value}, | ||
types::U64, | ||
|
@@ -353,8 +354,8 @@ impl<N: Network, C: ConsensusStorage<N>> Validator<N, C> { | |
match storage_mode { | ||
// If the node is running in development mode, only generate if you are allowed. | ||
StorageMode::Development(id) => { | ||
// If the node is not the first node, do not start the loop. | ||
if id != 0 { | ||
// If the node is not the first node, or if we should not create dev traffic, do not start the loop. | ||
if id != 0 || !dev_traffic { | ||
return Ok(()); | ||
} | ||
} | ||
|
@@ -472,6 +473,7 @@ mod tests { | |
let node = SocketAddr::from_str("0.0.0.0:4130").unwrap(); | ||
let rest = SocketAddr::from_str("0.0.0.0:3030").unwrap(); | ||
let storage_mode = StorageMode::Development(0); | ||
let dev_traffic = true; | ||
|
||
// Initialize an (insecure) fixed RNG. | ||
let mut rng = ChaChaRng::seed_from_u64(1234567890u64); | ||
|
@@ -494,6 +496,7 @@ mod tests { | |
&[], | ||
genesis, | ||
None, | ||
dev_traffic, | ||
storage_mode, | ||
) | ||
.await | ||
|
This file contains 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
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.
Is this
true
by default?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.
It is
false
by default, made it explicit: d3cc72bI realise this may lead to issues in the community because nodes require this flag to auto-advance blocks. But I think it is the right default for testing and the updated README 281acb5,
devnet.sh
should be sufficient guidance.Let me know if you prefer an alternative
dev-no-traffic
command.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.
It should be true by default.
Can use
no-dev-txs
as the flag name. Traffic implies network traffic among clients/validators.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.
Done
de2bd05
8a0145c