Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Implements the API for the `pallet-revive` host function `to_account_id` - [#2578](https://github.com/use-ink/ink/pull/2578)
- Add `#[ink::contract_ref]` attribute - [#2648](https://github.com/use-ink/ink/pull/2648)
- Add `ink_revive_types` (and remove `pallet-revive` dependency from `ink_e2e`) - [#2657](https://github.com/use-ink/ink/pull/2657)

### Changed
- Marks the `pallet-revive` host function `account_id` stable - [#2578](https://github.com/use-ink/ink/pull/2578)
Expand Down
35 changes: 25 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ members = [
"crates/ink/ir",
"crates/ink/macro",
"crates/metadata",
"crates/revive-types",
"crates/prelude",
"crates/primitives",
"crates/storage",
Expand Down Expand Up @@ -104,6 +105,7 @@ xcm = { package = "staging-xcm", git = "https://github.com/use-ink/polkadot-sdk.
polkavm-derive = { version = "0.26.0", default-features = false }

# Solidity dependencies
alloy-core = { version = "1.1.0", default-features = false }
alloy-sol-types = { version = "1.3.0", default-features = false }
const_format = { version = "0.2.34", features = ["fmt"] }
keccak-const = "0.2.0"
Expand All @@ -121,6 +123,7 @@ ink_macro = { version = "=6.0.0-alpha.4", path = "crates/ink/macro", default-fea
ink_metadata = { version = "=6.0.0-alpha.4", path = "crates/metadata", default-features = false }
ink_prelude = { version = "=6.0.0-alpha.4", path = "crates/prelude", default-features = false }
ink_primitives = { version = "=6.0.0-alpha.4", path = "crates/primitives", default-features = false }
ink_revive_types = { version = "=6.0.0-alpha.4", path = "crates/revive-types", default-features = false }
ink_storage = { version = "=6.0.0-alpha.4", path = "crates/storage", default-features = false }
ink_storage_traits = { version = "=6.0.0-alpha.4", path = "crates/storage/traits", default-features = false }

Expand Down
4 changes: 2 additions & 2 deletions crates/e2e/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ ink_e2e_macro = { workspace = true, default-features = true }
ink = { workspace = true, default-features = true }
ink_env = { workspace = true, default-features = true }
ink_primitives = { workspace = true, default-features = true }
ink_revive_types = { workspace = true, default-features = true }
ink_sandbox = { version = "=6.0.0-alpha.4", path = "./sandbox", optional = true }

cargo_metadata = { workspace = true }
contract-build = { workspace = true }
pallet-revive = { workspace = true }
funty = { workspace = true }
impl-serde = { workspace = true }
jsonrpsee = { workspace = true, features = ["ws-client"] }
Expand Down Expand Up @@ -61,7 +61,6 @@ default = [ "std" ]
std = [
"impl-serde/std",
"ink_e2e_macro/std",
"pallet-revive/std",
"scale-info/std",
"scale/std",
"serde/std",
Expand All @@ -72,6 +71,7 @@ std = [
"sp-runtime-interface/std",
"sp-weights/std",
"ink_e2e_macro/std",
"ink_revive_types/std",
"ink_sandbox?/std",
"frame-support/std",
]
Expand Down
2 changes: 2 additions & 0 deletions crates/e2e/sandbox/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ sp-externalities = { workspace = true }
sp-runtime = { workspace = true }
sp-io = { workspace = true }
ink_primitives = { workspace = true }
ink_revive_types = { workspace = true }

paste = { workspace = true }
scale-info = { workspace = true }
Expand All @@ -37,6 +38,7 @@ std = [
"frame-system/std",
"frame-metadata/std",
"ink_primitives/std",
"ink_revive_types/std",
"pallet-balances/std",
"pallet-revive/std",
"pallet-timestamp/std",
Expand Down
65 changes: 65 additions & 0 deletions crates/e2e/sandbox/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ use frame_system::{
},
};
use ink_primitives::U256;
use ink_revive_types::evm::{
CallLog,
CallTrace,
};
pub use macros::{
BlockBuilder,
DefaultSandbox,
Expand Down Expand Up @@ -170,3 +174,64 @@ where
let evm_value: U256 = value.into();
native_to_eth_ratio.saturating_mul(evm_value)
}

/// Convert a `pallet_revive::CallTrace` (sandbox) into an `ink_revive_types::CallTrace`
/// (API).
pub fn to_revive_trace(t: pallet_revive::evm::CallTrace) -> CallTrace {
CallTrace {
from: t.from,
gas: t.gas,
gas_used: t.gas_used,
to: t.to,
input: t.input.0,
output: t.output.0,
error: t.error,
revert_reason: t.revert_reason,
calls: t.calls.into_iter().map(to_revive_trace).collect(),
logs: t
.logs
.into_iter()
.map(|log| {
CallLog {
address: log.address,
topics: log.topics,
data: log.data.0,
..Default::default()
}
})
.collect(),
value: t.value,
call_type: to_revive_call_type(t.call_type),
}
}

/// Convert a `pallet_revive::CallType` into an `ink_revive_types::evm::CallType`.
fn to_revive_call_type(
ct: pallet_revive::evm::CallType,
) -> ink_revive_types::evm::CallType {
match ct {
pallet_revive::evm::CallType::Call => ink_revive_types::evm::CallType::Call,
pallet_revive::evm::CallType::StaticCall => {
ink_revive_types::evm::CallType::StaticCall
}
pallet_revive::evm::CallType::DelegateCall => {
ink_revive_types::evm::CallType::DelegateCall
}
pallet_revive::evm::CallType::Create => ink_revive_types::evm::CallType::Create,
pallet_revive::evm::CallType::Create2 => ink_revive_types::evm::CallType::Create2,
}
}

/// Convert a `pallet_revive::StorageDeposit` into an `ink_revive_types::StorageDeposit`.
pub fn to_revive_storage_deposit<B>(
sd: pallet_revive::StorageDeposit<B>,
) -> ink_revive_types::StorageDeposit<B> {
match sd {
pallet_revive::StorageDeposit::Charge(b) => {
ink_revive_types::StorageDeposit::Charge(b)
}
pallet_revive::StorageDeposit::Refund(b) => {
ink_revive_types::StorageDeposit::Refund(b)
}
}
}
2 changes: 1 addition & 1 deletion crates/e2e/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ use ink_primitives::{
H160,
abi::AbiEncodeWith,
};
use ink_revive_types::evm::CallTrace;
use jsonrpsee::core::async_trait;
use pallet_revive::evm::CallTrace;
use sp_weights::Weight;
use subxt::dynamic::Value;

Expand Down
2 changes: 1 addition & 1 deletion crates/e2e/src/contract_results.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use ink_primitives::{
H256,
MessageResult,
};
use pallet_revive::{
use ink_revive_types::{
CodeUploadResult,
ExecReturnValue,
InstantiateReturnValue,
Expand Down
2 changes: 1 addition & 1 deletion crates/e2e/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use pallet_revive::evm::CallTrace;
use ink_revive_types::evm::CallTrace;
use std::fmt;

/// An error occurred while interacting with the E2E backend.
Expand Down
2 changes: 1 addition & 1 deletion crates/e2e/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ pub use contract_results::{
UploadResult,
};
pub use ink_e2e_macro::test;
pub use ink_revive_types::evm::CallTrace;
pub use node_proc::{
TestNodeProcess,
TestNodeProcessBuilder,
};
pub use pallet_revive::evm::CallTrace;
#[cfg(feature = "sandbox")]
pub use sandbox_client::{
Client as SandboxClient,
Expand Down
Loading
Loading