-
Notifications
You must be signed in to change notification settings - Fork 67
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
Prepare for stability (1.0 release) #51
Comments
I got this error because we export macroses and some functions. To do that we need to have crates. |
@iho Re: borsh-derive-internal The question is whether we need to export those methods at all. I see no need in that, and serde went that path as well and 5 years ago it gave them 7% better compile time: serde-rs/serde@3859f58 |
I am going to work on
|
@iho Re: unsplit borsh-derive-internal I checked |
taking the following sub-issue for trial and error and resolution
|
taking the following sub-issue for trial and error and resolution
|
the following is covered in scope of #155
|
taking the following sub-issue for trial, error and resolution: |
The following is (partially) covered in scope of #155 . nostd_io in integration test.
|
taking following sub-issue in scope of #46
|
taking this sub-issue:
|
@matklad Could you, please, remind what you had in mind when added this item?
It seems that the only macro runtime things are “maybestd” and the public traits, aren’t they? Given that we already renamed and hid “maybestd” to “__maybestd”, it seems that there is no further action items there worth introducing the module. |
taking this issue
|
Yup, if it’s just __maybestd, no further action is required. I would still maybe prefer to call this |
taking this sub-issue
|
If you got one of those two errors, but your import is correct it means that you forgot to enable |
|
near-contract-standards v4.1.1
├── near-sdk v4.1.1
│ ├── borsh v1.0.0-alpha.2
│ ├── near-abi v0.3.0
│ │ ├── borsh v0.9.3
│ ├── near-crypto v0.17.0
│ │ ├── borsh v0.10.3
│ │ ├── near-account-id v0.17.0
│ │ │ ├── borsh v0.10.3 (*)
│ │ ├── near-config-utils v0.17.0
│ │ ├── near-stdx v0.17.0
│ ├── near-primitives v0.17.0
│ │ ├── borsh v0.10.3 (*)
│ │ ├── near-crypto v0.17.0 (*)
│ │ ├── near-fmt v0.17.0
│ │ │ └── near-primitives-core v0.17.0
│ │ │ ├── borsh v0.10.3 (*)
│ │ │ ├── near-account-id v0.17.0 (*)
│ │ ├── near-primitives-core v0.17.0 (*)
│ │ ├── near-rpc-error-macro v0.17.0 (proc-macro)
│ │ ├── near-stdx v0.17.0
│ │ ├── near-vm-errors v0.17.0
│ │ │ ├── borsh v0.10.3 (*)
│ │ │ ├── near-account-id v0.17.0 (*)
│ │ │ ├── near-rpc-error-macro v0.17.0 (proc-macro) (*)
│ ├── near-primitives-core v0.17.0 (*)
│ ├── near-sdk-macros v4.1.1 (proc-macro)
│ ├── near-sys v0.2.0
│ ├── near-vm-logic v0.17.0
│ │ ├── borsh v0.10.3 (*)
│ │ ├── near-account-id v0.17.0 (*)
│ │ ├── near-crypto v0.17.0 (*)
│ │ ├── near-fmt v0.17.0 (*)
│ │ ├── near-o11y v0.17.0
│ │ │ ├── near-crypto v0.17.0 (*)
│ │ │ ├── near-primitives-core v0.17.0 (*)
│ │ ├── near-primitives v0.17.0 (*)
│ │ ├── near-primitives-core v0.17.0 (*)
│ │ ├── near-stdx v0.17.0
│ │ ├── near-vm-errors v0.17.0 (*)
│ │ └── zeropool-bn v0.5.11
│ │ ├── borsh v0.9.3 (*)
near-sdk v4.1.1 (*)
near-sdk-macros v4.1.1 (proc-macro) (*)
near-sys v0.2.0 as dependencies are alined as follows:
|
taking following sub-issue for resolution:
|
So the alpha is out and the API is mostly settled? I think I can allocate some time to take a look at what we've arrived at. No promises, so don't block on me, but I'll try to do API review before Monday! |
I hope so. |
Notes from review (haven't look at the code for a while, so take as a weak advice as most!): Line 30 in 1953864
You want Line 31 in 1953864
probably makes sense to just switch to hashbrown=0.14. Or maybe even completely get rid of it? There's probably some historical reason why we need it, but, fundamentally, we shouldn't be neededing. Lines 9 to 11 in 1953864
This should probably say something about nostd_io traits as that's the main unusual thing you get with no std borsh. https://github.com/near/borsh-rs/blob/master/borsh/src/lib.rs#L39 It's a bit surprising that that's not the default. Probably makes sense to explain why we need this feature:
Lines 49 to 55 in 1953864
This is implementation detail, so it shouldn't go into user-facing docs. Additionally, if having feature aliases is the only reason to have build.rs, I'd probably recomend removing those --- build.rs slows down compilation somewhat, because build script needs to get compiled, linked and run even before the crate could start compiling. Line 79 in 1953864
Line 96 in 1953864
Duplicate full stop. borsh-rs/borsh/src/schema_helpers.rs Lines 27 to 28 in 1953864
Could save an allocation of intermediate vector here. Line 48 in 1953864
Here and in structs, we don't actually enforce that names are unique. So potentially someone can hand-craft schemas with duplicate names and cause some mischief. Not sure if we need to worry about this. Similarly, we don't enforce that all declarations have corresponding definitions. Line 144 in 1953864
Feels like an odd method for a trait. It makes no sense to override this, so it probably should be a free-standing function somewhere. Also, I belive implementatin can be simplifid to
Line 162 in 1953864
Similarly how we add top-level Line 58 in 1953864
Given Line 151 in 1953864
we return InvalidData when trying to serialize too long slices. So we probably shold InvalidData here as well. Lines 281 to 285 in 1953864
I am not sure, but perhaps Rust is advanced enough that its possible to leveate this to a compile-time error via some const-fn trickery? Line 371 in 1953864
Similarly, might want to InvalidData rather than unwrap here? Line 390 in 1953864
this should be consistent with Vec wrt handling zero-sized types Line 82 in 1953864
does this want to be in the __private module perhaps? |
I've also noticed this one. I've skipped it so far for 2 reasons:
Edit: probably the best fix for this is restricting the bound on type |
taking this subissue
|
I marked the 1.0.0 as fixed in Rustsec: rustsec/advisory-db#1794 |
@matklad Could you, please, take one more last look here? We are about to cut 1.0.0! |
Sorry, was taking the previous week off of GitHub, but I trust you all to do a good job here! Thanks for persevering, 1.0 for borsh is quite important! |
It feels like the ecosystem is big enough that the last breaking release, 1.0 is due. I don't think the current APIs are good enough for 1.0 release though, so I expect we need at least one more
0.x
release with substantional breakage. This issue collects all know future-compatibility problems, but isn't intended to be full stabilization check-list just yet.schema
cargo feature and future-proof it's APIschema
cargo feature flag tounstable__schema
maybe_std
module#[doc(hidden)] pub __rt
#[doc(hidden)] pub __private
module with macro runtime for use by derivesderive
behind an optional feature-flagBorshDeserialize::try_from_slice
in favor ofborsh::from_slice
top-level function ( 😡 a lot of churn with this one)borsh(skip)
ratherbosh_skip
The text was updated successfully, but these errors were encountered: