Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TaggedDataPayload cleanup #1644

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sdk/src/types/block/payload/candidacy_announcement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ use packable::Packable;
pub struct CandidacyAnnouncementPayload;

impl CandidacyAnnouncementPayload {
/// The payload kind of a [`CandidacyAnnouncementPayload`].
/// The [`Payload`](crate::types::block::payload::Payload) kind of a [`CandidacyAnnouncementPayload`].
pub const KIND: u8 = 2;
}
2 changes: 1 addition & 1 deletion sdk/src/types/block/payload/signed_transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub struct SignedTransactionPayload {
}

impl SignedTransactionPayload {
/// The payload kind of a [`SignedTransactionPayload`].
/// The [`Payload`](crate::types::block::payload::Payload) kind of a [`SignedTransactionPayload`].
pub const KIND: u8 = 1;

/// Creates a new [`SignedTransactionPayload`].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use packable::{
Packable,
};

use crate::types::block::{Block, Error};
use crate::types::block::Error;

pub(crate) type TagLength =
BoundedU8<{ *TaggedDataPayload::TAG_LENGTH_RANGE.start() }, { *TaggedDataPayload::TAG_LENGTH_RANGE.end() }>;
Expand All @@ -30,15 +30,12 @@ pub struct TaggedDataPayload {
}

impl TaggedDataPayload {
/// The payload kind of a [`TaggedDataPayload`].
/// The [`Payload`](crate::types::block::payload::Payload) kind of a [`TaggedDataPayload`].
pub const KIND: u8 = 0;
/// Valid lengths for the tag.
/// Valid length range for the tag.
pub const TAG_LENGTH_RANGE: RangeInclusive<u8> = 0..=64;
/// Valid lengths for the data.
// Less than max block length, because of the other fields in the block and payload kind, tagged payload field
// lengths.
// TODO https://github.com/iotaledger/iota-sdk/issues/1226
pub const DATA_LENGTH_RANGE: RangeInclusive<u32> = 0..=(Block::LENGTH_MAX - Block::LENGTH_MIN - 9) as u32;
/// Valid length range for the data.
pub const DATA_LENGTH_RANGE: RangeInclusive<u32> = 0..=8192;

/// Creates a new [`TaggedDataPayload`].
pub fn new(tag: impl Into<Box<[u8]>>, data: impl Into<Box<[u8]>>) -> Result<Self, Error> {
Expand Down
Loading