Skip to content
This repository has been archived by the owner on May 4, 2024. It is now read-only.

[Bug] Unable to generate ABI when feature address20 or feature address32 is enabled. #1033

Open
jewelzms opened this issue Apr 12, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@jewelzms
Copy link

🐛 Bug

To reproduce

Install move-cli
Unable to generate ABI when feature address20 or feature address32 is enabled.

# cargo install --features address20 --path language/tools/move-cli

build move contract
No ABI is generated when building, nor are there any error messages.

# move build --abi

Reason

Module type judgment logic error.

Error code segment

// language/move-model/src/ast.rs
pub fn is_script(&self) -> bool {
    static MAX_ADDR: Lazy<BigUint> = Lazy::new(|| {
        BigUint::from_str_radix("ffffffffffffffffffffffffffffffff", 16).expect("valid hex")
    });
    self.0 == *MAX_ADDR
}

Fix suggestion

// language/move-model/src/ast.rs
pub fn is_script(&self) -> bool {
    static MAX_ADDR: Lazy<BigUint> = Lazy::new(|| {
        use move_core_types::account_address::AccountAddress;
        BigUint::from_bytes_be(&[0xff; AccountAddress::LENGTH].to_vec())
    });
    self.0 == *MAX_ADDR
}
@jewelzms jewelzms added the bug Something isn't working label Apr 12, 2023
@jewelzms jewelzms changed the title [Bug] [Bug] Unable to generate ABI when feature address20 or feature address32 is enabled. Apr 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant