Skip to content
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
58 changes: 29 additions & 29 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ members = [
]

[workspace.package]
version = "0.1.35"
version = "0.1.36"
edition = "2021"
license = "Apache-2.0"
authors = ["Junha Park <0xjunha@gmail.com>"]
Expand Down Expand Up @@ -88,7 +88,6 @@ quote = "1.0.40"
rand = "0.8.5"
rayon = "1.11.0"
reed-solomon-simd = "3.0.1"
regex = "1.11.2"
rcgen = { version = "0.13.2", default-features = false, features = ["ring"] }
rocksdb = { version = "0.24.0", default-features = false, features = ["snappy"] }
rustls = { version = "0.23.31", default-features = false, features = ["std"] }
Expand Down
26 changes: 25 additions & 1 deletion block/src/types/extrinsics/tickets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,38 @@ impl Display for TicketsXt {
}
}

#[derive(Debug, Clone, PartialEq, Eq, JamEncode, JamDecode)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct TicketsXtEntry {
/// `e`: The ticket entry index, either 0 or 1.
pub entry_index: u8,
/// `p`: The ticket identifier (note: different from `Ticket` which contains hash of the proof as a ticket id)
pub ticket_proof: BandersnatchRingVrfSig,
}

impl JamEncode for TicketsXtEntry {
fn size_hint(&self) -> usize {
self.entry_index.size_hint() + self.ticket_proof.size_hint()
}

fn encode_to<T: JamOutput>(&self, dest: &mut T) -> Result<(), JamCodecError> {
self.entry_index.encode_to_fixed(dest, 1)?;
self.ticket_proof.encode_to(dest)?;
Ok(())
}
}

impl JamDecode for TicketsXtEntry {
fn decode<I: JamInput>(input: &mut I) -> Result<Self, JamCodecError>
where
Self: Sized,
{
Ok(Self {
entry_index: u8::decode_fixed(input, 1)?,
ticket_proof: BandersnatchRingVrfSig::decode(input)?,
})
}
}

impl Display for TicketsXtEntry {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self.ticket_proof.output_hash() {
Expand Down