1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) Subzero Labs, Inc.
use Pubkey;
pub use *;
// Re-export rex module contents for easier access.
pub use *;
/// The number of bytes in a kilobyte.
const KIB: u64 = 1024;
/// The number of bytes in a megabyte.
const MIB: u64 = 1024 * KIB;
/// The maximum size of a program instruction payload in bytes.
pub const MAX_INSTRUCTION_DATA_SIZE: u64 = 65 * KIB;
/// The maximum size of a consensus block in bytes.
pub const MAX_CONSENSUS_BLOCK_SIZE: u64 = 512 * KIB;
/// The maximum size of a single transaction in bytes.
pub const MAX_TRANSACTION_SIZE: u64 = 128 * KIB;
/// The maximum size for a payload received from a remote backend in bytes.
pub const MAX_RESPONSE_SIZE: usize = as usize;
/// The size of the data portion of a network packet in bytes.
/// Note: Maximum over-the-wire size of a Transaction
/// 1280 is IPv6 minimum MTU
/// 40 bytes is the size of the IPv6 header
/// 8 bytes is the size of the fragment header
pub const PACKET_DATA_SIZE: usize = 4096 - 40 - 8;
const_assert_eq!;
// The packet has a maximum length of 1232 bytes.
// This means the maximum number of 32 byte keys is 38.
// 38 as an min-sized encoded u16 is 1 byte.
// We can simply read this byte, if it's >38 we can return None.
pub const MAX_STATIC_ACCOUNTS_PER_PACKET: u8 =
as u8;