Skip to content

Commit dcc93b5

Browse files
committed
Fix tests
1 parent f45f1f5 commit dcc93b5

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

crates/env/src/call/execution.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ use super::{
1616
utils::ReturnType,
1717
Selector,
1818
};
19-
use crate::Environment;
19+
use crate::{
20+
call::utils::DecodeMessageResult,
21+
Environment,
22+
};
2023
use alloy_sol_types::{
2124
private::SolTypeValue,
2225
SolType,
@@ -31,7 +34,6 @@ use ink_primitives::reflect::{
3134
ScaleEncoding,
3235
SolEncoding,
3336
};
34-
use crate::call::utils::DecodeMessageResult;
3537

3638
/// The input data and the expected return type of a contract execution.
3739
pub struct Execution<Args, Output, Abi> {
@@ -78,7 +80,7 @@ pub trait Executor<E: Environment> {
7880
) -> Result<ink_primitives::MessageResult<Output>, Self::Error>
7981
where
8082
Args: AbiEncodeWith<Abi>,
81-
Output: AbiDecodeWith<Abi>;
83+
Output: AbiDecodeWith<Abi> + DecodeMessageResult<Abi>;
8284
}
8385

8486
/// The input data for a smart contract execution.

crates/ink/tests/ui/contract/pass/message-selector-encoding-all.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
fn main() {}
2-
/*
3-
// todo bring back once errors with "duplicate definitions for `…`" fixed.
41
use contract::Contract;
52

63
#[ink::contract(abi = "all")]
@@ -108,4 +105,3 @@ fn main() {
108105
[0xdc, 0x48, 0xaa, 0x5a],
109106
);
110107
}
111-
*/

integration-tests/public/runtime-call-contract/sandbox-runtime/pallet-revive-caller/src/executor.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,25 @@ use frame_system::pallet_prelude::OriginFor;
77
use ink::{
88
env::{
99
call::{
10+
utils::DecodeMessageResult,
1011
ExecutionInput,
1112
Executor,
1213
},
1314
Environment,
1415
},
1516
primitives::U256,
17+
reflect::{
18+
AbiDecodeWith,
19+
AbiEncodeWith,
20+
},
21+
MessageResult,
1622
H160,
1723
};
1824
use pallet_revive::{
1925
DepositLimit,
2026
MomentOf,
2127
};
2228
use sp_runtime::traits::Bounded;
23-
use ink::env::call::utils::DecodeMessageResult;
24-
use ink::reflect::AbiDecodeWith;
2529

2630
pub struct PalletReviveExecutor<E: Environment, Runtime: pallet_revive::Config> {
2731
// todo
@@ -50,10 +54,10 @@ where
5054
fn exec<Args, Output, Abi>(
5155
&self,
5256
input: &ExecutionInput<Args, Abi>,
53-
) -> Result<ink::MessageResult<Output>, Self::Error>
57+
) -> Result<MessageResult<Output>, Self::Error>
5458
where
55-
Args: ink::reflect::AbiEncodeWith<Abi>,
56-
Output: ink::reflect::AbiDecodeWith<Abi> + DecodeMessageResult<Abi>,
59+
Args: AbiEncodeWith<Abi>,
60+
Output: AbiDecodeWith<Abi> + DecodeMessageResult<Abi>,
5761
{
5862
let data = input.encode();
5963
let result = pallet_revive::Pallet::<R>::bare_call(
@@ -69,7 +73,7 @@ where
6973
);
7074

7175
let output = result.result?.data;
72-
let result = codec::Decode::decode(&mut &output[..]).map_err(|_| {
76+
let result = DecodeMessageResult::decode_output(&output[..]).map_err(|_| {
7377
sp_runtime::DispatchError::Other("Failed to decode contract output")
7478
})?;
7579

0 commit comments

Comments
 (0)