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

feat: Introduce time port in PoA service #2145

Conversation

netrome
Copy link
Contributor

@netrome netrome commented Aug 30, 2024

Linked Issues/PRs

Closes #2091

Description

This PR introduces a GetTime port in the PoA service. The port is implemented in a SystemTime adapter matching the current behavior of the PoA service when running live, and in a TestTime implementation allowing fine-grained control of how time elapses in tests.

Three additional tests have been added for previously untestable (but correct) behavior:

  • service_test::trigger_tests::interval_trigger_produces_blocks_in_the_future_when_time_is_lagging
  • service_test::trigger_tests::interval_trigger_produces_blocks_with_current_time_when_block_production_is_lagging
  • service_test::trigger_tests::interval_trigger_produces_blocks_in_the_future_when_time_rewinds

Checklist

  • Old behavior is reflected in tests

Before requesting review

  • I have reviewed the code myself

@netrome netrome added the no changelog Skip the CI check of the changelog modification label Aug 30, 2024
@netrome netrome force-pushed the 2091-we-are-using-instantnow-and-tai64now-directly-in-the-block-producer-rather-than-having-some-time-interface branch 3 times, most recently from 63f9ba3 to f6a08b4 Compare August 30, 2024 06:39
@netrome netrome marked this pull request as ready for review August 30, 2024 06:44
@netrome netrome requested a review from a team August 30, 2024 06:44
Copy link
Member

@rymnc rymnc left a comment

Choose a reason for hiding this comment

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

Nice PR, I've left some questions/comments :)

@rymnc rymnc requested a review from a team August 30, 2024 07:13
@netrome netrome force-pushed the 2091-we-are-using-instantnow-and-tai64now-directly-in-the-block-producer-rather-than-having-some-time-interface branch 2 times, most recently from 6ef5cfc to e404343 Compare August 30, 2024 08:51
@netrome netrome removed the no changelog Skip the CI check of the changelog modification label Aug 30, 2024
@netrome netrome force-pushed the 2091-we-are-using-instantnow-and-tai64now-directly-in-the-block-producer-rather-than-having-some-time-interface branch from d34586d to 76d00c4 Compare August 30, 2024 19:12
@netrome netrome self-assigned this Sep 2, 2024
MitchTurner
MitchTurner previously approved these changes Sep 5, 2024
@MitchTurner
Copy link
Member

Sorry about the slow review.


#[tokio::test]
async fn interval_trigger_produces_blocks_in_the_future_when_time_is_lagging() {
// Given
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: something missing here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure what you refer to here. The test is broken down into three sections "Given, When, Then", and this is the beginning of the first one.

…directly-in-the-block-producer-rather-than-having-some-time-interface
Copy link
Member

@rymnc rymnc left a comment

Choose a reason for hiding this comment

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

lgtm if tests pass 😎

…directly-in-the-block-producer-rather-than-having-some-time-interface
@netrome netrome requested a review from rymnc September 6, 2024 07:55
@netrome netrome merged commit d5ba082 into master Sep 6, 2024
35 checks passed
@netrome netrome deleted the 2091-we-are-using-instantnow-and-tai64now-directly-in-the-block-producer-rather-than-having-some-time-interface branch September 6, 2024 07:57
@xgreenx xgreenx mentioned this pull request Sep 17, 2024
xgreenx added a commit that referenced this pull request Sep 18, 2024
## Version v0.36.0

### Added
- [2135](#2135): Added metrics
logging for number of blocks served over the p2p req/res protocol.
- [2151](#2151): Added
limitations on gas used during dry_run in API.
- [2188](#2188): Added the new
variant `V2` for the `ConsensusParameters` which contains the new
`block_transaction_size_limit` parameter.
- [2163](#2163): Added
runnable task for fetching block committer data.
- [2204](#2204): Added
`dnsaddr` resolution for TLD without suffixes.

### Changed

#### Breaking
- [2199](#2199): Applying
several breaking changes to the WASM interface from backlog:
- Get the module to execute WASM byte code from the storage first, an
fallback to the built-in version in the case of the
`FUEL_ALWAYS_USE_WASM`.
- Added `host_v1` with a new `peek_next_txs_size` method, that accepts
`tx_number_limit` and `size_limit`.
- Added new variant of the return type to pass the validation result. It
removes block serialization and deserialization and should improve
performance.
- Added a V1 execution result type that uses `JSONError` instead of
postcard serialized error. It adds flexibility of how variants of the
error can be managed. More information about it in
FuelLabs/fuel-vm#797. The change also moves
`TooManyOutputs` error to the top. It shows that `JSONError` works as
expected.
- [2145](#2145): feat:
Introduce time port in PoA service.
- [2155](#2155): Added trait
declaration for block committer data
- [2142](#2142): Added
benchmarks for varied forms of db lookups to assist in optimizations.
- [2158](#2158): Log the
public address of the signing key, if it is specified
- [2188](#2188): Upgraded the
`fuel-vm` to `0.57.0`. More information in the
[release](https://github.com/FuelLabs/fuel-vm/releases/tag/v0.57.0).

## What's Changed
* chore(p2p_service): add metrics for number of blocks requested over
p2p req/res protocol by @rymnc in
#2135
* Weekly `cargo update` by @github-actions in
#2149
* Debug V1 algorightm and use more realistic values in gas price
analysis by @MitchTurner in
#2129
* feat(gas_price_service): include trait declaration for block committer
data by @rymnc in #2155
* Convert gas price analysis tool to CLI by @MitchTurner in
#2156
* chore: add benchmarks for varied forms of lookups by @rymnc in
#2142
* Add label nochangelog on weekly cargo update by @AurelienFT in
#2152
* Log consensus-key signer address if specified by @acerone85 in
#2158
* chore(rocks_db): move ShallowTempDir to benches crate by @rymnc in
#2168
* chore(benches): conditional dropping of databases in benchmarks by
@rymnc in #2170
* feat: Introduce time port in PoA service by @netrome in
#2145
* Get DA costs from predefined data by @MitchTurner in
#2157
* chore(shallow_temp_dir): panic if not panicking by @rymnc in
#2172
* chore: Add initial CODEOWNERS file by @netrome in
#2179
* Weekly `cargo update` by @github-actions in
#2177
* fix(db_lookup_times): rework core logic of benchmark by @rymnc in
#2159
* Add verification on transaction dry_run that they don't spend more
than block gas limit by @AurelienFT in
#2151
* bug: fix algorithm overflow issues by @MitchTurner in
#2173
* feat(gas_price_service): create runnable task for expensive background
polling for da metadata by @rymnc in
#2163
* Weekly `cargo update` by @github-actions in
#2197
* Fix bug with gas price factor in V1 algorithm by @MitchTurner in
#2201
* Applying several breaking changes to the WASM interface from backlog
by @xgreenx in #2199
* chore(p2p): dnsaddr recursive resolution by @rymnc in
#2204

## New Contributors
* @acerone85 made their first contribution in
#2158

**Full Changelog**:
v0.35.0...v0.36.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants