diff --git a/integration-tests/public/rlp/Cargo.toml b/integration-tests/public/rlp/Cargo.toml index 6676641218..4f54878734 100755 --- a/integration-tests/public/rlp/Cargo.toml +++ b/integration-tests/public/rlp/Cargo.toml @@ -11,7 +11,7 @@ ink = { path = "../../../crates/ink", default-features = false } [dev-dependencies] ink_e2e = { path = "../../../crates/e2e", features = ["sandbox"] } ink_sandbox = { path = "../../../crates/e2e/sandbox" } -pallet-contracts = { version = "38.0.0", default-features = false } +pallet-revive = { git = "https://github.com/paritytech/polkadot-sdk", rev = "645878a27115db52e5d63115699b4bbb89034067", default-features = false } sha3 = { version = "0.10" } [lib] diff --git a/integration-tests/public/rlp/e2e_tests.rs b/integration-tests/public/rlp/e2e_tests.rs index 4baf8e2732..2743308547 100644 --- a/integration-tests/public/rlp/e2e_tests.rs +++ b/integration-tests/public/rlp/e2e_tests.rs @@ -3,11 +3,12 @@ use ink_e2e::{ ContractsRegistry, Keypair, }; -use ink_sandbox::{ - api::balance_api::BalanceAPI, - AccountId32, -}; -use pallet_contracts::ExecReturnValue; +use ink_sandbox::{api::prelude::*, AccountId32, DefaultSandbox, Sandbox}; +use pallet_revive::ExecReturnValue; +use ink::H160; +use ink::primitives::{AccountId, DepositLimit}; +use ink_e2e::subxt::tx::Signer; +const STORAGE_DEPOSIT_LIMIT: DepositLimit = DepositLimit::Unchecked; #[test] fn call_rlp_encoded_message() { @@ -24,34 +25,39 @@ fn call_rlp_encoded_message() { ) .unwrap_or_else(|_| panic!("Failed to mint tokens")); + let origin = DefaultSandbox::convert_account_to_origin(AccountId32::from(caller.public_key().0)); + sandbox.map_account(origin.clone()).expect("unable to map"); + // given let constructor = RlpRef::new(false); let params = constructor .endowment(0u32.into()) - .code_hash(ink::primitives::Clear::CLEAR_HASH) - .salt_bytes(Vec::new()) + .code_hash(ink::primitives::H256::zero()) + .salt_bytes(None) .params(); let exec_input = params.exec_input(); + // TODO: could potentially simplify if helpers are exposed. + let code = contracts.load_code("rlp"); - let contract_account_id = + let contract_addr = ::deploy_contract( &mut sandbox, code, 0, ink::scale::Encode::encode(&exec_input), - vec![0u8], - caller.public_key().0.into(), - ::default_gas_limit(), + // salt None, + origin, + ::default_gas_limit(), + STORAGE_DEPOSIT_LIMIT ) .result - .expect("sandbox deploy contract failed") - .account_id; + .expect("sandbox deploy contract failed").addr; let mut contract = ContractSandbox { sandbox, - contract_account_id, + contract_addr: contract_addr, }; // set value @@ -66,7 +72,7 @@ fn call_rlp_encoded_message() { struct ContractSandbox { sandbox: ink_e2e::DefaultSandbox, - contract_account_id: AccountId32, + contract_addr: H160, } impl ContractSandbox { @@ -98,18 +104,19 @@ impl ContractSandbox { result.data } + fn call_raw(&mut self, data: Vec, caller: Keypair) -> ExecReturnValue { + let origin = DefaultSandbox::convert_account_to_origin(AccountId32::from(caller.public_key().0)); let result = - + ::call_contract( - &mut self.sandbox, - self.contract_account_id.clone(), - 0, - data, - caller.public_key().0.into(), - ::default_gas_limit(), - None, - pallet_contracts::Determinism::Enforced, + &mut self.sandbox, + self.contract_addr.clone(), + 0, + data, + origin, + ::default_gas_limit(), + STORAGE_DEPOSIT_LIMIT, ) .result .expect("sandbox call contract failed");