Skip to content

Conversation

@LucasGrasso
Copy link
Contributor

@LucasGrasso LucasGrasso commented Nov 9, 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 chain_id(output: &mut [u8; 32]);
  • fn balance_of(addr: &[u8; 20], output: &mut [u8; 32]);
  • fn base_fee(output: &mut [u8; 32]);
  • fn origin(output: &mut [u8; 20]);
  • fn code_size(addr: &[u8; 20]) -> u64;
  • fn block_hash(block_number: &[u8; 32], output: &mut [u8; 32]);
  • fn block_author(output: &mut [u8; 20]);

@LucasGrasso LucasGrasso changed the title Implement getters akin to EVM opcodes and block_author hostfns Implement getters akin to EVM opcodes Nov 9, 2025
@LucasGrasso LucasGrasso marked this pull request as ready for review November 9, 2025 23:52
@LucasGrasso
Copy link
Contributor Author

One question related to #2597. Should balance_of return Balance or U256? I've left it as U256 following the implementation of value_transferred().

@cmichi
Copy link
Collaborator

cmichi commented Nov 11, 2025

@LucasGrasso As an FYI, I've changed the ink GHA setting for running the CI from

Require approval for all external contributors

to

Require approval for first-time contributors

So you no longer need someone to approve your runs.

@LucasGrasso
Copy link
Contributor Author

LucasGrasso commented Nov 11, 2025

So you no longer need someone to approve your runs.

Excellent, That was a bugger.
Fixed the error now, my bad it took to long to realize that the issue was actually in the comment.

@Daanvdplas
Copy link
Contributor

He @0xLucca would you be interested to rebase on master so that we can finish this PR?

@Daanvdplas
Copy link
Contributor

@cmichi can you help finishing this PR?

Copy link
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.

Very nice!
See comment about BlockNumber type

Copy link
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
You just need to make rustfmt happy to make this ready to merge.

@LucasGrasso
Copy link
Contributor Author

Ran rustfmt. Thanks @davidsemakula for the review!

Copy link
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.

Thank you, Lucas!

@LucasGrasso
Copy link
Contributor Author

All set, thanks to all for your help!

@davidsemakula davidsemakula merged commit 000aecf into use-ink:master Nov 25, 2025
37 checks passed
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