Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 30 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,26 @@ jobs:
# and when that mirror goes quiet apt retries it until the job's 180-minute timeout
# instead of failing (seen 2026-08-19; the guarded form had been added everywhere
# except here, the one job that runs on every code PR and every master push).
timeout-minutes: 15
# 2026-11-19: same fix as the testnet arms below — ForceIPv4 (stalled attempts on a
# dead IPv6 route showed up as `Ign:` lines 20-40 s apart) and only the Boost
# components the build requests instead of the 154-package meta-package.
timeout-minutes: 20
run: |
set -euo pipefail
sudo sed -i 's|azure.archive.ubuntu.com|archive.ubuntu.com|g' \
/etc/apt/apt-mirrors.txt /etc/apt/sources.list 2>/dev/null || true
apt="sudo apt-get -o Acquire::Retries=3 -o Acquire::http::Timeout=20 -o Acquire::https::Timeout=20"
apt="sudo apt-get -o Acquire::Retries=3 -o Acquire::ForceIPv4=true -o Acquire::http::Timeout=20 -o Acquire::https::Timeout=20"
$apt update
$apt install -y --no-install-recommends \
build-essential ccache cmake libboost-all-dev libssl-dev \
build-essential ccache cmake libssl-dev \
libbz2-dev liblzma-dev libzstd-dev libreadline-dev \
libtool ncurses-dev pkg-config zlib1g-dev
$apt install -y --no-install-recommends \
libboost-thread-dev libboost-date-time-dev libboost-filesystem-dev \
libboost-program-options-dev libboost-serialization-dev libboost-chrono-dev \
libboost-test-dev libboost-context-dev libboost-locale-dev libboost-coroutine-dev \
libboost-iostreams-dev libboost-regex-dev \
|| $apt install -y --no-install-recommends libboost-all-dev

# ccache >= 4 keeps its cache in ~/.cache/ccache, not ~/.ccache, so the old path
# never existed and nothing was ever saved ("Path Validation Error"). Pin the
Expand Down Expand Up @@ -200,17 +209,32 @@ jobs:
# Runners fetch packages from azure.archive.ubuntu.com; when that mirror goes quiet
# apt keeps retrying it and the job hangs for hours instead of failing (seen
# 2026-08-19). Pin the canonical mirror, bound the wait, and cap the step.
timeout-minutes: 15
# 2026-11-19: the 15-minute cap was hit three times in a row on the same signature —
# a stream of `Ign:` lines 20-40 s apart where the retry then succeeded. Two causes
# are addressed here: stalled attempts usually mean a dead IPv6 route (ForceIPv4),
# and `libboost-all-dev` pulls 154 packages / 94 MB, most of it OpenCL/HIP/MPI that
# this build never links. Only the components CMakeLists actually requests are
# installed, with the meta-package kept as a fallback if a component is ever renamed.
timeout-minutes: 20
run: |
set -euo pipefail
sudo sed -i 's|azure.archive.ubuntu.com|archive.ubuntu.com|g' \
/etc/apt/apt-mirrors.txt /etc/apt/sources.list 2>/dev/null || true
apt="sudo apt-get -o Acquire::Retries=3 -o Acquire::http::Timeout=20 -o Acquire::https::Timeout=20"
apt="sudo apt-get -o Acquire::Retries=3 -o Acquire::ForceIPv4=true -o Acquire::http::Timeout=20 -o Acquire::https::Timeout=20"
$apt update
$apt install -y --no-install-recommends \
build-essential ccache cmake libboost-all-dev libssl-dev \
build-essential ccache cmake libssl-dev \
libbz2-dev liblzma-dev libzstd-dev libreadline-dev \
libtool ncurses-dev pkg-config zlib1g-dev
# Mirrors the components the build actually requests: BOOST_COMPONENTS in CMakeLists.txt
# (thread date_time filesystem program_options serialization chrono unit_test_framework
# context locale coroutine), plus iostreams (thirdparty/fc) and regex (cli_wallet).
$apt install -y --no-install-recommends \
libboost-thread-dev libboost-date-time-dev libboost-filesystem-dev \
libboost-program-options-dev libboost-serialization-dev libboost-chrono-dev \
libboost-test-dev libboost-context-dev libboost-locale-dev libboost-coroutine-dev \
libboost-iostreams-dev libboost-regex-dev \
|| $apt install -y --no-install-recommends libboost-all-dev

# One cache per matrix arm: CHAIN_TESTNET_VALIDATORS changes compile flags.
- name: Restore ccache
Expand Down
10 changes: 7 additions & 3 deletions libraries/chain/chain_properties_evaluators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ namespace graphene { namespace chain {
FC_ASSERT( _db.has_hardfork(CHAIN_HARDFORK_4), "versioned_chain_properties_update_evaluator not enabled until HF 4" );
_db.get_account(o.owner); // verify owner exists

// #6737: protocol validate() allows up to 3 years of 1 s blocks; until HF16 the old
// #6737: protocol validate() allows up to one year counted in LIVE blocks (31 536 000 at
// 1 s, the same number the old `CHAIN_BLOCKS_PER_YEAR * 3` produced); until HF16 the
// one-year-of-3-s-blocks bound stays consensus (the stored props are checked after the
// visit, so a rejected op leaves nothing behind - the whole op is rolled back).
const auto check_year_bound = [&](const chain_properties& p) {
Expand All @@ -110,8 +111,11 @@ namespace graphene { namespace chain {
FC_ASSERT(p.pm_closed_market_retention_sec > reveal_blocks * _db.block_interval(),
"retention must exceed the live worst-case commit reveal deadline");
if (_db.has_hardfork(CHAIN_HARDFORK_16)) {
FC_ASSERT(p.distribution_epoch_length >=
CHAIN_MIN_DISTRIBUTION_EPOCH_LENGTH * (CHAIN_BLOCK_INTERVAL / _db.block_interval()),
// The floor is a wall-clock promise, so it has one named value per block scale.
// No multiplication here: the pre-HF16 value (CHAIN_MIN_DISTRIBUTION_EPOCH_LENGTH)
// counts 3 s blocks, this one counts live 1 s blocks, and both mean the same time
// (owner 19.11.2026: nothing is multiplied).
FC_ASSERT(p.distribution_epoch_length >= CHAIN_MIN_DISTRIBUTION_EPOCH_LENGTH_HF16,
"distribution_epoch_length must preserve the minimum epoch duration after HF16");
return;
}
Expand Down
22 changes: 10 additions & 12 deletions libraries/chain/database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3464,8 +3464,8 @@ namespace graphene { namespace chain {
}

void database::update_bandwidth_reserve_candidates() {
// HF16: keep the hourly cadence in wall time (3x more blocks per hour at 1 s).
if ((head_block_num() % (CHAIN_BLOCKS_PER_HOUR * (CHAIN_BLOCK_INTERVAL / block_interval()))) != 0) return;
// HF16: CHAIN_BLOCKS_PER_HOUR is already in native 1 s blocks, so no runtime scaling.
if ((head_block_num() % CHAIN_BLOCKS_PER_HOUR) != 0) return;
uint32_t bandwidth_reserve_candidates = 1;
const auto &gprops = get_dynamic_global_properties();
const validator_schedule_object &consensus = get_validator_schedule_object();
Expand Down Expand Up @@ -3651,8 +3651,8 @@ namespace graphene { namespace chain {
}
}
}
// HF16: same wall-time cadence as with 3 s slots.
if ((head_block_num() % (COMMITTEE_REQUEST_PROCESSING * (CHAIN_BLOCK_INTERVAL / block_interval()))) != 0) return;
// HF16: COMMITTEE_REQUEST_PROCESSING is already in native 1 s blocks (10 min cadence).
if ((head_block_num() % COMMITTEE_REQUEST_PROCESSING) != 0) return;
uint32_t committee_payment_request_count = 1;
const auto &idx4_count = get_index<committee_request_index>().indices().get<by_status>();
auto itr3 = idx4_count.lower_bound(4);
Expand Down Expand Up @@ -6742,11 +6742,11 @@ namespace graphene { namespace chain {
if (w.signing_key != public_key_type() &&
head_block_num() -
w.last_confirmed_block_num >
CHAIN_EMERGENCY_MAX_VALIDATOR_MISSED_BLOCKS * (CHAIN_BLOCK_INTERVAL / block_interval())) {
CHAIN_EMERGENCY_MAX_VALIDATOR_MISSED_BLOCKS) {
elog("Emergency consensus: Validator ${w} missed ${missed} blocks since last confirmed ${lc} "
"(threshold=${t}), blanking signing_key",
("w", w.owner)("missed", head_block_num() - w.last_confirmed_block_num)
("lc", w.last_confirmed_block_num)("t", CHAIN_EMERGENCY_MAX_VALIDATOR_MISSED_BLOCKS * (CHAIN_BLOCK_INTERVAL / block_interval())));
("lc", w.last_confirmed_block_num)("t", CHAIN_EMERGENCY_MAX_VALIDATOR_MISSED_BLOCKS));
w.signing_key = public_key_type();
push_virtual_operation(shutdown_validator_operation(w.owner));
}
Expand All @@ -6772,7 +6772,7 @@ namespace graphene { namespace chain {
if (w.signing_key != public_key_type() &&
head_block_num() -
w.last_confirmed_block_num >
CHAIN_MAX_VALIDATOR_MISSED_BLOCKS * (CHAIN_BLOCK_INTERVAL / block_interval())) {
CHAIN_MAX_VALIDATOR_MISSED_BLOCKS) {
elog("Validator ${w} missed too many blocks (${missed} since last confirmed ${lc}), blanking signing_key (was ${k})",
("w", w.owner)("missed", head_block_num() - w.last_confirmed_block_num)
("lc", w.last_confirmed_block_num)("k", w.signing_key));
Expand Down Expand Up @@ -6842,11 +6842,9 @@ namespace graphene { namespace chain {
});

if (!(skip & skip_undo_history_check)) {
// HF16 (1 s blocks, Q#3108=A): the undo window is counted in blocks, so keep it equal in TIME —
// 3× the blocks, otherwise a LIB stall halts the chain after 2.8 h instead of 8.3 h.
const uint32_t max_undo = has_hardfork(CHAIN_HARDFORK_16)
? CHAIN_MAX_UNDO_HISTORY * (CHAIN_BLOCK_INTERVAL / CHAIN_BLOCK_INTERVAL_HF16)
: CHAIN_MAX_UNDO_HISTORY;
// HF16 (1 s blocks, Q#3108=A): CHAIN_MAX_UNDO_HISTORY is already in native 1 s blocks
// (same 8.3 h wall-clock window), so no runtime scaling.
const uint32_t max_undo = CHAIN_MAX_UNDO_HISTORY;
CHAIN_ASSERT(
_dgp.head_block_number - _dgp.last_irreversible_block_num < max_undo,
undo_database_exception,
Expand Down
23 changes: 11 additions & 12 deletions libraries/protocol/get_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ namespace graphene {
fc::variant_object get_config(uint32_t live_block_interval) {
const uint32_t interval = live_block_interval ? live_block_interval : CHAIN_BLOCK_INTERVAL;
FC_ASSERT(interval == CHAIN_BLOCK_INTERVAL || interval == CHAIN_BLOCK_INTERVAL_HF16);
const uint32_t scale = CHAIN_BLOCK_INTERVAL / interval;
fc::mutable_variant_object result;

result["CHAIN_100_PERCENT"] = CHAIN_100_PERCENT;
Expand Down Expand Up @@ -53,7 +52,7 @@ namespace graphene {
result["CHAIN_MAX_SIG_CHECK_DEPTH"] = CHAIN_MAX_SIG_CHECK_DEPTH;
result["CHAIN_MAX_TIME_UNTIL_EXPIRATION"] = CHAIN_MAX_TIME_UNTIL_EXPIRATION;
result["CHAIN_MAX_TRANSACTION_SIZE"] = CHAIN_MAX_TRANSACTION_SIZE;
result["CHAIN_MAX_UNDO_HISTORY"] = uint32_t(CHAIN_MAX_UNDO_HISTORY * scale);
result["CHAIN_MAX_UNDO_HISTORY"] = uint32_t(CHAIN_MAX_UNDO_HISTORY);
result["CHAIN_MAX_VOTE_CHANGES"] = CHAIN_MAX_VOTE_CHANGES;
result["CHAIN_MAX_TOP_VALIDATORS"] = CHAIN_MAX_TOP_VALIDATORS;
result["CHAIN_MAX_WITHDRAW_ROUTES"] = CHAIN_MAX_WITHDRAW_ROUTES;
Expand All @@ -76,19 +75,19 @@ namespace graphene {
result["CHAIN_PENDING_TRANSACTION_EXECUTION_LIMIT"] = CHAIN_PENDING_TRANSACTION_EXECUTION_LIMIT;
result["CHAIN_DIGITAL_ASSET_ISSUED_PER_BLOCK"] = CHAIN_DIGITAL_ASSET_ISSUED_PER_BLOCK;

// Stored/voted properties are native block counts (owner Q3108=A), not
// hidden 3-second units. Expose live defaults so clients need not re-vote
// stale compile-time values after HF16.
// Stored/voted properties are native block counts of the live chain (owner Q3108=A).
// Compile-time constants are native 1 s blocks too, so nothing is scaled here: what
// the chain stores and what clients receive are the same numbers (owner 19.11.2026:
// "no code that multiplies anything anywhere — what data we have is what we return").
chain_properties_pm defaults;
defaults.inflation_recalc_period *= scale;
defaults.distribution_epoch_length *= scale;
defaults.pm_batch_epoch_blocks *= scale;
defaults.pm_reveal_window_blocks *= scale;
result["CHAIN_DEFAULT_CHAIN_PROPERTIES"] = fc::variant(defaults);
result["CHAIN_PROPERTY_BLOCK_UNITS"] = "native-blocks";
result["CHAIN_MIN_DISTRIBUTION_EPOCH_LENGTH"] = uint32_t(CHAIN_MIN_DISTRIBUTION_EPOCH_LENGTH * scale);
result["CHAIN_MAX_VALIDATOR_MISSED_BLOCKS"] = uint32_t(CHAIN_MAX_VALIDATOR_MISSED_BLOCKS * scale);
result["CHAIN_EMERGENCY_MAX_VALIDATOR_MISSED_BLOCKS"] = uint32_t(CHAIN_EMERGENCY_MAX_VALIDATOR_MISSED_BLOCKS * scale);
// Both scales are named: a client on a pre-HF16 chain reads the first key, a client after
// HF16 reads the second. Neither is derived by multiplying at runtime.
result["CHAIN_MIN_DISTRIBUTION_EPOCH_LENGTH"] = uint32_t(CHAIN_MIN_DISTRIBUTION_EPOCH_LENGTH);
result["CHAIN_MIN_DISTRIBUTION_EPOCH_LENGTH_HF16"] = uint32_t(CHAIN_MIN_DISTRIBUTION_EPOCH_LENGTH_HF16);
result["CHAIN_MAX_VALIDATOR_MISSED_BLOCKS"] = uint32_t(CHAIN_MAX_VALIDATOR_MISSED_BLOCKS);
result["CHAIN_EMERGENCY_MAX_VALIDATOR_MISSED_BLOCKS"] = uint32_t(CHAIN_EMERGENCY_MAX_VALIDATOR_MISSED_BLOCKS);
return result;
}

Expand Down
16 changes: 10 additions & 6 deletions libraries/protocol/include/graphene/protocol/chain_operations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ namespace graphene { namespace protocol {
FC_ASSERT(inflation_ratio_committee_vs_reward_fund <= CHAIN_100_PERCENT);
FC_ASSERT(inflation_recalc_period >= 0);
// HF16 (#6737): one year is 3x more blocks at 1 s; the pre-HF16 bound is kept by the evaluator.
FC_ASSERT(inflation_recalc_period <= CHAIN_BLOCKS_PER_YEAR * 3);
FC_ASSERT(inflation_recalc_period <= CHAIN_BLOCKS_PER_YEAR_HF16);
}

chain_properties_hf4& operator=(const chain_properties_init& src) {
Expand Down Expand Up @@ -499,7 +499,7 @@ namespace graphene { namespace protocol {
FC_ASSERT(validator_miss_penalty_percent >= 0);
FC_ASSERT(validator_miss_penalty_percent <= CHAIN_100_PERCENT);
FC_ASSERT(validator_miss_penalty_duration >= 0);
FC_ASSERT(validator_miss_penalty_duration <= (CHAIN_BLOCKS_PER_YEAR * CHAIN_BLOCK_INTERVAL));
FC_ASSERT(validator_miss_penalty_duration <= CHAIN_SECONDS_PER_YEAR);
}

chain_properties_hf6& operator=(const chain_properties_init& src) {
Expand Down Expand Up @@ -591,7 +591,11 @@ namespace graphene { namespace protocol {
* Consensus - Period in blocks between delegator reward distributions.
* Each validator accumulates block rewards during this epoch and
* distributes the delegator share proportionally at epoch end.
* Allowed range: [CHAIN_MIN_DISTRIBUTION_EPOCH_LENGTH, CHAIN_BLOCKS_PER_YEAR].
* Allowed range: upper bound CHAIN_BLOCKS_PER_YEAR_HF16 (one year in live 1 s blocks,
* the same number as the pre-HF16 year in 3 s blocks). Lower bound is TWO named values
* because it is a wall-clock promise: this validate() enforces the pre-fork value
* CHAIN_MIN_DISTRIBUTION_EPOCH_LENGTH, and the post-fork check in the evaluator
* enforces CHAIN_MIN_DISTRIBUTION_EPOCH_LENGTH_HF16 (same time, live blocks).
*/
uint32_t distribution_epoch_length = CHAIN_DEFAULT_DISTRIBUTION_EPOCH_LENGTH;

Expand All @@ -600,7 +604,7 @@ namespace graphene { namespace protocol {
FC_ASSERT(distribution_epoch_length >= CHAIN_MIN_DISTRIBUTION_EPOCH_LENGTH,
"distribution_epoch_length must be at least ${min} blocks",
("min", CHAIN_MIN_DISTRIBUTION_EPOCH_LENGTH));
FC_ASSERT(distribution_epoch_length <= uint32_t(CHAIN_BLOCKS_PER_YEAR * 3), // HF16: see evaluator
FC_ASSERT(distribution_epoch_length <= uint32_t(CHAIN_BLOCKS_PER_YEAR_HF16),
"distribution_epoch_length must not exceed one year in blocks");
}

Expand Down Expand Up @@ -661,8 +665,8 @@ namespace graphene { namespace protocol {
uint16_t pm_no_contest_penalty_percent = 5000; ///< bp of dispute fee (50%)
uint32_t pm_dispute_reward_multiplier = 30000; ///< bp multiplier (10000=1x; default 3x)
// Batch / commit-reveal
uint32_t pm_batch_epoch_blocks = 20; ///< ~60 s
uint32_t pm_reveal_window_blocks = 200; ///< ~10 min liveness
uint32_t pm_batch_epoch_blocks = 60; ///< ~60 s in native 1 s blocks (was 20 at 3 s)
uint32_t pm_reveal_window_blocks = 600; ///< ~10 min liveness in native 1 s blocks (was 200 at 3 s)
uint16_t pm_commit_no_reveal_penalty_percent = 2000; ///< bp (20%) → winners' pool
asset pm_min_batch_bet = asset(1000, TOKEN_SYMBOL); ///< 1.000 VIZ anti-dust
bool pm_commit_reveal_enabled = true; ///< kill-switch (median-voted)
Expand Down
Loading