Skip to content

Commit 6a3ae3a

Browse files
add comment to SignedPayload from_payload about min limit (#104)
1 parent 9c0cd13 commit 6a3ae3a

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/ed25519.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,10 @@ impl SignedPayload {
388388
///
389389
/// If the payload is larger than 64 bytes.
390390
pub fn from_payload(payload: &[u8]) -> Result<Self, DecodeError> {
391-
// 32-byte for the signer, 4-byte for the payload size, then either 4-byte for the
392-
// min or 64-byte for the max payload
391+
// Min: 32-byte ed25519 key + 4-byte length prefix + 4 bytes (1-byte inner
392+
// payload padded to 4 per XDR). Empty inner payloads are not valid per
393+
// stellar-core (SetOptionsOpFrame rejects them with SET_OPTIONS_BAD_SIGNER).
394+
// Max: 32-byte ed25519 key + 4-byte length prefix + 64-byte inner payload.
393395
const MAX_INNER_PAYLOAD_LENGTH: u32 = 64;
394396
const MIN_LENGTH: usize = 32 + 4 + 4;
395397
const MAX_LENGTH: usize = 32 + 4 + (MAX_INNER_PAYLOAD_LENGTH as usize);

0 commit comments

Comments
 (0)