mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-06-14 20:21:07 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 454108d1f1 | |||
| 698e4c7812 |
+1
-1
@@ -66,7 +66,7 @@ log = { version = "0.4" }
|
|||||||
# polkadot-sdk and friends
|
# polkadot-sdk and friends
|
||||||
codec = { version = "3.6.12", default-features = false, package = "parity-scale-codec" }
|
codec = { version = "3.6.12", default-features = false, package = "parity-scale-codec" }
|
||||||
scale-info = { version = "2.11.1", default-features = false }
|
scale-info = { version = "2.11.1", default-features = false }
|
||||||
polkadot-sdk = { git = "https://github.com/paritytech/polkadot-sdk", rev = "d7b575338b2c647e04fc48bfbe00ea8f492fb580" }
|
polkadot-sdk = { git = "https://github.com/paritytech/polkadot-sdk", branch = "pg/repro" }
|
||||||
|
|
||||||
# llvm
|
# llvm
|
||||||
[workspace.dependencies.inkwell]
|
[workspace.dependencies.inkwell]
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Use this template for reporting issues
|
||||||
|
title: ''
|
||||||
|
labels: bug
|
||||||
|
assignees: ''
|
||||||
|
---
|
||||||
|
|
||||||
|
### 🐛 Bug Report
|
||||||
|
|
||||||
|
#### 📝 Description
|
||||||
|
|
||||||
|
Provide a clear and concise description of the bug.
|
||||||
|
|
||||||
|
#### 🔄 Reproduction Steps
|
||||||
|
|
||||||
|
Steps to reproduce the behaviour
|
||||||
|
|
||||||
|
#### 🤔 Expected Behavior
|
||||||
|
|
||||||
|
Describe what you expected to happen.
|
||||||
|
|
||||||
|
#### 😯 Current Behavior
|
||||||
|
|
||||||
|
Describe what actually happened.
|
||||||
|
|
||||||
|
#### 🖥️ Environment
|
||||||
|
|
||||||
|
Any relevant environment details.
|
||||||
|
|
||||||
|
#### 📋 Additional Context
|
||||||
|
|
||||||
|
Add any other context about the problem here. If applicable, add screenshots to help explain.
|
||||||
|
|
||||||
|
#### 📎 Log Output
|
||||||
|
|
||||||
|
```
|
||||||
|
Paste any relevant log output here.
|
||||||
|
```
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Use this template for requesting features
|
||||||
|
title: ''
|
||||||
|
labels: feat
|
||||||
|
assignees: ''
|
||||||
|
---
|
||||||
|
|
||||||
|
### 🌟 Feature Request
|
||||||
|
|
||||||
|
#### 📝 Description
|
||||||
|
|
||||||
|
Provide a clear and concise description of the feature you'd like to see.
|
||||||
|
|
||||||
|
#### 🤔 Rationale
|
||||||
|
|
||||||
|
Explain why this feature is important and how it benefits the project.
|
||||||
|
|
||||||
|
#### 📋 Additional Context
|
||||||
|
|
||||||
|
Add any other context or information about the feature request here.
|
||||||
+20
@@ -0,0 +1,20 @@
|
|||||||
|
# What ❔
|
||||||
|
|
||||||
|
<!-- What are the changes this PR brings about? -->
|
||||||
|
<!-- Example: This PR adds a PR template to the repo. -->
|
||||||
|
<!-- (For bigger PRs adding more context is appreciated) -->
|
||||||
|
|
||||||
|
## Why ❔
|
||||||
|
|
||||||
|
<!-- Why are these changes done? What goal do they contribute to? What are the principles behind them? -->
|
||||||
|
<!-- Example: PR templates ensure PR reviewers, observers, and future iterators are in context about the evolution of repos. -->
|
||||||
|
|
||||||
|
## Checklist
|
||||||
|
|
||||||
|
<!-- Check your PR fulfills the following items. -->
|
||||||
|
<!-- For draft PRs check the boxes as you complete them. -->
|
||||||
|
|
||||||
|
- [ ] PR title corresponds to the body of PR.
|
||||||
|
- [ ] Tests for the changes have been added / updated.
|
||||||
|
- [ ] Documentation comments have been added / updated.
|
||||||
|
- [ ] Code has been formatted via `cargo fmt` and checked with `cargo clippy`.
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
name: Cargo license check
|
||||||
|
on: pull_request
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
cargo-deny:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: EmbarkStudios/cargo-deny-action@v1
|
||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
name: "Rust CI"
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: cargo build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
- run: cargo build --verbose
|
||||||
|
|
||||||
|
formatting:
|
||||||
|
name: cargo fmt
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
with:
|
||||||
|
components: rustfmt
|
||||||
|
- name: Rustfmt Check
|
||||||
|
uses: actions-rust-lang/rustfmt@v1
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
name: Leaked Secrets Scan
|
||||||
|
on: [pull_request]
|
||||||
|
jobs:
|
||||||
|
TruffleHog:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: TruffleHog OSS
|
||||||
|
uses: trufflesecurity/trufflehog@0c66d30c1f4075cee1aada2e1ab46dabb1b0071a
|
||||||
|
with:
|
||||||
|
path: ./
|
||||||
|
base: ${{ github.event.repository.default_branch }}
|
||||||
|
head: HEAD
|
||||||
|
extra_args: --debug --only-verified
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
//! The revive exit code constants.
|
//!
|
||||||
|
//! The exit code constants.
|
||||||
|
//!
|
||||||
|
|
||||||
/// The common application success exit code.
|
/// The common application success exit code.
|
||||||
pub const EXIT_CODE_SUCCESS: i32 = 0;
|
pub const EXIT_CODE_SUCCESS: i32 = 0;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ pub(crate) mod byte_length;
|
|||||||
pub(crate) mod evm_version;
|
pub(crate) mod evm_version;
|
||||||
pub(crate) mod exit_code;
|
pub(crate) mod exit_code;
|
||||||
pub(crate) mod extension;
|
pub(crate) mod extension;
|
||||||
|
pub(crate) mod polkavm;
|
||||||
pub(crate) mod utils;
|
pub(crate) mod utils;
|
||||||
|
|
||||||
pub use self::base::*;
|
pub use self::base::*;
|
||||||
@@ -14,4 +15,5 @@ pub use self::byte_length::*;
|
|||||||
pub use self::evm_version::EVMVersion;
|
pub use self::evm_version::EVMVersion;
|
||||||
pub use self::exit_code::*;
|
pub use self::exit_code::*;
|
||||||
pub use self::extension::*;
|
pub use self::extension::*;
|
||||||
|
pub use self::polkavm::address::*;
|
||||||
pub use self::utils::*;
|
pub use self::utils::*;
|
||||||
|
|||||||
@@ -0,0 +1,115 @@
|
|||||||
|
//! The PolkaVM address constants.
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_TO_L1: u16 = 0xFFFF;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_PRECOMPILE: u16 = 0xFFFD;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_META: u16 = 0xFFFC;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_MIMIC_CALL: u16 = 0xFFFB;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_SYSTEM_MIMIC_CALL: u16 = 0xFFFA;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_MIMIC_CALL_BYREF: u16 = 0xFFF9;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_SYSTEM_MIMIC_CALL_BYREF: u16 = 0xFFF8;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_RAW_FAR_CALL: u16 = 0xFFF7;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_RAW_FAR_CALL_BYREF: u16 = 0xFFF6;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_SYSTEM_CALL: u16 = 0xFFF5;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_SYSTEM_CALL_BYREF: u16 = 0xFFF4;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_SET_CONTEXT_VALUE_CALL: u16 = 0xFFF3;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_SET_PUBDATA_PRICE: u16 = 0xFFF2;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_INCREMENT_TX_COUNTER: u16 = 0xFFF1;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_GET_GLOBAL_PTR_CALLDATA: u16 = 0xFFF0;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_GET_GLOBAL_CALL_FLAGS: u16 = 0xFFEF;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_GET_GLOBAL_PTR_RETURN_DATA: u16 = 0xFFEE;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_EVENT_INITIALIZE: u16 = 0xFFED;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_EVENT_WRITE: u16 = 0xFFEC;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_ACTIVE_PTR_LOAD_CALLDATA: u16 = 0xFFEB;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_ACTIVE_PTR_LOAD_RETURN_DATA: u16 = 0xFFEA;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_ACTIVE_PTR_ADD: u16 = 0xFFE9;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_ACTIVE_PTR_SHRINK: u16 = 0xFFE8;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_ACTIVE_PTR_PACK: u16 = 0xFFE7;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_MULTIPLICATION_HIGH_REGISTER: u16 = 0xFFE6;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_GET_GLOBAL_EXTRA_ABI_DATA: u16 = 0xFFE5;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_ACTIVE_PTR_DATA_LOAD: u16 = 0xFFE4;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_ACTIVE_PTR_DATA_COPY: u16 = 0xFFE3;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_ACTIVE_PTR_DATA_SIZE: u16 = 0xFFE2;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_CONST_ARRAY_DECLARE: u16 = 0xFFE1;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_CONST_ARRAY_SET: u16 = 0xFFE0;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_CONST_ARRAY_FINALIZE: u16 = 0xFFDF;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_CONST_ARRAY_GET: u16 = 0xFFDE;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_DECOMMIT: u16 = 0xFFDD;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_ACTIVE_PTR_LOAD_DECOMMIT: u16 = 0xFFDC;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_RETURN_FORWARD: u16 = 0xFFDB;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_REVERT_FORWARD: u16 = 0xFFDA;
|
||||||
|
|
||||||
|
/// The corresponding simulation predefined address.
|
||||||
|
pub const POLKAVM_ADDRESS_ACTIVE_PTR_SWAP: u16 = 0xFFD9;
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
//!
|
||||||
|
//! The PolkaVM constants.
|
||||||
|
//!
|
||||||
|
|
||||||
|
pub mod address;
|
||||||
@@ -2,40 +2,6 @@
|
|||||||
|
|
||||||
pragma solidity ^0.8;
|
pragma solidity ^0.8;
|
||||||
|
|
||||||
/* runner.json
|
|
||||||
{
|
|
||||||
"differential": true,
|
|
||||||
"actions": [
|
|
||||||
{
|
|
||||||
"Instantiate": {
|
|
||||||
"code": {
|
|
||||||
"Solidity": {
|
|
||||||
"contract": "Call"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Instantiate": {
|
|
||||||
"code": {
|
|
||||||
"Solidity": {
|
|
||||||
"contract": "Call"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Call": {
|
|
||||||
"dest": {
|
|
||||||
"Instantiated": 1
|
|
||||||
},
|
|
||||||
"data": "1b8b921d0000000000000000000000001c81a61a407017c58397a47d2ab28191b9b8ec9b000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000050102030405000000000000000000000000000000000000000000000000000000"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
contract Call {
|
contract Call {
|
||||||
function value_transfer(address payable destination) public payable {
|
function value_transfer(address payable destination) public payable {
|
||||||
destination.transfer(msg.value);
|
destination.transfer(msg.value);
|
||||||
|
|||||||
@@ -30,6 +30,9 @@ pub static GLOBAL_RETURN_DATA_SIZE: &str = "returndatasize";
|
|||||||
/// The call flags global variable name.
|
/// The call flags global variable name.
|
||||||
pub static GLOBAL_CALL_FLAGS: &str = "call_flags";
|
pub static GLOBAL_CALL_FLAGS: &str = "call_flags";
|
||||||
|
|
||||||
|
/// The extra ABI data global variable name.
|
||||||
|
pub static GLOBAL_EXTRA_ABI_DATA: &str = "extra_abi_data";
|
||||||
|
|
||||||
/// The constant array global variable name prefix.
|
/// The constant array global variable name prefix.
|
||||||
pub static GLOBAL_CONST_ARRAY_PREFIX: &str = "const_array_";
|
pub static GLOBAL_CONST_ARRAY_PREFIX: &str = "const_array_";
|
||||||
|
|
||||||
@@ -52,6 +55,9 @@ pub const HEAP_AUX_OFFSET_EXTERNAL_CALL: u64 = 0;
|
|||||||
pub const HEAP_AUX_OFFSET_CONSTRUCTOR_RETURN_DATA: u64 =
|
pub const HEAP_AUX_OFFSET_CONSTRUCTOR_RETURN_DATA: u64 =
|
||||||
8 * (revive_common::BYTE_LENGTH_WORD as u64);
|
8 * (revive_common::BYTE_LENGTH_WORD as u64);
|
||||||
|
|
||||||
|
/// The number of the extra ABI data arguments.
|
||||||
|
pub const EXTRA_ABI_DATA_SIZE: usize = 0;
|
||||||
|
|
||||||
/// The `create` method deployer signature.
|
/// The `create` method deployer signature.
|
||||||
pub static DEPLOYER_SIGNATURE_CREATE: &str = "create(bytes32,bytes32,bytes)";
|
pub static DEPLOYER_SIGNATURE_CREATE: &str = "create(bytes32,bytes32,bytes)";
|
||||||
|
|
||||||
|
|||||||
@@ -84,6 +84,17 @@ impl Entry {
|
|||||||
context.word_const(0),
|
context.word_const(0),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let extra_abi_data_type = context.array_type(
|
||||||
|
context.word_type().as_basic_type_enum(),
|
||||||
|
crate::polkavm::EXTRA_ABI_DATA_SIZE,
|
||||||
|
);
|
||||||
|
context.set_global(
|
||||||
|
crate::polkavm::GLOBAL_EXTRA_ABI_DATA,
|
||||||
|
extra_abi_data_type,
|
||||||
|
AddressSpace::Stack,
|
||||||
|
extra_abi_data_type.const_zero(),
|
||||||
|
);
|
||||||
|
|
||||||
context.set_global(
|
context.set_global(
|
||||||
crate::polkavm::GLOBAL_I256_SIZE,
|
crate::polkavm::GLOBAL_I256_SIZE,
|
||||||
context.xlen_type(),
|
context.xlen_type(),
|
||||||
|
|||||||
Reference in New Issue
Block a user