Spadina support (v2) (#1670)

## Issue Addressed

Resolves #1651

## Description

This supercedes #1658. Great work was done by @pawanjay176, I just needed to make a change whilst he is away.

See #1658 for a description, prior reviews and approval by @michaelsproul.

## Additional info

Ignores a rustsec advisory. This is tracked in #1669.


Co-authored-by: pawan <pawandhananjay@gmail.com>
This commit is contained in:
Paul Hauner
2020-09-26 01:58:31 +00:00
parent 258b28469e
commit 5688f21bbd
10 changed files with 49 additions and 77 deletions

View File

@@ -52,7 +52,6 @@ pub struct Eth2NetArchiveAndDirectory<'a> {
pub name: &'a str,
pub unique_id: &'a str,
pub archive_name: &'a str,
pub commit: &'a str,
pub genesis_is_known: bool,
}
@@ -76,26 +75,21 @@ impl<'a> Eth2NetArchiveAndDirectory<'a> {
#[macro_export]
macro_rules! unique_id {
($name: tt, $commit: tt, $genesis_is_known: tt) => {
concat!("testnet_", $name, "_", $commit, "_", $genesis_is_known);
};
($name: tt, $commit: tt) => {
concat!("testnet_", $name, "_", $commit, ".zip");
($name: tt) => {
concat!("testnet_", $name);
};
}
macro_rules! define_net {
($title: ident, $macro_title: tt, $name: tt, $commit: tt, $genesis_is_known: tt) => {
($title: ident, $macro_title: tt, $name: tt, $genesis_is_known: tt) => {
#[macro_use]
pub mod $title {
use super::*;
pub const ETH2_NET_DIR: Eth2NetArchiveAndDirectory = Eth2NetArchiveAndDirectory {
name: $name,
unique_id: unique_id!($name, $commit, $genesis_is_known),
archive_name: unique_id!($name, $commit),
commit: $commit,
unique_id: unique_id!($name),
archive_name: concat!(unique_id!($name), ".zip"),
genesis_is_known: $genesis_is_known,
};
@@ -104,33 +98,18 @@ macro_rules! define_net {
#[macro_export]
macro_rules! $macro_title {
($base_dir: tt, $filename: tt) => {
include_bytes!(concat!(
$base_dir,
unique_id!($name, $commit, $genesis_is_known),
"/",
$filename
))
include_bytes!(concat!($base_dir, unique_id!($name), "/", $filename))
};
}
}
};
}
define_net!(
altona,
include_altona_file,
"altona",
"a94e00c1a03df851f960fcf44a79f2a6b1d29af1",
true
);
define_net!(altona, include_altona_file, "altona", true);
define_net!(
medalla,
include_medalla_file,
"medalla",
"09bbf2c9d108944ac934f94ec6a1d0684ca062a5",
true
);
define_net!(medalla, include_medalla_file, "medalla", true);
define_net!(spadina, include_spadina_file, "spadina", false);
#[cfg(test)]
mod tests {