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

chore: use near-abi 0.3.0 #954

Merged
merged 5 commits into from
Nov 4, 2022
Merged

chore: use near-abi 0.3.0 #954

merged 5 commits into from
Nov 4, 2022

Conversation

itegulov
Copy link
Contributor

@itegulov itegulov commented Nov 2, 2022

Comment on lines +93 to +94
&MethodType::Regular => {
quote! { near_sdk::__private::AbiFunctionKind::Call }
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's worth noting for clarity that until #890 is merged, the ABI will represent self-less functions as call functions. Meaning clients will think they have to send signed transactions and not simply making view calls. Then again, I don't have any stats on how often these are used or if at all, so it might be a trivial nit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, but that is also the current behavior, so doesn't have to do anything with this particular change.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep!

examples/adder/Cargo.toml Outdated Show resolved Hide resolved
assert_eq!(args[1].name, "b".to_string());
}
AbiParameters::Borsh { .. } => {
assert!(false);
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, it is not actually unreachable if the thing we are trying to test happens to have borsh serialization though

Copy link
Contributor

@miraclx miraclx Nov 2, 2022

Choose a reason for hiding this comment

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

Hm, but isn't that the point of the test? Asserting that it is JSON serialized and not borsh? (at least in this case)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, but unreacheable! to me is something you know (statically) will never be reached, but can't convince compiler to be the case. This test, on the other hand, depends on some external input (a wasm file) and tests its properties.

This is arguing very subtle semantics and honestly it feels like AbiParameters should just have json()? and borsh()? methods instead of this match/fail pattern.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's fair, wasn't a strong opinion. I'm not sure if we're at the point where we need those helper methods, so we can proceed as-is. 👍🏽

Copy link
Contributor

Choose a reason for hiding this comment

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

In that case, still seems like panic!() might be more readable?

@itegulov itegulov merged commit 83b58f2 into master Nov 4, 2022
@itegulov itegulov deleted the daniyar/abi-0.3.0 branch November 4, 2022 00:06
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.

4 participants