Support trailing commas in create_db

This commit is contained in:
Luke Parker 2023-11-18 20:54:37 -05:00
parent be48dcc4a4
commit 6e4ecbc90c
No known key found for this signature in database
7 changed files with 7 additions and 7 deletions

View file

@ -38,7 +38,7 @@ pub fn serai_db_key(
#[macro_export]
macro_rules! create_db {
($db_name: ident {
$($field_name: ident: ($($arg: ident: $arg_type: ty),*) -> $field_type: ty),*
$($field_name: ident: ($($arg: ident: $arg_type: ty),*) -> $field_type: ty$(,)?)*
}) => {
$(
#[derive(Clone, Debug)]

View file

@ -29,7 +29,7 @@ use crate::{
create_db! {
CosignDb {
ReceivedCosign: (set: ValidatorSet, block: [u8; 32]) -> Vec<u8>,
DistinctChain: (set: ValidatorSet) -> ()
DistinctChain: (set: ValidatorSet) -> (),
}
}

View file

@ -14,7 +14,7 @@ create_db! {
CosignTriggered: () -> (),
IntendedCosign: () -> (u64, Option<u64>),
BlockHasEvents: (block: u64) -> u8,
CosignTransactions: (network: NetworkId) -> Vec<(Session, u64, [u8; 32])>
CosignTransactions: (network: NetworkId) -> Vec<(Session, u64, [u8; 32])>,
}
}

View file

@ -17,7 +17,7 @@ use crate::tributary::TributarySpec;
create_db! {
NewTributaryDb {
SeraiBlockNumber: (hash: [u8; 32]) -> u64
SeraiBlockNumber: (hash: [u8; 32]) -> u64,
}
}

View file

@ -14,7 +14,7 @@ const PLAN_SIGNING_CODE: u8 = 3;
create_db!(
NonceDeciderDb {
NextNonceDb: (genesis: [u8; 32]) -> u32,
ItemNonceDb: (genesis: [u8; 32], code: u8, id: &[u8]) -> u32
ItemNonceDb: (genesis: [u8; 32], code: u8, id: &[u8]) -> u32,
}
);

View file

@ -25,7 +25,7 @@ use crate::{Get, DbTxn, create_db};
create_db! {
CosignerDb {
Completed: (id: [u8; 32]) -> (),
Attempt: (id: [u8; 32], attempt: u32) -> ()
Attempt: (id: [u8; 32], attempt: u32) -> (),
}
}

View file

@ -39,7 +39,7 @@ create_db!(
// These do assume a key is only used once across sets, which holds true so long as a single
// participant is honest in their execution of the protocol
KeysDb: (network_key: &[u8]) -> Vec<u8>,
NetworkKey: (substrate_key: [u8; 32]) -> Vec<u8>
NetworkKey: (substrate_key: [u8; 32]) -> Vec<u8>,
}
);