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

ABI embedding #893

Merged
merged 47 commits into from
Aug 29, 2022
Merged
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
476ba43
extract ABI primitives into near-abi-rs
miraclx Aug 16, 2022
fca3a04
move schemars back to private
miraclx Aug 17, 2022
5954374
fix ci
miraclx Aug 17, 2022
4baa8bb
implement ABI embedding
miraclx Aug 21, 2022
f0e38f8
ignore abi test
miraclx Aug 21, 2022
7404cb1
separate abi-generate and abi-embed features
miraclx Aug 22, 2022
b833048
hide the abi-embed and abi-generate features
miraclx Aug 22, 2022
c9193de
apply suggestions
miraclx Aug 22, 2022
d67e591
update near-abi
miraclx Aug 22, 2022
6cdbd3f
Merge branch 'miraclx/extract-lib-abi' into miraclx/abi-embed
miraclx Aug 22, 2022
6628015
update lockfile
miraclx Aug 22, 2022
c521ee6
Merge branch 'miraclx/extract-lib-abi' into miraclx/abi-embed
miraclx Aug 22, 2022
0f85589
remove the feature flag
miraclx Aug 22, 2022
1ddcbc8
use the version of schemars that's privately exported from near-abi
miraclx Aug 22, 2022
ec2b378
limit the visibility of abi macro helpers
miraclx Aug 22, 2022
c9d7c80
Merge branch 'miraclx/extract-lib-abi' into miraclx/abi-embed
miraclx Aug 22, 2022
9670596
Merge branch 'master' into miraclx/extract-lib-abi
miraclx Aug 23, 2022
4720b28
update near-abi-rs
miraclx Aug 23, 2022
f08954c
Merge branch 'miraclx/extract-lib-abi' into miraclx/abi-embed
miraclx Aug 23, 2022
298e48a
update near-abi
miraclx Aug 23, 2022
794c491
Merge branch 'miraclx/extract-lib-abi' into miraclx/abi-embed
miraclx Aug 23, 2022
2b3a8a0
update near-abi
miraclx Aug 23, 2022
6eb3ead
Merge branch 'miraclx/extract-lib-abi' into miraclx/abi-embed
miraclx Aug 23, 2022
1d0f9b3
update near-abi
miraclx Aug 23, 2022
49d521c
revert 1ddcbc8
miraclx Aug 23, 2022
52c6158
Merge branch 'miraclx/extract-lib-abi' into miraclx/abi-embed
miraclx Aug 23, 2022
2a6db19
update near-abi dependency
miraclx Aug 23, 2022
06129d4
Merge branch 'miraclx/extract-lib-abi' into miraclx/abi-embed
miraclx Aug 23, 2022
e759423
modular import granularity
miraclx Aug 23, 2022
20570b4
Merge branch 'miraclx/extract-lib-abi' into miraclx/abi-embed
miraclx Aug 23, 2022
c0ddc89
Merge branch 'master' into miraclx/extract-lib-abi
miraclx Aug 24, 2022
01985b8
Merge branch 'miraclx/extract-lib-abi' into miraclx/abi-embed
miraclx Aug 24, 2022
ff45f49
specify an abi revision
miraclx Aug 24, 2022
2e28d57
Merge branch 'miraclx/extract-lib-abi' into miraclx/abi-embed
miraclx Aug 24, 2022
6e1adcf
specify an abi revision
miraclx Aug 24, 2022
4f7b6ba
update example dependency on abi
miraclx Aug 24, 2022
bc7b0e7
Merge branch 'miraclx/extract-lib-abi' into miraclx/abi-embed
miraclx Aug 24, 2022
e3d8378
refactor injected code according to suggestions
miraclx Aug 24, 2022
2a442be
treat the __contract_abi as a reserved method identifier
miraclx Aug 24, 2022
3e55eac
Merge branch 'master' into miraclx/abi-embed
miraclx Aug 24, 2022
5054d11
update near-abi
miraclx Aug 25, 2022
9a91441
Merge branch 'update-abi' into miraclx/abi-embed
miraclx Aug 25, 2022
dec7029
update near-abi
miraclx Aug 25, 2022
97a0d01
point to published version
miraclx Aug 25, 2022
b75d88d
Merge branch 'update-abi' into miraclx/abi-embed
miraclx Aug 25, 2022
1f9a7b2
Merge branch 'master' into miraclx/abi-embed
miraclx Aug 25, 2022
03bab8d
Merge branch 'master' into miraclx/abi-embed
miraclx Aug 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion near-sdk-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use proc_macro::TokenStream;

use self::core_impl::*;
use proc_macro2::Span;
use quote::quote;
use quote::{quote, ToTokens};
use syn::visit::Visit;
use syn::{File, ItemEnum, ItemImpl, ItemStruct, ItemTrait};

Expand Down Expand Up @@ -80,6 +80,18 @@ pub fn near_bindgen(_attr: TokenStream, item: TokenStream) -> TokenStream {
#[cfg(feature = "__abi-generate")]
let abi_generated = abi::generate(&item_impl_info);

for method in &item_impl_info.methods {
if method.attr_signature_info.ident == "__contract_abi" {
return TokenStream::from(
syn::Error::new_spanned(
method.attr_signature_info.original_sig.ident.to_token_stream(),
"use of reserved contract method",
)
.to_compile_error(),
);
}
}
Copy link
Contributor

@itegulov itegulov Aug 24, 2022

Choose a reason for hiding this comment

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

Looks good, but just noting that this would technically be a breaking change. Probably not big enough deal to warrant going into 5.x though.


let generated_code = item_impl_info.wrapper_code();

// Add wrapper methods for ext call API
Expand Down