neo_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).
5const 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.
9pub const MAX_METHOD_TOKENS: usize = 128;
10
11/// Maximum byte length of a method name stored in a NEF method token.
12/// Method names exceeding this limit will be truncated.
13pub const MAX_TOKEN_METHOD_LENGTH: usize = 32;
14
15/// Bitmask of valid CallFlags values (`CallFlags.All`).
16/// Used to validate call flags in method tokens.
17pub const MAX_CALL_FLAGS: u8 = 0x0F;
18
19/// Publicly exposed maximum byte length for the NEF `source` field.
20pub const NEF_SOURCE_MAX_BYTES: usize = MAX_SOURCE_LENGTH;
21
22/// NEF file magic bytes ("NEF3")
23pub const NEF_MAGIC: &[u8] = b"NEF3";
24
25/// NEF header size in bytes
26pub const NEF_HEADER_SIZE: usize = 64;
27
28/// Maximum script size in NEF (512 KB)
29pub const MAX_SCRIPT_SIZE: usize = 512 * 1024;