-
Notifications
You must be signed in to change notification settings - Fork 726
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into donal-auto-renew-benchmarks
- Loading branch information
Showing
21 changed files
with
882 additions
and
587 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,7 +74,7 @@ jobs: | |
- name: install parity-publish | ||
# Set the target dir to cache the build. | ||
run: CARGO_TARGET_DIR=./target/ cargo install [email protected].2 --locked -q | ||
run: CARGO_TARGET_DIR=./target/ cargo install [email protected].3 --locked -q | ||
|
||
- name: check semver | ||
run: | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ jobs: | |
cache-on-failure: true | ||
|
||
- name: install parity-publish | ||
run: cargo install [email protected].2 --locked -q | ||
run: cargo install [email protected].3 --locked -q | ||
|
||
- name: parity-publish update plan | ||
run: parity-publish --color always plan --skip-check --prdoc prdoc/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ jobs: | |
cache-on-failure: true | ||
|
||
- name: install parity-publish | ||
run: cargo install [email protected].2 --locked -q | ||
run: cargo install [email protected].3 --locked -q | ||
|
||
- name: parity-publish check | ||
run: parity-publish --color always check --allow-unpublished |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ jobs: | |
cache-on-failure: true | ||
|
||
- name: install parity-publish | ||
run: cargo install [email protected].2 --locked -q | ||
run: cargo install [email protected].3 --locked -q | ||
|
||
- name: parity-publish claim | ||
env: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
title: 'pallet-revive: Statically verify imports on code deployment' | ||
doc: | ||
- audience: Runtime Dev | ||
description: |- | ||
Previously, we failed at runtime if an unknown or unstable host function was called. This requires us to keep track of when a host function was added and when a code was deployed. We used the `api_version` to track at which API version each code was deployed. This made sure that when a new host function was added that old code won't have access to it. This is necessary as otherwise the behavior of a contract that made calls to this previously non existent host function would change from "trap" to "do something". | ||
|
||
In this PR we remove the API version. Instead, we statically verify on upload that no non-existent host function is ever used in the code. This will allow us to add new host function later without needing to keep track when they were added. | ||
|
||
This simplifies the code and also gives an immediate feedback if unknown host functions are used. | ||
crates: | ||
- name: pallet-revive-proc-macro | ||
bump: major | ||
- name: pallet-revive | ||
bump: major | ||
- name: pallet-revive-fixtures | ||
bump: major |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
title: '[pallet-revive] implement the call data load API' | ||
doc: | ||
- audience: Runtime Dev | ||
description: |- | ||
This PR implements the call data load API akin to [how it works on ethereum](https://www.evm.codes/?fork=cancun#35). | ||
crates: | ||
- name: pallet-revive-fixtures | ||
bump: minor | ||
- name: pallet-revive | ||
bump: minor | ||
- name: pallet-revive-uapi | ||
bump: minor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
substrate/frame/revive/fixtures/contracts/call_data_load.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// This file is part of Substrate. | ||
|
||
// Copyright (C) Parity Technologies (UK) Ltd. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
//! This uses the call data load API to first the first input byte. | ||
//! This single input byte is used as the offset for a second call | ||
//! to the call data load API. | ||
//! The output of the second API call is returned. | ||
#![no_std] | ||
#![no_main] | ||
|
||
extern crate common; | ||
use uapi::{HostFn, HostFnImpl as api, ReturnFlags}; | ||
|
||
#[no_mangle] | ||
#[polkavm_derive::polkavm_export] | ||
pub extern "C" fn deploy() {} | ||
|
||
#[no_mangle] | ||
#[polkavm_derive::polkavm_export] | ||
pub extern "C" fn call() { | ||
let mut buf = [0; 32]; | ||
api::call_data_load(&mut buf, 0); | ||
|
||
let offset = buf[31] as u32; | ||
let mut buf = [0; 32]; | ||
api::call_data_load(&mut buf, offset); | ||
|
||
api::return_value(ReturnFlags::empty(), &buf); | ||
} |
44 changes: 44 additions & 0 deletions
44
substrate/frame/revive/fixtures/contracts/unknown_syscall.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// This file is part of Substrate. | ||
|
||
// Copyright (C) Parity Technologies (UK) Ltd. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
#![no_std] | ||
#![no_main] | ||
|
||
extern crate common; | ||
|
||
#[polkavm_derive::polkavm_import] | ||
extern "C" { | ||
pub fn __this_syscall_does_not_exist__(); | ||
} | ||
|
||
// Export that is never called. We can put code here that should be in the binary | ||
// but is never supposed to be run. | ||
#[no_mangle] | ||
#[polkavm_derive::polkavm_export] | ||
pub extern "C" fn call_never() { | ||
// make sure it is not optimized away | ||
unsafe { | ||
__this_syscall_does_not_exist__(); | ||
} | ||
} | ||
|
||
#[no_mangle] | ||
#[polkavm_derive::polkavm_export] | ||
pub extern "C" fn deploy() {} | ||
|
||
#[no_mangle] | ||
#[polkavm_derive::polkavm_export] | ||
pub extern "C" fn call() {} |
44 changes: 44 additions & 0 deletions
44
substrate/frame/revive/fixtures/contracts/unstable_interface.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// This file is part of Substrate. | ||
|
||
// Copyright (C) Parity Technologies (UK) Ltd. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
#![no_std] | ||
#![no_main] | ||
|
||
extern crate common; | ||
|
||
#[polkavm_derive::polkavm_import] | ||
extern "C" { | ||
pub fn set_code_hash(); | ||
} | ||
|
||
// Export that is never called. We can put code here that should be in the binary | ||
// but is never supposed to be run. | ||
#[no_mangle] | ||
#[polkavm_derive::polkavm_export] | ||
pub extern "C" fn call_never() { | ||
// make sure it is not optimized away | ||
unsafe { | ||
set_code_hash(); | ||
} | ||
} | ||
|
||
#[no_mangle] | ||
#[polkavm_derive::polkavm_export] | ||
pub extern "C" fn deploy() {} | ||
|
||
#[no_mangle] | ||
#[polkavm_derive::polkavm_export] | ||
pub extern "C" fn call() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.