Skip to content

Commit a0e948e

Browse files
authored
Merge branch 'main' into revert_rust_version_fixed
2 parents 3a80485 + ea22806 commit a0e948e

File tree

11 files changed

+263
-232
lines changed

11 files changed

+263
-232
lines changed

.github/workflows/cd.yml

Lines changed: 30 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,21 @@ env:
1010
RUST_BACKTRACE: full
1111

1212
jobs:
13-
# The 3 following build jobs are 90% copy-pasted and should be refactored using
14-
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
15-
linux:
16-
runs-on: ubuntu-latest
13+
release:
14+
strategy:
15+
matrix:
16+
os: [ubuntu-latest, macOS-latest, windows-latest]
17+
include:
18+
- os: ubuntu-latest
19+
target: x86_64-unknown-linux-musl
20+
name: release_linux.tar.gz
21+
- os: windows-latest
22+
target: x86_64-pc-windows-msvc
23+
name: release_windows.zip
24+
- os: macOS-latest
25+
target: x86_64-apple-darwin
26+
name: release_macos.tar.gz
27+
runs-on: ${{ matrix.os }}
1728
steps:
1829
- uses: actions/checkout@v2
1930
with:
@@ -22,108 +33,32 @@ jobs:
2233
with:
2334
profile: minimal
2435
toolchain: nightly
25-
target: "x86_64-unknown-linux-musl"
36+
target: ${{ matrix.target }}
2637
override: true
2738
- uses: Swatinem/rust-cache@v1
2839
- uses: actions-rs/cargo@v1
2940
with:
3041
command: build
3142
args: --release
32-
- run: |
43+
- name: Package
44+
shell: bash
45+
run: |
3346
mkdir massa && cd massa && mkdir massa-node && mkdir massa-client
3447
cp -v ../target/release/massa-node massa-node/massa-node
3548
cp -v ../target/release/massa-client massa-client/massa-client
3649
cp -rv ../massa-node/config massa-node/config
3750
cp -rv ../massa-node/base_config massa-node/base_config
3851
cp -rv ../massa-node/storage massa-node/storage
3952
cp -rv ../massa-client/base_config massa-client/base_config
40-
- uses: actions/upload-artifact@v2
41-
with:
42-
name: release_linux
43-
path: massa/
44-
45-
windows:
46-
runs-on: ubuntu-latest
47-
steps:
48-
- uses: actions/checkout@v2
49-
with:
50-
submodules: "recursive"
51-
- uses: actions-rs/toolchain@v1
52-
with:
53-
profile: minimal
54-
toolchain: nightly
55-
target: "x86_64-pc-windows-gnu"
56-
override: true
57-
- uses: Swatinem/rust-cache@v1
58-
- uses: actions-rs/cargo@v1
53+
cd ..
54+
if [[ "${{ matrix.os }}" == "windows-latest" ]]
55+
then
56+
7z a ${{ matrix.name }} massa
57+
else
58+
tar czvf ${{ matrix.name }} massa
59+
fi
60+
cd -
61+
- name: Publish
62+
uses: softprops/action-gh-release@v1
5963
with:
60-
command: build
61-
args: --release
62-
- run: |
63-
mkdir massa && cd massa && mkdir massa-node && mkdir massa-client
64-
cp -v ../target/release/massa-node massa-node/massa-node.exe
65-
cp -v ../target/release/massa-client massa-client/massa-client.exe
66-
cp -rv ../massa-node/config massa-node/config
67-
cp -rv ../massa-node/base_config massa-node/base_config
68-
cp -rv ../massa-node/storage massa-node/storage
69-
cp -rv ../massa-client/base_config massa-client/base_config
70-
- uses: actions/upload-artifact@v2
71-
with:
72-
name: release_windows
73-
path: massa/
74-
75-
macos:
76-
runs-on: ubuntu-latest
77-
container:
78-
image: massalabs/linux-ci
79-
steps:
80-
- uses: actions/checkout@v2
81-
- run: |
82-
export HOME=/root
83-
rustup update
84-
rustup default nightly
85-
rustup target add x86_64-apple-darwin
86-
cargo update
87-
rm -rf massa/*
88-
mkdir -p massa/massa-node/
89-
CC=o64-clang CXX=o64-clang++ cargo build --release --target x86_64-apple-darwin
90-
cd massa/
91-
mkdir massa-client
92-
cp -v ../target/x86_64-apple-darwin/release/massa-node ./massa-node/massa-node
93-
cp -rv ../massa-node/config ./massa-node/config
94-
cp -rv ../massa-node/base_config ./massa-node/base_config
95-
cp -rv ../massa-node/storage ./massa-node/storage
96-
cp -v ../target/x86_64-apple-darwin/release/massa-client ./massa-client/massa-client
97-
cp -rv ../massa-client/base_config ./massa-client/base_config
98-
- uses: actions/upload-artifact@v2
99-
with:
100-
name: release_macos
101-
path: massa/
102-
103-
release:
104-
runs-on: ubuntu-latest
105-
needs: [linux, windows, macos]
106-
steps:
107-
- uses: actions/download-artifact@v2.0.10
108-
with:
109-
name: release_macos
110-
path: release_macos
111-
- uses: actions/download-artifact@v2.0.10
112-
with:
113-
name: release_windows
114-
path: release_windows
115-
- uses: actions/download-artifact@v2.0.10
116-
with:
117-
name: release_linux
118-
path: release_linux
119-
- run: |
120-
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
121-
tar -czvf massa_${RELEASE_VERSION}_linux.tar.gz release_linux
122-
tar -czvf massa_${RELEASE_VERSION}_windows.tar.gz release_windows
123-
tar -czvf massa_${RELEASE_VERSION}_macos.tar.gz release_macos
124-
- uses: softprops/action-gh-release@v1
125-
with:
126-
files: |
127-
release_linux.tar.gz
128-
release_darwin.tar.gz
129-
release_windows.tar.gz
64+
files: 'release_*'

massa-client/src/cmds.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -612,14 +612,18 @@ impl Command {
612612
}
613613
Command::when_episode_ends => {
614614
let end = match client.public.get_status().await {
615-
Ok(node_status) => node_status.consensus_stats.end_timespan,
615+
Ok(node_status) => node_status.config.end_timestamp,
616616
Err(e) => bail!("RpcError: {}", e),
617617
};
618-
let (days, hours, mins, secs) = end
619-
.saturating_sub(MassaTime::now()?)
620-
.days_hours_mins_secs()?; // compensation millis is zero
621618
let mut res = "".to_string();
622-
res.push_str(&format!("{} days, {} hours, {} minutes, {} seconds remaining until the end of the current episode", days, hours, mins, secs));
619+
if let Some(e) = end {
620+
let (days, hours, mins, secs) =
621+
e.saturating_sub(MassaTime::now()?).days_hours_mins_secs()?; // compensation millis is zero
622+
623+
res.push_str(&format!("{} days, {} hours, {} minutes, {} seconds remaining until the end of the current episode", days, hours, mins, secs));
624+
} else {
625+
res.push_str("There is no end !")
626+
}
623627
if !json {
624628
println!("{}", res);
625629
}

massa-consensus/endorsements.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Goal
44

5-
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.
5+
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.
66

77
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.
88

massa-consensus/src/block_graph.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,35 +51,35 @@ impl HeaderOrBlock {
5151
}
5252
}
5353

54-
/// Agregated changes made during a block's execution
54+
/// Aggregated changes made during a block's execution
5555
#[derive(Debug, Clone)]
5656
pub struct BlockStateAccumulator {
5757
/// Addresses impacted by ledger updates
5858
pub loaded_ledger_addrs: AddressHashSet,
5959
/// Subset of the ledger. Contains only data in the thread of the given block
6060
pub ledger_thread_subset: LedgerSubset,
61-
/// Cummulative changes made during that block execution
61+
/// Cumulative changes made during that block execution
6262
pub ledger_changes: LedgerChanges,
6363
/// Addresses impacted by roll updates
6464
pub loaded_roll_addrs: AddressHashSet,
6565
/// Current roll counts for these addresses
6666
pub roll_counts: RollCounts,
6767
/// Roll updates that happened during that block execution
6868
pub roll_updates: RollUpdates,
69-
/// Roll updates that happend during current cycle
69+
/// Roll updates that happened during current cycle
7070
pub cycle_roll_updates: RollUpdates,
7171
/// Cycle of the parent in the same thread
7272
pub same_thread_parent_cycle: u64,
7373
/// Address of the parent in the same thread
7474
pub same_thread_parent_creator: Address,
75-
/// Adresses of that block endorsers
75+
/// Addresses of that block endorsers
7676
pub endorsers_addresses: Vec<Address>,
7777
}
7878

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

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

1198-
/// Try to apply an operation in the contexxt of the block
1198+
/// Try to apply an operation in the context of the block
11991199
///
12001200
/// # Arguments
12011201
/// * state_accu: where the changes are accumulated while we go through the block
@@ -1566,7 +1566,7 @@ impl BlockGraph {
15661566
Ok(accu)
15671567
}
15681568

1569-
/// Gets lastest final blocks (hash, period) for each thread.
1569+
/// Gets latest final blocks (hash, period) for each thread.
15701570
pub fn get_latest_final_blocks_periods(&self) -> &Vec<(BlockId, u64)> {
15711571
&self.latest_final_blocks_periods
15721572
}
@@ -1736,7 +1736,7 @@ impl BlockGraph {
17361736
Ok((cur_rolls, cur_cycle_roll_updates))
17371737
}
17381738

1739-
/// gets Ledger data export for given Addressses
1739+
/// gets Ledger data export for given Addressees
17401740
pub fn get_ledger_data_export(
17411741
&self,
17421742
addresses: &AddressHashSet,

massa-consensus/src/consensus_worker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1202,7 +1202,7 @@ impl ConsensusWorker {
12021202
self.block_db.get_operations(operation_ids)
12031203
}
12041204

1205-
/// Manages received protocolevents.
1205+
/// Manages received protocol events.
12061206
///
12071207
/// # Arguments
12081208
/// * event: event type to process.

0 commit comments

Comments
 (0)