Skip to content

Commit

Permalink
Merge branch 'main' into revert_rust_version_fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
AurelienFT authored Jan 17, 2022
2 parents 3a80485 + ea22806 commit a0e948e
Show file tree
Hide file tree
Showing 11 changed files with 263 additions and 232 deletions.
125 changes: 30 additions & 95 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,21 @@ env:
RUST_BACKTRACE: full

jobs:
# The 3 following build jobs are 90% copy-pasted and should be refactored using
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
linux:
runs-on: ubuntu-latest
release:
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
name: release_linux.tar.gz
- os: windows-latest
target: x86_64-pc-windows-msvc
name: release_windows.zip
- os: macOS-latest
target: x86_64-apple-darwin
name: release_macos.tar.gz
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -22,108 +33,32 @@ jobs:
with:
profile: minimal
toolchain: nightly
target: "x86_64-unknown-linux-musl"
target: ${{ matrix.target }}
override: true
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/cargo@v1
with:
command: build
args: --release
- run: |
- name: Package
shell: bash
run: |
mkdir massa && cd massa && mkdir massa-node && mkdir massa-client
cp -v ../target/release/massa-node massa-node/massa-node
cp -v ../target/release/massa-client massa-client/massa-client
cp -rv ../massa-node/config massa-node/config
cp -rv ../massa-node/base_config massa-node/base_config
cp -rv ../massa-node/storage massa-node/storage
cp -rv ../massa-client/base_config massa-client/base_config
- uses: actions/upload-artifact@v2
with:
name: release_linux
path: massa/

windows:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: "recursive"
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
target: "x86_64-pc-windows-gnu"
override: true
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/cargo@v1
cd ..
if [[ "${{ matrix.os }}" == "windows-latest" ]]
then
7z a ${{ matrix.name }} massa
else
tar czvf ${{ matrix.name }} massa
fi
cd -
- name: Publish
uses: softprops/action-gh-release@v1
with:
command: build
args: --release
- run: |
mkdir massa && cd massa && mkdir massa-node && mkdir massa-client
cp -v ../target/release/massa-node massa-node/massa-node.exe
cp -v ../target/release/massa-client massa-client/massa-client.exe
cp -rv ../massa-node/config massa-node/config
cp -rv ../massa-node/base_config massa-node/base_config
cp -rv ../massa-node/storage massa-node/storage
cp -rv ../massa-client/base_config massa-client/base_config
- uses: actions/upload-artifact@v2
with:
name: release_windows
path: massa/

macos:
runs-on: ubuntu-latest
container:
image: massalabs/linux-ci
steps:
- uses: actions/checkout@v2
- run: |
export HOME=/root
rustup update
rustup default nightly
rustup target add x86_64-apple-darwin
cargo update
rm -rf massa/*
mkdir -p massa/massa-node/
CC=o64-clang CXX=o64-clang++ cargo build --release --target x86_64-apple-darwin
cd massa/
mkdir massa-client
cp -v ../target/x86_64-apple-darwin/release/massa-node ./massa-node/massa-node
cp -rv ../massa-node/config ./massa-node/config
cp -rv ../massa-node/base_config ./massa-node/base_config
cp -rv ../massa-node/storage ./massa-node/storage
cp -v ../target/x86_64-apple-darwin/release/massa-client ./massa-client/massa-client
cp -rv ../massa-client/base_config ./massa-client/base_config
- uses: actions/upload-artifact@v2
with:
name: release_macos
path: massa/

release:
runs-on: ubuntu-latest
needs: [linux, windows, macos]
steps:
- uses: actions/[email protected]
with:
name: release_macos
path: release_macos
- uses: actions/[email protected]
with:
name: release_windows
path: release_windows
- uses: actions/[email protected]
with:
name: release_linux
path: release_linux
- run: |
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
tar -czvf massa_${RELEASE_VERSION}_linux.tar.gz release_linux
tar -czvf massa_${RELEASE_VERSION}_windows.tar.gz release_windows
tar -czvf massa_${RELEASE_VERSION}_macos.tar.gz release_macos
- uses: softprops/action-gh-release@v1
with:
files: |
release_linux.tar.gz
release_darwin.tar.gz
release_windows.tar.gz
files: 'release_*'
14 changes: 9 additions & 5 deletions massa-client/src/cmds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -612,14 +612,18 @@ impl Command {
}
Command::when_episode_ends => {
let end = match client.public.get_status().await {
Ok(node_status) => node_status.consensus_stats.end_timespan,
Ok(node_status) => node_status.config.end_timestamp,
Err(e) => bail!("RpcError: {}", e),
};
let (days, hours, mins, secs) = end
.saturating_sub(MassaTime::now()?)
.days_hours_mins_secs()?; // compensation millis is zero
let mut res = "".to_string();
res.push_str(&format!("{} days, {} hours, {} minutes, {} seconds remaining until the end of the current episode", days, hours, mins, secs));
if let Some(e) = end {
let (days, hours, mins, secs) =
e.saturating_sub(MassaTime::now()?).days_hours_mins_secs()?; // compensation millis is zero

res.push_str(&format!("{} days, {} hours, {} minutes, {} seconds remaining until the end of the current episode", days, hours, mins, secs));
} else {
res.push_str("There is no end !")
}
if !json {
println!("{}", res);
}
Expand Down
2 changes: 1 addition & 1 deletion massa-consensus/endorsements.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Goal

Endorsements are included in a block's header. They are created by randomly selected endorsers chosen amon the stakers (including the block creator) to endorse the block's parent in the same thread. The block's total fee and reward are split between the block creator, the endorsers, and the creator of the endorsed block.
Endorsements are included in a block's header. They are created by randomly selected endorsers chosen among the stakers (including the block creator) to endorse the block's parent in the same thread. The block's total fee and reward are split between the block creator, the endorsers, and the creator of the endorsed block.

With that mechanism it becomes harder to gain control of the network (you now have to control `endorsement_count + 1` draw to gain control over one block) and to reward stakers more frequently.

Expand Down
22 changes: 11 additions & 11 deletions massa-consensus/src/block_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,35 +51,35 @@ impl HeaderOrBlock {
}
}

/// Agregated changes made during a block's execution
/// Aggregated changes made during a block's execution
#[derive(Debug, Clone)]
pub struct BlockStateAccumulator {
/// Addresses impacted by ledger updates
pub loaded_ledger_addrs: AddressHashSet,
/// Subset of the ledger. Contains only data in the thread of the given block
pub ledger_thread_subset: LedgerSubset,
/// Cummulative changes made during that block execution
/// Cumulative changes made during that block execution
pub ledger_changes: LedgerChanges,
/// Addresses impacted by roll updates
pub loaded_roll_addrs: AddressHashSet,
/// Current roll counts for these addresses
pub roll_counts: RollCounts,
/// Roll updates that happened during that block execution
pub roll_updates: RollUpdates,
/// Roll updates that happend during current cycle
/// Roll updates that happened during current cycle
pub cycle_roll_updates: RollUpdates,
/// Cycle of the parent in the same thread
pub same_thread_parent_cycle: u64,
/// Address of the parent in the same thread
pub same_thread_parent_creator: Address,
/// Adresses of that block endorsers
/// Addresses of that block endorsers
pub endorsers_addresses: Vec<Address>,
}

/// Block that was checked as final, with some useful precomputed data
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ActiveBlock {
/// The cretor's address
/// The creator's address
pub creator_address: Address,
/// The block itself, as it was created
pub block: Block,
Expand All @@ -92,7 +92,7 @@ pub struct ActiveBlock {
pub dependencies: BlockHashSet,
/// Blocks id that have this block as an ancestor
pub descendants: BlockHashSet,
/// ie has its fitness reached the given thresold
/// ie has its fitness reached the given threshold
pub is_final: bool,
/// Changes caused by this block
pub block_ledger_changes: LedgerChanges,
Expand All @@ -118,7 +118,7 @@ impl ActiveBlock {
}

/// Exportable version of ActiveBlock
/// Fields that can be easily recomuted were left out
/// Fields that can be easily recomputed were left out
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ExportActiveBlock {
/// The block itself, as it was created
Expand All @@ -130,7 +130,7 @@ pub struct ExportActiveBlock {
pub children: Vec<BlockHashMap<u64>>,
/// dependencies required for validity check
pub dependencies: BlockHashSet,
/// ie has its fitness reached the given thresold
/// ie has its fitness reached the given threshold
pub is_final: bool,
/// Changes caused by this block
pub block_ledger_changes: LedgerChanges,
Expand Down Expand Up @@ -1195,7 +1195,7 @@ impl BlockGraph {
})
}

/// Try to apply an operation in the contexxt of the block
/// Try to apply an operation in the context of the block
///
/// # Arguments
/// * state_accu: where the changes are accumulated while we go through the block
Expand Down Expand Up @@ -1566,7 +1566,7 @@ impl BlockGraph {
Ok(accu)
}

/// Gets lastest final blocks (hash, period) for each thread.
/// Gets latest final blocks (hash, period) for each thread.
pub fn get_latest_final_blocks_periods(&self) -> &Vec<(BlockId, u64)> {
&self.latest_final_blocks_periods
}
Expand Down Expand Up @@ -1736,7 +1736,7 @@ impl BlockGraph {
Ok((cur_rolls, cur_cycle_roll_updates))
}

/// gets Ledger data export for given Addressses
/// gets Ledger data export for given Addressees
pub fn get_ledger_data_export(
&self,
addresses: &AddressHashSet,
Expand Down
2 changes: 1 addition & 1 deletion massa-consensus/src/consensus_worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1202,7 +1202,7 @@ impl ConsensusWorker {
self.block_db.get_operations(operation_ids)
}

/// Manages received protocolevents.
/// Manages received protocol events.
///
/// # Arguments
/// * event: event type to process.
Expand Down
Loading

0 comments on commit a0e948e

Please sign in to comment.