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

Remove deadline clock in POA and replace with tokio time functions. #2109

Merged
merged 13 commits into from
Aug 20, 2024

Conversation

AurelienFT
Copy link
Contributor

@AurelienFT AurelienFT commented Aug 20, 2024

Linked Issues/PRs

Closes #1917

Description

This PR removes the DeadlineClock structure and his usage in POA. It's replaced by a mechanism using Tokio features.
This changes avoid the service to hangs up on an error, it will now wait and retry a block production

Checklist

  • Breaking changes are clearly marked as such in the PR description and changelog
  • New behavior is reflected in tests
  • The specification matches the implemented behavior (link update PR if changes are needed)

Before requesting review

  • I have reviewed the code myself
  • I have created follow-up issues caused by this PR and linked them here

After merging, notify other teams

Dentosal
Dentosal previously approved these changes Aug 20, 2024
Copy link
Member

@Dentosal Dentosal left a comment

Choose a reason for hiding this comment

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

Good cleanup. Removes code and adds tests. LGTM.

AurelienFT and others added 2 commits August 20, 2024 11:24
Rewrite test to avoid being time based.
Remove reset of `last_block_created` in `into_task` of POA
@AurelienFT AurelienFT self-assigned this Aug 20, 2024
xgreenx
xgreenx previously approved these changes Aug 20, 2024
@@ -194,6 +200,60 @@ async fn interval_trigger_produces_blocks_periodically() -> anyhow::Result<()> {
Ok(())
}

// In case of error during block creation, the block should be retried after a delay of 1 second.
#[tokio::test(start_paused = true)]
async fn retry_block_creation_in_case_error() -> anyhow::Result<()> {
Copy link
Member

Choose a reason for hiding this comment

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

I know the other tests in this file don't do this yet, but can we add a given/when/then to clearly mark the SUT, the conditions, and the expected result?

It's not super clear here anyway, since we don't get to handle the service directly (which I would assume is the SUT here). But at least say:
given: a service that just failed to commit a block
when: we wait for 2 seconds
then: the service succeeds at committing a block

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reorganized it.

@@ -194,6 +200,60 @@ async fn interval_trigger_produces_blocks_periodically() -> anyhow::Result<()> {
Ok(())
}

// In case of error during block creation, the block should be retried after a delay of 1 second.
#[tokio::test(start_paused = true)]
async fn retry_block_creation_in_case_error() -> anyhow::Result<()> {
Copy link
Member

Choose a reason for hiding this comment

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

[nit]: I don't think all the comments are necessary.

For example, the comment above the test name could just be the test name. I don't mind verbose test names:

async fn service__if_commit_result_fails_then_retry_commit_result_after_trigger_duration

I think the comments above the expect_commit_results are good. But a lot of the other comments are redundant.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I removed the others comments !

xgreenx
xgreenx previously approved these changes Aug 20, 2024
@xgreenx xgreenx enabled auto-merge (squash) August 20, 2024 16:09
@xgreenx xgreenx merged commit 2caca61 into master Aug 20, 2024
32 checks passed
@xgreenx xgreenx deleted the remove_deadline_clock_poa branch August 20, 2024 16:24
@xgreenx xgreenx mentioned this pull request Aug 20, 2024
xgreenx added a commit that referenced this pull request Aug 20, 2024
## Version v0.34.0

### Added
- [2051](#2051): Add support
for AWS KMS signing for the PoA consensus module. The new key can be
specified with `--consensus-aws-kms AWS_KEY_ARN`.
- [2092](#2092): Allow
iterating by keys in rocksdb, and other storages.
- [2096](#2096): GraphQL
endpoint to fetch blob byte code by its blob ID.

### Changed
- [2106](#2106): Remove
deadline clock in POA and replace with tokio time functions.

#### Breaking
- [2051](#2051): Misdocumented
`CONSENSUS_KEY` environ variable has been removed, use
`CONSENSUS_KEY_SECRET` instead. Also raises MSRV to `1.79.0`.

### Fixed

- [2106](#2106): Handle the
case when nodes with overriding start on the fresh network.
- [2105](#2105): Fixed the
rollback functionality to work with empty gas price database.

## What's Changed
* doc: refine the transaction example in the README by @mmyyrroonn in
#2072
* AWS KMS block signing support and Rust 1.79 by @Dentosal in
#2051
* feat(iterators): allow key-only iteration by @rymnc in
#2092
* feat: graphql endpoint to fetch the blob byte code by its blob ID by
@netrome in #2096
* Small improvements for tests to make them more stable by @xgreenx in
#2103
* Fixed the rollback functionality to work with empty gas price database
by @xgreenx in #2105
* Bump wasmtime version by @Dentosal in
#2089
* Handle the case when nodes with overriding start on the fresh network
by @xgreenx in #2106
* Remove deadline clock in POA and replace with tokio time functions. by
@AurelienFT in #2109

## New Contributors
* @mmyyrroonn made their first contribution in
#2072

**Full Changelog**:
v0.33.0...v0.34.0
GoldenPath1109 added a commit to GoldenPath1109/fuel-core that referenced this pull request Sep 7, 2024
## Version v0.34.0

### Added
- [2051](FuelLabs/fuel-core#2051): Add support
for AWS KMS signing for the PoA consensus module. The new key can be
specified with `--consensus-aws-kms AWS_KEY_ARN`.
- [2092](FuelLabs/fuel-core#2092): Allow
iterating by keys in rocksdb, and other storages.
- [2096](FuelLabs/fuel-core#2096): GraphQL
endpoint to fetch blob byte code by its blob ID.

### Changed
- [2106](FuelLabs/fuel-core#2106): Remove
deadline clock in POA and replace with tokio time functions.

#### Breaking
- [2051](FuelLabs/fuel-core#2051): Misdocumented
`CONSENSUS_KEY` environ variable has been removed, use
`CONSENSUS_KEY_SECRET` instead. Also raises MSRV to `1.79.0`.

### Fixed

- [2106](FuelLabs/fuel-core#2106): Handle the
case when nodes with overriding start on the fresh network.
- [2105](FuelLabs/fuel-core#2105): Fixed the
rollback functionality to work with empty gas price database.

## What's Changed
* doc: refine the transaction example in the README by @mmyyrroonn in
FuelLabs/fuel-core#2072
* AWS KMS block signing support and Rust 1.79 by @Dentosal in
FuelLabs/fuel-core#2051
* feat(iterators): allow key-only iteration by @rymnc in
FuelLabs/fuel-core#2092
* feat: graphql endpoint to fetch the blob byte code by its blob ID by
@netrome in FuelLabs/fuel-core#2096
* Small improvements for tests to make them more stable by @xgreenx in
FuelLabs/fuel-core#2103
* Fixed the rollback functionality to work with empty gas price database
by @xgreenx in FuelLabs/fuel-core#2105
* Bump wasmtime version by @Dentosal in
FuelLabs/fuel-core#2089
* Handle the case when nodes with overriding start on the fresh network
by @xgreenx in FuelLabs/fuel-core#2106
* Remove deadline clock in POA and replace with tokio time functions. by
@AurelienFT in FuelLabs/fuel-core#2109

## New Contributors
* @mmyyrroonn made their first contribution in
FuelLabs/fuel-core#2072

**Full Changelog**:
FuelLabs/fuel-core@v0.33.0...v0.34.0
This pull request was closed.
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.

Investigate removing DeadlineClock
4 participants