Skip to content

Conversation

@mitinarseny
Copy link
Contributor

This PR relaxes owned Strings requirements and lets you pass &str as function_call name(s), too:

Promise::new(account_id)
    .function_call("method", /* ... */)

@github-project-automation github-project-automation bot moved this to NEW❗ in DevTools Nov 18, 2025
@mitinarseny mitinarseny marked this pull request as ready for review November 18, 2025 01:22
@codecov
Copy link

codecov bot commented Nov 18, 2025

Codecov Report

❌ Patch coverage is 50.00000% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.52%. Comparing base (dc041fa) to head (a86bdad).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
near-sdk/src/promise.rs 50.00% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1404      +/-   ##
==========================================
- Coverage   80.62%   80.52%   -0.11%     
==========================================
  Files         107      107              
  Lines       15583    15591       +8     
==========================================
- Hits        12564    12554      -10     
- Misses       3019     3037      +18     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@akorchyn
Copy link
Collaborator

The only issue that I can envision with that is that allowing static polymorphism, users potentially enlarge their binary by creating method duplicates if they use several variations.

Copy link
Collaborator

@akorchyn akorchyn left a comment

Choose a reason for hiding this comment

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

LGTM

@akorchyn
Copy link
Collaborator

@race-of-sloths score 3

@race-of-sloths
Copy link

race-of-sloths commented Nov 18, 2025

@mitinarseny Thank you for your contribution! Your pull request is now a part of the Race of Sloths!
Weekly streak is on the road, smart strategy! Secure your streak with another PR!

Shows inviting banner with latest news.

Shows profile picture for the author of the PR

Current status: executed
Reviewer Score
@akorchyn 3

Your contribution is much appreciated with a final score of 3!
You have received 30 Sloth points for this contribution

@akorchyn received 25 Sloth Points for reviewing and scoring this pull request.

What is the Race of Sloths

Race of Sloths is a friendly competition where you can participate in challenges and compete with other open-source contributors within your normal workflow

For contributors:

  • Tag @race-of-sloths inside your pull requests
  • Wait for the maintainer to review and score your pull request
  • Check out your position in the Leaderboard
  • Keep weekly and monthly streaks to reach higher positions
  • Boast your contributions with a dynamic picture of your Profile

For maintainers:

  • Score pull requests that participate in the Race of Sloths and receive a reward
  • Engage contributors with fair scoring and fast responses so they keep their streaks
  • Promote the Race to the point where the Race starts promoting you
  • Grow the community of your contributors

Feel free to check our website for additional details!

Bot commands
  • For contributors
    • Include a PR: @race-of-sloths include to enter the Race with your PR
  • For maintainers:
    • Invite contributor @race-of-sloths invite to invite the contributor to participate in a race or include it, if it's already a runner.
    • Assign points: @race-of-sloths score [1/2/3/5/8/13] to award points based on your assessment.
    • Reject this PR: @race-of-sloths exclude to send this PR back to the drawing board.
    • Exclude repo: @race-of-sloths pause to stop bot activity in this repo until @race-of-sloths unpause command is called

@mitinarseny
Copy link
Contributor Author

mitinarseny commented Nov 18, 2025

The only issue that I can envision with that is that allowing static polymorphism, users potentially enlarge their binary by creating method duplicates if they use several variations.

@akorchyn What if hint the compiler and add #[inline] for these methods?

@akorchyn
Copy link
Collaborator

/compare

@akorchyn
Copy link
Collaborator

@mitinarseny I don't think that it's a big deal for now. I just saw a trend in a few latest Pull Requests with impl X in functions, and just wanted to raise that there is a trade-off in doing that

@mitinarseny
Copy link
Contributor Author

mitinarseny commented Nov 18, 2025

@akorchyn Sure, but if the developer wants the contract to be optimized in size, then he better switch to #![no_sdt] and avoid using near-sdk at all, since it currently adds more than 10x in size, anyway. This is the same with non-contract development: you can write low-level assembly if you really need that performance/size optimizations, which comes as trade-off for readability/maintenance burden. So, being an SDK, we need to make it as dev-friendly as possible IMO.

PS: the developer can still optimize out all template instantiations by using the same argument type everywhere.

@akorchyn akorchyn merged commit fdfa88d into near:master Nov 18, 2025
43 of 44 checks passed
@github-project-automation github-project-automation bot moved this from NEW❗ to Shipped 🚀 in DevTools Nov 18, 2025
@frol frol mentioned this pull request Nov 11, 2025
@github-actions
Copy link

Contract size report

Sizes are given in bytes.

contract master this branch difference
adder.wasm 68906 68906 +0%
approval_receiver.wasm 85273 85273 +0%
callback_results.wasm 83650 83650 +0%
cross_contract_high_level.wasm 73087 73087 +0%
cross_contract_low_level.wasm 67378 67378 +0%
defi.wasm 88852 88852 +0%
factory_contract_high_level.wasm 163616 163612 -0%
factory_contract_low_level.wasm 157620 157620 +0%
fungible_token.wasm 145240 145240 +0%
lockable_fungible_token.wasm 107018 107018 +0%
mission_control.wasm 108323 108323 +0%
mpc_contract.wasm 101053 101053 +0%
non_fungible_token.wasm 199454 199454 +0%
status_message.wasm 81756 81756 +0%
test_contract.wasm 20490 20490 +0%
token_receiver.wasm 85083 85083 +0%
versioned.wasm 89486 89486 +0%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Shipped 🚀

Development

Successfully merging this pull request may close these issues.

3 participants