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

testnet: Add flag for time between blocks #134

Merged
merged 2 commits into from
May 1, 2023
Merged

testnet: Add flag for time between blocks #134

merged 2 commits into from
May 1, 2023

Conversation

vitsalis
Copy link
Member

No description provided.

@vitsalis vitsalis marked this pull request as draft September 13, 2022 10:05
@@ -215,6 +220,8 @@ func InitTestnet(
nodeConfig.Instrumentation.Prometheus = true
// Set the number of simultaneous connections to unlimited
nodeConfig.Instrumentation.MaxOpenConnections = 0
// Time between blocks
nodeConfig.Consensus.TimeoutCommit = time.Second * time.Duration(timeBetweenBlocks)
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't look to be in line with what setting is for when I read https://github.com/tendermint/tendermint/blob/v0.35.9/config/config.go#L1130-L1133

The setting is to allow some extra votes to arrive. You need +2/3 votes for a quorum, but waiting a little longer can gather more votes, which is nice. If you say you want blocks every 5 seconds, then you can't spend the entire 5 seconds waiting for new votes before starting your next round, to collect your votes.

Say it takes 2 seconds for a quorum to form on a proposed block, and you want to wait an extra 1 second before you start making the next block for more votes to arrive. Then you start making the new blocks, but you only have 2 seconds left before your target of 5 seconds is reached. If you waited 5 seconds, then it would be 7 second per block.

I also don't understand why you would want to tweak this setting all of a sudden.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, that's what I initially understood, but the Tendermint docs say that this configuration should be specified

@@ -127,6 +130,7 @@ Example:
cmd.Flags().String(server.FlagMinGasPrices, fmt.Sprintf("0.000006%s", sdk.DefaultBondDenom), "Minimum gas prices to accept for transactions; All fees in a tx must meet this minimum (e.g. 0.01photino,0.001stake)")
cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|test)")
cmd.Flags().String(flags.FlagKeyAlgorithm, string(hd.Secp256k1Type), "Key signing algorithm to generate keys for")
cmd.Flags().Uint64(flagTimeBetweenBlocks, 5, "Time between blocks in seconds.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh I see it does recommend setting timeout_commit. How odd.

Copy link
Contributor

Choose a reason for hiding this comment

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

Plus, if you set create_empty_blocks_interval to something other than the default (0), Tendermint will be creating empty blocks even in the absence of transactions every create_empty_blocks_interval. For instance, with create_empty_blocks = false and create_empty_blocks_interval = "30s", Tendermint will only create blocks if there are transactions, or after waiting 30 seconds without receiving any transactions.

That sounds good, though?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, agreed.

@vitsalis vitsalis marked this pull request as ready for review September 13, 2022 12:32
@vitsalis
Copy link
Member Author

Thanks for the suggestions @aakoshh ! Updated the code based on those.

aakoshh
aakoshh previously approved these changes Sep 13, 2022
Copy link
Contributor

@aakoshh aakoshh left a comment

Choose a reason for hiding this comment

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

If this works, then cool!

@vitsalis
Copy link
Member Author

Blocks are still not getting produced every 10s. Converting this to draft since it is lower priority.

@vitsalis vitsalis marked this pull request as draft September 14, 2022 09:08
@vitsalis vitsalis requested review from SebastianElvis, gitferry and aakoshh and removed request for aakoshh January 31, 2023 15:06
@vitsalis vitsalis changed the base branch from main to dev January 31, 2023 15:07
@vitsalis vitsalis dismissed aakoshh’s stale review January 31, 2023 15:07

The base branch was changed.

@vitsalis vitsalis marked this pull request as ready for review January 31, 2023 15:07
@vitsalis
Copy link
Member Author

@SebastianElvis @gitferry Reworked on this and added changes that allow us to specify the time between blocks. Tested with the local deployment and we can change the time between blocks.

Copy link
Contributor

@gitferry gitferry left a comment

Choose a reason for hiding this comment

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

Awesome!

@vitsalis
Copy link
Member Author

vitsalis commented Jan 31, 2023

Seems the build fails due to integration tests. I rerun the job a couple of times, and this seems to be timing related. For example:

  • here the build crashes due to a btc base header not being available.
  • here the build crashes due to finalized chain info not being available for a chain.

@SebastianElvis given that you reviewed many of the e2e tests and @KonradStaniec is missing right now, any thoughts?

side note: This is not a requirement for the alpha testnet as this only affects the testnet command

@SebastianElvis
Copy link
Member

Debugged for a couple of times and the error persists 😅

Nevertheless, I found this in Tendermint's source code

	// NOTE: when modifying, make sure to update time_iota_ms genesis parameter
	TimeoutCommit time.Duration `mapstructure:"timeout_commit"`

where time_iota_ms is a genesis parameter in Tendermint. Maybe this is related?

@vitsalis
Copy link
Member Author

vitsalis commented Feb 1, 2023

I see. time_iota_ms seems to define the minimum time between blocks, so I guess it should be unrelated.

@vitsalis
Copy link
Member Author

Finally fixed this 😆 Reduced the default time between blocks to avoid inconsistencies in integration tests. @KonradStaniec @SebastianElvis another look please? (time_iota_ms is deprecated now).

Copy link
Member

@SebastianElvis SebastianElvis left a comment

Choose a reason for hiding this comment

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

Congrats that this finally works! This is much needed for sure

@vitsalis vitsalis merged commit 3a88d87 into dev May 1, 2023
@vitsalis vitsalis deleted the block-timeout branch May 1, 2023 15:06
vitsalis pushed a commit that referenced this pull request Jan 21, 2024
Co-authored-by: KonradStaniec <konrad.staniec@gmail.com>
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.

4 participants