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

extract ABI primitives into near-abi-rs #889

Merged
merged 18 commits into from
Aug 24, 2022
Merged

Conversation

miraclx
Copy link
Contributor

@miraclx miraclx commented Aug 16, 2022

near-sdk/src/lib.rs Outdated Show resolved Hide resolved
@miraclx miraclx mentioned this pull request Aug 21, 2022
Copy link
Contributor

@itegulov itegulov left a comment

Choose a reason for hiding this comment

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

A couple of nitpicks, looks good otherwise. Thanks for cleaning up the visitor pattern. That was originally written when we considered applying the ABI macro to mod sections instead of impl sections.

near-sdk-macros/src/core_impl/abi.rs Outdated Show resolved Hide resolved
near-sdk-macros/src/core_impl/abi.rs Outdated Show resolved Hide resolved
near-sdk-macros/src/core_impl/mod.rs Outdated Show resolved Hide resolved
Comment on lines 35 to 39
[dependencies.near-abi]
git = "https://github.com/near/near-abi-rs"
branch = "miraclx/init"
features = ["__chunked-entries"]
optional = true
Copy link
Contributor

Choose a reason for hiding this comment

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

Everything seems fine, just want to make sure this doesn't come in until it points at a release (so blocked on near/near-abi-rs#1)

examples/abi/Cargo.lock Outdated Show resolved Hide resolved
/// ```
/// will produce this struct:
/// ```ignore
/// near_sdk::__private::AbiFunction {
/// name: "f3".to_string(),
/// doc: Some(" I am a function.".to_string()),
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious why the initial space isn't removed from these comments. I know unrelated, just wondering if an issue should be opened up. cc @itegulov

Copy link
Contributor

Choose a reason for hiding this comment

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

The initial space comes from here:

/// I am a function
   ^

I left all original indentation intentionally as it is not clear on what exactly should be deleted. schemars actually tried doing some heuristics here, but they later realized that it does not suit all use cases and can even mess up markdown (see GREsau/schemars#38 (comment)). Specifically, here trimming all lines can mess with code indentation in ``` blocks. So I feel like post-processing should be left to the user depending on their use case as it is easy to remove unwanted stuff but impossible to deduce what stuff has already been removed by us.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, my assumption would be that just the first space would be trimmed, don't have opinions of any other line. Seems like that first space will always exist and might be a strange side-effect for those consuming it. Not blocking

Copy link
Contributor

@itegulov itegulov Aug 23, 2022

Choose a reason for hiding this comment

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

Hmm, I guess that is fair. I assumed that since Rust keeps this leading space when passing it to macros, you could technically do ///this is doc, but yeah I would not be opposed to trimming it.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll just open an issue, and we can do it in a separate PR or close it if we don't want to do it. Super minor and opinionated

near-sdk/src/private/mod.rs Outdated Show resolved Hide resolved
@itegulov
Copy link
Contributor

@austinabell anything blocking from your side? The near-abi dependency now points to a git rev which should be good enough IMO

@austinabell
Copy link
Contributor

@austinabell anything blocking from your side? The near-abi dependency now points to a git rev which should be good enough IMO

I can't do another pre-release until this points to a released version. We can do this in two-steps, where the SDK is left in an intermediate stage, or just release it and point to that (even if a pre-release). I'll leave that call to @miraclx

@miraclx
Copy link
Contributor Author

miraclx commented Aug 24, 2022

Yeah, work on this PR is pretty much done. We can merge this right away and then wait for abi-rs to be published before we make a pre-release. Although, it's not my place to say how many revisions abi-rs will go through before it gets to that point.

@miraclx miraclx merged commit 0d4a4ac into master Aug 24, 2022
@miraclx miraclx deleted the miraclx/extract-lib-abi branch August 24, 2022 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants