Skip to content

Impl 0ary hostfns#2694

Merged
cmichi merged 30 commits intouse-ink:masterfrom
LucasGrasso:impl_0ary_hostfns
Nov 6, 2025
Merged

Impl 0ary hostfns#2694
cmichi merged 30 commits intouse-ink:masterfrom
LucasGrasso:impl_0ary_hostfns

Conversation

@LucasGrasso
Copy link
Copy Markdown
Contributor

@LucasGrasso LucasGrasso commented Oct 29, 2025

Summary

Partially addresses #2653

  • [n] y/n | Does it introduce breaking changes?
  • [n] y/n | Is it dependent on a specific version of cargo-contract or pallet-revive?

Description

Implements the following host fns

  • fn gas_price() -> u64
  • fn call_data_size() -> u64
  • fn return_data_size() -> u64
  • fn ref_time_left() -> u64

@LucasGrasso LucasGrasso marked this pull request as ready for review October 29, 2025 03:50
@cmichi
Copy link
Copy Markdown
Collaborator

cmichi commented Oct 29, 2025

@LucasGrasso If you check the diff of this PR something is strange (see e.g. the changes to CHANGELOG.md). Maybe you need to update the master branch of your fork and then merge master into your branch.

@LucasGrasso
Copy link
Copy Markdown
Contributor Author

@cmichi I think its ok now, my IDE autoformatted the changelog file, so I just copied and pasted the one in use-ink/ink/master.

Copy link
Copy Markdown
Collaborator

@davidsemakula davidsemakula left a comment

Choose a reason for hiding this comment

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

Thanks @LucasGrasso
A few notes/comments, but I'll let @cmichi have the last word.

Edit: Also, you can ignore the CI failure for the examples-test (2) job, it's unrelated to your changes.

Comment thread crates/env/src/api.rs Outdated
Comment thread crates/env/src/backend.rs Outdated
Comment thread crates/env/src/engine/off_chain/impls.rs Outdated
Comment thread crates/env/src/engine/on_chain/pallet_revive.rs Outdated
Comment thread crates/env/src/engine/on_chain/pallet_revive.rs
@LucasGrasso
Copy link
Copy Markdown
Contributor Author

@davidsemakula Thanks for your comments, implemented the changes you mentioned, they made sense to me. Can rollback if you want tho.

Copy link
Copy Markdown
Collaborator

@davidsemakula davidsemakula left a comment

Choose a reason for hiding this comment

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

@LucasGrasso RE: #2694 (comment)
Added as a suggestion for clarity 🙂

Comment thread crates/env/src/engine/on_chain/pallet_revive.rs Outdated
Co-authored-by: David Semakula <davidsemakula@users.noreply.github.com>
Copy link
Copy Markdown
Collaborator

@cmichi cmichi left a comment

Choose a reason for hiding this comment

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

I've left soft changes to the comments. Can you adapt the example contract + other functions to the same changes?

Comment thread crates/env/src/api.rs Outdated
Comment thread crates/env/src/api.rs Outdated
Comment thread crates/env/src/api.rs Outdated
@LucasGrasso
Copy link
Copy Markdown
Contributor Author

@cmichi done, added evm opcodes and modified comments of functions related to this pr and gas_limit.

@LucasGrasso LucasGrasso requested a review from cmichi November 4, 2025 19:21
Copy link
Copy Markdown
Collaborator

@cmichi cmichi left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Looks good besides the nits.

After applying them you'll most likely have to run cargo fmt locally, as the length of the line will be too long.

Use

cd ink/
fd Cargo.toml | xargs -n1 -I{} bash -c "echo {}; cargo +nightly fmt --manifest-path={}"  

to apply it through the codebase and all examples (which are not in the workspace).

Comment thread crates/env/src/api.rs Outdated
Comment thread crates/env/src/api.rs Outdated
Comment thread crates/env/src/backend.rs Outdated
Comment thread crates/env/src/backend.rs Outdated
Comment thread crates/env/src/backend.rs Outdated
Comment thread crates/ink/src/env_access.rs Outdated
Comment thread crates/ink/src/env_access.rs Outdated
Comment thread crates/ink/src/env_access.rs Outdated
Co-authored-by: Michael Müller <mich@elmueller.net>
@LucasGrasso
Copy link
Copy Markdown
Contributor Author

LucasGrasso commented Nov 6, 2025

Thanks for your help!

After applying them you'll most likely have to run cargo fmt locally, as the length of the line will be too long.

Applied suggestions and no further formatting changes where needed after running the script locally

@cmichi cmichi merged commit 3139b74 into use-ink:master Nov 6, 2025
26 of 27 checks passed
@LucasGrasso LucasGrasso deleted the impl_0ary_hostfns branch November 7, 2025 01:05
@cmichi cmichi mentioned this pull request Nov 13, 2025
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