I used the example Flipper, and changed the code like this:

        pub fn flip(&mut self) -> Result<(), Error> {
            self.value = !self.value;
            return Err(Error::InsufficientAllowance);

If I deployed the contract on chain, the function will not change the state value.

If I run cargo test, the state will be changed.

1 Answer 1


It is the problem with Rust version. When I use 1.69.0, it works well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.