Skip to content

Commit

Permalink
feat: implement inflating tail emission
Browse files Browse the repository at this point in the history
This PR primarily adds tail emission inflation as a featuer; but it does
so using feature gates, which were broken in a few places, and so a big
part of this PR is resolving issues related to feature gates.

== Tail emission inflation

Adds a feature tari_feature_mainnet_emission to allow for tail emission
inflation. See #6122

This change necessitates the addition of 2 new consensus constants:
`inflation_bips` -- the annual inflation rate of the total supply.
and `tail_emission_epoch_length`, which controls the tail emission
inflation. These replace `tail_emission`.

We update the Protobuf definition for ConsensusConstants to account for
the new fields.

== Getting Feature flags working

When formally implementing compiler features, the setting of the `TARI_NETWORK`
and (from now) `TARI_TARGET_NETWORK` envar and the related compiler flags matter.

These changes require that when tests run, the correct network flags are set.

For example, blocks::genesis_block::test::stagenet_genesis_sanity_check should
only run when TARI_NETWORK=stagenet.

While writing this PR, I uncovered a problem:
There is not a 1:1 mapping between the build _target_ and the actual
network the binary may run on. E.g. the mainnet build can run on either
stagenet or mainnet.

Unfortunately the `TARI_NETWORK` envar was used to set both of these
variables. Without using feature flags, this discrepency went unnoticed.
With feature flags, a lot of tests that implicitly assumed say a mainnet
target and a stagenet run would simply fail, with no way to resolve the
issue.

Since these are 2 different things, this commit introduced
`TARI_TARGET_NETWORK` whicg sets the **build target**. In most contexts,
this then decouples the configured network, which is specified by the
`TARI_NETWORK` envar  as usual.

The other changes in this commit revolve around updating merkle roots
and the correct faucet sets to make the target/network/faucet
combination consistent.

== CI workflows

The CI is configured to run tests for each of
* Testnet (Esme)
* Nextnet (Nextnet)
* Mainnet (Mainnet, with some tests specifying stagenet)
  • Loading branch information
CjS77 committed Feb 8, 2024
1 parent 0e9877e commit f54873f
Show file tree
Hide file tree
Showing 44 changed files with 1,133 additions and 721 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 @@ -102,8 +102,10 @@ jobs:
run: |
source buildtools/multinet_envs.sh ${{ github.ref_name }}
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
9 changes: 8 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ jobs:
permissions:
checks: write
pull-requests: write
strategy:
matrix:
tari_target_network: ["testnet", "nextnet", "mainnet"]
env:
TARI_TARGET_NETWORK: ${{ matrix.tari_target_network }}
RUST_LOG: debug
steps:
- name: checkout
uses: actions/checkout@v4
Expand All @@ -192,8 +198,9 @@ 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 }}
restore-keys: |
tari-${{ runner.os }}-${{ runner.cpu-model }}-${{ env.toolchain }}-nightly-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.tari_target_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
Expand Down

0 comments on commit f54873f

Please sign in to comment.