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

bug!: updating consensus parameters #1569

Merged
merged 7 commits into from
Jan 9, 2025

Conversation

segfault-magnet
Copy link
Contributor

@segfault-magnet segfault-magnet commented Jan 9, 2025

Release notes

In this release, we:

  • Made the ConsensusParameters cache expire-able in Provider

Summary

The Provider now evicts the cached ConsensusParameters after the preconfigured TTL (defaulted to 60s).

You can change the TTL by doing:

    provider.set_cache_ttl(TtlConfig {
        consensus_parameters: Duration::from_secs(5),
    });

If you want to clear the cache immediately you can do so by:

    provider.clear_cache().await;

Breaking Changes

The consensus_parameters method in Provider is now async and fallable:

    pub async fn consensus_parameters(&self) -> Result<ConsensusParameters>

The following methods have been removed:

  • base_asset_id -- now acquired by provider.consensus_parameters().await?.base_asset_id()
  • chain_id -- now acquired by provider.consensus_parameters().await?.chain_id()

Checklist

  • All changes are covered by tests (or not applicable)
  • All changes are documented (or not applicable)
  • I reviewed the entire PR myself (preferably, on GH UI)
  • I described all Breaking Changes (or there's none)

@segfault-magnet segfault-magnet added bug Something isn't working enhancement New feature or request labels Jan 9, 2025
@segfault-magnet segfault-magnet self-assigned this Jan 9, 2025
@segfault-magnet segfault-magnet added bug Something isn't working and removed bug Something isn't working enhancement New feature or request labels Jan 9, 2025
@segfault-magnet segfault-magnet changed the title feat!: updating consensus parameters bug!: updating consensus parameters Jan 9, 2025
Copy link
Contributor

@hal3e hal3e left a comment

Choose a reason for hiding this comment

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

LGTM

packages/fuels-accounts/src/provider.rs Show resolved Hide resolved
packages/fuels-accounts/src/provider/cache.rs Show resolved Hide resolved
packages/fuels-accounts/src/provider.rs Show resolved Hide resolved
@segfault-magnet segfault-magnet merged commit 1d6de6c into master Jan 9, 2025
45 checks passed
@segfault-magnet segfault-magnet deleted the feat/updating_consensus_parameters branch January 9, 2025 16:48
@segfault-magnet segfault-magnet mentioned this pull request Jan 9, 2025
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Check for updates to cached ConsensusParameters
4 participants