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

revive: Fix compilation of uapi crate when unstable-hostfn is not set #7318

Merged
merged 3 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/build-misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,34 @@ jobs:
app-id: ${{ secrets.WORKFLOW_STOPPER_RUNNER_APP_ID }}
app-key: ${{ secrets.WORKFLOW_STOPPER_RUNNER_APP_KEY }}

# As part of our test fixtures we build the revive-uapi crate always with the `unstable-hostfn` feature.
# To make sure that it won't break for users downstream which are not setting this feature
# It doesn't need to produce working code so we just use a similar enough RISC-V target
check-revive-stable-uapi-polkavm:
timeout-minutes: 30
needs: [preflight]
runs-on: ${{ needs.preflight.outputs.RUNNER }}
container:
image: ${{ needs.preflight.outputs.IMAGE }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Check Rust
run: |
rustup show
rustup +nightly show

- name: Build
id: required
run: forklift cargo +nightly check -p pallet-revive-uapi --no-default-features --target riscv64imac-unknown-none-elf -Zbuild-std=core
- name: Stop all workflows if failed
if: ${{ failure() && steps.required.conclusion == 'failure' && !github.event.pull_request.head.repo.fork }}
uses: ./.github/actions/workflow-stopper
with:
app-id: ${{ secrets.WORKFLOW_STOPPER_RUNNER_APP_ID }}
app-key: ${{ secrets.WORKFLOW_STOPPER_RUNNER_APP_KEY }}

build-subkey:
timeout-minutes: 20
needs: [preflight]
Expand Down
8 changes: 8 additions & 0 deletions prdoc/pr_7318.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
title: 'revive: Fix compilation of `uapi` crate when `unstable-hostfn` is not set'
doc:
- audience: Runtime Dev
description: This regression was introduced with some of the recent PRs. Regression
fixed and test added.
crates:
- name: pallet-revive-uapi
bump: minor
26 changes: 13 additions & 13 deletions substrate/frame/revive/uapi/src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,18 +144,6 @@ pub trait HostFn: private::Sealed {
/// - `output`: A reference to the output data buffer to write the origin's address.
fn origin(output: &mut [u8; 20]);

/// Retrieve the account id for a specified address.
///
/// # Parameters
///
/// - `addr`: A `H160` address.
/// - `output`: A reference to the output data buffer to write the account id.
///
/// # Note
///
/// If no mapping exists for `addr`, the fallback account id will be returned.
fn to_account_id(addr: &[u8; 20], output: &mut [u8]);

/// Retrieve the code hash for a specified contract address.
///
/// # Parameters
Expand Down Expand Up @@ -415,9 +403,21 @@ pub trait HostFn: private::Sealed {
/// # Parameters
///
/// - `output`: A reference to the output data buffer to write the block number.
#[unstable_hostfn]
fn block_number(output: &mut [u8; 32]);

/// Retrieve the account id for a specified address.
///
/// # Parameters
///
/// - `addr`: A `H160` address.
/// - `output`: A reference to the output data buffer to write the account id.
///
/// # Note
///
/// If no mapping exists for `addr`, the fallback account id will be returned.
#[unstable_hostfn]
fn to_account_id(addr: &[u8; 20], output: &mut [u8]);

/// Stores the block hash of the given block number into the supplied buffer.
///
/// # Parameters
Expand Down
Loading