multiversx / mx-sdk-rs

🦀 MultiversX tool pack in Rust. Contains: a smart contract framework; a complete smart contract build solution; a large collection of example smart contracts; a testing framework and debugger that include a VM model; various other tools.
GNU General Public License v3.0
178 stars 98 forks source link

Chain VM has invalid sign assertion #1073

Closed alexander-smoktal closed 1 year ago

alexander-smoktal commented 1 year ago

Hi guys. It looks like this assertion has invalid condition:

fn assert_positive(bi: &num_bigint::BigInt) {
    assert!(
        bi.sign() == num_bigint::Sign::Minus,
        "bitwise operations only allowed on positive integers"
    );
}

https://github.com/multiversx/mx-sdk-rs/blob/09ae7f90e0c4116471733d9f58482a493bc78bd7/vm/src/api/managed_types/big_int_api_mock.rs#L17

I guess it should it be the other way around?

andrei-marinica commented 1 year ago

Hi! Thanks for notifying us. It looks like our tests were not covering this properly.

It will be fixed in no time.

alexander-smoktal commented 1 year ago

Hi, guys. Did you have a chance to take a look at this issue?

andrei-marinica commented 1 year ago

Was fixed in the release 0.42.0.