Skip to content

Commit

Permalink
Merge branch 'development' into core-mempool-optimisations
Browse files Browse the repository at this point in the history
* development:
  feat: covenants implementation (tari-project#3656)
  ci: add tor script to binaries bundle (tari-project#3689)
  • Loading branch information
sdbondi committed Jan 11, 2022
2 parents 4dfe866 + 8dfcf3a commit 21da5f1
Show file tree
Hide file tree
Showing 65 changed files with 3,330 additions and 133 deletions.
51 changes: 14 additions & 37 deletions .github/workflows/base_node_binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ on:

env:
TBN_FILENAME: "tari_base_node"
# PROTOC: protoc

jobs:
builds:
Expand Down Expand Up @@ -95,7 +94,6 @@ jobs:
libappindicator3-dev \
patchelf \
librsvg2-dev
# sudo apt-get -y upgrade
- name: Install macOS dependencies
if: startsWith(runner.os,'macOS')
run: brew install cmake zip coreutils
Expand All @@ -112,28 +110,30 @@ jobs:
echo "SHARUN=shasum --algorithm 256" >> $GITHUB_ENV
echo "CC=gcc" >> $GITHUB_ENV
echo "TBN_EXT=" >> $GITHUB_ENV
echo "S3DESTDIR=linux" >> $GITHUB_ENV
echo "SHELL_EXT=.sh" >> $GITHUB_ENV
echo "PLATFORM_SPECIFIC_DIR=linux" >> $GITHUB_ENV
echo "TBN_DIST=/dist" >> $GITHUB_ENV
- name: Set environment variables - macOS
if: startsWith(runner.os,'macOS')
run: |
echo "S3DESTDIR=osx" >> $GITHUB_ENV
echo "PLATFORM_SPECIFIC_DIR=osx" >> $GITHUB_ENV
- name: Set environment variables - Windows
if: startsWith(runner.os,'Windows')
shell: bash
run: |
echo "SHARUN=pwsh C:\ProgramData\chocolatey\lib\psutils\tools\psutils-master\shasum.ps1 --algorithm 256" >> $GITHUB_ENV
echo "TBN_EXT=.exe" >> $GITHUB_ENV
echo "SHELL_EXT=.bat" >> $GITHUB_ENV
echo "TBN_DIST=\dist" >> $GITHUB_ENV
echo "S3DESTDIR=windows" >> $GITHUB_ENV
echo "PLATFORM_SPECIFIC_DIR=windows" >> $GITHUB_ENV
echo "SQLITE3_LIB_DIR=C:\vcpkg\installed\x64-windows\lib" >> $GITHUB_ENV
echo "OPENSSL_DIR=C:\Program Files\OpenSSL-Win64" >> $GITHUB_ENV
echo "LIBCLANG_PATH=C:\Program Files\LLVM\bin" >> $GITHUB_ENV
echo "C:\Strawberry\perl\bin" >> $GITHUB_PATH
- name: Caching
- name: Cache cargo files and outputs
uses: actions/cache@v2
with:
path: |
Expand All @@ -142,50 +142,27 @@ jobs:
target
key: ${{ runner.os }}-${{ matrix.os }}-${{ matrix.target_cpu }}-${{ matrix.features }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}

- name: Compile NPM
- name: Compile launchpad GUI
run: |
cd applications/launchpad/gui-vue
npm install
npm run build
- name: Compile react (collectibles)
- name: Compile collectibles GUI
run: |
cd applications/tari_collectibles/web-app
npm install
npm run build
- name: Build binaries
- name: Build rust binaries
env:
RUSTFLAGS: "-C target_cpu=${{ matrix.target_cpu }}"
ROARING_ARCH: "${{ matrix.target_cpu }}"
run: |
echo "Cache Key: ${{ runner.os }}-${{ matrix.os }}-${{ matrix.target_cpu }}-${{ matrix.features }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}"
#cd applications/tari_base_node
#cargo build --release --bin tari_base_node --features ${{ matrix.features}}
cargo build --release
# - name: Build tauri apps
# env:
# RUSTFLAGS: "-C target_cpu=${{ matrix.target_cpu }}"
# run: |
# echo "Cache Key: ${{ runner.os }}-${{ matrix.os }}-${{ matrix.target_cpu }}-${{ matrix.features }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}"
# cd applications/tari_collectibles
# npm install
# cd web-app
# npm install
# cd ..
# npm run tauri build

# - name: Prepare Archives
# - name: Prepare Archives
# shell: bash
# run: |
# ls -la "$GITHUB_WORKSPACE"
# mkdir -p "$GITHUB_WORKSPACE${TBN_DIST}/archives"
# export distDir="$GITHUB_WORKSPACE${TBN_DIST}/archives"
# "$GITHUB_WORKSPACE/scripts/build_dists_tarball.sh" noBuild

- name: Prepare binaries
- name: Copy binaries to folder for zipping
shell: bash
run: |
mkdir -p "$GITHUB_WORKSPACE${TBN_DIST}"
Expand All @@ -195,18 +172,18 @@ jobs:
echo "Sha: ${VSHA_SHORT}"
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "VSHA_SHORT=${VSHA_SHORT}" >> $GITHUB_ENV
#BINFILE="${TBN_FILENAME}-${VERSION}-${VSHA_SHORT}-${{ matrix.os }}-${{ matrix.target_cpu }}-${{ matrix.features }}${TBN_EXT}"
BINFILE="${TBN_FILENAME}-${VERSION}-${VSHA_SHORT}-${{ matrix.os }}-${{ matrix.target_cpu }}${TBN_EXT}"
echo "BINFILE=${BINFILE}" >> $GITHUB_ENV
echo "Copying files for ${BINFILE} to $(pwd)"
#cp -v "$GITHUB_WORKSPACE/target/release/${TBN_FILENAME}${TBN_EXT}" "./${BINFILE}"
ls -la "$GITHUB_WORKSPACE/target/release/"
cp -v "$GITHUB_WORKSPACE/target/release/tari_base_node${TBN_EXT}" .
cp -v "$GITHUB_WORKSPACE/target/release/tari_console_wallet${TBN_EXT}" .
cp -v "$GITHUB_WORKSPACE/target/release/tari_merge_mining_proxy${TBN_EXT}" .
cp -v "$GITHUB_WORKSPACE/target/release/tari_mining_node${TBN_EXT}" .
cp -v "$GITHUB_WORKSPACE/target/release/tari_validator_node${TBN_EXT}" .
cp -v "$GITHUB_WORKSPACE/target/release/tari_collectibles${TBN_EXT}" .
cp -v "$GITHUB_WORKSPACE/target/release/tari_launchpad${TBN_EXT}" .
cp -v "$GITHUB_WORKSPACE/applications/tari_base_node/${PLATFORM_SPECIFIC_DIR}/runtime/start_tor${SHELL_EXT}" .
- name: Build the macos pkg
if: startsWith(runner.os,'macOS')
Expand Down Expand Up @@ -310,7 +287,7 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SOURCE: "${{ github.workspace }}${{ env.TBN_DIST }}"
DEST_DIR: "${{ env.S3DESTOVERRIDE }}${{ env.S3DESTDIR }}/"
DEST_DIR: "${{ env.S3DESTOVERRIDE }}${{ env.PLATFORM_SPECIFIC_DIR }}/"
S3CMD: "cp"
S3OPTIONS: '--recursive --exclude "*" --include "*.zip*"'
# S3OPTIONS: '--recursive --exclude "*" --include "*.zip*"'
Expand Down Expand Up @@ -346,7 +323,7 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SOURCE: "${{ github.workspace }}${{ env.TBN_DIST }}"
DEST_DIR: "${{ env.S3DESTOVERRIDE }}${{ env.S3DESTDIR }}/"
DEST_DIR: "${{ env.S3DESTOVERRIDE }}${{ env.PLATFORM_SPECIFIC_DIR }}/"
S3CMD: "cp"
S3OPTIONS: '--recursive --exclude "*" --include "*.zip*"'
# S3OPTIONS: '--recursive --exclude "*" --include "*.zip*"'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ The executables will either be inside your `~/tari/target/release` (on Linux) or
directory, depending on the build choice above, and must be run from the command line. If the former build method was
used, you can run it from that directory, or you more likely want to copy it somewhere more convenient. Make sure to
start Tor service `~/tari/applications/tari_base_node/osx/start_tor` (on Mac),
`~/tari/applications/tari_base_node/ubuntu/start_tor` (on Linux) or
`~/tari/applications/tari_base_node/linux/start_tor` (on Linux) or
`%USERPROFILE%\Code\tari\applications\tari_base_node\windows\start_tor.lnk` (on Windows).
To run from any directory of your choice, where the executable is visible in the path (first time use):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ fi

#gnome-terminal --working-directory="$PWD" -- tor --allow-missing-torrc --ignore-missing-torrc \
# --clientonly 1 --socksport 9050 --controlport 127.0.0.1:9051 \
# --log "notice stdout" --clientuseipv6 1 "${no_output}"
# --log "warn stdout" --clientuseipv6 1 "${no_output}"

gnome-terminal --working-directory="$PWD" -- tor --allow-missing-torrc --ignore-missing-torrc \
--clientonly 1 --socksport 9050 --controlport 127.0.0.1:9051 \
--log "notice stdout" --clientuseipv6 1
--log "warn stdout" --clientuseipv6 1

1 change: 1 addition & 0 deletions applications/tari_base_node/linux/setup_tor_service
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./runtime/setup_tor_service.sh
1 change: 1 addition & 0 deletions applications/tari_base_node/linux/start_all
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./runtime/start_all.sh
1 change: 1 addition & 0 deletions applications/tari_base_node/linux/start_tari_base_node
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./runtime/start_tari_base_node.sh
1 change: 1 addition & 0 deletions applications/tari_base_node/linux/start_tor
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./runtime/start_tor.sh
2 changes: 1 addition & 1 deletion applications/tari_base_node/osx/runtime/start_tor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
TOR=$(which tor)
$TOR --allow-missing-torrc --ignore-missing-torrc \
--clientonly 1 --socksport 9050 --controlport 127.0.0.1:9051 \
--log "notice stdout" --clientuseipv6 1
--log "warn stdout" --clientuseipv6 1
2 changes: 1 addition & 1 deletion applications/tari_base_node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
/// ```
/// tor --allow-missing-torrc --ignore-missing-torrc \
/// --clientonly 1 --socksport 9050 --controlport 127.0.0.1:9051 \
/// --log "notice stdout" --clientuseipv6 1
/// --log "warn stdout" --clientuseipv6 1
/// ```
///
/// For the first run
Expand Down
1 change: 0 additions & 1 deletion applications/tari_base_node/ubuntu/setup_tor_service

This file was deleted.

1 change: 0 additions & 1 deletion applications/tari_base_node/ubuntu/start_all

This file was deleted.

1 change: 0 additions & 1 deletion applications/tari_base_node/ubuntu/start_tari_base_node

This file was deleted.

1 change: 0 additions & 1 deletion applications/tari_base_node/ubuntu/start_tor

This file was deleted.

2 changes: 1 addition & 1 deletion applications/tari_base_node/windows/runtime/start_tor.bat
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if not defined TOR_RUNNING (
pause
)
)
start tor --allow-missing-torrc --ignore-missing-torrc --clientonly 1 --socksport 9050 --controlport 127.0.0.1:9051 --clientuseipv6 1 --log "notice stdout"
start tor --allow-missing-torrc --ignore-missing-torrc --clientonly 1 --socksport 9050 --controlport 127.0.0.1:9051 --clientuseipv6 1 --log "warn stdout"
echo Attempting to start Tor service on ports 9050 and 9051
ping -n 15 localhost>nul
) else (
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./runtime/start_tari_console_wallet.sh

This file was deleted.

5 changes: 2 additions & 3 deletions base_layer/core/src/consensus/consensus_constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use tari_common::configuration::Network;
use tari_crypto::{script, tari_utilities::epoch_time::EpochTime};

use crate::{
consensus::{network::NetworkConsensus, ConsensusEncodingSized, ConsensusEncodingWrapper},
consensus::{network::NetworkConsensus, ConsensusEncodingSized},
proof_of_work::{Difficulty, PowAlgorithm},
transactions::{
tari_amount::{uT, MicroTari, T},
Expand Down Expand Up @@ -143,8 +143,7 @@ impl ConsensusConstants {
pub fn coinbase_weight(&self) -> u64 {
// TODO: We do not know what script, features etc a coinbase has - this should be max coinbase size?
let metadata_size = self.transaction_weight.round_up_metadata_size(
ConsensusEncodingWrapper::wrap(&script![Nop]).consensus_encode_exact_size() +
OutputFeatures::default().consensus_encode_exact_size(),
script![Nop].consensus_encode_exact_size() + OutputFeatures::default().consensus_encode_exact_size(),
);
self.transaction_weight.calculate(1, 0, 1, metadata_size)
}
Expand Down
Loading

0 comments on commit 21da5f1

Please sign in to comment.