neo_devpack_solidity/neo/constants.rs
1// Neo N3 NEF format constants
2// These constants define the limits and constraints for the Neo Executable Format.
3
4/// Maximum byte length for the NEF `source` field (URL or identifier).
5pub(super) const MAX_SOURCE_LENGTH: usize = 256;
6
7/// Maximum number of method tokens allowed in a single NEF file.
8/// Method tokens enable optimized cross-contract calls. The NEF3 spec
9/// permits up to 512 entries; real-world contracts compiled by
10/// Neo.Compiler.CSharp / Neow3j can exceed 128.
11pub const MAX_METHOD_TOKENS: usize = 512;
12
13/// Maximum byte length of a method name stored in a NEF method token.
14/// Method names exceeding this limit will be truncated.
15pub const MAX_TOKEN_METHOD_LENGTH: usize = 32;
16
17/// Bitmask of valid CallFlags values (`CallFlags.All`).
18/// Used to validate call flags in method tokens.
19pub const MAX_CALL_FLAGS: u8 = 0x0F;
20
21/// Publicly exposed maximum byte length for the NEF `source` field.
22pub const NEF_SOURCE_MAX_BYTES: usize = MAX_SOURCE_LENGTH;
23
24/// NEF file magic bytes ("NEF3")
25pub const NEF_MAGIC: &[u8] = b"NEF3";
26
27/// NEF header size in bytes
28pub const NEF_HEADER_SIZE: usize = 64;
29
30/// Maximum script size in NEF (512 KB)
31pub const MAX_SCRIPT_SIZE: usize = 512 * 1024;