Skip to content

Commit

Permalink
Merge branch 'development' into sw_fix_hide_unmined_coinbase
Browse files Browse the repository at this point in the history
  • Loading branch information
SWvheerden committed Feb 26, 2024
2 parents d5411ce + 19a824d commit bc8edce
Show file tree
Hide file tree
Showing 31 changed files with 321 additions and 56 deletions.
12 changes: 12 additions & 0 deletions .config/nextest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,15 @@ slow-timeout = { period = "60s", terminate-after=2}

[profile.ci.junit] # this can be some other profile, too
path = "junit.xml"

[profile.intellij]
retries = 0
slow-timeout = { period = "30s" }
failure-output = "immediate-final"
fail-fast = false

[profile.intellij.junit] # this can be some other profile, too
path = "junit.xml"



2 changes: 2 additions & 0 deletions .github/workflows/base_node_binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,10 @@ jobs:
run: |
source buildtools/multinet_envs.sh ${{ env.GHA_NETWORK }}
echo ${TARI_NETWORK}
echo ${TARI_TARGET_NETWORK}
echo ${TARI_NETWORK_DIR}
echo "TARI_NETWORK=${TARI_NETWORK}" >> $GITHUB_ENV
echo "TARI_TARGET_NETWORK=${TARI_TARGET_NETWORK}" >> $GITHUB_ENV
echo "TARI_NETWORK_DIR=${TARI_NETWORK_DIR}" >> $GITHUB_ENV
echo "TARI_NETWORK_DIR=${TARI_NETWORK_DIR}" >> $GITHUB_OUTPUT
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/build_dockers_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ jobs:
source tari/buildtools/multinet_envs.sh ${{github.ref_name}}
echo ${TARI_NETWORK}
echo "TARI_NETWORK=${TARI_NETWORK}" >> $GITHUB_ENV
echo ${TARI_TARGET_NETWORK}
echo "TARI_TARGET_NETWORK=${TARI_TARGET_NETWORK}" >> $GITHUB_ENV
- name: environment setup
shell: bash
Expand Down Expand Up @@ -225,6 +227,7 @@ jobs:
APP_NAME=${{ matrix.builds.app_name }}
APP_EXEC=${{ matrix.builds.app_exec }}
TARI_NETWORK=${{ env.TARI_NETWORK }}
TARI_TARGET_NETWORK=${{ env.TARI_TARGET_NETWORK }}
${{ env.DOCKER_SUBTAG }}
tags: |
${{ steps.meta.outputs.tags }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build_libffis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,10 @@ jobs:
run: |
source buildtools/multinet_envs.sh ${{ github.ref_name }}
echo ${TARI_NETWORK}
echo ${TARI_TARGET_NETWORK}
echo ${TARI_NETWORK_CHANGELOG}
echo "TARI_NETWORK=${TARI_NETWORK}" >> $GITHUB_ENV
echo "TARI_TARGET_NETWORK=${TARI_TARGET_NETWORK}" >> $GITHUB_ENV
echo "TARI_NETWORK_CHANGELOG=${TARI_NETWORK_CHANGELOG}" >> $GITHUB_ENV
- name: Declare Android/iOS envs
Expand Down
18 changes: 15 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,17 @@ jobs:
permissions:
checks: write
pull-requests: write
strategy:
matrix:
tari_target_network: [
{ target: "testnet", network: "esmeralda" },
{ target: "nextnet", network: "nextnet" },
{ target: "mainnet", network: "stagenet" },
]
env:
TARI_TARGET_NETWORK: ${{ matrix.tari_target_network.target }}
TARI_NETWORK: ${{ matrix.tari_target_network.network }}
RUST_LOG: debug
steps:
- name: checkout
uses: actions/checkout@v4
Expand All @@ -192,21 +203,22 @@ jobs:
~/.cargo/registry/CACHEDIR.TAG
~/.cargo/git
target
key: tari-${{ runner.os }}-${{ runner.cpu-model }}-${{ env.toolchain }}-nightly-${{ hashFiles('**/Cargo.lock') }}
key: tari-${{ runner.os }}-${{ runner.cpu-model }}-${{ env.toolchain }}-nightly-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.tari_target_network.target }}
restore-keys: |
tari-${{ runner.os }}-${{ runner.cpu-model }}-${{ env.toolchain }}-nightly-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.tari_target_network.network }}
tari-${{ runner.os }}-${{ runner.cpu-model }}-${{ env.toolchain }}-nightly-${{ hashFiles('**/Cargo.lock') }}
tari-${{ runner.os }}-${{ runner.cpu-model }}-${{ env.toolchain }}-nightly
- name: Install cargo-nextest
run: cargo install cargo-nextest --locked --force
- name: cargo test compile
run: cargo test --no-run --locked --all-features --release
run: cargo test -vv --no-run --locked --all-features --release
- name: cargo test
run: cargo nextest run --all-features --release -E "not package(tari_integration_tests)" --profile ci
- name: upload artifact
uses: actions/upload-artifact@v4 # upload test results as artifact
if: always()
with:
name: test-results
name: test-results-${{ matrix.tari_target_network.target }}.${{ matrix.tari_target_network.network }}
path: ${{ github.workspace }}/target/nextest/ci/junit.xml

# Allows other workflows to know the PR number
Expand Down
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions applications/minotari_app_grpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ tonic = { version = "0.8.3", features = ["tls"]}
zeroize = "1"

[build-dependencies]
tari_features = { path = "../../common/tari_features", version = "1.0.0-pre.9" }
tonic-build = "0.8.4"

[package.metadata.cargo-machete]
Expand Down
3 changes: 3 additions & 0 deletions applications/minotari_app_grpc/build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// Copyright 2022 The Tari Project
// SPDX-License-Identifier: BSD-3-Clause

use tari_features::resolver::build_features;

fn main() -> Result<(), Box<dyn std::error::Error>> {
build_features();
tonic_build::configure().build_client(true).build_server(true).compile(
&[
"proto/base_node.proto",
Expand Down
4 changes: 2 additions & 2 deletions applications/minotari_app_utilities/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ license = "BSD-3-Clause"
tari_common = { path = "../../common" }
tari_common_types = { path = "../../base_layer/common_types" }
tari_comms = { path = "../../comms/core" }
tari_features = { path = "../../common/tari_features" }
tari_features = { path = "../../common/tari_features", version = "1.0.0-pre.9" }
tari_utilities = { version = "0.7" }
minotari_app_grpc = { path = "../minotari_app_grpc", optional = true }

Expand All @@ -27,7 +27,7 @@ tonic = "0.8.3"

[build-dependencies]
tari_common = { path = "../../common", features = ["build", "static-application-info"] }
tari_features = { path = "../../common/tari_features" }
tari_features = { path = "../../common/tari_features", version = "1.0.0-pre.9" }

[features]
miner_input = ["minotari_app_grpc"]
6 changes: 3 additions & 3 deletions applications/minotari_app_utilities/src/network_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ impl From<NetworkCheckError> for ExitError {
}
}

#[cfg(tari_network_mainnet)]
#[cfg(tari_target_network_mainnet)]
pub const TARGET_NETWORK: Target = Target::MainNet;

#[cfg(tari_network_nextnet)]
#[cfg(tari_target_network_nextnet)]
pub const TARGET_NETWORK: Target = Target::NextNet;

#[cfg(all(not(tari_network_mainnet), not(tari_network_nextnet)))]
#[cfg(all(not(tari_target_network_mainnet), not(tari_target_network_nextnet)))]
pub const TARGET_NETWORK: Target = Target::TestNet;

pub fn is_network_choice_valid(network: Network) -> Result<Network, NetworkCheckError> {
Expand Down
2 changes: 1 addition & 1 deletion applications/minotari_console_wallet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ default-features = false
features = ["crossterm"]

[build-dependencies]
tari_features = { path = "../../common/tari_features" }
tari_features = { path = "../../common/tari_features", version = "1.0.0-pre.9" }

[features]
default = ["libtor"]
Expand Down
13 changes: 11 additions & 2 deletions applications/minotari_console_wallet/src/automation/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,10 +409,19 @@ pub async fn make_it_rain(

// Manage transaction submission rate
let actual_ms = (Utc::now() - started_at).num_milliseconds();
let target_ms = (i as f64 / f64::from(transactions_per_second) / 1000.0) as i64;
let target_ms = (i as f64 * (1000.0 / f64::from(transactions_per_second))) as i64;
trace!(
target: LOG_TARGET,
"make-it-rain {}: target {:?} ms vs. actual {:?} ms", i, target_ms, actual_ms
);
if target_ms - actual_ms > 0 {
// Maximum delay between Txs set to 120 s
sleep(Duration::from_millis((target_ms - actual_ms).min(120_000i64) as u64)).await;
let delay_ms = Duration::from_millis((target_ms - actual_ms).min(120_000i64) as u64);
trace!(
target: LOG_TARGET,
"make-it-rain {}: delaying for {:?} ms", i, delay_ms
);
sleep(delay_ms).await;
}
let delayed_for = Instant::now();
let sender_clone = sender.clone();
Expand Down
2 changes: 1 addition & 1 deletion applications/minotari_merge_mining_proxy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ tracing = "0.1"
url = "2.1.1"

[build-dependencies]
tari_features = { path = "../../common/tari_features"}
tari_features = { path = "../../common/tari_features", version = "1.0.0-pre.9"}
2 changes: 1 addition & 1 deletion applications/minotari_node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ safe = []
libtor = ["tari_libtor"]

[build-dependencies]
tari_features = { path = "../../common/tari_features"}
tari_features = { path = "../../common/tari_features", version = "1.0.0-pre.9"}

[package.metadata.cargo-machete]
ignored = [
Expand Down
5 changes: 5 additions & 0 deletions base_layer/common_types/src/types/bullet_rangeproofs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ impl BulletRangeProof {
.expect("This should be 32 bytes for a Blake 256 hash")
.into()
}

/// Get the range proof as a vector reference, which is useful to satisfy the verification API without cloning
pub fn as_vec(&self) -> &Vec<u8> {
&self.0
}
}

impl ByteArray for BulletRangeProof {
Expand Down
1 change: 1 addition & 0 deletions base_layer/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ quickcheck = "1.0"

[build-dependencies]
tari_common = { path = "../../common", features = ["build"], version = "1.0.0-pre.9" }
tari_features = { path = "../../common/tari_features", version = "1.0.0-pre.9" }

[[bench]]
name = "mempool"
Expand Down
3 changes: 3 additions & 0 deletions base_layer/core/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

use tari_features::resolver::build_features;

fn main() {
build_features();
tari_common::build::ProtobufCompiler::new()
.include_paths(&["src/proto"])
.proto_paths(&[
Expand Down
36 changes: 20 additions & 16 deletions base_layer/core/src/blocks/genesis_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,17 @@ pub fn get_stagenet_genesis_block() -> ChainBlock {
if add_faucet_utxos {
// NB! Update 'consensus_constants.rs/pub fn igor()/ConsensusConstants {faucet_value: ?}' with total value
// NB: `stagenet_genesis_sanity_check` must pass
let file_contents = include_str!("faucets/esmeralda_faucet.json");
let file_contents = include_str!("faucets/stagenet_faucet.json");
add_faucet_utxos_to_genesis_block(file_contents, &mut block);
// Enable print only if you need to generate new Merkle roots, then disable it again
let print_values = false;
print_mr_values(&mut block, print_values);

// Hardcode the Merkle roots once they've been computed above
block.header.kernel_mr =
FixedHash::from_hex("3f4011ec1e8ddfbd66fb7331c5623b38f529a66e81233d924df85f2070b2aacb").unwrap();
FixedHash::from_hex("a08ff15219beea81d4131465290443fb3bd99d28b8af85975dbb2c77cb4cb5a0").unwrap();
block.header.output_mr =
FixedHash::from_hex("3e40efda288a57d3319c63388dd47ffe4b682baaf6a3b58622ec94d77ad712a2").unwrap();
FixedHash::from_hex("435f13e21be06b0d0ae9ad3869ac7c723edd933983fa2e26df843c82594b3245").unwrap();
block.header.validator_node_mr =
FixedHash::from_hex("277da65c40b2cf99db86baedb903a3f0a38540f3a94d40c826eecac7e27d5dfc").unwrap();
}
Expand Down Expand Up @@ -163,17 +163,17 @@ pub fn get_nextnet_genesis_block() -> ChainBlock {
if add_faucet_utxos {
// NB! Update 'consensus_constants.rs/pub fn igor()/ConsensusConstants {faucet_value: ?}' with total value
// NB: `nextnet_genesis_sanity_check` must pass
let file_contents = include_str!("faucets/esmeralda_faucet.json");
let file_contents = include_str!("faucets/nextnet_faucet.json");
add_faucet_utxos_to_genesis_block(file_contents, &mut block);
// Enable print only if you need to generate new Merkle roots, then disable it again
let print_values = false;
print_mr_values(&mut block, print_values);

// Hardcode the Merkle roots once they've been computed above
block.header.kernel_mr =
FixedHash::from_hex("3f4011ec1e8ddfbd66fb7331c5623b38f529a66e81233d924df85f2070b2aacb").unwrap();
FixedHash::from_hex("36881d87e25183f5189d2dca5f7da450c399e7006dafd9bd9240f73a5fb3f0ad").unwrap();
block.header.output_mr =
FixedHash::from_hex("3e40efda288a57d3319c63388dd47ffe4b682baaf6a3b58622ec94d77ad712a2").unwrap();
FixedHash::from_hex("7b65d5140485b44e33eef3690d46c41e4dc5c4520ad7464d7740f376f4f0a728").unwrap();
block.header.validator_node_mr =
FixedHash::from_hex("277da65c40b2cf99db86baedb903a3f0a38540f3a94d40c826eecac7e27d5dfc").unwrap();
}
Expand Down Expand Up @@ -368,6 +368,7 @@ mod test {

use tari_common_types::{epoch::VnEpoch, types::Commitment};
use tari_utilities::ByteArray;
use Network;

use super::*;
use crate::{
Expand All @@ -383,14 +384,16 @@ mod test {
};

#[test]
fn stagenet_genesis_sanity_check() {
// Note: Generate new data for `pub fn get_stagenet_genesis_block()` and `fn get_stagenet_genesis_block_raw()`
#[cfg(tari_target_network_testnet)]
fn esme_genesis_sanity_check() {
// Note: Generate new data for `pub fn get_esmeralda_genesis_block()` and `fn get_esmeralda_genesis_block_raw()`
// if consensus values change, e.g. new faucet or other
let block = get_stagenet_genesis_block();
check_block(Network::StageNet, &block, 100, 1);
let block = get_esmeralda_genesis_block();
check_block(Network::Esmeralda, &block, 100, 1);
}

#[test]
#[cfg(tari_target_network_nextnet)]
fn nextnet_genesis_sanity_check() {
// Note: Generate new data for `pub fn get_nextnet_genesis_block()` and `fn get_stagenet_genesis_block_raw()`
// if consensus values change, e.g. new faucet or other
Expand All @@ -399,17 +402,18 @@ mod test {
}

#[test]
fn esmeralda_genesis_sanity_check() {
// Note: Generate new data for `pub fn get_esmeralda_genesis_block()` and `fn get_esmeralda_genesis_block_raw()`
#[cfg(tari_target_network_mainnet)]
fn stagenet_genesis_sanity_check() {
Network::set_current(Network::StageNet).unwrap();
// Note: Generate new data for `pub fn get_stagenet_genesis_block()` and `fn get_stagenet_genesis_block_raw()`
// if consensus values change, e.g. new faucet or other
let block = get_esmeralda_genesis_block();
check_block(Network::Esmeralda, &block, 100, 1);
let block = get_stagenet_genesis_block();
check_block(Network::StageNet, &block, 100, 1);
}

#[test]
fn igor_genesis_sanity_check() {
// Note: Generate new data for `pub fn get_igor_genesis_block()` and `fn get_igor_genesis_block_raw()`
// if consensus values change, e.g. new faucet or other
// Note: If outputs and kernels are added, this test will fail unless you explicitly check that network == Igor
let block = get_igor_genesis_block();
check_block(Network::Igor, &block, 0, 0);
}
Expand Down
1 change: 1 addition & 0 deletions base_layer/core/src/proof_of_work/sha3x_pow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ pub mod test {
}

#[test]
#[cfg(tari_target_network_testnet)]
fn validate_max_target() {
let mut header = get_header();
header.nonce = 631;
Expand Down
2 changes: 1 addition & 1 deletion base_layer/core/src/transactions/coinbase_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ mod test {
let block_reward = rules.emission_schedule().block_reward(42) + missing_fee;
let builder = CoinbaseBuilder::new(key_manager.clone());
let builder = builder
.with_block_height(4200000)
.with_block_height(4_200_000)
.with_fees(1 * uT)
.with_spend_key_id(p.spend_key_id.clone())
.with_encryption_key_id(TariKeyId::default())
Expand Down
Loading

0 comments on commit bc8edce

Please sign in to comment.