forked from solana-labs/solana
-
Notifications
You must be signed in to change notification settings - Fork 239
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
Extract account-info crate #2429
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ed9469b
extract account-info crate
kevinheavey 69cef6a
make bincode optional in account-info crate
kevinheavey a6b0cb5
update lock file
kevinheavey 3965838
update doc examples
kevinheavey 52f4a41
remove solana-program from doc examples
kevinheavey e73816b
remove solana-program from dev deps
kevinheavey 15e2806
fmt
kevinheavey 1f9b33b
move MAX_PERMITTED_DATA_INCREASE to account-info crate
kevinheavey 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
[package] | ||
name = "solana-account-info" | ||
description = "Solana AccountInfo and related definitions." | ||
documentation = "https://docs.rs/solana-account-info" | ||
version = { workspace = true } | ||
authors = { workspace = true } | ||
repository = { workspace = true } | ||
homepage = { workspace = true } | ||
license = { workspace = true } | ||
edition = { workspace = true } | ||
|
||
[dependencies] | ||
bincode = { workspace = true, optional = true } | ||
serde = { workspace = true, optional = true } | ||
solana-program-error = { workspace = true } | ||
solana-program-memory = { workspace = true } | ||
solana-pubkey = { workspace = true, default-features = false } | ||
|
||
[features] | ||
bincode = ["dep:bincode", "dep:serde"] | ||
|
||
[package.metadata.docs.rs] | ||
targets = ["x86_64-unknown-linux-gnu"] |
File renamed without changes.
This file contains 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 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 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 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.
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.
Why was the Epoch type replaced with u64? Since we're using Pubkey, can we keep using Epoch too, please?
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.
Pubkey is a struct, and not a type, so it would be a breaking change to use anything else.
I might be missing something, but what's the reasoning to prefer the
Epoch
type alias? The idea was to avoid an extra dependency.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.
A struct is a type ;)
I'd prefer if Epoch were a proper type too, and not just an alias. (But that's orthogonal to this discussion.)
Ah, that part makes sense. How "expensive" is it to have this extra dependency?
Strong typing is beneficial for preventing errors/making refactors easier/etc. Since Epoch is a type alias, we lose some of that, but we still retain search and the self-documenting aspects of Epoch.
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.
Maybe @kevinheavey has some numbers on that, or I can whip them up
Gotcha, I can see from the documenting aspect that it could be useful. My thinking was that:
For those reasons, I lean towards keeping it as is, but if you feel strongly about it, we can change it.
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.
These points make sense to me, especially since this type is meant to be program-facing. The internal-facing structs for accounts can/do keep using Epoch, so I don't think any changes are necessary. Thanks for taking the time to explain this to me!
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.
Sounds good! And thanks for clarifying the difference between type and type alias 😅
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.
yeah on my machine adding the solana-clock dependency increases solana-account-info build time by 40%. It's made quite expensive by the proc macro deps in solana-clock