Sui.

Post

Share your knowledge.

Meaning.Sui.
Jul 14, 2025
Expert Q&A

Question about move attribute

Is there a list of move attributes (e.g #[test] #[expected_failure]) but not just for test but function attributes as well? I see #[syntax(index)] in 0x2::table::borrow. A table of definitions would be helpful.

  • Sui
2
2
Share
Comments
.

Answers

2
0xduckmove.
Jul 14 2025, 14:38

Enums values don't have IDs and aren't stored like owned objects, they are more like wrapped objects, where their bytes are just stored as part of the object that contains them

1
Best Answer
Comments
.
24p30p.
Jul 14 2025, 13:03

There isn't an official all-in-one list of Move attributes, but you can still find most of the ones that matter by exploring the Sui Move codebase and documentation. You mainly use attributes like #[test], #[expected_failure], and #[test_only] for testing, while others like #[entry] and #[view] control how a function behaves on-chain. For example, #[entry] marks a public function that can be called in a transaction, and #[view] means the function doesn’t change any state, making it safe for off-chain queries. When you see #[syntax(index)] in 0x2::table::borrow, that’s a low-level internal helper the Sui compiler uses to support sugar syntax like table[key] — it's not meant for general use. Right now, the best way to understand all the attributes is by browsing the sui-framework source, checking modules like coin, table, and transfer, and watching how attributes are applied there. For deeper behavior, you can also look at Move IR reference even though some attributes are Sui-specific and won’t show up there.

0
Comments
.

Do you know the answer?

Please log in and share it.

Sui is a Layer 1 protocol blockchain designed as the first internet-scale programmable blockchain platform.

420Posts611Answers
Sui.X.Peera.

Earn Your Share of 1000 Sui

Gain Reputation Points & Get Rewards for Helping the Sui Community Grow.

Reward CampaignJuly