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>
🐛 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.
With an associated
Move.toml
Compiling this Move package is fine (using either V1 or V2 compiler), e.g., with
However, when publishing it on chain, e.g., to the local testnet, the following error is observed:
It is really hard to decipher what it means...
Following is one way to publish the package and observe the error:
Expected Behavior
One of the following is expected:
System information
Please complete the following information: