Skip to content
This repository was archived by the owner on Feb 3, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 5 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,984 changes: 1,890 additions & 1,094 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

A UTXO chain implementation on Substrate, with two self-guided workshops.Original [UXTO inspiration](https://github.com/0x7CFE/substrate-node-template/tree/utxo) by [Dmitriy Kashitsyn](https://github.com/0x7CFE).

Substrate Version: `2.0.0-rc2`. For educational purposes only.
Substrate Version: `2.0.0-rc6`. For educational purposes only.

## Table of Contents
- [Installation](#Installation): Setting up Rust & Substrate dependencies
Expand Down
42 changes: 21 additions & 21 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ build = 'build.rs'
edition = '2018'
name = 'utxo-workshop'
repository = 'https://github.com/substrate-developer-hub/utxo-workshop'
version = '2.0.0-rc2'
version = '2.0.0-rc6'

[build-dependencies]
substrate-build-script-utils = '2.0.0-rc2'
substrate-build-script-utils = '2.0.0-rc6'

[dependencies.utxo-runtime]
path = '../runtime'
version = '2.0.0-rc2'
version = '2.0.0-rc6'

[dependencies]
futures = '0.3.1'
Expand All @@ -20,24 +20,24 @@ structopt = '0.3.8'
parity-scale-codec = '1.3.0'
sha3 = "0.8"
rand = { version = "0.7", features = ["small_rng"] }
sc-consensus-pow = '0.8.0-rc2'
sc-basic-authorship = '0.8.0-rc2'
sc-cli = '0.8.0-rc2'
sc-client-api = '2.0.0-rc2'
sc-consensus = '0.8.0-rc2'
sc-executor = '0.8.0-rc2'
sc-network = '0.8.0-rc2'
sc-service = '0.8.0-rc2'
sc-transaction-pool = '2.0.0-rc2'
sp-api = '2.0.0-rc2'
sp-blockchain = '2.0.0-rc2'
sp-consensus = '0.8.0-rc2'
sp-consensus-pow = '0.8.0-rc2'
sp-core = '2.0.0-rc2'
sp-inherents = '2.0.0-rc2'
sp-runtime = '2.0.0-rc2'
sp-timestamp = '2.0.0-rc2'
sp-transaction-pool = '2.0.0-rc2'
sc-consensus-pow = '0.8.0-rc6'
sc-basic-authorship = '0.8.0-rc6'
sc-cli = '0.8.0-rc6'
sc-client-api = '2.0.0-rc6'
sc-consensus = '0.8.0-rc6'
sc-executor = '0.8.0-rc6'
sc-network = '0.8.0-rc6'
sc-service = '0.8.0-rc6'
sc-transaction-pool = '2.0.0-rc6'
sp-api = '2.0.0-rc6'
sp-blockchain = '2.0.0-rc6'
sp-consensus = '0.8.0-rc6'
sp-consensus-pow = '0.8.0-rc6'
sp-core = '2.0.0-rc6'
sp-inherents = '2.0.0-rc6'
sp-runtime = '2.0.0-rc6'
sp-timestamp = '2.0.0-rc6'
sp-transaction-pool = '2.0.0-rc6'
sha3pow = {path = './sha3pow'}
hex = "0.4"

Expand Down
18 changes: 9 additions & 9 deletions node/sha3pow/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
authors = ['Anonymous']
edition = '2018'
name = 'sha3pow'
version = '2.0.0-rc2'
version = '2.0.0-rc6'

[dependencies]
parity-scale-codec = '1.3.0'
sha3 = "0.8"
rand = { version = "0.7", features = ["small_rng"] }
sc-consensus = '0.8.0-rc2'
sc-consensus-pow = '0.8.0-rc2'
sc-client-api = '2.0.0-rc2'
sp-api = '2.0.0-rc2'
sp-blockchain = '2.0.0-rc2'
sp-consensus-pow = '0.8.0-rc2'
sp-core = '2.0.0-rc2'
sp-runtime = '2.0.0-rc2'
sc-consensus = '0.8.0-rc6'
sc-consensus-pow = '0.8.0-rc6'
sc-client-api = '2.0.0-rc6'
sp-api = '2.0.0-rc6'
sp-blockchain = '2.0.0-rc6'
sp-consensus-pow = '0.8.0-rc6'
sp-core = '2.0.0-rc6'
sp-runtime = '2.0.0-rc6'
4 changes: 4 additions & 0 deletions node/sha3pow/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ impl<B: BlockT<Hash=H256>> PowAlgorithm<B> for MinimalSha3Algorithm {
&self,
_parent: &BlockId<B>,
pre_hash: &H256,
_pre_digest: Option<&[u8]>,
seal: &RawSeal,
difficulty: Self::Difficulty
) -> Result<bool, Error<B>> {
Expand Down Expand Up @@ -102,6 +103,7 @@ impl<B: BlockT<Hash=H256>> PowAlgorithm<B> for MinimalSha3Algorithm {
&self,
_parent: &BlockId<B>,
pre_hash: &H256,
_pre_digest: Option<&[u8]>,
difficulty: Self::Difficulty,
round: u32 // The number of nonces to try during this call
) -> Result<Option<RawSeal>, Error<B>> {
Expand Down Expand Up @@ -175,6 +177,7 @@ impl<B: BlockT<Hash=H256>, C> PowAlgorithm<B> for Sha3Algorithm<C> where
&self,
_parent: &BlockId<B>,
pre_hash: &H256,
_pre_digest: Option<&[u8]>,
seal: &RawSeal,
difficulty: Self::Difficulty
) -> Result<bool, Error<B>> {
Expand Down Expand Up @@ -207,6 +210,7 @@ impl<B: BlockT<Hash=H256>, C> PowAlgorithm<B> for Sha3Algorithm<C> where
&self,
_parent: &BlockId<B>,
pre_hash: &H256,
_pre_digest: Option<&[u8]>,
difficulty: Self::Difficulty,
round: u32 // The number of nonces to try during this call
) -> Result<Option<RawSeal>, Error<B>> {
Expand Down
2 changes: 1 addition & 1 deletion node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ fn testnet_genesis(
println!("NEW UTXO HASH in UTXOStore onchain: 0xdbc75ab8ee9b83dcbcea4695f9c42754d94e92c3c397d63b1bc627c2a2ef94e6\n");

GenesisConfig {
system: Some(SystemConfig {
frame_system: Some(SystemConfig {
code: WASM_BINARY.to_vec(),
changes_trie_config: Default::default(),
}),
Expand Down
52 changes: 28 additions & 24 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,36 @@
// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.

use sc_cli::{SubstrateCli};
use crate::service;
use crate::chain_spec;
use crate::cli::Cli;
use sc_cli::{SubstrateCli, RuntimeVersion, Role, ChainSpec};
use sc_service::PartialComponents;
use crate::service::new_partial;

impl SubstrateCli for Cli {
fn impl_name() -> &'static str {
"Substrate Node"
fn impl_name() -> String {
"Substrate Node".into()
}

fn impl_version() -> &'static str {
env!("SUBSTRATE_CLI_IMPL_VERSION")
fn impl_version() -> String {
env!("SUBSTRATE_CLI_IMPL_VERSION").into()
}

fn executable_name() -> &'static str {
env!("CARGO_PKG_NAME")
fn executable_name() -> String {
env!("CARGO_PKG_NAME").into()
}

fn author() -> &'static str {
env!("CARGO_PKG_AUTHORS")
fn author() -> String {
env!("CARGO_PKG_AUTHORS").into()
}

fn description() -> &'static str {
env!("CARGO_PKG_DESCRIPTION")
fn description() -> String {
env!("CARGO_PKG_DESCRIPTION").into()
}

fn support_url() -> &'static str {
"support.anonymous.an"
fn support_url() -> String {
"support.anonymous.an".into()
}

fn copyright_start_year() -> i32 {
Expand All @@ -57,6 +59,10 @@ impl SubstrateCli for Cli {
)?),
})
}

fn native_runtime_version(_: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
&utxo_runtime::VERSION
}
}

/// Parse and run command line arguments
Expand All @@ -67,21 +73,19 @@ pub fn run() -> sc_cli::Result<()> {
match &cli.subcommand {
Some(subcommand) => {
let runner = cli.create_runner(subcommand)?;

runner.run_subcommand(
subcommand,
|config| Ok(new_full_start!(config, default_sr25519_public_key).0),
)
runner.run_subcommand(subcommand, |config| {
let PartialComponents { client, backend, task_manager, import_queue, .. }
= new_partial(config)?;
Ok((client, backend, import_queue, task_manager))
})
},
None => {
let sr25519_public_key = cli.run.sr25519_public_key.unwrap_or(default_sr25519_public_key);
let runner = cli.create_runner(&cli.run.base)?;

runner.run_node(
|config| service::new_light(config, sr25519_public_key),
|config| service::new_full(config, sr25519_public_key),
utxo_runtime::VERSION,
)
runner.run_node_until_exit(|config| match config.role {
Role::Light => service::new_light(config, sr25519_public_key),
_ => service::new_full(config, sr25519_public_key),
})
},
}
}
Loading