Skip to content

Implement missing host functions #2653

@cmichi

Description

@cmichi

pallet-revive has added a number of host functions that we don't support in ink! yet. I've just compiled the list and am creating this tracking issue for them.

  • fn get_immutable_data(output: &mut &mut [u8]);
  • fn set_immutable_data(data: &[u8]);
  • fn balance_of(addr: &[u8; 20], output: &mut [u8; 32]);
  • fn chain_id(output: &mut [u8; 32]);
  • fn gas_price() -> u64;
  • fn base_fee(output: &mut [u8; 32]);
  • fn call_data_size() -> u64;
  • fn origin(output: &mut [u8; 20]);
  • fn code_size(addr: &[u8; 20]) -> u64;
  • fn call_data_load(output: &mut [u8; 32], offset: u32);
  • fn gas_limit() -> u64;
  • fn set_storage_or_clear(flags: StorageFlags, key: &[u8; 32], value: &[u8; 32]) -> Option<u32>;
  • fn get_storage_or_zero(flags: StorageFlags, key: &[u8; 32], output: &mut [u8; 32]);
  • fn return_data_size() -> u64;
  • fn return_data_copy(output: &mut &mut [u8], offset: u32);
  • fn ref_time_left() -> u64;
  • fn block_author(output: &mut [u8; 20]);
  • fn block_hash(block_number: &[u8; 32], output: &mut [u8; 32]);

Having the host functions supported is not a requirement for an ink! v6 release. Some are easy to implement, while others (e.g. immutable data) require more thought about the design.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-eDSLConcerning the Rust eDSL as a total.A-examples[examples] Work itemA-ink_env[ink_env] work itemA-ink_lang[ink_lang] Work itemB-enhancementNew feature or requestE-mentor-availableA mentor for this issue is available

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions