contract delegator bug
Created by: NetGodFather
Edit code base on https://github.com/paritytech/ink/tree/master/examples/delegator Modify adder/lib.rs,Add code like this:
#[ink(message)]
pub fn x_inc(&mut self, by: i32) -> Result<(), Error>{
self.accumulator.inc(by);
Ok(())
}
Compiling will report a large number of errors。
Add the following code again:
#[derive(Debug, PartialEq, Eq, scale::Encode)]
#[cfg_attr(feature = "std", derive(scale_info::TypeInfo))]
pub enum Error {
}
Compiling will return the following error:
Compiling adder v3.0.0-rc3 (/private/var/folders/fx/y3j80rgn433961wkpcjq4_fr0000gn/T/cargo-contract_sUXlX7/adder)
error[E0599]: the method `fire` exists for struct `CallBuilder<DefaultEnvironment, Set<ink_env::AccountId>, Unset<u64>, Unset<u128>, Set<ExecutionInput<ArgumentList<ink_env::call::utils::Argument<i32>, ArgumentList<ArgumentListEnd, ArgumentListEnd>>>>, Set<ReturnType<Result<(), adder::Error>>>>`, but its trait bounds were not satisfied
--> /Users/hezhiqun/Substrate/ink/examples/delegator/adder/lib.rs:54:9
|
54 | / pub fn x_inc(&mut self, by: i32) -> Result<(), Error>{
55 | | self.accumulator.inc(by);
56 | |
57 | | Ok(())
58 | | }
| |_________^ method cannot be called on `CallBuilder<DefaultEnvironment, Set<ink_env::AccountId>, Unset<u64>, Unset<u128>, Set<ExecutionInput<ArgumentList<ink_env::call::utils::Argument<i32>, ArgumentList<ArgumentListEnd, ArgumentListEnd>>>>, Set<ReturnType<Result<(), adder::Error>>>>` due to unsatisfied trait bounds
|
::: /Users/hezhiqun/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/result.rs:241:1
|
241 | pub enum Result<T, E> {
| --------------------- doesn't satisfy `_: adder::_::_parity_scale_codec::Decode`
|
= note: the following trait bounds were not satisfied:
`Result<(), adder::Error>: adder::_::_parity_scale_codec::Decode`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0599`.
error: could not compile `adder`
To learn more, run the command again with --verbose.