Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] cannot publish modules with public inline and #[view] function #15345

Open
meng-xu-cs opened this issue Nov 21, 2024 · 1 comment
Open
Labels
bug Something isn't working compiler-v2 stale-exempt Prevents issues from being automatically marked and closed as stale

Comments

@meng-xu-cs
Copy link
Collaborator

🐛 Bug

Trying to publish a Move package with both public inline and #[view] attribute leads to an unexpected and hard-to-understand error code (CONSTRAINT_NOT_SATISFIED).

To reproduce

Code snippet to reproduce

Following is a minimal Move package to reproduce this issue.

module demo::demo {
    #[view]
    public inline fun zero(): u64 { 0 }
}

With an associated Move.toml

[package]
name = "Demo"
version = "1.0.0"
upgrade_policy = "compatible"
authors = []

[addresses]
demo = '_'

Compiling this Move package is fine (using either V1 or V2 compiler), e.g., with

aptos move compile --named-addresses demo=0x123

However, when publishing it on chain, e.g., to the local testnet, the following error is observed:

API error: Unknown error Transaction committed on chain, but failed execution: CONSTRAINT_NOT_SATISFIED

It is really hard to decipher what it means...

Following is one way to publish the package and observe the error:

# Launch local testnet in one terminal session
aptos node run-local-testnet --with-faucet --force-restart

# Prepare a demo account
aptos init --network local --profile demo --private-key <some-key> --skip-faucet --assume-yes
aptos account fund-with-faucet --profile demo --account demo --amount 100000

# publish the package
aptos move publish --profile demo --sender-account demo <path-to-pkg>

Expected Behavior

One of the following is expected:

  • move publishing is okay
  • error out on the compile time
  • more useful information to show that is the issue

System information

Please complete the following information:

  • Aptos Core Version: dbdb613
  • Rust Version: rustc 1.78.0 (9b00956e5 2024-04-29)
  • Computer OS: Ubuntu 24.04
@meng-xu-cs meng-xu-cs added the bug Something isn't working label Nov 21, 2024
@brmataptos brmataptos moved this from 🆕 New to For Grabs in Move Language and Runtime Nov 21, 2024
@brmataptos
Copy link
Contributor

This should be an easy addition to extended checker.

@sausagee sausagee added the stale-exempt Prevents issues from being automatically marked and closed as stale label Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler-v2 stale-exempt Prevents issues from being automatically marked and closed as stale
Projects
Status: For Grabs
Development

No branches or pull requests

4 participants