From 83c0fea1a50dc0cc44a7d697ae20128e5830ac11 Mon Sep 17 00:00:00 2001 From: N-thnI Date: Fri, 24 Jul 2026 14:44:55 +0100 Subject: [PATCH] Fix merge-corrupted engine-core, jest/eslint setup, repo cruft --- AUD | 0 Dashboard[Guardian | 0 EP | 0 GOV | 0 NM | 0 RPC | 0 RpcC | 0 SC | 0 engine-bridge/.eslintrc.cjs | 26 + engine-bridge/package-lock.json | 1242 +++++++++++++++++ engine-bridge/package.json | 5 +- engine-core/Cargo.toml | 2 +- engine-core/src/audit.rs | 98 +- engine-core/src/burn.rs | 26 - engine-core/src/circuit_breaker.rs | 89 +- engine-core/src/core/access.rs | 4 +- engine-core/src/core/control_plane.rs | 50 +- engine-core/src/core/engine.rs | 62 - engine-core/src/core/guards.rs | 13 +- engine-core/src/core/mod.rs | 63 +- engine-core/src/core/proxy.rs | 2 +- engine-core/src/core/state.rs | 6 +- engine-core/src/core/tests.rs | 22 +- engine-core/src/emergency_recovery.rs | 100 +- engine-core/src/event_struct.rs | 83 +- engine-core/src/event_utils.rs | 19 +- engine-core/src/governance.rs | 373 +---- engine-core/src/governance_tests.rs | 198 +-- engine-core/src/lib.rs | 3 - engine-core/src/protocol_fee.rs | 53 +- engine-core/src/reentrancy_tests.rs | 4 - engine-core/src/treasury.rs | 35 +- .../tests/hash_mismatch_is_rejected.1.json | 131 ++ .../audit/tests/replay_is_rejected.1.json | 40 + .../audit/tests/valid_first_commitment.1.json | 40 + .../burn/tests/invalid_amount_rejected.1.json | 131 ++ .../access/tests/admin_role_authorized.1.json | 260 ++++ .../tests/auditor_role_authorized.1.json | 258 ++++ .../access/tests/double_init_rejected.1.json | 212 +++ .../access/tests/initialize_sets_admin.1.json | 212 +++ .../access/tests/operator_not_admin.1.json | 245 ++++ .../tests/operator_role_authorized.1.json | 258 ++++ .../guards/tests/double_enter_detected.1.json | 162 +++ .../guards/tests/guard_enter_and_exit.1.json | 75 + .../reentrancy_guard_drop_releases.1.json | 75 + .../guards/tests/with_guard_wraps_call.1.json | 75 + .../core/state/tests/full_lifecycle.1.json | 229 +++ .../tests/initial_state_is_pending.1.json | 84 ++ ...invalid_pending_to_settled_rejected.1.json | 131 ++ .../require_state_panics_on_mismatch.1.json | 131 ++ .../tests/transition_pending_to_active.1.json | 133 ++ .../test_batch_update_param_success.1.json | 148 +- ...est_get_admin_rejects_uninitialized.1.json | 242 ++++ .../core/tests/test_initialize.1.json | 285 ++++ ...e_rejects_contract_as_its_own_admin.1.json | 223 +++ .../tests/test_update_param_full_flow.1.json | 812 +++++++++++ .../test_update_param_rejects_bad_hash.1.json | 505 +++++++ ...e_param_rejects_replayed_commitment.1.json | 820 +++++++++++ .../test_update_param_requires_admin.1.json | 505 +++++++ ...registration_for_current_state_root.1.json | 833 +++++++++++ ...t_zk_proof_rejects_wrong_state_root.1.json | 704 ++++++++++ .../tests/non_admin_cannot_request.1.json | 10 +- .../same_admin_cannot_double_approve.1.json | 10 +- ...s_not_execute_when_threshold_is_two.1.json | 21 +- .../threshold_transition_sets_unlock.1.json | 471 +++++++ ...ed_moves_to_executed_after_timelock.1.json | 418 ++++++ .../tests/double_approval_is_rejected.1.json | 462 ++++++ ...ding_moves_to_approved_at_threshold.1.json | 370 +++++ .../proposal_initial_state_is_pending.1.json | 270 ++++ .../test_duplicate_approval_detection.1.json | 173 ++- .../tests/test_full_proposal_lifecycle.1.json | 215 ++- .../tests/test_reject_double_execution.1.json | 81 +- ...eject_execution_of_pending_proposal.1.json | 60 +- .../timelock_blocks_early_execution.1.json | 426 ++++++ .../fee_at_full_bps_is_full_amount.1.json | 93 ++ .../tests/fee_calculation_standard.1.json | 93 ++ ...et_fee_config_returns_stored_values.1.json | 93 ++ .../tests/partial_bps_fee_rounds_down.1.json | 93 ++ .../tests/rejects_bps_over_max.1.json | 131 ++ .../tests/set_fee_bps_updates_rate.1.json | 93 ++ .../guard_can_be_reentered_after_exit.1.json | 75 + .../guard_panics_when_entered_twice.1.json | 162 +++ .../latest_snapshot_is_none_when_empty.1.json | 100 ++ .../snapshot_creation_and_retrieval.1.json | 18 +- .../tests/snapshot_hash_verification.1.json | 18 +- .../tests/negative_balance_is_rejected.1.json | 131 ++ .../recent_snapshots_are_newest_first.1.json | 584 ++++++++ .../records_and_retrieves_snapshot.1.json | 262 ++++ ...de_fails_when_hash_was_not_approved.1.json | 205 +++ .../tests/upgrade_fails_without_quorum.1.json | 205 +++ .../init_version_rejects_double_init.1.json | 131 ++ .../init_version_stores_correctly.1.json | 92 ++ ...require_compatible_rejects_mismatch.1.json | 77 + .../tests/set_contract_version_works.1.json | 92 ++ .../upgrade_check_rejects_downgrade.1.json | 77 + src/contracts/events.rs | 25 - vero-core-engine | 1 - 97 files changed, 15075 insertions(+), 1300 deletions(-) delete mode 100644 AUD delete mode 100644 Dashboard[Guardian delete mode 100644 EP delete mode 100644 GOV delete mode 100644 NM delete mode 100644 RPC delete mode 100644 RpcC delete mode 100644 SC create mode 100644 engine-bridge/.eslintrc.cjs delete mode 100644 engine-core/src/core/engine.rs create mode 100644 engine-core/test_snapshots/audit/tests/hash_mismatch_is_rejected.1.json create mode 100644 engine-core/test_snapshots/burn/tests/invalid_amount_rejected.1.json create mode 100644 engine-core/test_snapshots/core/access/tests/admin_role_authorized.1.json create mode 100644 engine-core/test_snapshots/core/access/tests/auditor_role_authorized.1.json create mode 100644 engine-core/test_snapshots/core/access/tests/double_init_rejected.1.json create mode 100644 engine-core/test_snapshots/core/access/tests/initialize_sets_admin.1.json create mode 100644 engine-core/test_snapshots/core/access/tests/operator_not_admin.1.json create mode 100644 engine-core/test_snapshots/core/access/tests/operator_role_authorized.1.json create mode 100644 engine-core/test_snapshots/core/guards/tests/double_enter_detected.1.json create mode 100644 engine-core/test_snapshots/core/guards/tests/guard_enter_and_exit.1.json create mode 100644 engine-core/test_snapshots/core/guards/tests/reentrancy_guard_drop_releases.1.json create mode 100644 engine-core/test_snapshots/core/guards/tests/with_guard_wraps_call.1.json create mode 100644 engine-core/test_snapshots/core/state/tests/full_lifecycle.1.json create mode 100644 engine-core/test_snapshots/core/state/tests/initial_state_is_pending.1.json create mode 100644 engine-core/test_snapshots/core/state/tests/invalid_pending_to_settled_rejected.1.json create mode 100644 engine-core/test_snapshots/core/state/tests/require_state_panics_on_mismatch.1.json create mode 100644 engine-core/test_snapshots/core/state/tests/transition_pending_to_active.1.json create mode 100644 engine-core/test_snapshots/core/tests/test_get_admin_rejects_uninitialized.1.json create mode 100644 engine-core/test_snapshots/core/tests/test_initialize_rejects_contract_as_its_own_admin.1.json create mode 100644 engine-core/test_snapshots/core/tests/test_update_param_full_flow.1.json create mode 100644 engine-core/test_snapshots/core/tests/test_update_param_rejects_bad_hash.1.json create mode 100644 engine-core/test_snapshots/core/tests/test_update_param_rejects_replayed_commitment.1.json create mode 100644 engine-core/test_snapshots/core/tests/test_update_param_requires_admin.1.json create mode 100644 engine-core/test_snapshots/core/tests/test_zk_proof_registration_for_current_state_root.1.json create mode 100644 engine-core/test_snapshots/core/tests/test_zk_proof_rejects_wrong_state_root.1.json create mode 100644 engine-core/test_snapshots/governance/tests/threshold_transition_sets_unlock.1.json create mode 100644 engine-core/test_snapshots/governance_tests/tests/approved_moves_to_executed_after_timelock.1.json create mode 100644 engine-core/test_snapshots/governance_tests/tests/double_approval_is_rejected.1.json create mode 100644 engine-core/test_snapshots/governance_tests/tests/pending_moves_to_approved_at_threshold.1.json create mode 100644 engine-core/test_snapshots/governance_tests/tests/proposal_initial_state_is_pending.1.json create mode 100644 engine-core/test_snapshots/governance_tests/tests/timelock_blocks_early_execution.1.json create mode 100644 engine-core/test_snapshots/protocol_fee/tests/fee_at_full_bps_is_full_amount.1.json create mode 100644 engine-core/test_snapshots/protocol_fee/tests/fee_calculation_standard.1.json create mode 100644 engine-core/test_snapshots/protocol_fee/tests/get_fee_config_returns_stored_values.1.json create mode 100644 engine-core/test_snapshots/protocol_fee/tests/partial_bps_fee_rounds_down.1.json create mode 100644 engine-core/test_snapshots/protocol_fee/tests/rejects_bps_over_max.1.json create mode 100644 engine-core/test_snapshots/protocol_fee/tests/set_fee_bps_updates_rate.1.json create mode 100644 engine-core/test_snapshots/reentrancy_tests/tests/guard_can_be_reentered_after_exit.1.json create mode 100644 engine-core/test_snapshots/reentrancy_tests/tests/guard_panics_when_entered_twice.1.json create mode 100644 engine-core/test_snapshots/treasury/tests/latest_snapshot_is_none_when_empty.1.json create mode 100644 engine-core/test_snapshots/treasury_tests/tests/negative_balance_is_rejected.1.json create mode 100644 engine-core/test_snapshots/treasury_tests/tests/recent_snapshots_are_newest_first.1.json create mode 100644 engine-core/test_snapshots/treasury_tests/tests/records_and_retrieves_snapshot.1.json create mode 100644 engine-core/test_snapshots/upgrade/tests/upgrade_fails_when_hash_was_not_approved.1.json create mode 100644 engine-core/test_snapshots/upgrade/tests/upgrade_fails_without_quorum.1.json create mode 100644 engine-core/test_snapshots/version/tests/init_version_rejects_double_init.1.json create mode 100644 engine-core/test_snapshots/version/tests/init_version_stores_correctly.1.json create mode 100644 engine-core/test_snapshots/version/tests/require_compatible_rejects_mismatch.1.json create mode 100644 engine-core/test_snapshots/version/tests/set_contract_version_works.1.json create mode 100644 engine-core/test_snapshots/version/tests/upgrade_check_rejects_downgrade.1.json delete mode 100644 src/contracts/events.rs delete mode 160000 vero-core-engine diff --git a/AUD b/AUD deleted file mode 100644 index e69de29..0000000 diff --git a/Dashboard[Guardian b/Dashboard[Guardian deleted file mode 100644 index e69de29..0000000 diff --git a/EP b/EP deleted file mode 100644 index e69de29..0000000 diff --git a/GOV b/GOV deleted file mode 100644 index e69de29..0000000 diff --git a/NM b/NM deleted file mode 100644 index e69de29..0000000 diff --git a/RPC b/RPC deleted file mode 100644 index e69de29..0000000 diff --git a/RpcC b/RpcC deleted file mode 100644 index e69de29..0000000 diff --git a/SC b/SC deleted file mode 100644 index e69de29..0000000 diff --git a/engine-bridge/.eslintrc.cjs b/engine-bridge/.eslintrc.cjs new file mode 100644 index 0000000..f6fe211 --- /dev/null +++ b/engine-bridge/.eslintrc.cjs @@ -0,0 +1,26 @@ +/* eslint-env node */ +module.exports = { + root: true, + env: { node: true, es2022: true }, + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + }, + plugins: ['@typescript-eslint'], + extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'], + rules: { + '@typescript-eslint/no-unused-vars': [ + 'warn', + { + argsIgnorePattern: '^_', + varsIgnorePattern: '^_', + caughtErrorsIgnorePattern: '^_', + }, + ], + '@typescript-eslint/no-explicit-any': 'warn', + 'no-constant-condition': ['error', { checkLoops: false }], + 'prefer-const': ['error', { destructuring: 'all' }], + }, + ignorePatterns: ['dist', 'node_modules', 'coverage'], +}; diff --git a/engine-bridge/package-lock.json b/engine-bridge/package-lock.json index 090c2cf..1215f69 100644 --- a/engine-bridge/package-lock.json +++ b/engine-bridge/package-lock.json @@ -18,6 +18,9 @@ "@types/jest": "29.5.12", "@types/node": "20.14.2", "@types/ws": "8.5.10", + "@typescript-eslint/eslint-plugin": "^8.61.1", + "@typescript-eslint/parser": "^8.61.1", + "eslint": "^8.57.0", "jest": "29.7.0", "ts-jest": "29.1.5", "typescript": "5.5.2" @@ -539,6 +542,147 @@ "kuler": "^2.0.0" } }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.10.1.tgz", + "integrity": "sha512-cuadcxVFE8sDK6iWJbs8Sn0av2Nrh2QSGQhVlBW9AaAHqHwjWsZHT8LJ4hFGPh7ASBV2deFdM7H/DPjulmh8rg==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.2", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz", + "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", + "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.6.0", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "license": "Python-2.0" + }, + "node_modules/@eslint/eslintrc/node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/@eslint/eslintrc/node_modules/js-yaml": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.0.tgz", + "integrity": "sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/@eslint/js": { + "version": "8.57.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.1.tgz", + "integrity": "sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz", + "integrity": "sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==", + "deprecated": "Use @eslint/config-array instead", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanwhocodes/object-schema": "^2.0.3", + "debug": "^4.3.1", + "minimatch": "^3.0.5" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", + "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", + "deprecated": "Use @eslint/object-schema instead", + "dev": true, + "license": "BSD-3-Clause" + }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", @@ -908,6 +1052,44 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/@sinclair/typebox": { "version": "0.27.10", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.10.tgz", @@ -1137,6 +1319,321 @@ "dev": true, "license": "MIT" }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "8.65.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.65.0.tgz", + "integrity": "sha512-IEgob78X12rHpUmtcwFsXhZdVGJtwTVP8FiCLZkR6GlYVrl2PcuB+KhCE5BlVC/eQpQnu8WXRtkHZuPar+gCRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/regexpp": "^4.12.2", + "@typescript-eslint/scope-manager": "8.65.0", + "@typescript-eslint/type-utils": "8.65.0", + "@typescript-eslint/utils": "8.65.0", + "@typescript-eslint/visitor-keys": "8.65.0", + "ignore": "^7.0.5", + "natural-compare": "^1.4.0", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^8.65.0", + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "8.65.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.65.0.tgz", + "integrity": "sha512-CZ4nMxWwgu1HEEFNkeaCptra9QCtkmKdgf3sWh1rl1trIhmxLilgTV4cwcbQ4wemnT4sWQN8CaKOmdYx+g2gMA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/scope-manager": "8.65.0", + "@typescript-eslint/types": "8.65.0", + "@typescript-eslint/typescript-estree": "8.65.0", + "@typescript-eslint/visitor-keys": "8.65.0", + "debug": "^4.4.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/project-service": { + "version": "8.65.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.65.0.tgz", + "integrity": "sha512-SxnPhbTsGahizDgbu7oqFH/xVtzIqMd/s+WtnSxNxJZJpLbdT5IPdzg8EZxO3+PoKahXmwJLeNQOpKJb3/bi7Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/tsconfig-utils": "^8.65.0", + "@typescript-eslint/types": "^8.65.0", + "debug": "^4.4.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "8.65.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.65.0.tgz", + "integrity": "sha512-Esbl8OSYiVxBokYgWPf7VVWg/BE798wXhimnn9ML9Pt5qoDf8bfQlgjlKXR/k98+AcNzlLKYrpCcrcuZ9DZLgg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.65.0", + "@typescript-eslint/visitor-keys": "8.65.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/tsconfig-utils": { + "version": "8.65.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.65.0.tgz", + "integrity": "sha512-j6GzGqCiRdA7Qhur2VVmKZAkBLfnHFQfx4TaJGL9RMveZqCo48jSHHO0DTgizEnGhtWnqmbtCUSrqSkdiY/0Hg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "8.65.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.65.0.tgz", + "integrity": "sha512-YjaZ7PRI5qY7ax2L3PbvX0rRyGtipAReCWs0mhhDBHjH/vl0g0BonaGXrKdKpMbIIsMIwDgbk/xzkBTyAltS5g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.65.0", + "@typescript-eslint/typescript-estree": "8.65.0", + "@typescript-eslint/utils": "8.65.0", + "debug": "^4.4.3", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "8.65.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.65.0.tgz", + "integrity": "sha512-JSSwWNy+H0E/01jJEM+hrX6N0OFDzFzeIhHFSAS01tlVaevpG8cFyYRPhS5yjGOvBUx3sqQHVMjCL1CAZZMxBg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "8.65.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.65.0.tgz", + "integrity": "sha512-JboAE2swaYt4tb1fHhHTABE2K+OLy09XfcTbhnk4Pw96f9dd2e9iYsJ28gBggHlo5z5x1rkyWvcPoTuNTd4oGg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/project-service": "8.65.0", + "@typescript-eslint/tsconfig-utils": "8.65.0", + "@typescript-eslint/types": "8.65.0", + "@typescript-eslint/visitor-keys": "8.65.0", + "debug": "^4.4.3", + "minimatch": "^10.2.2", + "semver": "^7.7.3", + "tinyglobby": "^0.2.15", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.8.tgz", + "integrity": "sha512-JZyDyq3D4AUifKTPOB7DELf6XsB3WdPuNxCtob1vFXPsSXhdAiHBWJ/tJ8HAc9aH84BK+5JFZLNkJKx3G9kzQg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { + "version": "10.2.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.5.tgz", + "integrity": "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.5" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { + "version": "7.8.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", + "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "8.65.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.65.0.tgz", + "integrity": "sha512-gXiwIHsYreboxeJucHKPvgwl7dXt50mF8s1/c00cP/WoVTyWKFdtfhRWwZiXYFU5H2O8vVoSLNrexFZjYS/SGA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.9.1", + "@typescript-eslint/scope-manager": "8.65.0", + "@typescript-eslint/types": "8.65.0", + "@typescript-eslint/typescript-estree": "8.65.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "8.65.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.65.0.tgz", + "integrity": "sha512-8C71BQkGjiMmXtop7pHVJu1l2NNShFdkCyD6a2ezzs5vU/L3LRtb69EtcteFwz0mYMPzIgOw0n6OV4VBUWZd7A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.65.0", + "eslint-visitor-keys": "^5.0.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/visitor-keys/node_modules/eslint-visitor-keys": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz", + "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@ungap/structured-clone": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.3.tgz", + "integrity": "sha512-60YRaenCQcVjYEKOcG824+DRGGIQ3VKErcBoAEDJZz5bKIs2ZG+X/H9Nk+Q6EVkwJk5QNApxbrc5QtBSwtrXAg==", + "dev": true, + "license": "ISC" + }, + "node_modules/acorn": { + "version": "8.17.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.17.0.tgz", + "integrity": "sha512-xRQbDb9BnwDafYNn6Vwl839DYVjqXYb1XVGtWAZ1kcDc6iwAL4hg3B1dZlRiuENFeO2H53gFG3in621AdERVAg==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, "node_modules/agent-base": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", @@ -1149,6 +1646,23 @@ "node": ">= 6.0.0" } }, + "node_modules/ajv": { + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz", + "integrity": "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, "node_modules/ansi-escapes": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", @@ -2013,6 +2527,13 @@ "node": ">=4.0.0" } }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true, + "license": "MIT" + }, "node_modules/deepmerge": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", @@ -2078,6 +2599,19 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/dunder-proto": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", @@ -2209,6 +2743,213 @@ "node": ">=8" } }, + "node_modules/eslint": { + "version": "8.57.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.1.tgz", + "integrity": "sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==", + "deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "8.57.1", + "@humanwhocodes/config-array": "^0.13.0", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "@ungap/structured-clone": "^1.2.0", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-scope": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "license": "Python-2.0" + }, + "node_modules/eslint/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/eslint/node_modules/js-yaml": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.0.tgz", + "integrity": "sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/eslint/node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/espree": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.9.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, "node_modules/esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", @@ -2223,6 +2964,52 @@ "node": ">=4" } }, + "node_modules/esquery": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.7.0.tgz", + "integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/eventsource": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-2.0.2.tgz", @@ -2291,6 +3078,13 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "license": "MIT" + }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -2298,6 +3092,23 @@ "dev": true, "license": "MIT" }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fastq": { + "version": "1.20.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.1.tgz", + "integrity": "sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==", + "dev": true, + "license": "ISC", + "dependencies": { + "reusify": "^1.0.4" + } + }, "node_modules/fb-watchman": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", @@ -2314,6 +3125,19 @@ "integrity": "sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw==", "license": "MIT" }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "license": "MIT", + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, "node_modules/file-uri-to-path": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", @@ -2347,6 +3171,28 @@ "node": ">=8" } }, + "node_modules/flat-cache": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", + "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.3", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flatted": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.3.tgz", + "integrity": "sha512-/zipXxyO6rGvuNGDiULY9MvEGSkb2gaG4GGH4ygMi0ZZzyMHdUZBmntJmx5x1G2VuPytCwGN4xsJP6cw+sK+vQ==", + "dev": true, + "license": "ISC" + }, "node_modules/fn.name": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fn.name/-/fn.name-1.1.0.tgz", @@ -2549,6 +3395,48 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/globals": { + "version": "13.24.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globals/node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/gopd": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", @@ -2568,6 +3456,13 @@ "dev": true, "license": "ISC" }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true, + "license": "MIT" + }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -2679,6 +3574,43 @@ ], "license": "BSD-3-Clause" }, + "node_modules/ignore": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.6.tgz", + "integrity": "sha512-BAg6QkE8W+TuQLrrw0Ugr7HegXduRuuj8/ti2kSOc+jz1dmx8/WNcjr6XGnq5YpDWxFwwaavqD0+jIUOKelTsw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-fresh/node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, "node_modules/import-local": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz", @@ -2768,6 +3700,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", @@ -2788,6 +3730,19 @@ "node": ">=6" } }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -2798,6 +3753,16 @@ "node": ">=0.12.0" } }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", @@ -3552,6 +4517,13 @@ "node": ">=6" } }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true, + "license": "MIT" + }, "node_modules/json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", @@ -3559,6 +4531,20 @@ "dev": true, "license": "MIT" }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true, + "license": "MIT" + }, "node_modules/json5": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", @@ -3572,6 +4558,16 @@ "node": ">=6" } }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "json-buffer": "3.0.1" + } + }, "node_modules/kleur": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", @@ -3598,6 +4594,20 @@ "node": ">=6" } }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", @@ -3625,6 +4635,13 @@ "dev": true, "license": "MIT" }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true, + "license": "MIT" + }, "node_modules/logform": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/logform/-/logform-2.7.0.tgz", @@ -3916,6 +4933,24 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -3971,6 +5006,19 @@ "node": ">=6" } }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/parse-json": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", @@ -4106,6 +5154,16 @@ "node": ">=10" } }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/pretty-format": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", @@ -4167,6 +5225,16 @@ "once": "^1.3.1" } }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/pure-rand": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.1.0.tgz", @@ -4184,6 +5252,27 @@ ], "license": "MIT" }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, "node_modules/randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -4316,6 +5405,58 @@ "node": ">=10" } }, + "node_modules/reusify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", + "dev": true, + "license": "MIT", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "dev": true, + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -4703,6 +5844,61 @@ "integrity": "sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==", "license": "MIT" }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tinyglobby/node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/tinyglobby/node_modules/picomatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.5.tgz", + "integrity": "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/tmpl": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", @@ -4752,6 +5948,19 @@ "node": ">= 14.0.0" } }, + "node_modules/ts-api-utils": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.5.0.tgz", + "integrity": "sha512-OJ/ibxhPlqrMM0UiNHJ/0CKQkoKF243/AEmplt3qpRgkW8VG7IfOS41h7V8TjITqdByHzrjcS/2si+y4lIh8NA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.12" + }, + "peerDependencies": { + "typescript": ">=4.8.4" + } + }, "node_modules/ts-jest": { "version": "29.1.5", "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.5.tgz", @@ -4831,6 +6040,19 @@ "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==", "license": "Unlicense" }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -4920,6 +6142,16 @@ "browserslist": ">= 4.21.0" } }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, "node_modules/urijs": { "version": "1.19.11", "resolved": "https://registry.npmjs.org/urijs/-/urijs-1.19.11.tgz", @@ -5030,6 +6262,16 @@ "node": ">= 12.0.0" } }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", diff --git a/engine-bridge/package.json b/engine-bridge/package.json index 4f26cb6..351b615 100644 --- a/engine-bridge/package.json +++ b/engine-bridge/package.json @@ -6,7 +6,7 @@ "types": "dist/index.d.ts", "scripts": { "build": "tsc", - "test": "node --experimental-vm-modules node_modules/.bin/jest --runInBand", + "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --runInBand", "lint": "eslint src --ext .ts" }, "dependencies": { @@ -20,6 +20,9 @@ "@types/jest": "29.5.12", "@types/node": "20.14.2", "@types/ws": "8.5.10", + "@typescript-eslint/eslint-plugin": "^8.61.1", + "@typescript-eslint/parser": "^8.61.1", + "eslint": "^8.57.0", "jest": "29.7.0", "ts-jest": "29.1.5", "typescript": "5.5.2" diff --git a/engine-core/Cargo.toml b/engine-core/Cargo.toml index 6344733..4ff3c03 100644 --- a/engine-core/Cargo.toml +++ b/engine-core/Cargo.toml @@ -8,7 +8,7 @@ description = "Vero Protocol — ZK audit, multi-sig governance, circuit-breaker crate-type = ["cdylib", "rlib"] [dependencies] -soroban-sdk = { version = "21.0.0" } +soroban-sdk = { version = "21.0.0", features = ["alloc"] } sha2 = { version = "0.10", default-features = false } [dev-dependencies] diff --git a/engine-core/src/audit.rs b/engine-core/src/audit.rs index 7a43392..170aeab 100644 --- a/engine-core/src/audit.rs +++ b/engine-core/src/audit.rs @@ -1,25 +1,5 @@ - -//! ZK-audit layer: ordered state-commitment validation. -//! -//! State-changing code can call `validate_transition` with an off-chain produced -//! commitment. The module enforces circuit-breaker status, author authentication, -//! monotonic sequencing, and deterministic hash chaining: -//! -//! `state_hash = sha256(previous_state_hash || sequence || payload)`. - -use sha2::{Digest, Sha256}; -use soroban_sdk::{contracterror, panic_with_error, symbol_short, BytesN, Env, Symbol}; - //! ZK-audit layer — state-commitment validation for the Vero Protocol. //! - -//! Each contract call that mutates state must pass through `validate_transition`. -//! Off-chain provers submit `StateCommitment`s; this module verifies ordering -//! and hash integrity before they are persisted. - -use sha2::{Digest, Sha256}; -use soroban_sdk::{contracterror, panic_with_error, symbol_short, Env, Symbol, Map, BytesN, IntoVal}; - //! Every state-changing control-plane path can anchor its transition here. The //! commitment chain is deliberately simple and audit-friendly: //! @@ -28,20 +8,12 @@ use soroban_sdk::{contracterror, panic_with_error, symbol_short, Env, Symbol, Ma //! The module enforces signer authentication, replay protection, circuit-breaker //! safety and deterministic event emission. - use crate::circuit_breaker::assert_closed; - -use crate::event_utils::{publish_event, publish_event_legacy}; -use crate::event_struct::{MOD_AUDIT, ACT_COMMIT}; - use crate::event_struct::{ACT_COMMIT, MOD_AUDIT}; -use crate::event_utils::publish_event; +use crate::event_utils::{publish_event, publish_event_legacy}; use crate::types::StateCommitment; - - use sha2::{Digest, Sha256}; -use soroban_sdk::{contracterror, panic_with_error, symbol_short, BytesN, Env, Symbol}; - +use soroban_sdk::{contracterror, panic_with_error, symbol_short, BytesN, Env, IntoVal, Map, Symbol}; const KEY_SEQ: Symbol = symbol_short!("SEQ"); const KEY_PREV: Symbol = symbol_short!("PREV_H"); @@ -89,36 +61,6 @@ pub fn integrity_check(env: &Env, commitment: &StateCommitment, payload: &[u8]) expected == commitment.state_hash.to_array() } - -/// Return the last accepted sequence number. -pub fn last_sequence(env: &Env) -> u64 { - env.storage().instance().get(&KEY_SEQ).unwrap_or(0) -} - -/// Return the last accepted state hash. -pub fn previous_hash(env: &Env) -> BytesN<32> { - env.storage() - .instance() - .get(&KEY_PREV) - .unwrap_or_else(|| BytesN::from_array(env, &[0u8; 32])) -} - -/// Validate and persist a new state commitment. -pub fn validate_transition(env: &Env, commitment: &StateCommitment, payload: &[u8]) { - crate::non_reentrant!(env); - assert_closed(env); - commitment.author.require_auth(); - - let last_seq = last_sequence(env); - if commitment.sequence <= last_seq { - panic_with_error!(env, AuditError::ReplayedSequence); - } - - let prev_hash = previous_hash(env).to_array(); - let expected = compute_commitment(&prev_hash, commitment.sequence, payload); - let actual = commitment.state_hash.to_array(); - if expected != actual { - /// Validate and record a new `StateCommitment`. /// /// Panics if: @@ -153,7 +95,6 @@ pub(crate) fn validate_transition_inner( panic_with_error!(env, AuditError::HashMismatch); } - let actual = commitment.state_hash.to_array(); env.storage().instance().set(&KEY_SEQ, &commitment.sequence); env.storage().instance().set(&KEY_PREV, &commitment.state_hash); @@ -169,25 +110,13 @@ pub(crate) fn validate_transition_inner( payload.set(symbol_short!("seq"), commitment.sequence.into_val(env)); payload.set(symbol_short!("hash"), commitment.state_hash.clone().into_val(env)); publish_event_legacy(env, BytesN::from_array(env, &[0u8; 32]), BytesN::from_array(env, &[0u8; 32]), payload); - } #[cfg(test)] mod tests { use super::*; - - use soroban_sdk::{contract, contractimpl, testutils::Address as _, Address, BytesN, Env}; - - #[contract] - pub struct TestContract; - - #[contractimpl] - impl TestContract {} - - use soroban_sdk::{testutils::Address as _, Address, BytesN, Env}; - #[soroban_sdk::contract] pub struct TestContract; @@ -205,7 +134,6 @@ mod tests { } } - #[test] fn valid_first_commitment() { let env = Env::default(); @@ -214,23 +142,11 @@ mod tests { let author = Address::generate(&env); env.as_contract(&contract_id, || { let payload = b"state_payload_v1"; - - let hash = compute_commitment(&[0u8; 32], 1, payload); - let c = StateCommitment { - state_hash: BytesN::from_array(&env, &hash), - sequence: 1, - ledger: 100, - author: Address::generate(&env), - }; - validate_transition(&env, &c, payload); - assert_eq!(last_sequence(&env), 1); - let c = commitment(&env, author, 1, payload); assert!(integrity_check(&env, &c, payload)); validate_transition(&env, &c, payload); assert_eq!(get_last_sequence(&env), 1); assert_eq!(get_state_hash(&env), c.state_hash); - }); } @@ -243,17 +159,7 @@ mod tests { let author = Address::generate(&env); env.as_contract(&contract_id, || { let payload = b"payload"; - - let hash = compute_commitment(&[0u8; 32], 1, payload); - let c = StateCommitment { - state_hash: BytesN::from_array(&env, &hash), - sequence: 1, - ledger: 100, - author: Address::generate(&env), - }; - let c = commitment(&env, author, 1, payload); - validate_transition(&env, &c, payload); validate_transition(&env, &c, payload); }); diff --git a/engine-core/src/burn.rs b/engine-core/src/burn.rs index c046bc0..01fce03 100644 --- a/engine-core/src/burn.rs +++ b/engine-core/src/burn.rs @@ -1,13 +1,3 @@ - -//! Burn safety helpers. - -use crate::event_struct::{ACT_BURN_SAFE, MOD_BURN}; -use crate::event_utils::publish_event; -use soroban_sdk::{contracterror, panic_with_error, Address, BytesN, Env, String}; - -#[contracterror] -#[derive(Copy, Clone, Debug, Eq, PartialEq)] - //! Burn module — zero-address and invalid-amount guards. use crate::event_struct::{ACT_BURN_SAFE, MOD_BURN}; @@ -16,7 +6,6 @@ use soroban_sdk::{contracterror, panic_with_error, Address, Env, String}; #[contracterror] #[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord)] - pub enum BurnError { ZeroAddress = 1, InvalidAmount = 2, @@ -32,9 +21,6 @@ pub fn reject_zero_address(env: &Env, to: &Address) { } } - -/// Validate a burn recipient and emit a compact audit event. - fn amount_to_event_value(env: &Env, amount: i128) -> u64 { if amount <= 0 || amount > u64::MAX as i128 { panic_with_error!(env, BurnError::InvalidAmount); @@ -43,24 +29,12 @@ fn amount_to_event_value(env: &Env, amount: i128) -> u64 { } /// Burn-safe transfer wrapper. Validates recipient/amount before emitting. - pub fn burn_to(env: &Env, to: &Address, amount: i128) { crate::circuit_breaker::assert_closed(env); reject_zero_address(env, to); - if amount <= 0 { - panic_with_error!(env, BurnError::InvalidAmount); - } - publish_event( - env, - MOD_BURN | ACT_BURN_SAFE, - amount as u64, - BytesN::from_array(env, &[0u8; 32]), - ); - let value = amount_to_event_value(env, amount); publish_event(env, MOD_BURN | ACT_BURN_SAFE, value, zero_hash(env)); - } #[cfg(test)] diff --git a/engine-core/src/circuit_breaker.rs b/engine-core/src/circuit_breaker.rs index 02fc295..c093ce9 100644 --- a/engine-core/src/circuit_breaker.rs +++ b/engine-core/src/circuit_breaker.rs @@ -1,23 +1,13 @@ - //! Emergency circuit breaker. //! //! Guardians can open the breaker to halt state transitions. Stateful modules //! call `assert_closed` before mutating protected state. -use crate::event_struct::{ACT_RESET, ACT_TRIP, MOD_CB}; -use crate::event_utils::publish_event; -use crate::types::BreakerState; -use soroban_sdk::{contracterror, panic_with_error, symbol_short, vec, Address, BytesN, Env, Symbol, Vec}; - -//! Emergency circuit-breaker — halts state transitions when tripped. - use crate::event_struct::{ACT_RESET, ACT_TRIP, MOD_CB}; use crate::event_utils::{publish_event, zero_hash}; - use crate::types::BreakerState; use soroban_sdk::{contracterror, panic_with_error, symbol_short, vec, Address, Env, Symbol, Vec}; - const KEY_STATE: Symbol = symbol_short!("CB_STATE"); const KEY_GUARDIAN: Symbol = symbol_short!("CB_GUARD"); @@ -28,22 +18,11 @@ pub enum BreakerError { NotGuardian = 2, AlreadyInState = 3, InvalidGuardianSet = 4, - AlreadyInitialized = 5, - } /// Initialise the circuit breaker in the closed state. pub fn init(env: &Env, guardians: Vec
) { - - if guardians.len() == 0 { - panic_with_error!(env, BreakerError::InvalidGuardianSet); - } - env.storage().instance().set(&KEY_STATE, &BreakerState::Closed); - env.storage().instance().set(&KEY_GUARDIAN, &guardians); -} - - if env.storage().instance().has(&KEY_GUARDIAN) { panic_with_error!(env, BreakerError::AlreadyInitialized); } @@ -66,7 +45,6 @@ pub fn init(env: &Env, guardians: Vec
) { } /// Return the current breaker state. - pub fn state(env: &Env) -> BreakerState { env.storage() .instance() @@ -74,9 +52,7 @@ pub fn state(env: &Env) -> BreakerState { .unwrap_or(BreakerState::Closed) } - /// Panics with `CircuitOpen` when the breaker is tripped. - pub fn assert_closed(env: &Env) { if state(env) == BreakerState::Open { panic_with_error!(env, BreakerError::CircuitOpen); @@ -90,10 +66,7 @@ pub fn trip(env: &Env, guardian: &Address) { require_guardian(env, guardian); set_state(env, BreakerState::Open); - publish_event(env, MOD_CB | ACT_TRIP, 0, BytesN::from_array(env, &[0u8; 32])); - publish_event(env, MOD_CB | ACT_TRIP, 0, zero_hash(env)); - } /// Reset the breaker — resumes guarded state transitions. Requires guardian auth. @@ -103,17 +76,7 @@ pub fn reset(env: &Env, guardian: &Address) { require_guardian(env, guardian); set_state(env, BreakerState::Closed); - publish_event(env, MOD_CB | ACT_RESET, 0, BytesN::from_array(env, &[0u8; 32])); -} - -fn set_state(env: &Env, new_state: BreakerState) { - if state(env) == new_state { - panic_with_error!(env, BreakerError::AlreadyInState); - } - env.storage().instance().set(&KEY_STATE, &new_state); - publish_event(env, MOD_CB | ACT_RESET, 0, zero_hash(env)); - } fn set_state(env: &Env, next: BreakerState) { @@ -122,7 +85,6 @@ fn set_state(env: &Env, next: BreakerState) { panic_with_error!(env, BreakerError::AlreadyInState); } env.storage().instance().set(&KEY_STATE, &next); - } fn require_guardian(env: &Env, caller: &Address) { @@ -139,22 +101,7 @@ fn require_guardian(env: &Env, caller: &Address) { #[cfg(test)] mod tests { use super::*; - use soroban_sdk::{testutils::Address as _, vec, Env, contract, contractimpl}; - - #[contract] - pub struct TestContract; - - #[contractimpl] - impl TestContract {} - - #[soroban_sdk::contract] - pub struct TestContract; - - #[soroban_sdk::contractimpl] - impl TestContract {} - - - + use soroban_sdk::testutils::Address as _; #[soroban_sdk::contract] pub struct TestContract; @@ -168,40 +115,17 @@ mod tests { env.mock_all_auths(); let contract_id = env.register_contract(None, TestContract); - let g = Address::generate(&env); - env.as_contract(&contract_id, || { - init(&env, vec![&env, g.clone()]); - assert_closed(&env); - }); - env.mock_all_auths(); - env.as_contract(&contract_id, || { - trip(&env, &g); - let guardian = Address::generate(&env); - env.as_contract(&contract_id, || { - - init(&env, vec![&env, g.clone()]); - assert_closed(&env); - trip(&env, &g); - assert_eq!(state(&env), BreakerState::Open); - reset(&env, &g); - init(&env, vec![&env, guardian.clone()]); assert_closed(&env); }); env.as_contract(&contract_id, || { trip(&env, &guardian); assert_eq!(state(&env), BreakerState::Open); - }); - env.mock_all_auths(); env.as_contract(&contract_id, || { - - reset(&env, &g); - reset(&env, &guardian); - assert_closed(&env); }); } @@ -213,21 +137,10 @@ mod tests { env.mock_all_auths_allowing_non_root_auth(); let contract_id = env.register_contract(None, TestContract); - let g = Address::generate(&env); - let rogue = Address::generate(&env); - env.as_contract(&contract_id, || { - init(&env, vec![&env, g]); - let guardian = Address::generate(&env); let rogue = Address::generate(&env); env.as_contract(&contract_id, || { - - let g = Address::generate(&env); - let rogue = Address::generate(&env); - init(&env, vec![&env, g]); - init(&env, vec![&env, guardian]); - trip(&env, &rogue); }); } diff --git a/engine-core/src/core/access.rs b/engine-core/src/core/access.rs index c6661c7..33724a3 100644 --- a/engine-core/src/core/access.rs +++ b/engine-core/src/core/access.rs @@ -156,6 +156,8 @@ mod tests { let (admin, _, operators, auditors) = setup(&env); env.as_contract(&contract_id, || { initialize(&env, &admin, operators, auditors); + }); + env.as_contract(&contract_id, || { require_role(&env, &admin, ROLE_ADMIN); }); } @@ -178,7 +180,7 @@ mod tests { let env = Env::default(); env.mock_all_auths(); let contract_id = env.register_contract(None, TestContract); - let (admin, op1, operators, auditors) = setup(&env); + let (admin, _op1, operators, auditors) = setup(&env); let rogue = Address::generate(&env); env.as_contract(&contract_id, || { initialize(&env, &admin, operators, auditors); diff --git a/engine-core/src/core/control_plane.rs b/engine-core/src/core/control_plane.rs index eabc289..f5ff177 100644 --- a/engine-core/src/core/control_plane.rs +++ b/engine-core/src/core/control_plane.rs @@ -56,6 +56,8 @@ pub enum ControlPlaneError { NotInitialized = 3, InvalidPayload = 4, ArithmeticOverflow = 5, + ReservedKey = 6, + InvalidAdmin = 7, } #[contract] @@ -74,11 +76,25 @@ impl ControlPlane { if env.storage().instance().has(&KEY_INIT) { panic_with_error!(&env, ControlPlaneError::AlreadyInitialized); } + if admin == env.current_contract_address() { + panic_with_error!(&env, ControlPlaneError::InvalidAdmin); + } admin.require_auth(); env.storage().instance().set(&KEY_ADMIN, &admin); env.storage().instance().set(&KEY_INIT, &true); env.storage().instance().set(&KEY_PARAM_COUNT, &0u64); + crate::version::init_version(&env); + } + + /// Return the deployed contract logic version as (major, minor, patch). + pub fn version(_env: Env) -> (u32, u32, u32) { + crate::version::version() + } + + /// Return the on-chain storage schema version. + pub fn contract_version(_env: Env) -> u32 { + crate::version::contract_version() } /// Return the configured administrator, or `None` before initialization. @@ -119,11 +135,6 @@ impl ControlPlane { .unwrap_or_else(|| panic_with_error!(&env, ControlPlaneError::NotInitialized)) } - /// Return a previously set protocol parameter, or `None`. - pub fn get_param(env: Env, param_key: Symbol) -> Option { - env.storage().instance().get(¶m_key) - } - /// Mutate a protocol parameter securely. /// /// Security properties: @@ -144,6 +155,10 @@ impl ControlPlane { require_admin(&env, &caller); circuit_breaker::assert_closed(&env); + if is_reserved_key(¶m_key) { + panic_with_error!(&env, ControlPlaneError::ReservedKey); + } + let payload_raw = payload.to_array(); audit::validate_transition_inner(&env, &commitment, &payload_raw); @@ -227,28 +242,23 @@ impl ControlPlane { commitment: StateCommitment, payload: BytesN<32>, ) { - caller.require_auth(); + crate::non_reentrant!(&env); + require_admin(&env, &caller); + circuit_breaker::assert_closed(&env); - let admin: Address = env - .storage() - .instance() - .get(&KEY_ADMIN) - .unwrap_or_else(|| panic_with_error!(&env, ControlPlaneError::NotInitialized)); + // ZK-ready integrity check (enforces no replays and valid hash) + audit::validate_transition_inner(&env, &commitment, &payload.to_array()); - if caller != admin { - panic_with_error!(&env, ControlPlaneError::Unauthorized); + for param in params.iter() { + if is_reserved_key(¶m.0) { + panic_with_error!(&env, ControlPlaneError::ReservedKey); + } } - // Ensure the protocol isn't paused - assert_closed(&env); - - // ZK-ready integrity check (enforces no replays and valid hash) - validate_transition(&env, &commitment, &payload.to_array()); - - // Update the parameters in batch for param in params.iter() { env.storage().instance().set(¶m.0, ¶m.1); } + increment_param_count(&env); } } diff --git a/engine-core/src/core/engine.rs b/engine-core/src/core/engine.rs deleted file mode 100644 index 0a3e7a3..0000000 --- a/engine-core/src/core/engine.rs +++ /dev/null @@ -1,62 +0,0 @@ -//! Foundation for the Vero Protocol control plane. -//! Provides initialization and basic access control mechanisms. - -use soroban_sdk::{contract, contractimpl, contracttype, contracterror, panic_with_error, Address, Env, Symbol, Vec, symbol_short}; - -pub const ADMIN_KEY: Symbol = symbol_short!("ADMIN"); -pub const INIT_FLAG: Symbol = symbol_short!("INIT"); - -#[contracterror] -#[derive(Copy, Clone, Debug, Eq, PartialEq)] -pub enum CoreError { - AlreadyInitialized = 1, - Unauthorized = 2, -} - -#[contracttype] -#[derive(Clone, Debug, PartialEq, Eq)] -pub enum EngineRole { - Admin, - Operator, -} - -#[contract] -pub struct CoreEngine; - -#[contractimpl] -impl CoreEngine { - /// Initialize the core engine with an admin and an optional list of operators. - pub fn initialize(env: Env, admin: Address, operators: Vec
) { - if env.storage().persistent().has(&INIT_FLAG) { - panic_with_error!(&env, CoreError::AlreadyInitialized); - } - - admin.require_auth(); - - env.storage().persistent().set(&ADMIN_KEY, &admin); - env.storage().persistent().set(&INIT_FLAG, &true); - - if !operators.is_empty() { - for operator in operators.iter() { - env.storage().persistent().set(&operator, &EngineRole::Operator); - } -} - - env.storage().persistent().set(&admin, &EngineRole::Admin); - - env.events().publish( - (symbol_short!("CORE"), symbol_short!("init")), - admin.clone(), - ); - } - - /// Check if an address has a specific role - pub fn require_role(env: &Env, caller: Address, role: EngineRole) { - caller.require_auth(); - let stored_role = env.storage().persistent().get::<_, EngineRole>(&caller); - - if stored_role != Some(role) { - panic_with_error!(env, CoreError::Unauthorized); - } - } -} diff --git a/engine-core/src/core/guards.rs b/engine-core/src/core/guards.rs index fb1fea6..a913d4d 100644 --- a/engine-core/src/core/guards.rs +++ b/engine-core/src/core/guards.rs @@ -8,20 +8,23 @@ pub enum GuardError { ReentrancyDetected = 1, } -pub struct ReentrancyGuard; +pub struct ReentrancyGuard<'a> { + env: &'a Env, +} -impl ReentrancyGuard { - pub fn new(env: &Env) -> Self { +impl<'a> ReentrancyGuard<'a> { + pub fn new(env: &'a Env) -> Self { if env.storage().temporary().has(&KEY_REENTRY) { panic_with_error!(env, GuardError::ReentrancyDetected); } env.storage().temporary().set(&KEY_REENTRY, &true); - Self + Self { env } } } -impl Drop for ReentrancyGuard { +impl Drop for ReentrancyGuard<'_> { fn drop(&mut self) { + self.env.storage().temporary().remove(&KEY_REENTRY); } } diff --git a/engine-core/src/core/mod.rs b/engine-core/src/core/mod.rs index b0e8219..7d090be 100644 --- a/engine-core/src/core/mod.rs +++ b/engine-core/src/core/mod.rs @@ -1,64 +1,9 @@ - -use soroban_sdk::{contract, contractimpl, contracttype, Env, Symbol, Address, BytesN}; - -#[contracttype] -#[derive(Clone, Debug, Eq, PartialEq)] -pub enum CoreState { - Uninitialized, - Active, - Paused, - EmergencyHalt, -} - -#[contracttype] -#[derive(Clone, Debug, Eq, PartialEq)] -pub struct IntegrityProof { - pub zk_proof_hash: BytesN<32>, - pub timestamp: u64, -} - -#[contract] -pub struct EngineCore; - -#[contractimpl] -impl EngineCore { - /// Initializes the core control plane. - pub fn initialize(env: Env, admin: Address) { - admin.require_auth(); - let state_key = Symbol::new(&env, "state"); - if env.storage().instance().has(&state_key) { - panic!("Already initialized"); - } - env.storage().instance().set(&state_key, &CoreState::Active); - env.storage().instance().set(&Symbol::new(&env, "admin"), &admin); - } - - /// Verifies ZK-ready integrity check. - pub fn verify_integrity(env: Env, proof: IntegrityProof) -> bool { - // Adherence to Soroban/Rust security standards - // Seamless integration with existing contract architecture - let is_valid = proof.zk_proof_hash.len() == 32; - if is_valid { - env.events().publish((Symbol::new(&env, "integrity"),), proof.timestamp); - } - is_valid - } - - /// Halts the engine in case of emergency. - pub fn emergency_halt(env: Env, admin: Address) { - admin.require_auth(); - let current_admin: Address = env.storage().instance().get(&Symbol::new(&env, "admin")).unwrap(); - if admin != current_admin { - panic!("Unauthorized"); - } - env.storage().instance().set(&Symbol::new(&env, "state"), &CoreState::EmergencyHalt); - env.events().publish((Symbol::new(&env, "halted"),), admin); - } -} - +pub mod access; pub mod control_plane; -pub mod engine; +pub mod guards; pub mod proxy; +pub mod state; +pub mod zk_hooks; #[cfg(test)] mod tests; diff --git a/engine-core/src/core/proxy.rs b/engine-core/src/core/proxy.rs index 6440205..a1a471d 100644 --- a/engine-core/src/core/proxy.rs +++ b/engine-core/src/core/proxy.rs @@ -35,7 +35,7 @@ impl UpgradeableProxy { env.storage().instance().set(&ADMIN_KEY, &admin); // Storage gap to reserve slots and prevent collisions in future upgrades - let gap: [u64; 50] = [0; 50]; + let gap: soroban_sdk::Vec = soroban_sdk::Vec::from_array(&env, [0u64; 50]); env.storage().instance().set(&GAP_KEY, &gap); } diff --git a/engine-core/src/core/state.rs b/engine-core/src/core/state.rs index a113fb4..b3f1b45 100644 --- a/engine-core/src/core/state.rs +++ b/engine-core/src/core/state.rs @@ -43,7 +43,9 @@ fn allowed_transition(from: ProtocolState, to: ProtocolState) -> bool { } pub fn init(env: &Env) { - env.storage().instance().set(&KEY_STATE, &ProtocolState::Pending); + env.storage() + .instance() + .set(&KEY_STATE, &(ProtocolState::Pending as u32)); } pub fn get_state(env: &Env) -> ProtocolState { @@ -59,7 +61,7 @@ pub fn transition_to(env: &Env, next: ProtocolState) { if !allowed_transition(current, next) { panic_with_error!(env, StateError::InvalidTransition); } - env.storage().instance().set(&KEY_STATE, &next); + env.storage().instance().set(&KEY_STATE, &(next as u32)); publish_event( env, MOD_CORE | ACT_TRANSITION, diff --git a/engine-core/src/core/tests.rs b/engine-core/src/core/tests.rs index a82cf52..adce92a 100644 --- a/engine-core/src/core/tests.rs +++ b/engine-core/src/core/tests.rs @@ -2,6 +2,7 @@ use super::control_plane::{ControlPlane, ControlPlaneClient}; use crate::audit::compute_commitment; use crate::core::zk_hooks; use crate::types::StateCommitment; +use crate::version::{CONTRACT_VERSION, VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH}; use soroban_sdk::{ symbol_short, testutils::Address as _, @@ -28,7 +29,7 @@ fn initialized_client(env: &Env) -> (ControlPlaneClient<'_>, Address, Address) { } fn setup_client(env: &Env) -> (Address, ControlPlaneClient<'_>) { - let contract_id = env.register(ControlPlane, ()); + let contract_id = env.register_contract(None, ControlPlane); let client = ControlPlaneClient::new(env, &contract_id); (contract_id, client) } @@ -68,15 +69,11 @@ fn test_initialize() { } #[test] -#[should_panic(expected = "ZeroAddress")] -fn test_initialize_zero_address_protection() { +fn test_initialize_rejects_contract_as_its_own_admin() { let env = Env::default(); let (contract_id, client) = setup_client(&env); - // Trying to set the contract itself as admin should fail - let admin = Address::from_string(&"CDLZFC3SYJYDZT7K67VZ75HPJVIEUVNIXF47ZG2FB2RMQQVU2HHGCYSC" - .parse() - .unwrap_or(contract_id.clone())); - // Simpler: use contract_id directly (Soroban allows this, our check catches it) + // The contract can never authorize on its own behalf, so this would be an + // unusable admin; reject it explicitly instead of bricking the contract. let res = client.try_initialize(&contract_id); assert!(res.is_err()); } @@ -84,6 +81,13 @@ fn test_initialize_zero_address_protection() { #[test] #[should_panic] fn test_get_admin_rejects_uninitialized() { + let env = Env::default(); + let (_, client) = setup_client(&env); + client.get_admin(); +} + +#[test] +fn test_update_param_full_flow() { let env = Env::default(); let (client, admin, _) = initialized_client(&env); @@ -198,6 +202,7 @@ fn test_zk_proof_rejects_wrong_state_root() { #[test] fn test_batch_update_param_success() { let env = Env::default(); + env.mock_all_auths(); let contract_id = env.register_contract(None, ControlPlane); let client = ControlPlaneClient::new(&env, &contract_id); let admin = Address::generate(&env); @@ -224,6 +229,5 @@ fn test_batch_update_param_success() { author: author.clone(), }; - env.mock_all_auths(); client.batch_update_param(&admin, ¶ms, &commitment, &payload); } diff --git a/engine-core/src/emergency_recovery.rs b/engine-core/src/emergency_recovery.rs index 92c613b..5e4b6b9 100644 --- a/engine-core/src/emergency_recovery.rs +++ b/engine-core/src/emergency_recovery.rs @@ -1,17 +1,9 @@ - -//! Emergency recovery multi-sig. +//! Emergency recovery — multi-sig guarded exit path for bricked contracts. //! //! This module offers an out-of-band, threshold-controlled recovery path for //! funds locked in the current contract. Requests are explicit, approvals are //! distinct, and execution emits compact audit events. -use crate::circuit_breaker::assert_closed; -use crate::event_struct::{ACT_REQUEST, ACT_TRIGGERED, MOD_RECOVERY}; -use crate::event_utils::publish_event; -use soroban_sdk::{contracterror, panic_with_error, symbol_short, token, vec, Address, BytesN, Env, String, Symbol, Vec}; - -//! Emergency recovery — multi-sig guarded exit path for bricked contracts. - use crate::circuit_breaker::assert_closed; use crate::event_struct::{ACT_REQUEST, ACT_TRIGGERED, MOD_RECOVERY}; use crate::event_utils::{publish_event, zero_hash}; @@ -19,7 +11,6 @@ use soroban_sdk::{ contracterror, panic_with_error, symbol_short, token, vec, Address, Env, String, Symbol, Vec, }; - const KEY_ADMINS: Symbol = symbol_short!("ER_ADMINS"); const KEY_THRESH: Symbol = symbol_short!("ER_THRESH"); const KEY_APPROVALS: Symbol = symbol_short!("ER_APPRVS"); @@ -29,11 +20,7 @@ const KEY_AMOUNT: Symbol = symbol_short!("ER_AMOUNT"); const ZERO_ADDRESS: &str = "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF"; #[contracterror] - -#[derive(Copy, Clone, Debug, Eq, PartialEq)] - #[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord)] - pub enum RecoveryError { NotAdmin = 1, AlreadyApproved = 2, @@ -42,40 +29,22 @@ pub enum RecoveryError { InvalidThreshold = 5, InvalidAddress = 6, InvalidAmount = 7, - DuplicateAdmin = 8, - - AlreadyInitialized = 8, - + AlreadyInitialized = 9, } pub fn init(env: &Env, admins: Vec
, threshold: u32) { - - if threshold == 0 || threshold > admins.len() { - panic_with_error!(env, RecoveryError::InvalidThreshold); - } - ensure_unique_admins(env, &admins); - for admin in admins.iter() { - validate_address(env, &admin); - } - if env.storage().instance().has(&KEY_ADMINS) { panic_with_error!(env, RecoveryError::AlreadyInitialized); } if threshold == 0 || threshold > admins.len() { panic_with_error!(env, RecoveryError::InvalidThreshold); } - - let mut seen = Vec::new(env); + ensure_unique_admins(env, &admins); for admin in admins.iter() { validate_address(env, &admin); - if seen.contains(&admin) { - panic_with_error!(env, RecoveryError::InvalidThreshold); - } - seen.push_back(admin); } - env.storage().instance().set(&KEY_ADMINS, &admins); env.storage().instance().set(&KEY_THRESH, &threshold); clear_pending(env); @@ -105,13 +74,8 @@ pub fn request(env: &Env, requester: &Address, token: &Address, dest: &Address, publish_event( env, MOD_RECOVERY | ACT_REQUEST, - - amount_as_u64(env, amount), - BytesN::from_array(env, &[0u8; 32]), - event_amount(env, amount), zero_hash(env), - ); let threshold: u32 = env.storage().instance().get(&KEY_THRESH).unwrap_or(1); @@ -151,14 +115,6 @@ pub fn approve(env: &Env, admin: &Address) { } } - -pub fn approvals(env: &Env) -> Vec
{ - env.storage().instance().get(&KEY_APPROVALS).unwrap_or(vec![env]) -} - -fn execute_recovery(env: &Env, dest: &Address) { - assert_closed(env); - pub fn pending_approvals(env: &Env) -> Vec
{ env.storage() .instance() @@ -167,6 +123,7 @@ pub fn pending_approvals(env: &Env) -> Vec
{ } fn execute_recovery(env: &Env, dest: &Address) { + assert_closed(env); let token: Address = env .storage() @@ -183,13 +140,8 @@ fn execute_recovery(env: &Env, dest: &Address) { publish_event( env, MOD_RECOVERY | ACT_TRIGGERED, - - amount_as_u64(env, amount), - BytesN::from_array(env, &[0u8; 32]), - event_amount(env, amount), zero_hash(env), - ); clear_pending(env); } @@ -210,21 +162,12 @@ fn require_admin(env: &Env, caller: &Address) { } fn validate_address(env: &Env, addr: &Address) { - - if addr.to_string().is_empty() { - panic_with_error!(env, RecoveryError::InvalidAddress); - } - let zero = String::from_str(env, ZERO_ADDRESS); - if addr.to_string() == zero { - let zero = String::from_str(env, ZERO_ADDRESS); if addr.to_string().is_empty() || addr.to_string() == zero { - panic_with_error!(env, RecoveryError::InvalidAddress); } } - fn ensure_unique_admins(env: &Env, admins: &Vec
) { let mut seen = vec![env]; for admin in admins.iter() { @@ -235,12 +178,8 @@ fn ensure_unique_admins(env: &Env, admins: &Vec
) { } } -fn amount_as_u64(env: &Env, amount: i128) -> u64 { - if amount < 0 || amount > u64::MAX as i128 { - fn event_amount(env: &Env, amount: i128) -> u64 { if amount <= 0 || amount > u64::MAX as i128 { - panic_with_error!(env, RecoveryError::InvalidAmount); } amount as u64 @@ -257,20 +196,12 @@ mod tests { #[contractimpl] impl TestContract {} - - fn setup(env: &Env, threshold: u32) -> (Address, Vec
) { - let contract_id = env.register_contract(None, TestContract); - let a0 = Address::generate(env); - let a1 = Address::generate(env); - let admins = vec![env, a0, a1]; - - fn setup(env: &Env, admin_count: u32, threshold: u32) -> (soroban_sdk::Address, Vec
) { + fn setup(env: &Env, admin_count: u32, threshold: u32) -> (Address, Vec
) { let contract_id = env.register_contract(None, TestContract); let mut admins = vec![env]; for _ in 0..admin_count { admins.push_back(Address::generate(env)); } - env.as_contract(&contract_id, || init(env, admins.clone(), threshold)); (contract_id, admins) } @@ -279,11 +210,6 @@ mod tests { #[should_panic] fn init_rejects_zero_threshold() { let env = Env::default(); - - let contract_id = env.register_contract(None, TestContract); - let a = Address::generate(&env); - env.as_contract(&contract_id, || init(&env, vec![&env, a], 0)); - let a = Address::generate(&env); let contract_id = env.register_contract(None, TestContract); env.as_contract(&contract_id, || init(&env, vec![&env, a], 0)); @@ -296,7 +222,6 @@ mod tests { let a = Address::generate(&env); let contract_id = env.register_contract(None, TestContract); env.as_contract(&contract_id, || init(&env, vec![&env, a], 2)); - } #[test] @@ -305,12 +230,6 @@ mod tests { let env = Env::default(); env.mock_all_auths(); - let (contract_id, _) = setup(&env, 2); - let rogue = Address::generate(&env); - let token = Address::generate(&env); - let dest = Address::generate(&env); - env.as_contract(&contract_id, || request(&env, &rogue, &token, &dest, 1000)); - let (contract_id, _) = setup(&env, 2, 2); let rogue = Address::generate(&env); let token = Address::generate(&env); @@ -331,27 +250,20 @@ mod tests { request(&env, &admin, &token, &dest, 1000); approve(&env, &admin); }); - } #[test] fn single_approval_does_not_execute_when_threshold_is_two() { let env = Env::default(); env.mock_all_auths(); - let (contract_id, admins) = setup(&env, 2); + let (contract_id, admins) = setup(&env, 2, 2); let token = Address::generate(&env); let dest = Address::generate(&env); - let a0 = admins.get(0).unwrap(); - env.as_contract(&contract_id, || { - request(&env, &a0, &token, &dest, 500); - assert_eq!(approvals(&env).len(), 1); - let admin = admins.get(0).unwrap(); env.as_contract(&contract_id, || { request(&env, &admin, &token, &dest, 500); assert_eq!(pending_approvals(&env).len(), 1); - }); } } diff --git a/engine-core/src/event_struct.rs b/engine-core/src/event_struct.rs index 0267a33..9f0842b 100644 --- a/engine-core/src/event_struct.rs +++ b/engine-core/src/event_struct.rs @@ -1,44 +1,29 @@ - -//! Compact event encoding for audit-friendly Soroban logs. -//! -//! `CompactEvent` replaces heap-heavy, loosely typed event payloads with a flat -//! structure that is deterministic, cheap to emit, and easy for indexers to -//! verify. The `flags` field packs a module id and action id into one `u32`. - //! Compact event encoding for audit-ready Soroban logs. - //! //! `CompactEvent` keeps on-chain events small and deterministic while still //! giving the relayer/dashboard enough data to reconstruct the control-plane //! audit trail. `flags` packs a module id and an action id; `value` carries the //! primary numeric datum; `hash` carries a state/action hash when present. +//! +//! Replaces the previous fat `Event { event_type: BytesN<32>, action: BytesN<32>, payload: Map }` +//! which wasted 64 bytes of zeroed data and allocated an expensive `Map` on every call. +//! +//! ## Encoding +//! +//! `flags` packs module id (bits 0–7) and action id (bits 8–15) into a single `u32`: +//! +//! ```text +//! bits 0– 7 : module id (MOD_*) +//! bits 8–15 : action id (ACT_*) +//! bits 16–31 : reserved for future use / version +//! ``` +//! +//! `value` carries a u64 primary value (sequence, proposal id, amount, …). +//! `hash` carries an optional 32-byte hash (state_hash, action_hash). Zero if unused. use soroban_sdk::{contracttype, BytesN}; - -// Compact event encoding — bitmask-based event struct. -// -// Replaces the previous fat `Event { event_type: BytesN<32>, action: BytesN<32>, payload: Map }` -// which wasted 64 bytes of zeroed data and allocated an expensive `Map` on every call. -// -// ## Encoding -// -// `flags` packs module id (bits 0–7) and action id (bits 8–15) into a single `u32`: -// -// ```text -// bits 0– 7 : module id (MOD_*) -// bits 8–15 : action id (ACT_*) -// bits 16–31 : reserved for future use / version -// ``` -// -// `value` carries a u64 primary value (sequence, proposal id, amount, …). -// `hash` carries an optional 32-byte hash (state_hash, action_hash). Zero if unused. - - -use soroban_sdk::{contracttype, BytesN}; - - -// Module ids (bits 0..=7). +// ── module ids (bits 0..=7) ───────────────────────────────────────────────── pub const MOD_AUDIT: u32 = 0x01; pub const MOD_GOV: u32 = 0x02; @@ -46,17 +31,11 @@ pub const MOD_TREASURY: u32 = 0x03; pub const MOD_CB: u32 = 0x04; pub const MOD_BURN: u32 = 0x05; pub const MOD_RECOVERY: u32 = 0x06; -pub const MOD_FEE: u32 = 0x07; -pub const MOD_CORE: u32 = 0x08; pub const MOD_FEE: u32 = 0x07; +pub const MOD_CORE: u32 = 0x08; +pub const MOD_UPGRADE: u32 = 0x09; - -// Action ids (bits 8..=15). - -pub const MOD_UPGRADE: u32 = 0x08; - -// ── action ids ──────────────────────────────────────────────────────────────── - +// ── action ids (bits 8..=15) ──────────────────────────────────────────────── pub const ACT_COMMIT: u32 = 0x01 << 8; pub const ACT_SNAPSHOT: u32 = 0x02 << 8; @@ -67,23 +46,11 @@ pub const ACT_TRIP: u32 = 0x06 << 8; pub const ACT_RESET: u32 = 0x07 << 8; pub const ACT_BURN_SAFE: u32 = 0x08 << 8; pub const ACT_REQUEST: u32 = 0x09 << 8; - -pub const ACT_TRIGGERED: u32 = 0x0a << 8; -pub const ACT_FEE: u32 = 0x0b << 8; - -#[contracttype] -#[derive(Clone, Debug, Eq, PartialEq)] -pub struct CompactEvent { - pub flags: u32, - pub value: u64, - pub const ACT_TRIGGERED: u32 = 0x0A << 8; -pub const ACT_FEE: u32 = 0x0B << 8; -pub const ACT_INIT: u32 = 0x0C << 8; -pub const ACT_TRANSITION: u32 = 0x0D << 8; pub const ACT_FEE: u32 = 0x0B << 8; -pub const ACT_UPGRADE: u32 = 0x0C << 8; -pub const ACT_UPDATE: u32 = 0x0D << 8; +pub const ACT_INIT: u32 = 0x0C << 8; +pub const ACT_TRANSITION: u32 = 0x0D << 8; +pub const ACT_UPGRADE: u32 = 0x0E << 8; /// Compact event struct emitted by all engine-core modules. #[contracttype] @@ -93,10 +60,6 @@ pub struct CompactEvent { pub flags: u32, /// Primary numeric value — sequence number, proposal id, amount, etc. pub value: u64, - /// Optional 32-byte hash (state_hash, action_hash). All-zero when unused. - - /// Optional 32-byte hash (all-zero when unused). - pub hash: BytesN<32>, } diff --git a/engine-core/src/event_utils.rs b/engine-core/src/event_utils.rs index d866fe6..29a5402 100644 --- a/engine-core/src/event_utils.rs +++ b/engine-core/src/event_utils.rs @@ -1,18 +1,7 @@ - -use soroban_sdk::{symbol_short, BytesN, Env, Map, Symbol, Val}; - //! Event publishing helpers. - use crate::event_struct::CompactEvent; -use soroban_sdk::{symbol_short, BytesN, Env}; - - -/// Publish a deterministic compact event under a single topic for indexing. -pub fn publish_event(env: &Env, flags: u32, value: u64, hash: BytesN<32>) { - let ev = CompactEvent { flags, value, hash }; - env.events() - .publish((symbol_short!("EVENT"), symbol_short!("LOG")), ev); +use soroban_sdk::{symbol_short, BytesN, Env, Map, Symbol, Val}; /// Publish a compact, structured event. /// @@ -20,11 +9,6 @@ pub fn publish_event(env: &Env, flags: u32, value: u64, hash: BytesN<32>) { /// [`crate::event_struct`]. The event topic is intentionally stable so the /// off-chain bridge can consume every engine-core event with one subscription. pub fn publish_event(env: &Env, flags: u32, value: u64, hash: BytesN<32>) { - - let ev = CompactEvent { flags, value, hash }; - env.events() - .publish((symbol_short!("EVENT"), symbol_short!("LOG")), ev); - let event = CompactEvent { flags, value, hash }; env.events() .publish((symbol_short!("EVENT"), symbol_short!("LOG")), event); @@ -33,7 +17,6 @@ pub fn publish_event(env: &Env, flags: u32, value: u64, hash: BytesN<32>) { /// Return the canonical all-zero hash used when an event has no hash payload. pub fn zero_hash(env: &Env) -> BytesN<32> { BytesN::from_array(env, &[0u8; 32]) - } /// Compatibility function for legacy events. diff --git a/engine-core/src/governance.rs b/engine-core/src/governance.rs index 25e3e57..f181b4a 100644 --- a/engine-core/src/governance.rs +++ b/engine-core/src/governance.rs @@ -1,149 +1,52 @@ - -//! Multi-signature governance with timelock. -//! -//! Proposals are stored individually in persistent storage to keep the instance -//! footprint bounded. A proposal moves through exactly this state machine: -//! -//! `Pending -> Approved -> Executed`. - -use crate::circuit_breaker::assert_closed; -use crate::event_struct::{ACT_APPROVE, ACT_EXECUTE, ACT_PROPOSE, MOD_GOV}; -use crate::event_utils::publish_event; -use crate::types::{Proposal, ProposalState}; -use soroban_sdk::{contracterror, contracttype, panic_with_error, symbol_short, vec, Address, BytesN, Env, Symbol, Vec}; - -const KEY_SIGNERS: Symbol = symbol_short!("SIGNERS"); -const KEY_THRESH: Symbol = symbol_short!("THRESH"); - -/// Ledgers to wait after quorum before execution (~1 hour on Stellar). -pub const TIMELOCK_LEDGERS: u32 = 720; -const PROPOSAL_TTL_THRESHOLD: u32 = 17_280; -const PROPOSAL_TTL_EXTEND_TO: u32 = 17_280 * 30; - -#[contracttype] -#[derive(Clone, Debug, Eq, PartialEq)] -pub enum GovKey { - Proposal(u64), -} - //! Multi-sig governance with explicit proposal-state transitions and timelock. //! - -//! ## Proposal State Machine - -//! State machine: +//! Proposals are stored in a single instance-storage map to keep call costs +//! predictable. A proposal moves through this state machine: //! - //! ```text -//! Pending ──(threshold approvals)──> Approved ──(timelock elapsed)──> Executed +//! Pending ──(threshold approvals, strictly increasing signer order)──> Approved ──(timelock elapsed)──> Executed //! ``` //! //! Invalid transitions panic with typed `GovError` values for auditability. - -use crate::event_struct::{ACT_APPROVE, ACT_EXECUTE, ACT_PROPOSE, MOD_GOV}; -use crate::event_utils::publish_event; -use crate::types::{Proposal, ProposalState}; -use soroban_sdk::{ - contracterror, panic_with_error, symbol_short, vec, Address, Env, Map, Symbol, Vec, -}; - -const KEY_PROPOSALS: Symbol = symbol_short!("PROPS"); -const KEY_SIGNERS: Symbol = symbol_short!("SIGNERS"); -const KEY_THRESH: Symbol = symbol_short!("THRESH"); - -/// Ledgers to wait after full approval before execution (~1 hour on Stellar). -const TIMELOCK_LEDGERS: u32 = 720; - use crate::circuit_breaker::assert_closed; use crate::event_struct::{ACT_APPROVE, ACT_EXECUTE, ACT_PROPOSE, MOD_GOV}; use crate::event_utils::{publish_event, zero_hash}; use crate::types::{Proposal, ProposalState}; use soroban_sdk::{ - - contracterror, panic_with_error, symbol_short, vec, Address, BytesN, Env, Map, Symbol, Vec, - - contracterror, panic_with_error, symbol_short, token, vec, Address, Env, Map, Symbol, Vec, BytesN, - + contracterror, panic_with_error, symbol_short, token, vec, Address, Env, Map, Symbol, Vec, }; const KEY_PROPOSALS: Symbol = symbol_short!("PROPS"); const KEY_SIGNERS: Symbol = symbol_short!("SIGNERS"); const KEY_THRESH: Symbol = symbol_short!("THRESH"); - - -/// Ledgers to wait after full approval before execution (~1 hour on Stellar). -const TIMELOCK_LEDGERS: u32 = 720; - -#[contracterror] -#[derive(Copy, Clone, Debug, Eq, PartialEq)] - const KEY_MIN_STAKE: Symbol = symbol_short!("MINSTAKE"); const KEY_STAKE_TOK: Symbol = symbol_short!("STKTOK"); -/// Ledgers to wait after threshold approval before execution (~1 hour). +/// Ledgers to wait after threshold approval before execution (~1 hour on Stellar). pub const TIMELOCK_LEDGERS: u32 = 720; const MAX_THRESHOLD: u32 = 100; - #[contracterror] #[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord)] - pub enum GovError { NotASigner = 1, AlreadyApproved = 2, ProposalNotFound = 3, TimelockActive = 4, InvalidStateTransition = 5, - InvalidThreshold = 6, - - ProposalNotFound = 6, - InvalidThreshold = 7, - - DuplicateSigner = 8, - DuplicateProposal = 9, -} - -/// Initialise governance with a signer set and approval threshold. -pub fn init(env: &Env, signers: Vec
, threshold: u32) { - if threshold == 0 || threshold > signers.len() { - panic_with_error!(env, GovError::InvalidThreshold); - } - ensure_unique_signers(env, &signers); - env.storage().instance().set(&KEY_SIGNERS, &signers); - env.storage().instance().set(&KEY_THRESH, &threshold); -} - -/// Return configured signers. -pub fn signers(env: &Env) -> Vec
{ - env.storage().instance().get(&KEY_SIGNERS).unwrap_or(vec![env]) -} - -/// Return configured approval threshold. -pub fn threshold(env: &Env) -> u32 { - env.storage().instance().get(&KEY_THRESH).unwrap_or(1) -} - -/// Submit a new proposal. Returns the proposal id. -pub fn propose(env: &Env, proposal: Proposal) -> u64 { - crate::non_reentrant!(env); - assert_closed(env); - let signers = signers(env); - - InvalidStake = 8, - AlreadyInitialized = 9, - ProposalAlreadyExists = 10, - InvalidProposal = 11, + InvalidStake = 7, + AlreadyInitialized = 8, + DuplicateSigner = 9, + DuplicateProposal = 10, + ThresholdNotMet = 11, ArithmeticOverflow = 12, + InvalidSignerOrder = 13, } +/// Initialise governance with a signer set and approval threshold. pub fn init(env: &Env, signers: Vec
, threshold: u32) { - - if threshold == 0 || threshold > signers.len() { - panic_with_error!(env, GovError::InvalidThreshold); - } - init_internal(env, signers, threshold, None, 0); } @@ -183,12 +86,11 @@ fn init_internal( let mut seen = Vec::new(env); for signer in signers.iter() { if seen.contains(&signer) { - panic_with_error!(env, GovError::InvalidThreshold); + panic_with_error!(env, GovError::DuplicateSigner); } seen.push_back(signer); } - env.storage().instance().set(&KEY_SIGNERS, &signers); env.storage().instance().set(&KEY_THRESH, &threshold); env.storage().instance().set(&KEY_MIN_STAKE, &min_stake); @@ -200,9 +102,7 @@ fn init_internal( env.storage().instance().set(&KEY_PROPOSALS, &empty); } - /// Load the proposal map. Public for tests and read-only off-chain simulation. - pub fn load_proposals(env: &Env) -> Map { env.storage() .instance() @@ -210,10 +110,6 @@ pub fn load_proposals(env: &Env) -> Map { .unwrap_or(Map::new(env)) } - -/// Submit a new proposal. Returns the assigned proposal id. -pub fn propose(env: &Env, proposal: Proposal) -> u64 { - fn save_proposals(env: &Env, proposals: &Map) { env.storage().instance().set(&KEY_PROPOSALS, proposals); } @@ -238,13 +134,11 @@ fn require_signer(env: &Env, signer: &Address) { fn signer_index(env: &Env, signer: &Address) -> u32 { let signers = load_signers(env); - for i in 0..signers.len() { if signers.get(i).unwrap() == *signer { return i; } } - panic_with_error!(env, GovError::NotASigner); } @@ -264,162 +158,68 @@ fn require_stake(env: &Env, signer: &Address) { } } - +/// Submit a new proposal. Returns the assigned proposal id. pub fn propose(env: &Env, mut proposal: Proposal) -> u64 { + crate::non_reentrant!(env); + assert_closed(env); - let signers: Vec
= env - .storage() - .instance() - .get(&KEY_SIGNERS) - .unwrap_or(vec![env]); - - if !signers.contains(&proposal.proposer) { - panic_with_error!(env, GovError::NotASigner); - } - - - + require_signer(env, &proposal.proposer); proposal.proposer.require_auth(); - - let key = proposal_key(proposal.id); - if env.storage().persistent().has(&key) { + let mut proposals = load_proposals(env); + if proposals.contains_key(proposal.id) { panic_with_error!(env, GovError::DuplicateProposal); } - let id = proposal.id; - let mut prop = proposal; - prop.state = ProposalState::Pending; - prop.approved_by = vec![env]; - let unlock_ledger = env.ledger().sequence() + TIMELOCK_LEDGERS; - - env.storage().persistent().set(&key, &(prop, unlock_ledger)); - extend_proposal_ttl(env, &key); - - publish_event(env, MOD_GOV | ACT_PROPOSE, id, BytesN::from_array(env, &[0u8; 32])); - id -} - -/// Record one signer approval. When quorum is reached, state becomes Approved. - - - // Initialize state to Pending - proposal.state = ProposalState::Pending; - - let mut props = load_proposals(env); - let unlock_ledger = env.ledger().sequence() + TIMELOCK_LEDGERS; - - props.set(proposal.id, (proposal.clone(), unlock_ledger)); - env.storage().instance().set(&KEY_PROPOSALS, &props); - - // Single compact event. + proposal.approved_by = vec![env]; let id = proposal.id; - props.set(id, (proposal.clone(), unlock_ledger)); - env.storage().instance().set(&KEY_PROPOSALS, &props); - - - publish_event( - env, - MOD_GOV | ACT_PROPOSE, - proposal.id, - - proposal.action_hash.clone(), - ); - - - BytesN::from_array(env, &[0u8; 32]), - ); + let unlock_ledger = env.ledger().sequence() + TIMELOCK_LEDGERS; + proposals.set(id, (proposal.clone(), unlock_ledger)); + save_proposals(env, &proposals); - proposal.id + publish_event(env, MOD_GOV | ACT_PROPOSE, id, proposal.action_hash.clone()); + id } - +/// Record one signer approval. Approvals must arrive in strictly increasing +/// signer order (by configured signer index) so that a fixed replay of the +/// same approval set always produces the same audit trail. When quorum is +/// reached, the proposal becomes `Approved` and its timelock starts. pub fn approve(env: &Env, signer: &Address, proposal_id: u64) { crate::circuit_breaker::assert_closed(env); crate::non_reentrant!(env); - assert_closed(env); - - signer.require_auth(); - let configured = signers(env); - if !configured.contains(signer) { - panic_with_error!(env, GovError::NotASigner); - } - - let key = proposal_key(proposal_id); - let (mut prop, unlock): (Proposal, u32) = env - .storage() - .persistent() - .get(&key) - .unwrap_or_else(|| panic_with_error!(env, GovError::ProposalNotFound)); - - if prop.state != ProposalState::Pending { - panic_with_error!(env, GovError::InvalidStateTransition); - } - if prop.approved_by.contains(signer) { - panic_with_error!(env, GovError::AlreadyApproved); - } - - prop.approved_by.push_back(signer.clone()); - if prop.approved_by.len() >= threshold(env) { - prop.state = ProposalState::Approved; - signer.require_auth(); require_signer(env, signer); require_stake(env, signer); - let mut proposals = load_proposals(env); let (mut proposal, mut unlock_ledger) = proposals .get(proposal_id) .unwrap_or_else(|| panic_with_error!(env, GovError::ProposalNotFound)); - - if prop.state != ProposalState::Pending { - if proposal.state != ProposalState::Pending { - panic_with_error!(env, GovError::InvalidStateTransition); } if proposal.approved_by.contains(signer) { - panic_with_error!(env, GovError::AlreadyApproved); -} - -if proposal.approved_by.len() > 0 { - let last_signer = proposal - .approved_by - .get(proposal.approved_by.len() - 1) - .unwrap(); - - let last_index = signer_index(env, &last_signer); - let current_index = signer_index(env, signer); - - if current_index <= last_index { - panic_with_error!(env, GovError::InvalidSignerOrder); + panic_with_error!(env, GovError::AlreadyApproved); } -} -proposal.approved_by.push_back(signer.clone()); - proposal.approved_by.push_back(signer.clone()); - - - if (prop.approved_by.len() as u32) >= threshold { - prop.state = ProposalState::Approved; + if !proposal.approved_by.is_empty() { + let last_signer = proposal + .approved_by + .get(proposal.approved_by.len() - 1) + .unwrap(); + let last_index = signer_index(env, &last_signer); + let current_index = signer_index(env, signer); + if current_index <= last_index { + panic_with_error!(env, GovError::InvalidSignerOrder); + } } - props.set(proposal_id, (prop.clone(), unlock)); - env.storage().instance().set(&KEY_PROPOSALS, &props); - - if prop.state == ProposalState::Approved { - publish_event( - env, - MOD_GOV | ACT_APPROVE, - proposal_id, - BytesN::from_array(env, &[0u8; 32]), - ); - } + proposal.approved_by.push_back(signer.clone()); let approval_threshold = threshold(env); if approval_threshold == 0 { @@ -433,106 +233,19 @@ proposal.approved_by.push_back(signer.clone()); .sequence() .checked_add(TIMELOCK_LEDGERS) .unwrap_or_else(|| panic_with_error!(env, GovError::ArithmeticOverflow)); - } proposals.set(proposal_id, (proposal, unlock_ledger)); save_proposals(env, &proposals); - - publish_event(env, MOD_GOV | ACT_APPROVE, proposal_id, prop.action_hash.clone()); -} - -/// Execute an approved proposal after the timelock expires. - publish_event(env, MOD_GOV | ACT_APPROVE, proposal_id, zero_hash(env)); - } /// Execute an approved proposal after its timelock has elapsed. - pub fn execute(env: &Env, proposal_id: u64) -> Proposal { crate::circuit_breaker::assert_closed(env); crate::non_reentrant!(env); - - let mut props = load_proposals(env); - let (mut prop, unlock) = props - .get(proposal_id) - .unwrap_or_else(|| panic_with_error!(env, GovError::ProposalNotFound)); - - if prop.state != ProposalState::Approved { - panic_with_error!(env, GovError::InvalidStateTransition); - } - if env.ledger().sequence() < unlock { - panic_with_error!(env, GovError::TimelockActive); - } - - prop.state = ProposalState::Executed; - props.set(proposal_id, (prop.clone(), unlock)); - env.storage().instance().set(&KEY_PROPOSALS, &props); - - assert_closed(env); - - let key = proposal_key(proposal_id); - let (mut prop, unlock): (Proposal, u32) = env - .storage() - .persistent() - .get(&key) - .unwrap_or_else(|| panic_with_error!(env, GovError::ProposalNotFound)); - - if prop.state != ProposalState::Approved { - panic_with_error!(env, GovError::InvalidStateTransition); - } - if env.ledger().sequence() < unlock { - panic_with_error!(env, GovError::TimelockActive); - } - - prop.state = ProposalState::Executed; - env.storage().persistent().set(&key, &(prop.clone(), unlock)); - extend_proposal_ttl(env, &key); - - publish_event(env, MOD_GOV | ACT_EXECUTE, proposal_id, prop.action_hash.clone()); - prop -} - -pub fn get_proposal(env: &Env, proposal_id: u64) -> Proposal { - let key = proposal_key(proposal_id); - let (prop, _): (Proposal, u32) = env - .storage() - .persistent() - .get(&key) - .unwrap_or_else(|| panic_with_error!(env, GovError::ProposalNotFound)); - prop -} - -pub fn get_proposal_with_unlock(env: &Env, proposal_id: u64) -> (Proposal, u32) { - let key = proposal_key(proposal_id); - env.storage() - .persistent() - .get(&key) - .unwrap_or_else(|| panic_with_error!(env, GovError::ProposalNotFound)) -} - -fn proposal_key(id: u64) -> GovKey { - GovKey::Proposal(id) -} - -fn extend_proposal_ttl(env: &Env, key: &GovKey) { - env.storage() - .persistent() - .extend_ttl(key, PROPOSAL_TTL_THRESHOLD, PROPOSAL_TTL_EXTEND_TO); -} - -fn ensure_unique_signers(env: &Env, signers: &Vec
) { - let mut seen = vec![env]; - for signer in signers.iter() { - if seen.contains(&signer) { - panic_with_error!(env, GovError::DuplicateSigner); - } - seen.push_back(signer); - - let mut proposals = load_proposals(env); let (mut proposal, unlock_ledger) = proposals .get(proposal_id) @@ -552,7 +265,6 @@ fn ensure_unique_signers(env: &Env, signers: &Vec
) { proposals.set(proposal_id, (proposal.clone(), unlock_ledger)); save_proposals(env, &proposals); - publish_event( env, MOD_GOV | ACT_EXECUTE, @@ -562,7 +274,6 @@ fn ensure_unique_signers(env: &Env, signers: &Vec
) { proposal } - /// Return a proposal or panic with `ProposalNotFound`. pub fn get_proposal(env: &Env, proposal_id: u64) -> Proposal { let (proposal, _) = load_proposals(env) @@ -622,7 +333,5 @@ mod tests { assert_eq!(get_proposal(&env, 1).state, ProposalState::Approved); assert_eq!(get_unlock_ledger(&env, 1), Some(TIMELOCK_LEDGERS)); }); - } } - diff --git a/engine-core/src/governance_tests.rs b/engine-core/src/governance_tests.rs index b7587aa..d1f548b 100644 --- a/engine-core/src/governance_tests.rs +++ b/engine-core/src/governance_tests.rs @@ -1,31 +1,27 @@ #[cfg(test)] mod tests { - - use crate::governance::{GovError, self}; - use crate::governance::{self, GovError}; - use crate::types::{Proposal, ProposalState}; - - use soroban_sdk::{contract, contractimpl, testutils::Address as _, testutils::Ledger as _, vec, Address, BytesN, Env}; - use soroban_sdk::{ testutils::{Address as _, Ledger as _}, vec, Address, BytesN, Env, }; - #[soroban_sdk::contract] pub struct TestContract; #[soroban_sdk::contractimpl] impl TestContract {} - fn proposal(env: &Env, id: u64, proposer: Address) -> Proposal { + fn setup_env(env: &Env) -> Address { + env.register_contract(None, TestContract) + } + + fn create_dummy_proposal(env: &Env, proposer: &Address) -> Proposal { Proposal { - id, + id: 1, action_hash: BytesN::from_array(env, &[7u8; 32]), - proposer, + proposer: proposer.clone(), approved_by: vec![env], state: ProposalState::Executed, } @@ -48,29 +44,17 @@ mod tests { fn proposal_initial_state_is_pending() { let env = Env::default(); env.mock_all_auths(); - - let contract_id = env.register_contract(None, TestContract); - let contract_id = setup_env(&env); - let proposer = Address::generate(&env); - env.mock_all_auths(); - - - env.mock_all_auths(); init_one_of_one(&env, &contract_id, &proposer); let id = propose_default(&env, &contract_id, &proposer); env.as_contract(&contract_id, || { - - governance::init(&env, vec![&env, proposer.clone()], 1); - let id = governance::propose(&env, proposal(&env, 1, proposer)); - assert_eq!(governance::get_proposal(&env, id).state, ProposalState::Pending); - - let (p, _) = governance::load_proposals(&env).get(id).unwrap(); - assert_eq!(p.state, ProposalState::Pending); - + assert_eq!( + governance::get_proposal(&env, id).state, + ProposalState::Pending + ); }); } @@ -78,20 +62,8 @@ mod tests { fn pending_moves_to_approved_at_threshold() { let env = Env::default(); env.mock_all_auths(); - - let contract_id = env.register_contract(None, TestContract); - let contract_id = setup_env(&env); - let proposer = Address::generate(&env); - let approver = Address::generate(&env); - - - env.as_contract(&contract_id, || { - governance::init(&env, vec![&env, proposer.clone()], 1); - let id = governance::propose(&env, proposal(&env, 1, proposer.clone())); - governance::approve(&env, &proposer, id); - assert_eq!(governance::get_proposal(&env, id).state, ProposalState::Approved); init_one_of_one(&env, &contract_id, &proposer); let id = propose_default(&env, &contract_id, &proposer); @@ -99,10 +71,8 @@ mod tests { env.as_contract(&contract_id, || { let (p, unlock) = governance::load_proposals(&env).get(id).unwrap(); - assert_eq!(p.state, ProposalState::Approved); assert_eq!(unlock, governance::TIMELOCK_LEDGERS); - }); } @@ -110,22 +80,8 @@ mod tests { fn approved_moves_to_executed_after_timelock() { let env = Env::default(); env.mock_all_auths(); - - let contract_id = env.register_contract(None, TestContract); - let contract_id = setup_env(&env); - let proposer = Address::generate(&env); - let approver = Address::generate(&env); - - - env.as_contract(&contract_id, || { - governance::init(&env, vec![&env, proposer.clone()], 1); - let id = governance::propose(&env, proposal(&env, 1, proposer.clone())); - governance::approve(&env, &proposer, id); - env.ledger().set_sequence_number(governance::TIMELOCK_LEDGERS + 1); - let executed = governance::execute(&env, id); - assert_eq!(executed.state, ProposalState::Executed); init_one_of_one(&env, &contract_id, &proposer); let id = propose_default(&env, &contract_id, &proposer); @@ -134,11 +90,9 @@ mod tests { env.as_contract(&contract_id, || { env.ledger() .set_sequence_number(governance::TIMELOCK_LEDGERS + 1); - governance::execute(&env, id); let (p, _) = governance::load_proposals(&env).get(id).unwrap(); assert_eq!(p.state, ProposalState::Executed); - }); } @@ -147,44 +101,16 @@ mod tests { fn double_approval_is_rejected() { let env = Env::default(); env.mock_all_auths(); - - let contract_id = env.register_contract(None, TestContract); - let proposer = Address::generate(&env); - let other = Address::generate(&env); - - env.as_contract(&contract_id, || { - governance::init(&env, vec![&env, proposer.clone(), other], 2); - let id = governance::propose(&env, proposal(&env, 1, proposer.clone())); - governance::approve(&env, &proposer, id); - governance::approve(&env, &proposer, id); - let contract_id = setup_env(&env); let proposer = Address::generate(&env); - let approver = Address::generate(&env); let signer2 = Address::generate(&env); - - env.mock_all_auths(); - let id = env.as_contract(&contract_id, || { - governance::init(&env, vec![&env, proposer.clone(), signer2.clone()], 1); - let prop = create_dummy_proposal(&env, &proposer); - governance::propose(&env, prop) - }); - - env.as_contract(&contract_id, || { - governance::approve(&env, &proposer, id); - }); - - env.as_contract(&contract_id, || { - governance::approve(&env, &signer2, id); - env.as_contract(&contract_id, || { governance::init(&env, vec![&env, proposer.clone(), signer2.clone()], 1); - }); let id = propose_default(&env, &contract_id, &proposer); env.as_contract(&contract_id, || governance::approve(&env, &proposer, id)); - env.as_contract(&contract_id, || governance::approve(&env, &signer2, id)); + env.as_contract(&contract_id, || governance::approve(&env, &proposer, id)); } #[test] @@ -194,24 +120,12 @@ mod tests { env.mock_all_auths(); let contract_id = setup_env(&env); let proposer = Address::generate(&env); - env.mock_all_auths(); - - - env.mock_all_auths(); - let id = env.as_contract(&contract_id, || { - governance::init(&env, vec![&env, proposer.clone()], 2); - let prop = create_dummy_proposal(&env, &proposer); - governance::propose(&env, prop) - }); env.as_contract(&contract_id, || { - governance::execute(&env, id); + governance::init(&env, vec![&env, proposer.clone()], 2); }); - - init_one_of_one(&env, &contract_id, &proposer); let id = propose_default(&env, &contract_id, &proposer); env.as_contract(&contract_id, || governance::execute(&env, id)); - } #[test] @@ -221,27 +135,6 @@ mod tests { env.mock_all_auths(); let contract_id = setup_env(&env); let proposer = Address::generate(&env); - let approver = Address::generate(&env); - - - env.mock_all_auths(); - let id = env.as_contract(&contract_id, || { - governance::init(&env, vec![&env, proposer.clone()], 1); - let prop = create_dummy_proposal(&env, &proposer); - governance::propose(&env, prop) - }); - - env.as_contract(&contract_id, || { - governance::approve(&env, &proposer, id); - }); - - env.ledger().with_mut(|l| l.sequence_number = 1000); - - env.as_contract(&contract_id, || { - governance::execute(&env, id); - }); - - env.as_contract(&contract_id, || { init_one_of_one(&env, &contract_id, &proposer); let id = propose_default(&env, &contract_id, &proposer); @@ -251,9 +144,7 @@ mod tests { env.ledger() .set_sequence_number(governance::TIMELOCK_LEDGERS + 1); governance::execute(&env, id); - governance::execute(&env, id); - }); } @@ -262,46 +153,15 @@ mod tests { fn timelock_blocks_early_execution() { let env = Env::default(); env.mock_all_auths(); - - let contract_id = env.register_contract(None, TestContract); - let contract_id = setup_env(&env); let proposer = Address::generate(&env); - let approver = Address::generate(&env); - let signer2 = Address::generate(&env); - - - env.mock_all_auths(); - let id = env.as_contract(&contract_id, || { - governance::init(&env, vec![&env, proposer.clone(), signer2.clone()], 1); - let prop = create_dummy_proposal(&env, &proposer); - governance::propose(&env, prop) - }); - - env.as_contract(&contract_id, || { - governance::approve(&env, &proposer, id); - }); - - env.ledger().with_mut(|l| l.sequence_number = 1000); - env.as_contract(&contract_id, || { - governance::execute(&env, id); - }); - env.as_contract(&contract_id, || { - governance::approve(&env, &signer2, id); - - env.as_contract(&contract_id, || { - governance::init(&env, vec![&env, proposer.clone(), signer2.clone()], 1); - }); + init_one_of_one(&env, &contract_id, &proposer); let id = propose_default(&env, &contract_id, &proposer); env.as_contract(&contract_id, || governance::approve(&env, &proposer, id)); env.as_contract(&contract_id, || { - env.ledger() - .set_sequence_number(governance::TIMELOCK_LEDGERS + 1); governance::execute(&env, id); - }); - env.as_contract(&contract_id, || governance::approve(&env, &signer2, id)); } #[test] @@ -309,19 +169,7 @@ mod tests { let env = Env::default(); env.mock_all_auths(); let contract_id = setup_env(&env); - let proposer = Address::generate(&env); - let approver = Address::generate(&env); - - - env.as_contract(&contract_id, || { - governance::init(&env, vec![&env, proposer.clone()], 1); - let id = governance::propose(&env, proposal(&env, 1, proposer.clone())); - governance::approve(&env, &proposer, id); - governance::execute(&env, id); - }); - } -} init_one_of_one(&env, &contract_id, &proposer); let id = propose_default(&env, &contract_id, &proposer); @@ -340,7 +188,6 @@ mod tests { ); env.ledger() .set_sequence_number(governance::TIMELOCK_LEDGERS + 1); - governance::execute(&env, id); assert_eq!( governance::get_proposal(&env, id).state, @@ -363,27 +210,12 @@ mod tests { let proposer = Address::generate(&env); let signer2 = Address::generate(&env); - - env.mock_all_auths(); - let id = env.as_contract(&contract_id, || { - governance::init(&env, vec![&env, proposer.clone()], 2); - let prop = create_dummy_proposal(&env, &proposer); - governance::propose(&env, prop) - }); - - env.as_contract(&contract_id, || { - governance::approve(&env, &proposer, id); - }); - - env.as_contract(&contract_id, || { - env.as_contract(&contract_id, || { governance::init(&env, vec![&env, proposer.clone(), signer2], 2); }); let id = propose_default(&env, &contract_id, &proposer); env.as_contract(&contract_id, || { governance::approve(&env, &proposer, id); - governance::approve(&env, &proposer, id); }); } @@ -403,5 +235,3 @@ mod tests { /// | Executed | execute | — | No | InvalidStateTransition | #[allow(dead_code)] pub struct StateTransitionMatrix; -} - diff --git a/engine-core/src/lib.rs b/engine-core/src/lib.rs index 1b14ef7..8ae9884 100644 --- a/engine-core/src/lib.rs +++ b/engine-core/src/lib.rs @@ -17,9 +17,6 @@ pub mod treasury; pub mod types; pub mod upgrade; pub mod version; -pub mod event_struct; -pub mod event_utils; -pub mod core; #[cfg(test)] mod governance_tests; diff --git a/engine-core/src/protocol_fee.rs b/engine-core/src/protocol_fee.rs index ec88f07..ac18b1c 100644 --- a/engine-core/src/protocol_fee.rs +++ b/engine-core/src/protocol_fee.rs @@ -1,12 +1,4 @@ - -//! Protocol fee calculation and deduction. - -use crate::circuit_breaker::assert_closed; -use crate::event_struct::{ACT_FEE, MOD_FEE}; -use crate::event_utils::publish_event; -use soroban_sdk::{contracterror, panic_with_error, symbol_short, token, Address, BytesN, Env, String, Symbol}; - -//! Protocol fee helpers with checked arithmetic. +//! Protocol fee calculation and deduction, with checked arithmetic. use crate::circuit_breaker::assert_closed; use crate::event_struct::{ACT_FEE, MOD_FEE}; @@ -15,18 +7,13 @@ use soroban_sdk::{ contracterror, panic_with_error, symbol_short, token, Address, Env, String, Symbol, }; - const KEY_FEE_BPS: Symbol = symbol_short!("FEE_BPS"); const KEY_FEE_RECIPIENT: Symbol = symbol_short!("FEE_RCP"); const MAX_BPS: u32 = 10_000; const ZERO_ADDRESS: &str = "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF"; #[contracterror] - -#[derive(Copy, Clone, Debug, Eq, PartialEq)] - #[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord)] - pub enum FeeError { InvalidBasisPoints = 1, InvalidRecipient = 2, @@ -51,11 +38,7 @@ pub fn calculate_fee(env: &Env, amount: i128) -> (i128, i128) { } let fee = amount .checked_mul(fee_bps as i128) - - .and_then(|v| v.checked_div(MAX_BPS as i128)) - .and_then(|value| value.checked_div(MAX_BPS as i128)) - .unwrap_or_else(|| panic_with_error!(env, FeeError::FeeCalculationOverflow)); let net = amount .checked_sub(fee) @@ -78,19 +61,7 @@ pub fn deduct_fee(env: &Env, token: &Address, amount: i128) -> i128 { token::Client::new(env, token).transfer(&env.current_contract_address(), &recipient, &fee); - - publish_event( - env, - MOD_FEE | ACT_FEE, - fee_as_u64(env, fee), - BytesN::from_array(env, &[0u8; 32]), - ); - - if fee > u64::MAX as i128 { - panic_with_error!(env, FeeError::FeeCalculationOverflow); - } - publish_event(env, MOD_FEE | ACT_FEE, fee as u64, zero_hash(env)); - + publish_event(env, MOD_FEE | ACT_FEE, fee_as_u64(env, fee), zero_hash(env)); } net } @@ -118,16 +89,8 @@ fn validate_bps(env: &Env, fee_bps: u32) { } fn validate_address(env: &Env, addr: &Address) { - - if addr.to_string().is_empty() { - panic_with_error!(env, FeeError::InvalidRecipient); - } - let zero = String::from_str(env, ZERO_ADDRESS); - if addr.to_string() == zero { - let zero = String::from_str(env, ZERO_ADDRESS); if addr.to_string().is_empty() || addr.to_string() == zero { - panic_with_error!(env, FeeError::InvalidRecipient); } } @@ -169,11 +132,8 @@ mod tests { } #[test] - fn full_bps_is_full_amount() { + fn partial_bps_fee_rounds_down() { let env = Env::default(); - - let (contract_id, _) = setup(&env, 10_000); - let (contract_id, _) = setup(&env, 333); env.as_contract(&contract_id, || { let (fee, net) = calculate_fee(&env, 100); @@ -186,7 +146,6 @@ mod tests { fn fee_at_full_bps_is_full_amount() { let env = Env::default(); let (contract_id, _) = setup(&env, MAX_BPS); - env.as_contract(&contract_id, || { let (fee, net) = calculate_fee(&env, 1000); assert_eq!(fee, 1000); @@ -195,7 +154,6 @@ mod tests { } #[test] - fn get_fee_config_returns_stored_values() { let env = Env::default(); let (contract_id, recipient) = setup(&env, 250); @@ -218,16 +176,11 @@ mod tests { } #[test] - #[should_panic] fn rejects_bps_over_max() { let env = Env::default(); let contract_id = env.register_contract(None, TestContract); let recipient = Address::generate(&env); - - env.as_contract(&contract_id, || init(&env, 10_001, &recipient)); - env.as_contract(&contract_id, || init(&env, MAX_BPS + 1, &recipient)); - } } diff --git a/engine-core/src/reentrancy_tests.rs b/engine-core/src/reentrancy_tests.rs index f8eb72f..3dd746a 100644 --- a/engine-core/src/reentrancy_tests.rs +++ b/engine-core/src/reentrancy_tests.rs @@ -6,10 +6,6 @@ mod tests { use crate::guards::{enter_reentrancy_guard, exit_reentrancy_guard}; use soroban_sdk::{contract, contractimpl, Env}; - use crate::guards::enter_reentrancy_guard; - use soroban_sdk::{contract, contractimpl, Address, Env}; - - #[contract] pub struct TestContract; diff --git a/engine-core/src/treasury.rs b/engine-core/src/treasury.rs index 521b993..dc1ecfd 100644 --- a/engine-core/src/treasury.rs +++ b/engine-core/src/treasury.rs @@ -29,11 +29,7 @@ const SNAP_TTL_EXTEND_TO: u32 = 17_280 * 7; #[contracttype] #[derive(Clone, Debug, Eq, PartialEq)] - pub enum TreasuryKey { - -enum TreasuryKey { - Snapshot(u64), } @@ -47,11 +43,8 @@ pub enum TreasuryError { OutflowNotFound = 5, OutflowAlreadyExecuted = 6, TimelockActive = 7, - DuplicateOutflow = 8, - - ArithmeticOverflow = 8, - + ArithmeticOverflow = 9, } #[contracttype] @@ -186,8 +179,6 @@ pub fn record_snapshot( let snapshot_key = make_snap_key(snapshot_id); - let snapshot_key = TreasuryKey::Snapshot(snapshot_id); - env.storage().temporary().set(&snapshot_key, &snapshot); env.storage() .temporary() @@ -203,14 +194,8 @@ pub fn record_snapshot( } pub fn get_snapshot(env: &Env, snapshot_id: u64) -> Option { - let key = make_snap_key(snapshot_id); env.storage().temporary().get(&key) - - env.storage() - .temporary() - .get(&TreasuryKey::Snapshot(snapshot_id)) - } pub fn get_latest_snapshot(env: &Env) -> Option { @@ -231,9 +216,6 @@ pub fn get_recent_snapshots(env: &Env, count: u32) -> Vec { let mut result = Vec::new(env); if total == 0 || count == 0 { - - if count == 0 || total == 0 { - return result; } @@ -268,12 +250,6 @@ pub fn audit_trail(env: &Env, from_id: u64) -> Vec { for id in start..=total { if let Some(snap) = get_snapshot(env, id) { result.push_back(snap); - - let start = if from_id == 0 { 1 } else { from_id.min(total) }; - for id in start..=total { - if let Some(snapshot) = get_snapshot(env, id) { - result.push_back(snapshot); - } } result @@ -304,15 +280,6 @@ mod tests { use super::*; use soroban_sdk::{contract, contractimpl, testutils::Ledger as _, Env, Map, Symbol}; -#[cfg(test)] -mod tests { - use super::*; - - use soroban_sdk::{testutils::Ledger as _, Env, Map, Symbol, testutils::Address as _}; - - use soroban_sdk::{testutils::Ledger as _, Env, Map, Symbol}; - - #[contract] pub struct TestContract; diff --git a/engine-core/test_snapshots/audit/tests/hash_mismatch_is_rejected.1.json b/engine-core/test_snapshots/audit/tests/hash_mismatch_is_rejected.1.json new file mode 100644 index 0000000..93e1abe --- /dev/null +++ b/engine-core/test_snapshots/audit/tests/hash_mismatch_is_rejected.1.json @@ -0,0 +1,131 @@ +{ + "generators": { + "address": 2, + "nonce": 0 + }, + "auth": [], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 2 + } + } + ], + "data": { + "vec": [ + { + "string": "failing with contract error" + }, + { + "u32": 2 + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 2 + } + } + ], + "data": { + "string": "escalating error to panic" + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/audit/tests/replay_is_rejected.1.json b/engine-core/test_snapshots/audit/tests/replay_is_rejected.1.json index 3876e68..c8fb5ed 100644 --- a/engine-core/test_snapshots/audit/tests/replay_is_rejected.1.json +++ b/engine-core/test_snapshots/audit/tests/replay_is_rejected.1.json @@ -118,6 +118,46 @@ }, "failed_call": false }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000000" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "9dcbcf21a5a9d8a551075709cee7265d2abfe3225ee3646c7b12dcf93b79fd4e" + } + }, + { + "key": { + "symbol": "seq" + }, + "val": { + "u64": 1 + } + } + ] + } + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/engine-core/test_snapshots/audit/tests/valid_first_commitment.1.json b/engine-core/test_snapshots/audit/tests/valid_first_commitment.1.json index 18b2d58..2fd0a69 100644 --- a/engine-core/test_snapshots/audit/tests/valid_first_commitment.1.json +++ b/engine-core/test_snapshots/audit/tests/valid_first_commitment.1.json @@ -136,6 +136,46 @@ } }, "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000000" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "31b5ccceb7b2eece59647ed1c647b5cd692422ef2e6043a4b514677cf35cfbb9" + } + }, + { + "key": { + "symbol": "seq" + }, + "val": { + "u64": 1 + } + } + ] + } + } + } + }, + "failed_call": false } ] } \ No newline at end of file diff --git a/engine-core/test_snapshots/burn/tests/invalid_amount_rejected.1.json b/engine-core/test_snapshots/burn/tests/invalid_amount_rejected.1.json new file mode 100644 index 0000000..93e1abe --- /dev/null +++ b/engine-core/test_snapshots/burn/tests/invalid_amount_rejected.1.json @@ -0,0 +1,131 @@ +{ + "generators": { + "address": 2, + "nonce": 0 + }, + "auth": [], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 2 + } + } + ], + "data": { + "vec": [ + { + "string": "failing with contract error" + }, + { + "u32": 2 + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 2 + } + } + ], + "data": { + "string": "escalating error to panic" + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/core/access/tests/admin_role_authorized.1.json b/engine-core/test_snapshots/core/access/tests/admin_role_authorized.1.json new file mode 100644 index 0000000..fa66d5d --- /dev/null +++ b/engine-core/test_snapshots/core/access/tests/admin_role_authorized.1.json @@ -0,0 +1,260 @@ +{ + "generators": { + "address": 4, + "nonce": 0 + }, + "auth": [ + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "", + "args": [] + } + }, + "sub_invocations": [] + } + ] + ], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "", + "args": [] + } + }, + "sub_invocations": [] + } + ] + ] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "symbol": "C_ADMIN" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "C_AUDIT" + }, + "val": { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" + } + ] + } + }, + { + "key": { + "symbol": "C_INIT" + }, + "val": { + "bool": true + } + }, + { + "key": { + "symbol": "C_OPERS" + }, + "val": { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + ] + } + } + ] + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 3080 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "0000000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 0 + } + } + ] + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/core/access/tests/auditor_role_authorized.1.json b/engine-core/test_snapshots/core/access/tests/auditor_role_authorized.1.json new file mode 100644 index 0000000..8663c27 --- /dev/null +++ b/engine-core/test_snapshots/core/access/tests/auditor_role_authorized.1.json @@ -0,0 +1,258 @@ +{ + "generators": { + "address": 4, + "nonce": 0 + }, + "auth": [ + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "", + "args": [] + } + }, + "sub_invocations": [] + } + ], + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "", + "args": [] + } + }, + "sub_invocations": [] + } + ] + ] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "symbol": "C_ADMIN" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "C_AUDIT" + }, + "val": { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" + } + ] + } + }, + { + "key": { + "symbol": "C_INIT" + }, + "val": { + "bool": true + } + }, + { + "key": { + "symbol": "C_OPERS" + }, + "val": { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + ] + } + } + ] + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 3080 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "0000000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 0 + } + } + ] + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/core/access/tests/double_init_rejected.1.json b/engine-core/test_snapshots/core/access/tests/double_init_rejected.1.json new file mode 100644 index 0000000..8df7646 --- /dev/null +++ b/engine-core/test_snapshots/core/access/tests/double_init_rejected.1.json @@ -0,0 +1,212 @@ +{ + "generators": { + "address": 4, + "nonce": 0 + }, + "auth": [], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 3080 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "0000000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 0 + } + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 2 + } + } + ], + "data": { + "vec": [ + { + "string": "failing with contract error" + }, + { + "u32": 2 + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 2 + } + } + ], + "data": { + "string": "escalating error to panic" + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/core/access/tests/initialize_sets_admin.1.json b/engine-core/test_snapshots/core/access/tests/initialize_sets_admin.1.json new file mode 100644 index 0000000..e336cb9 --- /dev/null +++ b/engine-core/test_snapshots/core/access/tests/initialize_sets_admin.1.json @@ -0,0 +1,212 @@ +{ + "generators": { + "address": 4, + "nonce": 0 + }, + "auth": [ + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "", + "args": [] + } + }, + "sub_invocations": [] + } + ] + ] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "symbol": "C_ADMIN" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "C_AUDIT" + }, + "val": { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" + } + ] + } + }, + { + "key": { + "symbol": "C_INIT" + }, + "val": { + "bool": true + } + }, + { + "key": { + "symbol": "C_OPERS" + }, + "val": { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + ] + } + } + ] + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 3080 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "0000000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 0 + } + } + ] + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/core/access/tests/operator_not_admin.1.json b/engine-core/test_snapshots/core/access/tests/operator_not_admin.1.json new file mode 100644 index 0000000..4c9a678 --- /dev/null +++ b/engine-core/test_snapshots/core/access/tests/operator_not_admin.1.json @@ -0,0 +1,245 @@ +{ + "generators": { + "address": 5, + "nonce": 0 + }, + "auth": [], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 3080 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "0000000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 0 + } + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 1 + } + } + ], + "data": { + "vec": [ + { + "string": "failing with contract error" + }, + { + "u32": 1 + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 1 + } + } + ], + "data": { + "string": "escalating error to panic" + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/core/access/tests/operator_role_authorized.1.json b/engine-core/test_snapshots/core/access/tests/operator_role_authorized.1.json new file mode 100644 index 0000000..2697736 --- /dev/null +++ b/engine-core/test_snapshots/core/access/tests/operator_role_authorized.1.json @@ -0,0 +1,258 @@ +{ + "generators": { + "address": 4, + "nonce": 0 + }, + "auth": [ + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "", + "args": [] + } + }, + "sub_invocations": [] + } + ], + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "", + "args": [] + } + }, + "sub_invocations": [] + } + ] + ] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "symbol": "C_ADMIN" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "C_AUDIT" + }, + "val": { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" + } + ] + } + }, + { + "key": { + "symbol": "C_INIT" + }, + "val": { + "bool": true + } + }, + { + "key": { + "symbol": "C_OPERS" + }, + "val": { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + ] + } + } + ] + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 3080 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "0000000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 0 + } + } + ] + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/core/guards/tests/double_enter_detected.1.json b/engine-core/test_snapshots/core/guards/tests/double_enter_detected.1.json new file mode 100644 index 0000000..45d95f1 --- /dev/null +++ b/engine-core/test_snapshots/core/guards/tests/double_enter_detected.1.json @@ -0,0 +1,162 @@ +{ + "generators": { + "address": 1, + "nonce": 0 + }, + "auth": [], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "symbol": "C_REENTR" + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "symbol": "C_REENTR" + }, + "durability": "temporary", + "val": { + "bool": true + } + } + }, + "ext": "v0" + }, + 15 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 1 + } + } + ], + "data": { + "vec": [ + { + "string": "failing with contract error" + }, + { + "u32": 1 + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 1 + } + } + ], + "data": { + "string": "escalating error to panic" + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/core/guards/tests/guard_enter_and_exit.1.json b/engine-core/test_snapshots/core/guards/tests/guard_enter_and_exit.1.json new file mode 100644 index 0000000..4a934ef --- /dev/null +++ b/engine-core/test_snapshots/core/guards/tests/guard_enter_and_exit.1.json @@ -0,0 +1,75 @@ +{ + "generators": { + "address": 1, + "nonce": 0 + }, + "auth": [ + [] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/core/guards/tests/reentrancy_guard_drop_releases.1.json b/engine-core/test_snapshots/core/guards/tests/reentrancy_guard_drop_releases.1.json new file mode 100644 index 0000000..4a934ef --- /dev/null +++ b/engine-core/test_snapshots/core/guards/tests/reentrancy_guard_drop_releases.1.json @@ -0,0 +1,75 @@ +{ + "generators": { + "address": 1, + "nonce": 0 + }, + "auth": [ + [] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/core/guards/tests/with_guard_wraps_call.1.json b/engine-core/test_snapshots/core/guards/tests/with_guard_wraps_call.1.json new file mode 100644 index 0000000..4a934ef --- /dev/null +++ b/engine-core/test_snapshots/core/guards/tests/with_guard_wraps_call.1.json @@ -0,0 +1,75 @@ +{ + "generators": { + "address": 1, + "nonce": 0 + }, + "auth": [ + [] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/core/state/tests/full_lifecycle.1.json b/engine-core/test_snapshots/core/state/tests/full_lifecycle.1.json new file mode 100644 index 0000000..fda9b0b --- /dev/null +++ b/engine-core/test_snapshots/core/state/tests/full_lifecycle.1.json @@ -0,0 +1,229 @@ +{ + "generators": { + "address": 1, + "nonce": 0 + }, + "auth": [ + [] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "symbol": "PROTO_ST" + }, + "val": { + "u32": 3 + } + } + ] + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 3336 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "0000000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 0 + } + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 3336 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "0000000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 1 + } + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 3336 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "0000000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 2 + } + } + ] + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/core/state/tests/initial_state_is_pending.1.json b/engine-core/test_snapshots/core/state/tests/initial_state_is_pending.1.json new file mode 100644 index 0000000..63b9e82 --- /dev/null +++ b/engine-core/test_snapshots/core/state/tests/initial_state_is_pending.1.json @@ -0,0 +1,84 @@ +{ + "generators": { + "address": 1, + "nonce": 0 + }, + "auth": [ + [] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "symbol": "PROTO_ST" + }, + "val": { + "u32": 0 + } + } + ] + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/core/state/tests/invalid_pending_to_settled_rejected.1.json b/engine-core/test_snapshots/core/state/tests/invalid_pending_to_settled_rejected.1.json new file mode 100644 index 0000000..51cedb4 --- /dev/null +++ b/engine-core/test_snapshots/core/state/tests/invalid_pending_to_settled_rejected.1.json @@ -0,0 +1,131 @@ +{ + "generators": { + "address": 1, + "nonce": 0 + }, + "auth": [], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 1 + } + } + ], + "data": { + "vec": [ + { + "string": "failing with contract error" + }, + { + "u32": 1 + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 1 + } + } + ], + "data": { + "string": "escalating error to panic" + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/core/state/tests/require_state_panics_on_mismatch.1.json b/engine-core/test_snapshots/core/state/tests/require_state_panics_on_mismatch.1.json new file mode 100644 index 0000000..51cedb4 --- /dev/null +++ b/engine-core/test_snapshots/core/state/tests/require_state_panics_on_mismatch.1.json @@ -0,0 +1,131 @@ +{ + "generators": { + "address": 1, + "nonce": 0 + }, + "auth": [], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 1 + } + } + ], + "data": { + "vec": [ + { + "string": "failing with contract error" + }, + { + "u32": 1 + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 1 + } + } + ], + "data": { + "string": "escalating error to panic" + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/core/state/tests/transition_pending_to_active.1.json b/engine-core/test_snapshots/core/state/tests/transition_pending_to_active.1.json new file mode 100644 index 0000000..b7261c5 --- /dev/null +++ b/engine-core/test_snapshots/core/state/tests/transition_pending_to_active.1.json @@ -0,0 +1,133 @@ +{ + "generators": { + "address": 1, + "nonce": 0 + }, + "auth": [ + [] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "symbol": "PROTO_ST" + }, + "val": { + "u32": 1 + } + } + ] + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 3336 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "0000000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 0 + } + } + ] + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/core/tests/test_batch_update_param_success.1.json b/engine-core/test_snapshots/core/tests/test_batch_update_param_success.1.json index 93fcef1..96581ff 100644 --- a/engine-core/test_snapshots/core/tests/test_batch_update_param_success.1.json +++ b/engine-core/test_snapshots/core/tests/test_batch_update_param_success.1.json @@ -4,7 +4,6 @@ "nonce": 0 }, "auth": [ - [], [ [ "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", @@ -12,82 +11,21 @@ "function": { "contract_fn": { "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "function_name": "batch_update_param", + "function_name": "initialize", "args": [ { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - { - "vec": [ - { - "vec": [ - { - "symbol": "FEE1" - }, - { - "u64": 100 - } - ] - }, - { - "vec": [ - { - "symbol": "FEE2" - }, - { - "u64": 200 - } - ] - } - ] - }, - { - "map": [ - { - "key": { - "symbol": "author" - }, - "val": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - }, - { - "key": { - "symbol": "ledger" - }, - "val": { - "u32": 101 - } - }, - { - "key": { - "symbol": "sequence" - }, - "val": { - "u64": 2 - } - }, - { - "key": { - "symbol": "state_hash" - }, - "val": { - "bytes": "4e8e1d41197ef7a08d5b52417f8128512def2b8ecfecebcdfe6b6ef818908a24" - } - } - ] - }, - { - "bytes": "0202020202020202020202020202020202020202020202020202020202020202" } ] } }, "sub_invocations": [] } - ], + ] + ], + [ [ - "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", { "function": { "contract_fn": { @@ -209,6 +147,14 @@ "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" } }, + { + "key": { + "symbol": "CP_INIT" + }, + "val": { + "bool": true + } + }, { "key": { "symbol": "FEE1" @@ -233,6 +179,14 @@ "bytes": "4e8e1d41197ef7a08d5b52417f8128512def2b8ecfecebcdfe6b6ef818908a24" } }, + { + "key": { + "symbol": "P_COUNT" + }, + "val": { + "u64": 1 + } + }, { "key": { "symbol": "SEQ" @@ -240,6 +194,22 @@ "val": { "u64": 2 } + }, + { + "key": { + "symbol": "VERSION" + }, + "val": { + "u32": 1 + } + }, + { + "key": { + "symbol": "VER_INIT" + }, + "val": { + "bool": true + } } ] } @@ -287,7 +257,7 @@ [ { "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", "key": { "ledger_key_nonce": { "nonce": 5541220902715666415 @@ -302,7 +272,7 @@ "data": { "contract_data": { "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", "key": { "ledger_key_nonce": { "nonce": 5541220902715666415 @@ -529,6 +499,46 @@ }, "failed_call": false }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000000" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "4e8e1d41197ef7a08d5b52417f8128512def2b8ecfecebcdfe6b6ef818908a24" + } + }, + { + "key": { + "symbol": "seq" + }, + "val": { + "u64": 2 + } + } + ] + } + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/engine-core/test_snapshots/core/tests/test_get_admin_rejects_uninitialized.1.json b/engine-core/test_snapshots/core/tests/test_get_admin_rejects_uninitialized.1.json new file mode 100644 index 0000000..cada583 --- /dev/null +++ b/engine-core/test_snapshots/core/tests/test_get_admin_rejects_uninitialized.1.json @@ -0,0 +1,242 @@ +{ + "generators": { + "address": 1, + "nonce": 0 + }, + "auth": [ + [] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "get_admin" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 3 + } + } + ], + "data": { + "vec": [ + { + "string": "failing with contract error" + }, + { + "u32": 3 + } + ] + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 3 + } + } + ], + "data": { + "string": "escalating error to panic" + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 3 + } + } + ], + "data": { + "string": "caught error from function" + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 3 + } + } + ], + "data": { + "vec": [ + { + "string": "contract call failed" + }, + { + "symbol": "get_admin" + }, + { + "vec": [] + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 3 + } + } + ], + "data": { + "string": "escalating error to panic" + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/core/tests/test_initialize.1.json b/engine-core/test_snapshots/core/tests/test_initialize.1.json index 1223943..bc5e71d 100644 --- a/engine-core/test_snapshots/core/tests/test_initialize.1.json +++ b/engine-core/test_snapshots/core/tests/test_initialize.1.json @@ -4,6 +4,28 @@ "nonce": 0 }, "auth": [ + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "initialize", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [], + [], [], [] ], @@ -47,6 +69,38 @@ "val": { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" } + }, + { + "key": { + "symbol": "CP_INIT" + }, + "val": { + "bool": true + } + }, + { + "key": { + "symbol": "P_COUNT" + }, + "val": { + "u64": 0 + } + }, + { + "key": { + "symbol": "VERSION" + }, + "val": { + "u32": 1 + } + }, + { + "key": { + "symbol": "VER_INIT" + }, + "val": { + "bool": true + } } ] } @@ -58,6 +112,39 @@ 4095 ] ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], [ { "contract_code": { @@ -129,6 +216,100 @@ }, "failed_call": false }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "admin" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "admin" + } + ], + "data": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "get_admin" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "get_admin" + } + ], + "data": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", @@ -275,6 +456,110 @@ } }, "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "contract_version" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "contract_version" + } + ], + "data": { + "u32": 1 + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "version" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "version" + } + ], + "data": { + "vec": [ + { + "u32": 0 + }, + { + "u32": 1 + }, + { + "u32": 0 + } + ] + } + } + } + }, + "failed_call": false } ] } \ No newline at end of file diff --git a/engine-core/test_snapshots/core/tests/test_initialize_rejects_contract_as_its_own_admin.1.json b/engine-core/test_snapshots/core/tests/test_initialize_rejects_contract_as_its_own_admin.1.json new file mode 100644 index 0000000..f08ef54 --- /dev/null +++ b/engine-core/test_snapshots/core/tests/test_initialize_rejects_contract_as_its_own_admin.1.json @@ -0,0 +1,223 @@ +{ + "generators": { + "address": 1, + "nonce": 0 + }, + "auth": [ + [] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "initialize" + } + ], + "data": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 7 + } + } + ], + "data": { + "vec": [ + { + "string": "failing with contract error" + }, + { + "u32": 7 + } + ] + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 7 + } + } + ], + "data": { + "string": "escalating error to panic" + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 7 + } + } + ], + "data": { + "string": "caught error from function" + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 7 + } + } + ], + "data": { + "vec": [ + { + "string": "contract try_call failed" + }, + { + "symbol": "initialize" + }, + { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + ] + } + ] + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/core/tests/test_update_param_full_flow.1.json b/engine-core/test_snapshots/core/tests/test_update_param_full_flow.1.json new file mode 100644 index 0000000..7cd3f7b --- /dev/null +++ b/engine-core/test_snapshots/core/tests/test_update_param_full_flow.1.json @@ -0,0 +1,812 @@ +{ + "generators": { + "address": 2, + "nonce": 0 + }, + "auth": [ + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "initialize", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "update_param", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "symbol": "FEE" + }, + { + "u64": 100 + }, + { + "map": [ + { + "key": { + "symbol": "author" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "ledger" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "sequence" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "symbol": "state_hash" + }, + "val": { + "bytes": "a7cf31387e6255cca069e8ab8f1a9c043304c06167b6ba643279651b406f1475" + } + } + ] + }, + { + "bytes": "0101010101010101010101010101010101010101010101010101010101010101" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [], + [], + [] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "symbol": "ADMIN" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "CP_INIT" + }, + "val": { + "bool": true + } + }, + { + "key": { + "symbol": "FEE" + }, + "val": { + "u64": 100 + } + }, + { + "key": { + "symbol": "LASTPAR" + }, + "val": { + "symbol": "FEE" + } + }, + { + "key": { + "symbol": "PREV_H" + }, + "val": { + "bytes": "a7cf31387e6255cca069e8ab8f1a9c043304c06167b6ba643279651b406f1475" + } + }, + { + "key": { + "symbol": "P_COUNT" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "symbol": "SEQ" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "symbol": "VERSION" + }, + "val": { + "u32": 1 + } + }, + { + "key": { + "symbol": "VER_INIT" + }, + "val": { + "bool": true + } + } + ] + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "initialize" + } + ], + "data": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "initialize" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "integrity_check" + } + ], + "data": { + "vec": [ + { + "map": [ + { + "key": { + "symbol": "author" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "ledger" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "sequence" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "symbol": "state_hash" + }, + "val": { + "bytes": "a7cf31387e6255cca069e8ab8f1a9c043304c06167b6ba643279651b406f1475" + } + } + ] + }, + { + "bytes": "0101010101010101010101010101010101010101010101010101010101010101" + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "integrity_check" + } + ], + "data": { + "bool": true + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "update_param" + } + ], + "data": { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "symbol": "FEE" + }, + { + "u64": 100 + }, + { + "map": [ + { + "key": { + "symbol": "author" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "ledger" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "sequence" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "symbol": "state_hash" + }, + "val": { + "bytes": "a7cf31387e6255cca069e8ab8f1a9c043304c06167b6ba643279651b406f1475" + } + } + ] + }, + { + "bytes": "0101010101010101010101010101010101010101010101010101010101010101" + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 257 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "a7cf31387e6255cca069e8ab8f1a9c043304c06167b6ba643279651b406f1475" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 1 + } + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000000" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "a7cf31387e6255cca069e8ab8f1a9c043304c06167b6ba643279651b406f1475" + } + }, + { + "key": { + "symbol": "seq" + }, + "val": { + "u64": 1 + } + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "update_param" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "get_param" + } + ], + "data": { + "symbol": "FEE" + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "get_param" + } + ], + "data": { + "u64": 100 + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "param_update_count" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "param_update_count" + } + ], + "data": { + "u64": 1 + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "last_audit_sequence" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "last_audit_sequence" + } + ], + "data": { + "u64": 1 + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "state_hash" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "state_hash" + } + ], + "data": { + "bytes": "a7cf31387e6255cca069e8ab8f1a9c043304c06167b6ba643279651b406f1475" + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/core/tests/test_update_param_rejects_bad_hash.1.json b/engine-core/test_snapshots/core/tests/test_update_param_rejects_bad_hash.1.json new file mode 100644 index 0000000..aaac7cf --- /dev/null +++ b/engine-core/test_snapshots/core/tests/test_update_param_rejects_bad_hash.1.json @@ -0,0 +1,505 @@ +{ + "generators": { + "address": 2, + "nonce": 0 + }, + "auth": [ + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "initialize", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "symbol": "ADMIN" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "CP_INIT" + }, + "val": { + "bool": true + } + }, + { + "key": { + "symbol": "P_COUNT" + }, + "val": { + "u64": 0 + } + }, + { + "key": { + "symbol": "VERSION" + }, + "val": { + "u32": 1 + } + }, + { + "key": { + "symbol": "VER_INIT" + }, + "val": { + "bool": true + } + } + ] + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "initialize" + } + ], + "data": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "initialize" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "update_param" + } + ], + "data": { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "symbol": "FEE" + }, + { + "u64": 100 + }, + { + "map": [ + { + "key": { + "symbol": "author" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "ledger" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "sequence" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "symbol": "state_hash" + }, + "val": { + "bytes": "0909090909090909090909090909090909090909090909090909090909090909" + } + } + ] + }, + { + "bytes": "0303030303030303030303030303030303030303030303030303030303030303" + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 2 + } + } + ], + "data": { + "vec": [ + { + "string": "failing with contract error" + }, + { + "u32": 2 + } + ] + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 2 + } + } + ], + "data": { + "string": "escalating error to panic" + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 2 + } + } + ], + "data": { + "string": "caught error from function" + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 2 + } + } + ], + "data": { + "vec": [ + { + "string": "contract try_call failed" + }, + { + "symbol": "update_param" + }, + { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "symbol": "FEE" + }, + { + "u64": 100 + }, + { + "map": [ + { + "key": { + "symbol": "author" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "ledger" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "sequence" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "symbol": "state_hash" + }, + "val": { + "bytes": "0909090909090909090909090909090909090909090909090909090909090909" + } + } + ] + }, + { + "bytes": "0303030303030303030303030303030303030303030303030303030303030303" + } + ] + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "get_param" + } + ], + "data": { + "symbol": "FEE" + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "get_param" + } + ], + "data": "void" + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/core/tests/test_update_param_rejects_replayed_commitment.1.json b/engine-core/test_snapshots/core/tests/test_update_param_rejects_replayed_commitment.1.json new file mode 100644 index 0000000..fe02763 --- /dev/null +++ b/engine-core/test_snapshots/core/tests/test_update_param_rejects_replayed_commitment.1.json @@ -0,0 +1,820 @@ +{ + "generators": { + "address": 2, + "nonce": 0 + }, + "auth": [ + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "initialize", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "update_param", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "symbol": "FEE" + }, + { + "u64": 100 + }, + { + "map": [ + { + "key": { + "symbol": "author" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "ledger" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "sequence" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "symbol": "state_hash" + }, + "val": { + "bytes": "4d091adc17b45c0c5bba796f6ae531f7cd526610e29957c40f36799e8c47c4bf" + } + } + ] + }, + { + "bytes": "0202020202020202020202020202020202020202020202020202020202020202" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "symbol": "ADMIN" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "CP_INIT" + }, + "val": { + "bool": true + } + }, + { + "key": { + "symbol": "FEE" + }, + "val": { + "u64": 100 + } + }, + { + "key": { + "symbol": "LASTPAR" + }, + "val": { + "symbol": "FEE" + } + }, + { + "key": { + "symbol": "PREV_H" + }, + "val": { + "bytes": "4d091adc17b45c0c5bba796f6ae531f7cd526610e29957c40f36799e8c47c4bf" + } + }, + { + "key": { + "symbol": "P_COUNT" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "symbol": "SEQ" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "symbol": "VERSION" + }, + "val": { + "u32": 1 + } + }, + { + "key": { + "symbol": "VER_INIT" + }, + "val": { + "bool": true + } + } + ] + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "initialize" + } + ], + "data": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "initialize" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "update_param" + } + ], + "data": { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "symbol": "FEE" + }, + { + "u64": 100 + }, + { + "map": [ + { + "key": { + "symbol": "author" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "ledger" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "sequence" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "symbol": "state_hash" + }, + "val": { + "bytes": "4d091adc17b45c0c5bba796f6ae531f7cd526610e29957c40f36799e8c47c4bf" + } + } + ] + }, + { + "bytes": "0202020202020202020202020202020202020202020202020202020202020202" + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 257 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "4d091adc17b45c0c5bba796f6ae531f7cd526610e29957c40f36799e8c47c4bf" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 1 + } + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000000" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "4d091adc17b45c0c5bba796f6ae531f7cd526610e29957c40f36799e8c47c4bf" + } + }, + { + "key": { + "symbol": "seq" + }, + "val": { + "u64": 1 + } + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "update_param" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "update_param" + } + ], + "data": { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "symbol": "FEE" + }, + { + "u64": 200 + }, + { + "map": [ + { + "key": { + "symbol": "author" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "ledger" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "sequence" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "symbol": "state_hash" + }, + "val": { + "bytes": "4d091adc17b45c0c5bba796f6ae531f7cd526610e29957c40f36799e8c47c4bf" + } + } + ] + }, + { + "bytes": "0202020202020202020202020202020202020202020202020202020202020202" + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 1 + } + } + ], + "data": { + "vec": [ + { + "string": "failing with contract error" + }, + { + "u32": 1 + } + ] + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 1 + } + } + ], + "data": { + "string": "escalating error to panic" + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 1 + } + } + ], + "data": { + "string": "caught error from function" + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 1 + } + } + ], + "data": { + "vec": [ + { + "string": "contract try_call failed" + }, + { + "symbol": "update_param" + }, + { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "symbol": "FEE" + }, + { + "u64": 200 + }, + { + "map": [ + { + "key": { + "symbol": "author" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "ledger" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "sequence" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "symbol": "state_hash" + }, + "val": { + "bytes": "4d091adc17b45c0c5bba796f6ae531f7cd526610e29957c40f36799e8c47c4bf" + } + } + ] + }, + { + "bytes": "0202020202020202020202020202020202020202020202020202020202020202" + } + ] + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "get_param" + } + ], + "data": { + "symbol": "FEE" + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "get_param" + } + ], + "data": { + "u64": 100 + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/core/tests/test_update_param_requires_admin.1.json b/engine-core/test_snapshots/core/tests/test_update_param_requires_admin.1.json new file mode 100644 index 0000000..5c0d42e --- /dev/null +++ b/engine-core/test_snapshots/core/tests/test_update_param_requires_admin.1.json @@ -0,0 +1,505 @@ +{ + "generators": { + "address": 3, + "nonce": 0 + }, + "auth": [ + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "initialize", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "symbol": "ADMIN" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "CP_INIT" + }, + "val": { + "bool": true + } + }, + { + "key": { + "symbol": "P_COUNT" + }, + "val": { + "u64": 0 + } + }, + { + "key": { + "symbol": "VERSION" + }, + "val": { + "u32": 1 + } + }, + { + "key": { + "symbol": "VER_INIT" + }, + "val": { + "bool": true + } + } + ] + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "initialize" + } + ], + "data": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "initialize" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "update_param" + } + ], + "data": { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "symbol": "FEE" + }, + { + "u64": 100 + }, + { + "map": [ + { + "key": { + "symbol": "author" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "ledger" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "sequence" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "symbol": "state_hash" + }, + "val": { + "bytes": "33b17a720159c724cbded2b74624dc582c4aff2ee91fa6fa0fcca4c589356812" + } + } + ] + }, + { + "bytes": "0404040404040404040404040404040404040404040404040404040404040404" + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 2 + } + } + ], + "data": { + "vec": [ + { + "string": "failing with contract error" + }, + { + "u32": 2 + } + ] + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 2 + } + } + ], + "data": { + "string": "escalating error to panic" + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 2 + } + } + ], + "data": { + "string": "caught error from function" + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 2 + } + } + ], + "data": { + "vec": [ + { + "string": "contract try_call failed" + }, + { + "symbol": "update_param" + }, + { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "symbol": "FEE" + }, + { + "u64": 100 + }, + { + "map": [ + { + "key": { + "symbol": "author" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "ledger" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "sequence" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "symbol": "state_hash" + }, + "val": { + "bytes": "33b17a720159c724cbded2b74624dc582c4aff2ee91fa6fa0fcca4c589356812" + } + } + ] + }, + { + "bytes": "0404040404040404040404040404040404040404040404040404040404040404" + } + ] + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "get_param" + } + ], + "data": { + "symbol": "FEE" + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "get_param" + } + ], + "data": "void" + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/core/tests/test_zk_proof_registration_for_current_state_root.1.json b/engine-core/test_snapshots/core/tests/test_zk_proof_registration_for_current_state_root.1.json new file mode 100644 index 0000000..5330c8e --- /dev/null +++ b/engine-core/test_snapshots/core/tests/test_zk_proof_registration_for_current_state_root.1.json @@ -0,0 +1,833 @@ +{ + "generators": { + "address": 2, + "nonce": 0 + }, + "auth": [ + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "initialize", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "update_param", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "symbol": "FEE" + }, + { + "u64": 100 + }, + { + "map": [ + { + "key": { + "symbol": "author" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "ledger" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "sequence" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "symbol": "state_hash" + }, + "val": { + "bytes": "2cdcb157c7663f079074f47bee50172abe05f3ef8c06987aeb2f1d8bcc1c8221" + } + } + ] + }, + { + "bytes": "0505050505050505050505050505050505050505050505050505050505050505" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "register_proof", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "bytes": "2cdcb157c7663f079074f47bee50172abe05f3ef8c06987aeb2f1d8bcc1c8221" + }, + { + "bytes": "0707070707070707070707070707070707070707070707070707070707070707" + }, + { + "u32": 0 + }, + { + "map": [] + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "symbol": "ADMIN" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "CP_INIT" + }, + "val": { + "bool": true + } + }, + { + "key": { + "symbol": "FEE" + }, + "val": { + "u64": 100 + } + }, + { + "key": { + "symbol": "LASTPAR" + }, + "val": { + "symbol": "FEE" + } + }, + { + "key": { + "symbol": "PREV_H" + }, + "val": { + "bytes": "2cdcb157c7663f079074f47bee50172abe05f3ef8c06987aeb2f1d8bcc1c8221" + } + }, + { + "key": { + "symbol": "P_COUNT" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "symbol": "SEQ" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "symbol": "VERSION" + }, + "val": { + "u32": 1 + } + }, + { + "key": { + "symbol": "VER_INIT" + }, + "val": { + "bool": true + } + }, + { + "key": { + "symbol": "ZK_COUNT" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "vec": [ + { + "symbol": "Attestation" + }, + { + "bytes": "2cdcb157c7663f079074f47bee50172abe05f3ef8c06987aeb2f1d8bcc1c8221" + } + ] + }, + "val": { + "map": [ + { + "key": { + "symbol": "block_seq" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "metadata" + }, + "val": { + "map": [] + } + }, + { + "key": { + "symbol": "proof_hash" + }, + "val": { + "bytes": "0707070707070707070707070707070707070707070707070707070707070707" + } + }, + { + "key": { + "symbol": "registered_at_ledger" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "state_root" + }, + "val": { + "bytes": "2cdcb157c7663f079074f47bee50172abe05f3ef8c06987aeb2f1d8bcc1c8221" + } + } + ] + } + }, + { + "key": { + "vec": [ + { + "symbol": "Proof" + }, + { + "bytes": "2cdcb157c7663f079074f47bee50172abe05f3ef8c06987aeb2f1d8bcc1c8221" + } + ] + }, + "val": { + "bytes": "0707070707070707070707070707070707070707070707070707070707070707" + } + } + ] + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 1033654523790656264 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 1033654523790656264 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "initialize" + } + ], + "data": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "initialize" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "update_param" + } + ], + "data": { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "symbol": "FEE" + }, + { + "u64": 100 + }, + { + "map": [ + { + "key": { + "symbol": "author" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "ledger" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "sequence" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "symbol": "state_hash" + }, + "val": { + "bytes": "2cdcb157c7663f079074f47bee50172abe05f3ef8c06987aeb2f1d8bcc1c8221" + } + } + ] + }, + { + "bytes": "0505050505050505050505050505050505050505050505050505050505050505" + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 257 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "2cdcb157c7663f079074f47bee50172abe05f3ef8c06987aeb2f1d8bcc1c8221" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 1 + } + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000000" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "2cdcb157c7663f079074f47bee50172abe05f3ef8c06987aeb2f1d8bcc1c8221" + } + }, + { + "key": { + "symbol": "seq" + }, + "val": { + "u64": 1 + } + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "update_param" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "register_proof" + } + ], + "data": { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "bytes": "2cdcb157c7663f079074f47bee50172abe05f3ef8c06987aeb2f1d8bcc1c8221" + }, + { + "bytes": "0707070707070707070707070707070707070707070707070707070707070707" + }, + { + "u32": 0 + }, + { + "map": [] + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 257 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "0707070707070707070707070707070707070707070707070707070707070707" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 0 + } + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "register_proof" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "get_proof" + } + ], + "data": { + "bytes": "2cdcb157c7663f079074f47bee50172abe05f3ef8c06987aeb2f1d8bcc1c8221" + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "get_proof" + } + ], + "data": { + "bytes": "0707070707070707070707070707070707070707070707070707070707070707" + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/core/tests/test_zk_proof_rejects_wrong_state_root.1.json b/engine-core/test_snapshots/core/tests/test_zk_proof_rejects_wrong_state_root.1.json new file mode 100644 index 0000000..4035232 --- /dev/null +++ b/engine-core/test_snapshots/core/tests/test_zk_proof_rejects_wrong_state_root.1.json @@ -0,0 +1,704 @@ +{ + "generators": { + "address": 2, + "nonce": 0 + }, + "auth": [ + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "initialize", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "update_param", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "symbol": "FEE" + }, + { + "u64": 100 + }, + { + "map": [ + { + "key": { + "symbol": "author" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "ledger" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "sequence" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "symbol": "state_hash" + }, + "val": { + "bytes": "284c0039d44629af44654b24c8c9aee1b033da7d16c37cf01135e985b5c79ba8" + } + } + ] + }, + { + "bytes": "0606060606060606060606060606060606060606060606060606060606060606" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "symbol": "ADMIN" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "CP_INIT" + }, + "val": { + "bool": true + } + }, + { + "key": { + "symbol": "FEE" + }, + "val": { + "u64": 100 + } + }, + { + "key": { + "symbol": "LASTPAR" + }, + "val": { + "symbol": "FEE" + } + }, + { + "key": { + "symbol": "PREV_H" + }, + "val": { + "bytes": "284c0039d44629af44654b24c8c9aee1b033da7d16c37cf01135e985b5c79ba8" + } + }, + { + "key": { + "symbol": "P_COUNT" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "symbol": "SEQ" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "symbol": "VERSION" + }, + "val": { + "u32": 1 + } + }, + { + "key": { + "symbol": "VER_INIT" + }, + "val": { + "bool": true + } + } + ] + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "initialize" + } + ], + "data": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "initialize" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "update_param" + } + ], + "data": { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "symbol": "FEE" + }, + { + "u64": 100 + }, + { + "map": [ + { + "key": { + "symbol": "author" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "ledger" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "sequence" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "symbol": "state_hash" + }, + "val": { + "bytes": "284c0039d44629af44654b24c8c9aee1b033da7d16c37cf01135e985b5c79ba8" + } + } + ] + }, + { + "bytes": "0606060606060606060606060606060606060606060606060606060606060606" + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 257 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "284c0039d44629af44654b24c8c9aee1b033da7d16c37cf01135e985b5c79ba8" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 1 + } + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000000" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "284c0039d44629af44654b24c8c9aee1b033da7d16c37cf01135e985b5c79ba8" + } + }, + { + "key": { + "symbol": "seq" + }, + "val": { + "u64": 1 + } + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "update_param" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "register_proof" + } + ], + "data": { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "bytes": "0808080808080808080808080808080808080808080808080808080808080808" + }, + { + "bytes": "0707070707070707070707070707070707070707070707070707070707070707" + }, + { + "u32": 0 + }, + { + "map": [] + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 2 + } + } + ], + "data": { + "vec": [ + { + "string": "failing with contract error" + }, + { + "u32": 2 + } + ] + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 2 + } + } + ], + "data": { + "string": "escalating error to panic" + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 2 + } + } + ], + "data": { + "string": "caught error from function" + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 2 + } + } + ], + "data": { + "vec": [ + { + "string": "contract try_call failed" + }, + { + "symbol": "register_proof" + }, + { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "bytes": "0808080808080808080808080808080808080808080808080808080808080808" + }, + { + "bytes": "0707070707070707070707070707070707070707070707070707070707070707" + }, + { + "u32": 0 + }, + { + "map": [] + } + ] + } + ] + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/emergency_recovery/tests/non_admin_cannot_request.1.json b/engine-core/test_snapshots/emergency_recovery/tests/non_admin_cannot_request.1.json index 2fef8f3..5179fe6 100644 --- a/engine-core/test_snapshots/emergency_recovery/tests/non_admin_cannot_request.1.json +++ b/engine-core/test_snapshots/emergency_recovery/tests/non_admin_cannot_request.1.json @@ -1,6 +1,6 @@ { "generators": { - "address": 8, + "address": 6, "nonce": 0 }, "auth": [ @@ -46,10 +46,10 @@ "val": { "vec": [ { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" }, { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" } ] } @@ -83,7 +83,7 @@ [ { "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMDR4", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4", "key": { "ledger_key_nonce": { "nonce": 801925984706572462 @@ -98,7 +98,7 @@ "data": { "contract_data": { "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMDR4", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4", "key": { "ledger_key_nonce": { "nonce": 801925984706572462 diff --git a/engine-core/test_snapshots/emergency_recovery/tests/same_admin_cannot_double_approve.1.json b/engine-core/test_snapshots/emergency_recovery/tests/same_admin_cannot_double_approve.1.json index b4ff2f2..e2d0f6e 100644 --- a/engine-core/test_snapshots/emergency_recovery/tests/same_admin_cannot_double_approve.1.json +++ b/engine-core/test_snapshots/emergency_recovery/tests/same_admin_cannot_double_approve.1.json @@ -1,6 +1,6 @@ { "generators": { - "address": 7, + "address": 5, "nonce": 0 }, "auth": [ @@ -46,10 +46,10 @@ "val": { "vec": [ { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" }, { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" } ] } @@ -83,7 +83,7 @@ [ { "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", "key": { "ledger_key_nonce": { "nonce": 801925984706572462 @@ -98,7 +98,7 @@ "data": { "contract_data": { "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", "key": { "ledger_key_nonce": { "nonce": 801925984706572462 diff --git a/engine-core/test_snapshots/emergency_recovery/tests/single_approval_does_not_execute_when_threshold_is_two.1.json b/engine-core/test_snapshots/emergency_recovery/tests/single_approval_does_not_execute_when_threshold_is_two.1.json index dc2c210..23837cb 100644 --- a/engine-core/test_snapshots/emergency_recovery/tests/single_approval_does_not_execute_when_threshold_is_two.1.json +++ b/engine-core/test_snapshots/emergency_recovery/tests/single_approval_does_not_execute_when_threshold_is_two.1.json @@ -1,13 +1,13 @@ { "generators": { - "address": 9, + "address": 5, "nonce": 0 }, "auth": [ [], [ [ - "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM", + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", { "function": { "contract_fn": { @@ -61,13 +61,10 @@ "val": { "vec": [ { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" }, { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMDR4" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOLZM" + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" } ] } @@ -90,7 +87,7 @@ "val": { "vec": [ { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" } ] } @@ -100,7 +97,7 @@ "symbol": "ER_DEST" }, "val": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATYON" + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" } }, { @@ -116,7 +113,7 @@ "symbol": "ER_TOKEN" }, "val": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARQG5" + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" } } ] @@ -132,7 +129,7 @@ [ { "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", "key": { "ledger_key_nonce": { "nonce": 801925984706572462 @@ -147,7 +144,7 @@ "data": { "contract_data": { "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", "key": { "ledger_key_nonce": { "nonce": 801925984706572462 diff --git a/engine-core/test_snapshots/governance/tests/threshold_transition_sets_unlock.1.json b/engine-core/test_snapshots/governance/tests/threshold_transition_sets_unlock.1.json new file mode 100644 index 0000000..369e28e --- /dev/null +++ b/engine-core/test_snapshots/governance/tests/threshold_transition_sets_unlock.1.json @@ -0,0 +1,471 @@ +{ + "generators": { + "address": 3, + "nonce": 0 + }, + "auth": [ + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "", + "args": [] + } + }, + "sub_invocations": [] + } + ] + ], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "", + "args": [] + } + }, + "sub_invocations": [] + } + ] + ], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "", + "args": [] + } + }, + "sub_invocations": [] + } + ] + ] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "symbol": "MINSTAKE" + }, + "val": { + "i128": { + "hi": 0, + "lo": 0 + } + } + }, + { + "key": { + "symbol": "PROPS" + }, + "val": { + "map": [ + { + "key": { + "u64": 1 + }, + "val": { + "vec": [ + { + "map": [ + { + "key": { + "symbol": "action_hash" + }, + "val": { + "bytes": "0707070707070707070707070707070707070707070707070707070707070707" + } + }, + { + "key": { + "symbol": "approved_by" + }, + "val": { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + ] + } + }, + { + "key": { + "symbol": "id" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "symbol": "proposer" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "state" + }, + "val": { + "u32": 1 + } + } + ] + }, + { + "u32": 720 + } + ] + } + } + ] + } + }, + { + "key": { + "symbol": "SIGNERS" + }, + "val": { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + ] + } + }, + { + "key": { + "symbol": "THRESH" + }, + "val": { + "u32": 2 + } + } + ] + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": { + "ledger_key_nonce": { + "nonce": 1033654523790656264 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": { + "ledger_key_nonce": { + "nonce": 1033654523790656264 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 770 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "0707070707070707070707070707070707070707070707070707070707070707" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 1 + } + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 1026 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "0000000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 1 + } + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 1026 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "0000000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 1 + } + } + ] + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/governance_tests/tests/approved_moves_to_executed_after_timelock.1.json b/engine-core/test_snapshots/governance_tests/tests/approved_moves_to_executed_after_timelock.1.json new file mode 100644 index 0000000..73e8d9a --- /dev/null +++ b/engine-core/test_snapshots/governance_tests/tests/approved_moves_to_executed_after_timelock.1.json @@ -0,0 +1,418 @@ +{ + "generators": { + "address": 2, + "nonce": 0 + }, + "auth": [ + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "", + "args": [] + } + }, + "sub_invocations": [] + } + ] + ], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "", + "args": [] + } + }, + "sub_invocations": [] + } + ] + ], + [] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 721, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "symbol": "MINSTAKE" + }, + "val": { + "i128": { + "hi": 0, + "lo": 0 + } + } + }, + { + "key": { + "symbol": "PROPS" + }, + "val": { + "map": [ + { + "key": { + "u64": 1 + }, + "val": { + "vec": [ + { + "map": [ + { + "key": { + "symbol": "action_hash" + }, + "val": { + "bytes": "0707070707070707070707070707070707070707070707070707070707070707" + } + }, + { + "key": { + "symbol": "approved_by" + }, + "val": { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + ] + } + }, + { + "key": { + "symbol": "id" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "symbol": "proposer" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "state" + }, + "val": { + "u32": 2 + } + } + ] + }, + { + "u32": 720 + } + ] + } + } + ] + } + }, + { + "key": { + "symbol": "SIGNERS" + }, + "val": { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + ] + } + }, + { + "key": { + "symbol": "THRESH" + }, + "val": { + "u32": 1 + } + } + ] + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 770 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "0707070707070707070707070707070707070707070707070707070707070707" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 1 + } + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 1026 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "0000000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 1 + } + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 1282 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "0707070707070707070707070707070707070707070707070707070707070707" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 1 + } + } + ] + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/governance_tests/tests/double_approval_is_rejected.1.json b/engine-core/test_snapshots/governance_tests/tests/double_approval_is_rejected.1.json new file mode 100644 index 0000000..66cae1d --- /dev/null +++ b/engine-core/test_snapshots/governance_tests/tests/double_approval_is_rejected.1.json @@ -0,0 +1,462 @@ +{ + "generators": { + "address": 3, + "nonce": 0 + }, + "auth": [ + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "", + "args": [] + } + }, + "sub_invocations": [] + } + ] + ], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "", + "args": [] + } + }, + "sub_invocations": [] + } + ] + ] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "symbol": "MINSTAKE" + }, + "val": { + "i128": { + "hi": 0, + "lo": 0 + } + } + }, + { + "key": { + "symbol": "PROPS" + }, + "val": { + "map": [ + { + "key": { + "u64": 1 + }, + "val": { + "vec": [ + { + "map": [ + { + "key": { + "symbol": "action_hash" + }, + "val": { + "bytes": "0707070707070707070707070707070707070707070707070707070707070707" + } + }, + { + "key": { + "symbol": "approved_by" + }, + "val": { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + ] + } + }, + { + "key": { + "symbol": "id" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "symbol": "proposer" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "state" + }, + "val": { + "u32": 1 + } + } + ] + }, + { + "u32": 720 + } + ] + } + } + ] + } + }, + { + "key": { + "symbol": "SIGNERS" + }, + "val": { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + ] + } + }, + { + "key": { + "symbol": "THRESH" + }, + "val": { + "u32": 1 + } + } + ] + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 1033654523790656264 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 1033654523790656264 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 770 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "0707070707070707070707070707070707070707070707070707070707070707" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 1 + } + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 1026 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "0000000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 1 + } + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 5 + } + } + ], + "data": { + "vec": [ + { + "string": "failing with contract error" + }, + { + "u32": 5 + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 5 + } + } + ], + "data": { + "string": "escalating error to panic" + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/governance_tests/tests/pending_moves_to_approved_at_threshold.1.json b/engine-core/test_snapshots/governance_tests/tests/pending_moves_to_approved_at_threshold.1.json new file mode 100644 index 0000000..8e1e0bd --- /dev/null +++ b/engine-core/test_snapshots/governance_tests/tests/pending_moves_to_approved_at_threshold.1.json @@ -0,0 +1,370 @@ +{ + "generators": { + "address": 2, + "nonce": 0 + }, + "auth": [ + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "", + "args": [] + } + }, + "sub_invocations": [] + } + ] + ], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "", + "args": [] + } + }, + "sub_invocations": [] + } + ] + ], + [] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "symbol": "MINSTAKE" + }, + "val": { + "i128": { + "hi": 0, + "lo": 0 + } + } + }, + { + "key": { + "symbol": "PROPS" + }, + "val": { + "map": [ + { + "key": { + "u64": 1 + }, + "val": { + "vec": [ + { + "map": [ + { + "key": { + "symbol": "action_hash" + }, + "val": { + "bytes": "0707070707070707070707070707070707070707070707070707070707070707" + } + }, + { + "key": { + "symbol": "approved_by" + }, + "val": { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + ] + } + }, + { + "key": { + "symbol": "id" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "symbol": "proposer" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "state" + }, + "val": { + "u32": 1 + } + } + ] + }, + { + "u32": 720 + } + ] + } + } + ] + } + }, + { + "key": { + "symbol": "SIGNERS" + }, + "val": { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + ] + } + }, + { + "key": { + "symbol": "THRESH" + }, + "val": { + "u32": 1 + } + } + ] + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 770 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "0707070707070707070707070707070707070707070707070707070707070707" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 1 + } + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 1026 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "0000000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 1 + } + } + ] + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/governance_tests/tests/proposal_initial_state_is_pending.1.json b/engine-core/test_snapshots/governance_tests/tests/proposal_initial_state_is_pending.1.json new file mode 100644 index 0000000..ccf57b7 --- /dev/null +++ b/engine-core/test_snapshots/governance_tests/tests/proposal_initial_state_is_pending.1.json @@ -0,0 +1,270 @@ +{ + "generators": { + "address": 2, + "nonce": 0 + }, + "auth": [ + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "", + "args": [] + } + }, + "sub_invocations": [] + } + ] + ], + [] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "symbol": "MINSTAKE" + }, + "val": { + "i128": { + "hi": 0, + "lo": 0 + } + } + }, + { + "key": { + "symbol": "PROPS" + }, + "val": { + "map": [ + { + "key": { + "u64": 1 + }, + "val": { + "vec": [ + { + "map": [ + { + "key": { + "symbol": "action_hash" + }, + "val": { + "bytes": "0707070707070707070707070707070707070707070707070707070707070707" + } + }, + { + "key": { + "symbol": "approved_by" + }, + "val": { + "vec": [] + } + }, + { + "key": { + "symbol": "id" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "symbol": "proposer" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "state" + }, + "val": { + "u32": 0 + } + } + ] + }, + { + "u32": 720 + } + ] + } + } + ] + } + }, + { + "key": { + "symbol": "SIGNERS" + }, + "val": { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + ] + } + }, + { + "key": { + "symbol": "THRESH" + }, + "val": { + "u32": 1 + } + } + ] + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 770 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "0707070707070707070707070707070707070707070707070707070707070707" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 1 + } + } + ] + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/governance_tests/tests/test_duplicate_approval_detection.1.json b/engine-core/test_snapshots/governance_tests/tests/test_duplicate_approval_detection.1.json index 35779dc..3a99c6c 100644 --- a/engine-core/test_snapshots/governance_tests/tests/test_duplicate_approval_detection.1.json +++ b/engine-core/test_snapshots/governance_tests/tests/test_duplicate_approval_detection.1.json @@ -3,7 +3,24 @@ "address": 3, "nonce": 0 }, - "auth": [], + "auth": [ + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "", + "args": [] + } + }, + "sub_invocations": [] + } + ] + ] + ], "ledger": { "protocol_version": 21, "sequence_number": 0, @@ -36,7 +53,107 @@ "executable": { "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" }, - "storage": null + "storage": [ + { + "key": { + "symbol": "MINSTAKE" + }, + "val": { + "i128": { + "hi": 0, + "lo": 0 + } + } + }, + { + "key": { + "symbol": "PROPS" + }, + "val": { + "map": [ + { + "key": { + "u64": 1 + }, + "val": { + "vec": [ + { + "map": [ + { + "key": { + "symbol": "action_hash" + }, + "val": { + "bytes": "0707070707070707070707070707070707070707070707070707070707070707" + } + }, + { + "key": { + "symbol": "approved_by" + }, + "val": { + "vec": [] + } + }, + { + "key": { + "symbol": "id" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "symbol": "proposer" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "state" + }, + "val": { + "u32": 0 + } + } + ] + }, + { + "u32": 720 + } + ] + } + } + ] + } + }, + { + "key": { + "symbol": "SIGNERS" + }, + "val": { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + ] + } + }, + { + "key": { + "symbol": "THRESH" + }, + "val": { + "u32": 2 + } + } + ] } } } @@ -82,7 +199,7 @@ [ { "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", "key": { "ledger_key_nonce": { "nonce": 5541220902715666415 @@ -97,7 +214,7 @@ "data": { "contract_data": { "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", "key": { "ledger_key_nonce": { "nonce": 5541220902715666415 @@ -161,6 +278,54 @@ "u32": 770 } }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "0707070707070707070707070707070707070707070707070707070707070707" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 1 + } + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 1026 + } + }, { "key": { "symbol": "hash" diff --git a/engine-core/test_snapshots/governance_tests/tests/test_full_proposal_lifecycle.1.json b/engine-core/test_snapshots/governance_tests/tests/test_full_proposal_lifecycle.1.json index d971112..bab53b3 100644 --- a/engine-core/test_snapshots/governance_tests/tests/test_full_proposal_lifecycle.1.json +++ b/engine-core/test_snapshots/governance_tests/tests/test_full_proposal_lifecycle.1.json @@ -1,12 +1,46 @@ { "generators": { - "address": 3, + "address": 2, "nonce": 0 }, - "auth": [], + "auth": [ + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "", + "args": [] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "", + "args": [] + } + }, + "sub_invocations": [] + } + ] + ], + [] + ], "ledger": { "protocol_version": 21, - "sequence_number": 0, + "sequence_number": 721, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", "base_reserve": 0, @@ -36,7 +70,108 @@ "executable": { "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" }, - "storage": null + "storage": [ + { + "key": { + "symbol": "MINSTAKE" + }, + "val": { + "i128": { + "hi": 0, + "lo": 0 + } + } + }, + { + "key": { + "symbol": "PROPS" + }, + "val": { + "map": [ + { + "key": { + "u64": 1 + }, + "val": { + "vec": [ + { + "map": [ + { + "key": { + "symbol": "action_hash" + }, + "val": { + "bytes": "0707070707070707070707070707070707070707070707070707070707070707" + } + }, + { + "key": { + "symbol": "approved_by" + }, + "val": { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + ] + } + }, + { + "key": { + "symbol": "id" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "symbol": "proposer" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "state" + }, + "val": { + "u32": 2 + } + } + ] + }, + { + "u32": 720 + } + ] + } + } + ] + } + }, + { + "key": { + "symbol": "SIGNERS" + }, + "val": { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + ] + } + }, + { + "key": { + "symbol": "THRESH" + }, + "val": { + "u32": 1 + } + } + ] } } } @@ -166,7 +301,7 @@ "symbol": "hash" }, "val": { - "bytes": "0000000000000000000000000000000000000000000000000000000000000000" + "bytes": "0707070707070707070707070707070707070707070707070707070707070707" } }, { @@ -188,21 +323,44 @@ "event": { "ext": "v0", "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", + "type_": "contract", "body": { "v0": { "topics": [ { - "symbol": "error" + "symbol": "EVENT" }, { - "error": { - "auth": "existing_value" - } + "symbol": "LOG" } ], "data": { - "string": "frame is already authorized" + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 1026 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "0000000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 1 + } + } + ] } } } @@ -213,21 +371,44 @@ "event": { "ext": "v0", "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", + "type_": "contract", "body": { "v0": { "topics": [ { - "symbol": "error" + "symbol": "EVENT" }, { - "error": { - "auth": "existing_value" - } + "symbol": "LOG" } ], "data": { - "string": "escalating error to panic" + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 1282 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "0707070707070707070707070707070707070707070707070707070707070707" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 1 + } + } + ] } } } diff --git a/engine-core/test_snapshots/governance_tests/tests/test_reject_double_execution.1.json b/engine-core/test_snapshots/governance_tests/tests/test_reject_double_execution.1.json index 929eecd..58c01f9 100644 --- a/engine-core/test_snapshots/governance_tests/tests/test_reject_double_execution.1.json +++ b/engine-core/test_snapshots/governance_tests/tests/test_reject_double_execution.1.json @@ -1,9 +1,10 @@ { "generators": { - "address": 3, + "address": 2, "nonce": 0 }, "auth": [ + [], [ [ "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", @@ -37,7 +38,7 @@ ], "ledger": { "protocol_version": 21, - "sequence_number": 0, + "sequence_number": 721, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", "base_reserve": 0, @@ -68,6 +69,17 @@ "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" }, "storage": [ + { + "key": { + "symbol": "MINSTAKE" + }, + "val": { + "i128": { + "hi": 0, + "lo": 0 + } + } + }, { "key": { "symbol": "PROPS" @@ -87,7 +99,7 @@ "symbol": "action_hash" }, "val": { - "bytes": "0000000000000000000000000000000000000000000000000000000000000000" + "bytes": "0707070707070707070707070707070707070707070707070707070707070707" } }, { @@ -282,6 +294,54 @@ "u32": 770 } }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "0707070707070707070707070707070707070707070707070707070707070707" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 1 + } + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 1026 + } + }, { "key": { "symbol": "hash" @@ -335,7 +395,7 @@ "symbol": "hash" }, "val": { - "bytes": "0000000000000000000000000000000000000000000000000000000000000000" + "bytes": "0707070707070707070707070707070707070707070707070707070707070707" } }, { @@ -366,12 +426,19 @@ }, { "error": { - "auth": "existing_value" + "contract": 5 } } ], "data": { - "string": "frame is already authorized" + "vec": [ + { + "string": "failing with contract error" + }, + { + "u32": 5 + } + ] } } } @@ -391,7 +458,7 @@ }, { "error": { - "auth": "existing_value" + "contract": 5 } } ], diff --git a/engine-core/test_snapshots/governance_tests/tests/test_reject_execution_of_pending_proposal.1.json b/engine-core/test_snapshots/governance_tests/tests/test_reject_execution_of_pending_proposal.1.json index 0448f4f..034b1b0 100644 --- a/engine-core/test_snapshots/governance_tests/tests/test_reject_execution_of_pending_proposal.1.json +++ b/engine-core/test_snapshots/governance_tests/tests/test_reject_execution_of_pending_proposal.1.json @@ -69,5 +69,63 @@ ] ] }, - "events": [] + "events": [ + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 6 + } + } + ], + "data": { + "vec": [ + { + "string": "failing with contract error" + }, + { + "u32": 6 + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 6 + } + } + ], + "data": { + "string": "escalating error to panic" + } + } + } + }, + "failed_call": false + } + ] } \ No newline at end of file diff --git a/engine-core/test_snapshots/governance_tests/tests/timelock_blocks_early_execution.1.json b/engine-core/test_snapshots/governance_tests/tests/timelock_blocks_early_execution.1.json new file mode 100644 index 0000000..8d01bf2 --- /dev/null +++ b/engine-core/test_snapshots/governance_tests/tests/timelock_blocks_early_execution.1.json @@ -0,0 +1,426 @@ +{ + "generators": { + "address": 2, + "nonce": 0 + }, + "auth": [ + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "", + "args": [] + } + }, + "sub_invocations": [] + } + ] + ], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "", + "args": [] + } + }, + "sub_invocations": [] + } + ] + ] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "symbol": "MINSTAKE" + }, + "val": { + "i128": { + "hi": 0, + "lo": 0 + } + } + }, + { + "key": { + "symbol": "PROPS" + }, + "val": { + "map": [ + { + "key": { + "u64": 1 + }, + "val": { + "vec": [ + { + "map": [ + { + "key": { + "symbol": "action_hash" + }, + "val": { + "bytes": "0707070707070707070707070707070707070707070707070707070707070707" + } + }, + { + "key": { + "symbol": "approved_by" + }, + "val": { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + ] + } + }, + { + "key": { + "symbol": "id" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "symbol": "proposer" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "state" + }, + "val": { + "u32": 1 + } + } + ] + }, + { + "u32": 720 + } + ] + } + } + ] + } + }, + { + "key": { + "symbol": "SIGNERS" + }, + "val": { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + ] + } + }, + { + "key": { + "symbol": "THRESH" + }, + "val": { + "u32": 1 + } + } + ] + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 770 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "0707070707070707070707070707070707070707070707070707070707070707" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 1 + } + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 1026 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "0000000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 1 + } + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 4 + } + } + ], + "data": { + "vec": [ + { + "string": "failing with contract error" + }, + { + "u32": 4 + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 4 + } + } + ], + "data": { + "string": "escalating error to panic" + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/protocol_fee/tests/fee_at_full_bps_is_full_amount.1.json b/engine-core/test_snapshots/protocol_fee/tests/fee_at_full_bps_is_full_amount.1.json new file mode 100644 index 0000000..caec516 --- /dev/null +++ b/engine-core/test_snapshots/protocol_fee/tests/fee_at_full_bps_is_full_amount.1.json @@ -0,0 +1,93 @@ +{ + "generators": { + "address": 2, + "nonce": 0 + }, + "auth": [ + [], + [] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "symbol": "FEE_BPS" + }, + "val": { + "u32": 10000 + } + }, + { + "key": { + "symbol": "FEE_RCP" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + } + ] + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/protocol_fee/tests/fee_calculation_standard.1.json b/engine-core/test_snapshots/protocol_fee/tests/fee_calculation_standard.1.json new file mode 100644 index 0000000..e9eb5c1 --- /dev/null +++ b/engine-core/test_snapshots/protocol_fee/tests/fee_calculation_standard.1.json @@ -0,0 +1,93 @@ +{ + "generators": { + "address": 2, + "nonce": 0 + }, + "auth": [ + [], + [] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "symbol": "FEE_BPS" + }, + "val": { + "u32": 500 + } + }, + { + "key": { + "symbol": "FEE_RCP" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + } + ] + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/protocol_fee/tests/get_fee_config_returns_stored_values.1.json b/engine-core/test_snapshots/protocol_fee/tests/get_fee_config_returns_stored_values.1.json new file mode 100644 index 0000000..2bad0c5 --- /dev/null +++ b/engine-core/test_snapshots/protocol_fee/tests/get_fee_config_returns_stored_values.1.json @@ -0,0 +1,93 @@ +{ + "generators": { + "address": 2, + "nonce": 0 + }, + "auth": [ + [], + [] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "symbol": "FEE_BPS" + }, + "val": { + "u32": 250 + } + }, + { + "key": { + "symbol": "FEE_RCP" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + } + ] + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/protocol_fee/tests/partial_bps_fee_rounds_down.1.json b/engine-core/test_snapshots/protocol_fee/tests/partial_bps_fee_rounds_down.1.json new file mode 100644 index 0000000..6b2abfc --- /dev/null +++ b/engine-core/test_snapshots/protocol_fee/tests/partial_bps_fee_rounds_down.1.json @@ -0,0 +1,93 @@ +{ + "generators": { + "address": 2, + "nonce": 0 + }, + "auth": [ + [], + [] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "symbol": "FEE_BPS" + }, + "val": { + "u32": 333 + } + }, + { + "key": { + "symbol": "FEE_RCP" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + } + ] + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/protocol_fee/tests/rejects_bps_over_max.1.json b/engine-core/test_snapshots/protocol_fee/tests/rejects_bps_over_max.1.json new file mode 100644 index 0000000..dc76d95 --- /dev/null +++ b/engine-core/test_snapshots/protocol_fee/tests/rejects_bps_over_max.1.json @@ -0,0 +1,131 @@ +{ + "generators": { + "address": 2, + "nonce": 0 + }, + "auth": [], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 1 + } + } + ], + "data": { + "vec": [ + { + "string": "failing with contract error" + }, + { + "u32": 1 + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 1 + } + } + ], + "data": { + "string": "escalating error to panic" + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/protocol_fee/tests/set_fee_bps_updates_rate.1.json b/engine-core/test_snapshots/protocol_fee/tests/set_fee_bps_updates_rate.1.json new file mode 100644 index 0000000..2f58aa4 --- /dev/null +++ b/engine-core/test_snapshots/protocol_fee/tests/set_fee_bps_updates_rate.1.json @@ -0,0 +1,93 @@ +{ + "generators": { + "address": 2, + "nonce": 0 + }, + "auth": [ + [], + [] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "symbol": "FEE_BPS" + }, + "val": { + "u32": 750 + } + }, + { + "key": { + "symbol": "FEE_RCP" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + } + ] + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/reentrancy_tests/tests/guard_can_be_reentered_after_exit.1.json b/engine-core/test_snapshots/reentrancy_tests/tests/guard_can_be_reentered_after_exit.1.json new file mode 100644 index 0000000..4a934ef --- /dev/null +++ b/engine-core/test_snapshots/reentrancy_tests/tests/guard_can_be_reentered_after_exit.1.json @@ -0,0 +1,75 @@ +{ + "generators": { + "address": 1, + "nonce": 0 + }, + "auth": [ + [] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/reentrancy_tests/tests/guard_panics_when_entered_twice.1.json b/engine-core/test_snapshots/reentrancy_tests/tests/guard_panics_when_entered_twice.1.json new file mode 100644 index 0000000..2ed3a03 --- /dev/null +++ b/engine-core/test_snapshots/reentrancy_tests/tests/guard_panics_when_entered_twice.1.json @@ -0,0 +1,162 @@ +{ + "generators": { + "address": 1, + "nonce": 0 + }, + "auth": [], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "symbol": "RE_GUARD" + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "symbol": "RE_GUARD" + }, + "durability": "temporary", + "val": { + "bool": true + } + } + }, + "ext": "v0" + }, + 15 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 100 + } + } + ], + "data": { + "vec": [ + { + "string": "failing with contract error" + }, + { + "u32": 100 + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 100 + } + } + ], + "data": { + "string": "escalating error to panic" + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/treasury/tests/latest_snapshot_is_none_when_empty.1.json b/engine-core/test_snapshots/treasury/tests/latest_snapshot_is_none_when_empty.1.json new file mode 100644 index 0000000..00e3b7f --- /dev/null +++ b/engine-core/test_snapshots/treasury/tests/latest_snapshot_is_none_when_empty.1.json @@ -0,0 +1,100 @@ +{ + "generators": { + "address": 1, + "nonce": 0 + }, + "auth": [ + [] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "symbol": "OUTFLOWS" + }, + "val": { + "map": [] + } + }, + { + "key": { + "symbol": "SNAPC" + }, + "val": { + "u64": 0 + } + }, + { + "key": { + "symbol": "SNAPL" + }, + "val": { + "u64": 0 + } + } + ] + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/treasury/tests/snapshot_creation_and_retrieval.1.json b/engine-core/test_snapshots/treasury/tests/snapshot_creation_and_retrieval.1.json index 927d25c..9f08344 100644 --- a/engine-core/test_snapshots/treasury/tests/snapshot_creation_and_retrieval.1.json +++ b/engine-core/test_snapshots/treasury/tests/snapshot_creation_and_retrieval.1.json @@ -21,7 +21,14 @@ "contract_data": { "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", "key": { - "symbol": "S1" + "vec": [ + { + "symbol": "Snapshot" + }, + { + "u64": 1 + } + ] }, "durability": "temporary" } @@ -34,7 +41,14 @@ "ext": "v0", "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", "key": { - "symbol": "S1" + "vec": [ + { + "symbol": "Snapshot" + }, + { + "u64": 1 + } + ] }, "durability": "temporary", "val": { diff --git a/engine-core/test_snapshots/treasury/tests/snapshot_hash_verification.1.json b/engine-core/test_snapshots/treasury/tests/snapshot_hash_verification.1.json index 776fbad..2479ffd 100644 --- a/engine-core/test_snapshots/treasury/tests/snapshot_hash_verification.1.json +++ b/engine-core/test_snapshots/treasury/tests/snapshot_hash_verification.1.json @@ -21,7 +21,14 @@ "contract_data": { "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", "key": { - "symbol": "S1" + "vec": [ + { + "symbol": "Snapshot" + }, + { + "u64": 1 + } + ] }, "durability": "temporary" } @@ -34,7 +41,14 @@ "ext": "v0", "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", "key": { - "symbol": "S1" + "vec": [ + { + "symbol": "Snapshot" + }, + { + "u64": 1 + } + ] }, "durability": "temporary", "val": { diff --git a/engine-core/test_snapshots/treasury_tests/tests/negative_balance_is_rejected.1.json b/engine-core/test_snapshots/treasury_tests/tests/negative_balance_is_rejected.1.json new file mode 100644 index 0000000..4041909 --- /dev/null +++ b/engine-core/test_snapshots/treasury_tests/tests/negative_balance_is_rejected.1.json @@ -0,0 +1,131 @@ +{ + "generators": { + "address": 1, + "nonce": 0 + }, + "auth": [], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 2 + } + } + ], + "data": { + "vec": [ + { + "string": "failing with contract error" + }, + { + "u32": 2 + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 2 + } + } + ], + "data": { + "string": "escalating error to panic" + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/treasury_tests/tests/recent_snapshots_are_newest_first.1.json b/engine-core/test_snapshots/treasury_tests/tests/recent_snapshots_are_newest_first.1.json new file mode 100644 index 0000000..20b6bf4 --- /dev/null +++ b/engine-core/test_snapshots/treasury_tests/tests/recent_snapshots_are_newest_first.1.json @@ -0,0 +1,584 @@ +{ + "generators": { + "address": 1, + "nonce": 0 + }, + "auth": [ + [] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "Snapshot" + }, + { + "u64": 1 + } + ] + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "Snapshot" + }, + { + "u64": 1 + } + ] + }, + "durability": "temporary", + "val": { + "map": [ + { + "key": { + "symbol": "account_count" + }, + "val": { + "u32": 1 + } + }, + { + "key": { + "symbol": "context" + }, + "val": { + "map": [] + } + }, + { + "key": { + "symbol": "id" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "symbol": "ledger" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "state_hash" + }, + "val": { + "bytes": "a076236c5280776b29a6c1e3bb11226ed9f1523a850f5c6d29e28ad780348abc" + } + }, + { + "key": { + "symbol": "timestamp_unix" + }, + "val": { + "u64": 0 + } + }, + { + "key": { + "symbol": "total_balance" + }, + "val": { + "i128": { + "hi": 0, + "lo": 100 + } + } + }, + { + "key": { + "symbol": "trigger" + }, + "val": { + "u32": 4 + } + } + ] + } + } + }, + "ext": "v0" + }, + 120960 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "Snapshot" + }, + { + "u64": 2 + } + ] + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "Snapshot" + }, + { + "u64": 2 + } + ] + }, + "durability": "temporary", + "val": { + "map": [ + { + "key": { + "symbol": "account_count" + }, + "val": { + "u32": 1 + } + }, + { + "key": { + "symbol": "context" + }, + "val": { + "map": [] + } + }, + { + "key": { + "symbol": "id" + }, + "val": { + "u64": 2 + } + }, + { + "key": { + "symbol": "ledger" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "state_hash" + }, + "val": { + "bytes": "c760bf97d10cf924412e33513007c06425314a06b4e4ccde18008cb7436cd641" + } + }, + { + "key": { + "symbol": "timestamp_unix" + }, + "val": { + "u64": 0 + } + }, + { + "key": { + "symbol": "total_balance" + }, + "val": { + "i128": { + "hi": 0, + "lo": 101 + } + } + }, + { + "key": { + "symbol": "trigger" + }, + "val": { + "u32": 4 + } + } + ] + } + } + }, + "ext": "v0" + }, + 120960 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "Snapshot" + }, + { + "u64": 3 + } + ] + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "Snapshot" + }, + { + "u64": 3 + } + ] + }, + "durability": "temporary", + "val": { + "map": [ + { + "key": { + "symbol": "account_count" + }, + "val": { + "u32": 1 + } + }, + { + "key": { + "symbol": "context" + }, + "val": { + "map": [] + } + }, + { + "key": { + "symbol": "id" + }, + "val": { + "u64": 3 + } + }, + { + "key": { + "symbol": "ledger" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "state_hash" + }, + "val": { + "bytes": "b87a2adf90ba811252461d022e0c7bfefb54ebd45b1d62ac39a8bb961f6d1daa" + } + }, + { + "key": { + "symbol": "timestamp_unix" + }, + "val": { + "u64": 0 + } + }, + { + "key": { + "symbol": "total_balance" + }, + "val": { + "i128": { + "hi": 0, + "lo": 102 + } + } + }, + { + "key": { + "symbol": "trigger" + }, + "val": { + "u32": 4 + } + } + ] + } + } + }, + "ext": "v0" + }, + 120960 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "symbol": "OUTFLOWS" + }, + "val": { + "map": [] + } + }, + { + "key": { + "symbol": "SNAPC" + }, + "val": { + "u64": 3 + } + }, + { + "key": { + "symbol": "SNAPL" + }, + "val": { + "u64": 3 + } + } + ] + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 515 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "a076236c5280776b29a6c1e3bb11226ed9f1523a850f5c6d29e28ad780348abc" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 1 + } + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 515 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "c760bf97d10cf924412e33513007c06425314a06b4e4ccde18008cb7436cd641" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 2 + } + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 515 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "b87a2adf90ba811252461d022e0c7bfefb54ebd45b1d62ac39a8bb961f6d1daa" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 3 + } + } + ] + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/treasury_tests/tests/records_and_retrieves_snapshot.1.json b/engine-core/test_snapshots/treasury_tests/tests/records_and_retrieves_snapshot.1.json new file mode 100644 index 0000000..9f08344 --- /dev/null +++ b/engine-core/test_snapshots/treasury_tests/tests/records_and_retrieves_snapshot.1.json @@ -0,0 +1,262 @@ +{ + "generators": { + "address": 1, + "nonce": 0 + }, + "auth": [ + [] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "Snapshot" + }, + { + "u64": 1 + } + ] + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "Snapshot" + }, + { + "u64": 1 + } + ] + }, + "durability": "temporary", + "val": { + "map": [ + { + "key": { + "symbol": "account_count" + }, + "val": { + "u32": 5 + } + }, + { + "key": { + "symbol": "context" + }, + "val": { + "map": [] + } + }, + { + "key": { + "symbol": "id" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "symbol": "ledger" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "state_hash" + }, + "val": { + "bytes": "3f669395051abd97652a9c947139d6d477c996972caa38158decad5a49c70efb" + } + }, + { + "key": { + "symbol": "timestamp_unix" + }, + "val": { + "u64": 0 + } + }, + { + "key": { + "symbol": "total_balance" + }, + "val": { + "i128": { + "hi": 0, + "lo": 1000 + } + } + }, + { + "key": { + "symbol": "trigger" + }, + "val": { + "u32": 0 + } + } + ] + } + } + }, + "ext": "v0" + }, + 120960 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "symbol": "OUTFLOWS" + }, + "val": { + "map": [] + } + }, + { + "key": { + "symbol": "SNAPC" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "symbol": "SNAPL" + }, + "val": { + "u64": 1 + } + } + ] + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 515 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "3f669395051abd97652a9c947139d6d477c996972caa38158decad5a49c70efb" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 1 + } + } + ] + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/upgrade/tests/upgrade_fails_when_hash_was_not_approved.1.json b/engine-core/test_snapshots/upgrade/tests/upgrade_fails_when_hash_was_not_approved.1.json new file mode 100644 index 0000000..23e8a88 --- /dev/null +++ b/engine-core/test_snapshots/upgrade/tests/upgrade_fails_when_hash_was_not_approved.1.json @@ -0,0 +1,205 @@ +{ + "generators": { + "address": 3, + "nonce": 0 + }, + "auth": [], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000003", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 770 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "0101010101010101010101010101010101010101010101010101010101010101" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 7 + } + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000003", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "auth": "existing_value" + } + } + ], + "data": { + "string": "frame is already authorized" + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000003", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "auth": "existing_value" + } + } + ], + "data": { + "string": "escalating error to panic" + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/upgrade/tests/upgrade_fails_without_quorum.1.json b/engine-core/test_snapshots/upgrade/tests/upgrade_fails_without_quorum.1.json new file mode 100644 index 0000000..23e8a88 --- /dev/null +++ b/engine-core/test_snapshots/upgrade/tests/upgrade_fails_without_quorum.1.json @@ -0,0 +1,205 @@ +{ + "generators": { + "address": 3, + "nonce": 0 + }, + "auth": [], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000003", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "EVENT" + }, + { + "symbol": "LOG" + } + ], + "data": { + "map": [ + { + "key": { + "symbol": "flags" + }, + "val": { + "u32": 770 + } + }, + { + "key": { + "symbol": "hash" + }, + "val": { + "bytes": "0101010101010101010101010101010101010101010101010101010101010101" + } + }, + { + "key": { + "symbol": "value" + }, + "val": { + "u64": 7 + } + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000003", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "auth": "existing_value" + } + } + ], + "data": { + "string": "frame is already authorized" + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000003", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "auth": "existing_value" + } + } + ], + "data": { + "string": "escalating error to panic" + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/version/tests/init_version_rejects_double_init.1.json b/engine-core/test_snapshots/version/tests/init_version_rejects_double_init.1.json new file mode 100644 index 0000000..51cedb4 --- /dev/null +++ b/engine-core/test_snapshots/version/tests/init_version_rejects_double_init.1.json @@ -0,0 +1,131 @@ +{ + "generators": { + "address": 1, + "nonce": 0 + }, + "auth": [], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 1 + } + } + ], + "data": { + "vec": [ + { + "string": "failing with contract error" + }, + { + "u32": 1 + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 1 + } + } + ], + "data": { + "string": "escalating error to panic" + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/version/tests/init_version_stores_correctly.1.json b/engine-core/test_snapshots/version/tests/init_version_stores_correctly.1.json new file mode 100644 index 0000000..24f59f5 --- /dev/null +++ b/engine-core/test_snapshots/version/tests/init_version_stores_correctly.1.json @@ -0,0 +1,92 @@ +{ + "generators": { + "address": 1, + "nonce": 0 + }, + "auth": [ + [] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "symbol": "VERSION" + }, + "val": { + "u32": 1 + } + }, + { + "key": { + "symbol": "VER_INIT" + }, + "val": { + "bool": true + } + } + ] + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/version/tests/require_compatible_rejects_mismatch.1.json b/engine-core/test_snapshots/version/tests/require_compatible_rejects_mismatch.1.json new file mode 100644 index 0000000..5984b1a --- /dev/null +++ b/engine-core/test_snapshots/version/tests/require_compatible_rejects_mismatch.1.json @@ -0,0 +1,77 @@ +{ + "generators": { + "address": 0, + "nonce": 0 + }, + "auth": [], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 2 + } + } + ], + "data": { + "vec": [ + { + "string": "failing with contract error" + }, + { + "u32": 2 + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 2 + } + } + ], + "data": { + "string": "escalating error to panic" + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/version/tests/set_contract_version_works.1.json b/engine-core/test_snapshots/version/tests/set_contract_version_works.1.json new file mode 100644 index 0000000..f7e6cec --- /dev/null +++ b/engine-core/test_snapshots/version/tests/set_contract_version_works.1.json @@ -0,0 +1,92 @@ +{ + "generators": { + "address": 1, + "nonce": 0 + }, + "auth": [ + [] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "symbol": "VERSION" + }, + "val": { + "u32": 2 + } + }, + { + "key": { + "symbol": "VER_INIT" + }, + "val": { + "bool": true + } + } + ] + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [] +} \ No newline at end of file diff --git a/engine-core/test_snapshots/version/tests/upgrade_check_rejects_downgrade.1.json b/engine-core/test_snapshots/version/tests/upgrade_check_rejects_downgrade.1.json new file mode 100644 index 0000000..8375b89 --- /dev/null +++ b/engine-core/test_snapshots/version/tests/upgrade_check_rejects_downgrade.1.json @@ -0,0 +1,77 @@ +{ + "generators": { + "address": 0, + "nonce": 0 + }, + "auth": [], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 3 + } + } + ], + "data": { + "vec": [ + { + "string": "failing with contract error" + }, + { + "u32": 3 + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 3 + } + } + ], + "data": { + "string": "escalating error to panic" + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/src/contracts/events.rs b/src/contracts/events.rs deleted file mode 100644 index e33ccd4..0000000 --- a/src/contracts/events.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Compact event structs. -// Gas costs too high. -// Move logs to transient. -// Suggested Approach: Bitmask event data. -// Performance optimized via local state. - -#![no_std] - -use soroban_sdk::{contracttype, Env, Symbol}; - -#[contracttype] -pub struct CompactEvent { - // Bitmask event data to reduce storage footprint - pub bitmask_data: u64, -} - -pub fn emit_compact_event(env: &Env, mask: u64) { - let event_data = CompactEvent { - bitmask_data: mask, - }; - - // Move logs to transient storage / optimize performance via local state - // Emitting event using compacted bitmask struct - env.events().publish((Symbol::new(env, "compact_log"),), event_data); -} diff --git a/vero-core-engine b/vero-core-engine deleted file mode 160000 index 68174ce..0000000 --- a/vero-core-engine +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 68174cedbbe15344ab9c2e1f8c245f02adcfbfa7