-
Notifications
You must be signed in to change notification settings - Fork 8
chore: upgrade to Rust edition 2024 #118
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull request overview
This PR upgrades the Rust crate from edition 2021 to edition 2024. The workspace configuration uses a centralized edition setting that is automatically inherited by both workspace members (api and types crates) via edition.workspace = true. The minimum Rust version is set to 1.85, which supports edition 2024.
Changes:
- Updated workspace edition from "2021" to "2024" in the root Cargo.toml
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #118 +/- ##
==========================================
+ Coverage 51.58% 51.61% +0.02%
==========================================
Files 40 40
Lines 5168 5169 +1
==========================================
+ Hits 2666 2668 +2
+ Misses 2502 2501 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
88fc803 to
bd19016
Compare
vsavchyn-dev
left a comment
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.
Just few questions
| // Fetch a single final block | ||
| let final_block = Chain::block() | ||
| .at(Reference::Final) | ||
| .fetch_from_mainnet() | ||
| .await?; | ||
|
|
||
| let block_number = Chain::block_number().fetch_from_mainnet().await?; | ||
| let block_hash = Chain::block_hash().fetch_from_mainnet().await?; | ||
| let block_number = final_block.header.height; | ||
| let block_hash = final_block.header.hash.into(); | ||
|
|
||
| let _block = Chain::block() | ||
| let _block_by_number = Chain::block() |
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.
I think the purpose of this test is to test code path of retrieving specific information of the block (block itself, "block_hash", "block_number"), right @akorchyn?
AFAIU, @r-near changed this test due to it failing to find block. It is related to the block reference being optimistic in Chain::block_number() and Chain::block_hash(), right?
Maybe we should just change these lines in test then:
// Fetch a single final block
let _final_block = Chain::block()
.at(Reference::Optimistic)
.fetch_from_mainnet()
.await?;
let block_number = Chain::block_number()
.at(Reference::Final)
.fetch_from_mainnet()
.await?;
let block_hash = Chain::block_hash()
.at(Reference::Final)
.fetch_from_mainnet()
.await?;|
|
||
| [workspace.package] | ||
| edition = "2021" | ||
| edition = "2024" |
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.
| edition = "2024" | |
| edition = "2024" | |
| rust-version = "1.85" |
Maybe we should also opt-in ./api/Cargo.toml and ./types/Cargo.toml with rust-version.workspace = true?
Updates the crate to Rust edition 2024 with resolver v3.