Skip to content

Commit

Permalink
Merge pull request #3 from comit-network/update-upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaseizinger authored May 4, 2021
2 parents 44672f8 + ce9b9c6 commit 0aff97f
Show file tree
Hide file tree
Showing 22 changed files with 1,810 additions and 486 deletions.
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "cargo"
directory: "/"
schedule:
interval: "daily"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
88 changes: 88 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

env:
CARGO_TERM_COLOR: always

jobs:

static_analysis:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Run Rustfmt
run: cargo fmt -- --check

- name: Run Clippy
run: cargo clippy --workspace --all-targets -- -D warnings

build:

strategy:
matrix:
rust: [
stable,
nightly
]

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Install Rust ${{ matrix.rust }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
profile: minimal

- uses: Swatinem/[email protected]

- name: Install libboost
run: sudo apt-get install libboost-dev

- name: Build
run: cargo build --verbose

- name: Build with feature 'serde_support'
run: cargo build --verbose --features serde_support

- name: Build with feature 'strict_encoding_support'
run: cargo build --verbose --features strict_encoding_support

- name: Build wasm with all features
run: cargo build --verbose --all-features

test:

strategy:
matrix:
rust: [
stable,
nightly
]

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Install Rust ${{ matrix.rust }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
profile: minimal

- uses: Swatinem/[email protected]

- run: cargo test --verbose --all-features
12 changes: 0 additions & 12 deletions .travis.yml

This file was deleted.

5 changes: 1 addition & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "monero"
description = "Rust Monero Library."
keywords = ["monero"]
version = "0.11.2"
version = "0.12.0"
authors = ["h4sh3d <[email protected]>"]
license = "MIT"
homepage = "https://github.com/monero-rs/monero-rs"
Expand Down Expand Up @@ -48,9 +48,6 @@ default-features = false
rand = { version = "0.7", features = ["std"] }
serde_json = "1"

[badges]
travis-ci = { repository = "monero-rs/monero-rs", branch = "master" }

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
[![Build Status](https://travis-ci.com/monero-rs/monero-rs.svg?branch=master)](https://travis-ci.com/monero-rs/monero-rs) [![unsafe forbidden](https://img.shields.io/badge/unsafe-forbidden-success.svg)](https://github.com/rust-secure-code/safety-dance/) [![Crates.io](https://img.shields.io/crates/v/monero.svg)](https://crates.io/crates/monero) [![Documentation](https://docs.rs/monero/badge.svg)](https://docs.rs/monero) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Build Status](https://img.shields.io/github/workflow/status/monero-rs/monero-rs/CI/main)](https://github.com/monero-rs/monero-rs/actions/workflows/ci.yml)
[![unsafe forbidden](https://img.shields.io/badge/unsafe-forbidden-success.svg)](https://github.com/rust-secure-code/safety-dance/)
[![Crates.io](https://img.shields.io/crates/v/monero.svg)](https://crates.io/crates/monero)
[![Documentation](https://docs.rs/monero/badge.svg)](https://docs.rs/monero)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Rust Monero Library
===
Expand Down
28 changes: 16 additions & 12 deletions src/blockdata/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
// copies or substantial portions of the Software.
//

//! Block and block header
//! Block and block header structures.
//!
//! This module defines structures of blocks.
//! This module defines structures for manipulating Monero blocks. A block is composed of an
//! [`Header`](BlockHeader), the miner [`Transaction`], and a list of transactions'
//! [`Hash`](hash::Hash) included in the block.
//!
use crate::blockdata::transaction::Transaction;
Expand All @@ -25,19 +27,20 @@ use crate::cryptonote::hash;
use serde::{Deserialize, Serialize};
use std::fmt;

/// Monero block header
/// A block header containing the version, the mining timestamp, the previous block hash and the
/// nonce.
#[derive(Debug, Clone, Default)]
#[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))]
pub struct BlockHeader {
/// Major version, defines the consensus rules
/// Major version, defines the consensus rules.
pub major_version: VarInt,
/// Minor version, also used to vote
/// Minor version, also used to vote.
pub minor_version: VarInt,
/// Block timestamp
/// Block mining timestamp.
pub timestamp: VarInt,
/// Previous block hash
/// Previous block hash.
pub prev_id: hash::Hash,
/// Nonce
/// The nonce used for the proof of work.
pub nonce: u32,
}

Expand All @@ -60,15 +63,16 @@ impl_consensus_encoding!(
nonce
);

/// Monero block with all transaction hashes
/// A full block with the mining transaction and the commitments (hash) to all included
/// transaction.
#[derive(Debug, Clone, Default)]
#[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))]
pub struct Block {
/// The block header
/// The block header.
pub header: BlockHeader,
/// Coinbase transaction
/// The coinbase transaction (mining transaction).
pub miner_tx: Transaction,
/// List of included transactions
/// List of included transactions within this block, only hashes are store.
pub tx_hashes: Vec<hash::Hash>,
}

Expand Down
10 changes: 3 additions & 7 deletions src/blockdata/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,11 @@
// copies or substantial portions of the Software.
//

//! Blockdata consensus structures
//! Blockdata consensus structures.
//!
//! This module defines structures and functions for storing transactions which
//! make up the Monero system. Primites like Monero transactions and blocks are
//! under this module.
//! This module defines structures and functions for manipulating transactions which constitute the
//! Monero blockchain. Primites like Monero transactions and blocks are under this module.
//!
pub mod block;
pub mod transaction;

pub use block::Block;
pub use transaction::{Transaction, TransactionPrefix, TxIn, TxOut};
Loading

0 comments on commit 0aff97f

Please sign in to comment.