1571 Commits

Author SHA1 Message Date
Alex Ant 82e399a2ca feat(leap-util): built-in genesis registry — 'genesis print/list' subcommands (#9)
Bootstrapping a fresh node used to require an externally hosted genesis.json;
lose the file and you cannot sync. The canonical genesis states of known
Coopenomics chains (mainnet, testnet) are now compiled into the binary and
reproducible from the package alone:

  leap-util genesis list                      # names + chain ids
  leap-util genesis print mainnet > genesis.json

Each entry only overrides initial_key — the production initial_timestamp and
chain_config values are already the compile-time defaults of genesis_state.
The default EOSIO_ROOT_KEY is intentionally untouched, so dev forks and the
docker-hub harness keep their well-known dev key; one build serves mainnet,
testnet and dev (a config-time root key change would have forked every dev
setup, and shipping per-network builds was rejected outright).

Unit test pins both registry chain ids to the canonical values, proving every
hashed genesis field is correct, and pins the dev default to NOT equal any
production genesis.

Co-authored-by: coopops <coopos@coopenomics.world>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-10 22:17:26 +05:00
Alex Ant b94c791b10 feat(chain): v5.3.1 — onblock skip + non-zero mroot bypass + builtin registry (#7)
Three coupled mechanisms in chain_historical_exceptions so archival nodes can
replay coopenomics mainnet past the 2026-05-11 v5.2.0-dev incident:

- chain_historical_exceptions gains onblock_skip_windows and
  suppressed_activations vectors; both are optional in the JSON form so v5.3.0
  files keep parsing.
- apply_block bypass no longer requires action_mroot == 0 inside a window —
  any divergent mroot is accepted when every other header field matches.
  Needed because a sound replay computes a non-zero mroot in the dirty window
  (onblock works) while the canonical chain stored zero.
- start_block skips the implicit onblock transaction inside any configured
  window. Without this the chainbase (block_summary_object etc.) mutated by
  onblock diverges from canonical state and every later block fails to
  validate, defeating the mroot bypass.
- trigger_activation_handler can be suppressed per feature_digest via the
  registry — guards against future incidents where a marked-activated feature
  must not run its handler during replay.
- New chain_exceptions_builtin.cpp ships a compiled-in registry keyed by
  chain_id; for coopenomics mainnet it carries action_mroot + onblock-skip
  windows [113273322..113275716]. Operators no longer need to distribute a
  separate JSON file; the .deb is self-contained. File option still wins
  per-node when set.

Co-authored-by: coopops <coopos@coopenomics.world>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-04 10:12:24 +05:00
coopops 1ab8b51a21 fix(unittests): drop json_roundtrip test, fc::json::to_string requires deadline
The template overload fc::json::to_string<T>(...) in this fork takes the
deadline argument without a default (only the variant overload has a
default), so the one-arg call inside json_roundtrip would not compile:

  error: no matching function for call to
    'fc::json::to_string(eosio::chain::chain_historical_exceptions&)'
  note: candidate expects 4 arguments, 1 provided

JSON round-trip is already exercised indirectly by every remaining test
case — each writes the file via fc::json::to_pretty_string (template
overload with deadline default) and the controller reads it back via
fc::json::from_file<T>() in the loader.
2026-06-03 08:04:14 +00:00
coopops de24cd822e feat(chain): chain-historical-exceptions registry for action_mroot bypass
Adds a generic per-chain exception mechanism that lets a controller skip
the producer_block_id != ab._id assert in apply_block when the only
header divergence is a known historical action_mroot=0 inside a declared
block-number window for the matching chain_id.

Motivation: on 2026-05-11 the mainnet Коопеномикс BP briefly ran a dev
build (v5.2.0-dev-294edf3b8) that did not register the on_activation
handler for ASSERT_RECOVER_KEY_ACCOUNT (id=24). For ~20 minutes (blocks
113273322..113275716) onblock did not register intrinsics,
_action_receipt_digests was empty and finalized action_mroot was the
zero digest. The window is now permanently irreversible. Any current
binary refuses to replay past block 113273322 with
block_validate_exception, so new full-history archive nodes / fresh BPs
/ --hard-replay-blockchain on mainnet are blocked.

Design (see exception-notes.md):
- New struct chain_historical_exceptions { chain_id, windows[] }
  loaded from a JSON file path supplied via the new config option
  chain-historical-exceptions. Absent / empty file => no change in
  behavior, strict upstream Antelope validation. Forks and subnets
  reusing this codebase without supplying a file are unaffected.
- Loader fires from controller_impl::init() right after
  protocol_features.init(db) (where self.get_chain_id() is valid) and
  EOS_ASSERTs that the file's chain_id matches the running chain — so
  the mainnet exception file cannot accidentally be applied to a
  different chain.
- Bypass site is the existing producer_block_id != ab._id branch in
  apply_block. Bypass fires only when all three hold: block_num is
  inside a declared window, b->action_mroot is strictly the zero
  digest, and a new other_header_fields_match helper confirms every
  other header field (timestamp, producer, confirmed, previous,
  transaction_mroot, schedule_version, new_producers,
  header_extensions) matches the locally-assembled block. Any other
  header divergence still throws block_validate_exception as before.
- Every bypass application is logged via wlog with the configured
  reason for forensics.

The data file for mainnet Коопеномикс is shipped separately (lives in
the playbooks repo, deployed to /etc/coopos/exceptions/) so the data
never leaks into forks that simply pull this codebase.

Unit tests cover JSON round-trip, chain_id mismatch -> startup refusal,
in-window action_mroot=0 -> bypass accepts, out-of-window -> rejected,
and in-window-but-other-field-altered -> rejected.

Refs: incident 2026-05-11, coopos commit 2c23b8108 (root-cause fix that
arrived too late for the dirty window).
2026-06-03 06:19:06 +00:00
Matt Witherspoon 7826f5044c remove executable bit from a lot of files 2024-04-04 22:32:31 -04:00
Matt Witherspoon a0b41fca24 don't enable EOS VM OC's vm_limit when ASAN or UBSAN is enabled 2024-03-11 13:49:40 -04:00
Matt Witherspoon 161cb28dc0 tests for ship & snapshots with jumbo rows 2024-02-01 16:29:30 -05:00
Matt Witherspoon af57b8e835 don't use exceptions to indicate a missing permission in auth checker 2024-01-19 18:38:37 -05:00
Matt Witherspoon 066d6ab555 Merge remote-tracking branch 'origin/release/5.0' into HEAD 2024-01-09 22:33:23 -05:00
Matt Witherspoon 1b8d31a598 fix disabling EOS VM OC subjective limits in tests 2024-01-08 14:55:55 -05:00
Lin Huang 4938640911 remove unnecessary static_cast<signed_block_header> 2023-12-19 11:31:33 -05:00
Lin Huang 7c4ca8a5df do not emit signed_block_header and block_num; use a single block_signal_params type 2023-12-18 13:34:46 -05:00
Lin Huang 22cec2c3bf restore commented out first_block->verify_signee in forked_tests 2023-12-17 14:41:40 -05:00
Lin Huang 360f3ba90e make accepted_blocks signal information only needed 2023-12-16 21:43:27 -05:00
Lin Huang 423c1d20e0 rename pending_block_header_state to pending_block_header_state_legacy 2023-12-12 08:29:31 -05:00
Matt Witherspoon c083fcb271 Merge remote-tracking branch 'origin/release/5.0' into HEAD 2023-12-07 11:58:42 -05:00
Matt Witherspoon 3a61aa469d Merge commit '82ad13a' into HEAD 2023-12-07 11:10:01 -05:00
Matt Witherspoon 1ee94df9aa Merge commit '1af6e38' into HEAD 2023-12-07 10:40:14 -05:00
Lin Huang 9e4e7b440e Merge branch 'main' into rename_block_state 2023-12-06 13:15:51 -05:00
Kevin Heifner 78c92dfb68 Merge remote-tracking branch 'origin/release/5.0' into GH-1953-bls-n0-main 2023-12-06 11:21:53 -06:00
Kevin Heifner c10e7c0c72 GH-1953 Update test for n==0 is an error 2023-12-06 08:31:15 -06:00
Lin Huang 14287b0ca1 rename block_state to block_state_legacy and block_header_state to block_header_state_legacy 2023-12-05 16:35:37 -05:00
Kevin Heifner c315531eaf Merge remote-tracking branch 'origin/release/5.0' into bls12-381-update-main 2023-11-30 10:06:48 -06:00
yarkin 1269951979 Update feature manager, fix deep-mind.log accordinglly. 2023-11-30 01:51:46 +08:00
yarkin 4255d62daa Add more test case and update submodule (only contains test updates). 2023-11-15 16:34:39 +08:00
yarkin 9d35e5a328 Add tests for fp_mod, fp_exp, fp_mul 2023-11-15 15:36:27 +08:00
yarkin 49d17e30bd Update to use affine form instead of jacobian form for data
serialization.
2023-11-14 15:55:17 +08:00
yarkin 35f375c9b0 Update unit tests. 2023-11-13 17:07:34 +08:00
greg7mdp e776e792d4 Update chainbase to tip. 2023-11-09 08:50:45 -05:00
greg7mdp 5b8ea89c40 Merge branch 'main' of github.com:AntelopeIO/leap into gh_1652 2023-11-08 08:39:59 -05:00
Lin Huang 56328b1144 Merge branch 'release/5.0' into disable_oc_subj_limits_5_0 2023-11-07 16:18:08 -05:00
greg7mdp aeb64c31a9 Move test_chainbase_types.cpp from chain_plugin/test -> unittests 2023-11-07 16:02:22 -05:00
Lin Huang 1b0cebae0a use tester's default_config, use std::optional for limits. remove hard/soft cpu and vm limits 2023-11-07 13:59:13 -05:00
Matt Witherspoon 0e090f0103 globally --catch_system_errors=no 2023-11-02 12:14:10 -04:00
Lin Huang e4df534c67 incorporate review comments 2023-11-01 19:51:47 -04:00
Matt Witherspoon 2717d0a135 globally --catch_system_errors=no 2023-11-01 13:42:16 -04:00
Lin Huang c012b14671 add eosvmoc limits tests 2023-10-31 13:27:20 -04:00
Kevin Heifner 231f6aa359 Merge remote-tracking branch 'origin/release/4.0' into GH-1694-ship-head-5.0 2023-10-16 08:00:41 -05:00
Kevin Heifner c561ba8128 GH-1694 Verify produced block matches validated block and accepted block 2023-10-13 08:38:01 -05:00
Kevin Heifner 03d53b78f0 GH-1275 Signal accepted_block after it is marked valid 2023-10-13 07:44:06 -05:00
Lin Huang 7f50c71aa6 remove modify_gto_for_canceldelay_test, restore canceldelay_test, and update disable_deferred_trxs_stage_1_no_op_test 2023-10-10 17:18:00 -04:00
Lin Huang c87d87f369 add a block validation test before DISABLE_DEFERRED_TRXS_STAGE_1 is activated 2023-10-10 13:18:21 -04:00
Lin Huang 7d8445fee5 add a test to invlidate blocks containing deferred trxs after disable_deferred_trxs_stage_1 is activated 2023-10-09 16:47:52 -04:00
Lin Huang e8e0b436b4 update api_tests' deferred_cfa_failed 2023-10-09 16:31:15 -04:00
Lin Huang 170c1a55d9 update delay_tests 2023-10-06 17:22:45 -04:00
Lin Huang 962f30982a restore api_tests' deferred_cfa_not_allowed and deferred_cfa_success 2023-10-06 17:00:53 -04:00
Lin Huang 4c38e86980 make api_tests::transaction_tests for before and after disable_trxs_protocol_features are activated 2023-10-03 21:12:44 -04:00
Lin Huang 058ed3951b make sure all protocol features are activated in the same order such that block_id is the same (needed for deep-mind test) 2023-10-03 17:48:49 -04:00
Lin Huang 28e9d3e9cc revert to use full protococol features for currency_tests not involved in deferred trxs 2023-10-03 17:01:47 -04:00
Lin Huang cf15dd85fb refactor preactivate_builtin_protocol_features and revert back to original full policy for deep-mind test and update deep-mind log 2023-10-03 15:12:04 -04:00