Skip to content

Commit

Permalink
Merge pull request #37 from EspressoSystems/lr/publish-txn-correct
Browse files Browse the repository at this point in the history
Add Transactions topic
  • Loading branch information
lukaszrzasik authored Apr 24, 2024
2 parents a5a7a7c + 8b832fc commit 287fa32
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
4 changes: 4 additions & 0 deletions cdn-proto/schema/messages.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ enum Topic {
# The DA-specfic topic. Only participants in the DA committee should want to
# be subscribed to this.
da @1;

# The topic with transactions. Only soon-to-be-leaders should want to be
# subscribed to this.
transactions @2;
}

# This message is used to authenticate the client to a marshal or a broker
Expand Down
17 changes: 12 additions & 5 deletions cdn-proto/schema/messages_capnp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@ pub mod message {
pub enum Topic {
Global = 0,
Da = 1,
Transactions = 2,
}

impl ::capnp::introspect::Introspect for Topic {
Expand All @@ -600,6 +601,7 @@ impl ::core::convert::TryFrom<u16> for Topic {
match value {
0 => ::core::result::Result::Ok(Self::Global),
1 => ::core::result::Result::Ok(Self::Da),
2 => ::core::result::Result::Ok(Self::Transactions),
n => ::core::result::Result::Err(::capnp::NotInSchema(n)),
}
}
Expand All @@ -612,7 +614,7 @@ impl ::capnp::traits::HasTypeId for Topic {
const TYPE_ID: u64 = 0xde3a_dca5_3496_8c3eu64;
}
mod topic {
pub static ENCODED_NODE: [::capnp::Word; 25] = [
pub static ENCODED_NODE: [::capnp::Word; 30] = [
::capnp::word(0, 0, 0, 0, 5, 0, 6, 0),
::capnp::word(62, 140, 150, 52, 165, 220, 58, 222),
::capnp::word(15, 0, 0, 0, 2, 0, 0, 0),
Expand All @@ -622,22 +624,27 @@ pub static ENCODED_NODE: [::capnp::Word; 25] = [
::capnp::word(21, 0, 0, 0, 170, 0, 0, 0),
::capnp::word(29, 0, 0, 0, 7, 0, 0, 0),
::capnp::word(0, 0, 0, 0, 0, 0, 0, 0),
::capnp::word(25, 0, 0, 0, 55, 0, 0, 0),
::capnp::word(25, 0, 0, 0, 79, 0, 0, 0),
::capnp::word(0, 0, 0, 0, 0, 0, 0, 0),
::capnp::word(0, 0, 0, 0, 0, 0, 0, 0),
::capnp::word(109, 101, 115, 115, 97, 103, 101, 115),
::capnp::word(46, 99, 97, 112, 110, 112, 58, 84),
::capnp::word(111, 112, 105, 99, 0, 0, 0, 0),
::capnp::word(0, 0, 0, 0, 1, 0, 1, 0),
::capnp::word(8, 0, 0, 0, 1, 0, 2, 0),
::capnp::word(12, 0, 0, 0, 1, 0, 2, 0),
::capnp::word(0, 0, 0, 0, 0, 0, 0, 0),
::capnp::word(17, 0, 0, 0, 58, 0, 0, 0),
::capnp::word(29, 0, 0, 0, 58, 0, 0, 0),
::capnp::word(0, 0, 0, 0, 0, 0, 0, 0),
::capnp::word(1, 0, 0, 0, 0, 0, 0, 0),
::capnp::word(9, 0, 0, 0, 26, 0, 0, 0),
::capnp::word(21, 0, 0, 0, 26, 0, 0, 0),
::capnp::word(0, 0, 0, 0, 0, 0, 0, 0),
::capnp::word(2, 0, 0, 0, 0, 0, 0, 0),
::capnp::word(13, 0, 0, 0, 106, 0, 0, 0),
::capnp::word(0, 0, 0, 0, 0, 0, 0, 0),
::capnp::word(103, 108, 111, 98, 97, 108, 0, 0),
::capnp::word(100, 97, 0, 0, 0, 0, 0, 0),
::capnp::word(116, 114, 97, 110, 115, 97, 99, 116),
::capnp::word(105, 111, 110, 115, 0, 0, 0, 0),
];
pub fn get_annotation_types(child_index: Option<u16>, index: u32) -> ::capnp::introspect::Type {
panic!("invalid annotation indices ({:?}, {}) ", child_index, index)
Expand Down
7 changes: 6 additions & 1 deletion cdn-proto/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,8 @@ pub enum Topic {
/// The DA-specfic topic. Only participants in the DA committee should want to
/// be subscribed to this.
DA,
/// The topic with transactions. Only soon-to-be-leaders should want to be subscribed to this.
Transactions,
}

/// We need this because it allows conversions to and from the Cap'n' Proto version
Expand All @@ -329,6 +331,7 @@ impl From<messages_capnp::Topic> for Topic {
match value {
messages_capnp::Topic::Global => Self::Global,
messages_capnp::Topic::Da => Self::DA,
messages_capnp::Topic::Transactions => Self::Transactions,
}
}
}
Expand All @@ -340,6 +343,7 @@ impl From<Topic> for messages_capnp::Topic {
match value {
Topic::Global => Self::Global,
Topic::DA => Self::Da,
Topic::Transactions => Self::Transactions,
}
}
}
Expand All @@ -352,7 +356,7 @@ impl TryInto<Topic> for String {
match self.as_str() {
"DA" => Ok(Topic::DA),
"Global" => Ok(Topic::Global),

"Transactions" => Ok(Topic::Transactions),
_ => Err(Error::Parse(
"failed to parse topic: did not exist".to_string(),
)),
Expand All @@ -366,6 +370,7 @@ impl Display for Topic {
match self {
Self::Global => write!(f, "Global"),
Self::DA => write!(f, "DA"),
Self::Transactions => write!(f, "Transactions"),
}
}
}
Expand Down

0 comments on commit 287fa32

Please sign in to comment.