Repository navigation
wasm: Route clock reads through a time module #1122
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
Open
benthecarman
wants to merge
5
commits into
lightningdevkit:main
Choose a base branch
from
benthecarman:wasm-time
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
47d420e
Centralize clock reads in a time module
benthecarman 7ce676a
Use explicit time in dependency APIs
benthecarman 7a69cd5
Gate LDK std behind an ldk-std feature
benthecarman 512f1fb
Gate the tokio peer transport behind a feature
benthecarman f89930d
Update clippy MSRV to 1.85
benthecarman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -1 +1,35 @@ | ||
| msrv = "1.63.0" | ||
| msrv = "1.85.0" | ||
|
|
||
| # Keep library clock reads behind src/time.rs so they work on wasm32. Tokio's runtime timers | ||
| # are separate. | ||
| disallowed-methods = [ | ||
| { path = "std::time::SystemTime::now", reason = "use crate::time instead" }, | ||
| { path = "std::time::SystemTime::elapsed", reason = "use crate::time instead" }, | ||
| { path = "std::time::Instant::now", reason = "use crate::time::Instant instead" }, | ||
| { path = "std::time::Instant::elapsed", reason = "use crate::time::Instant instead" }, | ||
| { path = "tokio::time::Instant::now", reason = "use crate::time::Instant for clock reads; runtime timers remain separate" }, | ||
| { path = "tokio::time::Instant::elapsed", reason = "use crate::time::Instant for elapsed measurements" }, | ||
| { path = "chrono::Utc::now", reason = "use crate::time::now_utc instead", allow-invalid = true }, | ||
| { path = "chrono::Local::now", reason = "use crate::time::now_utc instead", allow-invalid = true }, | ||
| # Dependency APIs that read the platform clock internally. Use their explicit-time variants. | ||
| { path = "bdk_wallet::Wallet::start_full_scan", reason = "use start_full_scan_at with crate::time" }, | ||
| { path = "bdk_wallet::Wallet::start_sync_with_revealed_spks", reason = "use start_sync_with_revealed_spks_at with crate::time" }, | ||
| { path = "lightning_liquidity::LiquidityManager::new", reason = "use new_with_custom_time_provider with crate::time::LdkTimeProvider" }, | ||
| { path = "lightning_invoice::InvoiceBuilder::current_timestamp", reason = "use duration_since_epoch with crate::time" }, | ||
| { path = "lightning_invoice::Bolt11Invoice::is_expired", reason = "use would_expire with crate::time" }, | ||
| { path = "lightning_invoice::Bolt11Invoice::duration_until_expiry", reason = "use expiration_remaining_from_epoch with crate::time" }, | ||
| { path = "lightning::offers::offer::Offer::is_expired", reason = "use is_expired_no_std with crate::time" }, | ||
| { path = "lightning::offers::refund::Refund::is_expired", reason = "use is_expired_no_std with crate::time" }, | ||
| { path = "lightning::offers::invoice::Bolt12Invoice::is_expired", reason = "use is_expired_no_std with crate::time" }, | ||
| { path = "lightning::offers::static_invoice::StaticInvoice::is_expired", reason = "use is_expired_no_std with crate::time" }, | ||
| { path = "lightning::offers::invoice_request::InvoiceRequest::respond_with", reason = "use respond_with_no_std with crate::time" }, | ||
| { path = "lightning::offers::invoice_request::VerifiedInvoiceRequest::respond_with", reason = "use respond_with_no_std with crate::time" }, | ||
| { path = "lightning::offers::invoice_request::VerifiedInvoiceRequest::respond_using_derived_keys", reason = "use respond_using_derived_keys_no_std with crate::time" }, | ||
| { path = "lightning::offers::refund::Refund::respond_with", reason = "use respond_with_no_std with crate::time" }, | ||
| { path = "lightning::offers::refund::Refund::respond_using_derived_keys", reason = "use respond_using_derived_keys_no_std with crate::time" }, | ||
| { path = "lightning_rapid_gossip_sync::RapidGossipSync::update_network_graph", reason = "use update_network_graph_no_std with Some(crate::time::unix_time_secs().expect(...)) to retain freshness validation" }, | ||
| { path = "lightning_rapid_gossip_sync::RapidGossipSync::sync_network_graph_with_file_path", reason = "read the snapshot and use update_network_graph_no_std with current time" }, | ||
| { path = "lightning::routing::gossip::NetworkGraph::remove_stale_channels_and_tracking", reason = "use remove_stale_channels_and_tracking_with_time with crate::time" }, | ||
| { path = "bdk_chain::bdk_core::spk_client::SyncRequest::builder", reason = "use builder_at with crate::time" }, | ||
| { path = "bdk_chain::bdk_core::spk_client::FullScanRequest::builder", reason = "use builder_at with crate::time" }, | ||
| ] |
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
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.
Not a big fan of this feature. I think before we move forward it would be better to refactor upstream so we can plug a custom
TimeProvidereverywhere or consistenly discernstdandtimefeatures so we can just not set the latter here. (cc @TheBlueMatt thoughts?)