diff --git a/core-rust/Cargo.lock b/core-rust/Cargo.lock index ca23882cae..7a10bfcde3 100644 --- a/core-rust/Cargo.lock +++ b/core-rust/Cargo.lock @@ -206,6 +206,17 @@ dependencies = [ "zeroize", ] +[[package]] +name = "blueprint-schema-init" +version = "1.2.0-dev" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=develop-839137f1#839137f1b34f45273c51429459221080b4d41b1d" +dependencies = [ + "bitflags 1.3.2", + "radix-engine-common", + "sbor", + "serde", +] + [[package]] name = "bnum" version = "0.7.0" @@ -366,6 +377,7 @@ version = "0.1.0" dependencies = [ "axum", "blake2", + "blueprint-schema-init", "chrono", "futures", "futures-util", @@ -378,13 +390,13 @@ dependencies = [ "radix-engine", "radix-engine-common", "radix-engine-interface", - "radix-engine-queries", - "radix-engine-store-interface", - "radix-engine-stores", "sbor", "serde", "serde_json", "state-manager", + "substate-store-impls", + "substate-store-interface", + "substate-store-queries", "tokio", "tower", "tower-http", @@ -949,11 +961,11 @@ dependencies = [ "radix-engine", "radix-engine-common", "radix-engine-interface", - "radix-engine-queries", - "radix-engine-store-interface", - "radix-engine-stores", "sbor", "state-manager", + "substate-store-impls", + "substate-store-interface", + "substate-store-queries", "transaction", "transaction-scenarios", "utils", @@ -1174,11 +1186,10 @@ dependencies = [ [[package]] name = "native-sdk" -version = "1.1.0-rc1" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=anemone-e212f2ea#e212f2ea33f05f7980ef6b4026edf60e162aaae3" +version = "1.2.0-dev" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=develop-839137f1#839137f1b34f45273c51429459221080b4d41b1d" dependencies = [ "radix-engine-common", - "radix-engine-derive", "radix-engine-interface", "sbor", "utils", @@ -1198,10 +1209,10 @@ dependencies = [ "radix-engine", "radix-engine-common", "radix-engine-interface", - "radix-engine-queries", - "radix-engine-store-interface", - "radix-engine-stores", "sbor", + "substate-store-impls", + "substate-store-interface", + "substate-store-queries", "tokio", "tokio-util", "tracing", @@ -1521,10 +1532,11 @@ dependencies = [ [[package]] name = "radix-engine" -version = "1.1.0-rc1" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=anemone-e212f2ea#e212f2ea33f05f7980ef6b4026edf60e162aaae3" +version = "1.2.0-dev" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=develop-839137f1#839137f1b34f45273c51429459221080b4d41b1d" dependencies = [ "bitflags 1.3.2", + "blueprint-schema-init", "colored", "const-sha1", "hex", @@ -1536,11 +1548,11 @@ dependencies = [ "radix-engine-common", "radix-engine-interface", "radix-engine-macros", - "radix-engine-store-interface", "resources-tracker-macro", "sbor", "serde_json", "strum", + "substate-store-interface", "syn 1.0.93", "transaction", "utils", @@ -1551,8 +1563,8 @@ dependencies = [ [[package]] name = "radix-engine-common" -version = "1.1.0-rc1" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=anemone-e212f2ea#e212f2ea33f05f7980ef6b4026edf60e162aaae3" +version = "1.2.0-dev" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=develop-839137f1#839137f1b34f45273c51429459221080b4d41b1d" dependencies = [ "bech32", "blake2", @@ -1576,8 +1588,8 @@ dependencies = [ [[package]] name = "radix-engine-derive" -version = "1.1.0-rc1" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=anemone-e212f2ea#e212f2ea33f05f7980ef6b4026edf60e162aaae3" +version = "1.2.0-dev" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=develop-839137f1#839137f1b34f45273c51429459221080b4d41b1d" dependencies = [ "proc-macro2", "quote", @@ -1587,20 +1599,19 @@ dependencies = [ [[package]] name = "radix-engine-interface" -version = "1.1.0-rc1" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=anemone-e212f2ea#e212f2ea33f05f7980ef6b4026edf60e162aaae3" +version = "1.2.0-dev" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=develop-839137f1#839137f1b34f45273c51429459221080b4d41b1d" dependencies = [ "bitflags 1.3.2", + "blueprint-schema-init", "const-sha1", "hex", "lazy_static", "paste", "radix-engine-common", - "radix-engine-derive", "radix-engine-macros", "regex", "sbor", - "scrypto-schema", "serde", "serde_json", "strum", @@ -1609,8 +1620,8 @@ dependencies = [ [[package]] name = "radix-engine-macros" -version = "1.1.0-rc1" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=anemone-e212f2ea#e212f2ea33f05f7980ef6b4026edf60e162aaae3" +version = "1.2.0-dev" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=develop-839137f1#839137f1b34f45273c51429459221080b4d41b1d" dependencies = [ "paste", "proc-macro2", @@ -1621,56 +1632,12 @@ dependencies = [ [[package]] name = "radix-engine-profiling" -version = "1.1.0-rc1" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=anemone-e212f2ea#e212f2ea33f05f7980ef6b4026edf60e162aaae3" +version = "1.2.0-dev" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=develop-839137f1#839137f1b34f45273c51429459221080b4d41b1d" dependencies = [ "fixedstr", ] -[[package]] -name = "radix-engine-queries" -version = "1.1.0-rc1" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=anemone-e212f2ea#e212f2ea33f05f7980ef6b4026edf60e162aaae3" -dependencies = [ - "hex", - "itertools 0.10.5", - "paste", - "radix-engine", - "radix-engine-interface", - "radix-engine-store-interface", - "sbor", - "transaction", - "utils", -] - -[[package]] -name = "radix-engine-store-interface" -version = "1.1.0-rc1" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=anemone-e212f2ea#e212f2ea33f05f7980ef6b4026edf60e162aaae3" -dependencies = [ - "hex", - "itertools 0.10.5", - "radix-engine-common", - "radix-engine-derive", - "radix-engine-interface", - "sbor", - "utils", -] - -[[package]] -name = "radix-engine-stores" -version = "1.1.0-rc1" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=anemone-e212f2ea#e212f2ea33f05f7980ef6b4026edf60e162aaae3" -dependencies = [ - "hex", - "itertools 0.10.5", - "radix-engine-common", - "radix-engine-derive", - "radix-engine-store-interface", - "sbor", - "utils", -] - [[package]] name = "rand" version = "0.7.3" @@ -1791,8 +1758,8 @@ checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" [[package]] name = "resources-tracker-macro" -version = "1.1.0-rc1" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=anemone-e212f2ea#e212f2ea33f05f7980ef6b4026edf60e162aaae3" +version = "1.2.0-dev" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=develop-839137f1#839137f1b34f45273c51429459221080b4d41b1d" dependencies = [ "proc-macro2", "quote", @@ -1867,8 +1834,8 @@ dependencies = [ [[package]] name = "sbor" -version = "1.1.0-rc1" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=anemone-e212f2ea#e212f2ea33f05f7980ef6b4026edf60e162aaae3" +version = "1.2.0-dev" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=develop-839137f1#839137f1b34f45273c51429459221080b4d41b1d" dependencies = [ "const-sha1", "hex", @@ -1881,8 +1848,8 @@ dependencies = [ [[package]] name = "sbor-derive" -version = "1.1.0-rc1" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=anemone-e212f2ea#e212f2ea33f05f7980ef6b4026edf60e162aaae3" +version = "1.2.0-dev" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=develop-839137f1#839137f1b34f45273c51429459221080b4d41b1d" dependencies = [ "proc-macro2", "sbor-derive-common", @@ -1890,8 +1857,8 @@ dependencies = [ [[package]] name = "sbor-derive-common" -version = "1.1.0-rc1" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=anemone-e212f2ea#e212f2ea33f05f7980ef6b4026edf60e162aaae3" +version = "1.2.0-dev" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=develop-839137f1#839137f1b34f45273c51429459221080b4d41b1d" dependencies = [ "const-sha1", "itertools 0.10.5", @@ -1915,54 +1882,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" -[[package]] -name = "scrypto" -version = "1.1.0-rc1" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=anemone-e212f2ea#e212f2ea33f05f7980ef6b4026edf60e162aaae3" -dependencies = [ - "bech32", - "const-sha1", - "hex", - "num-bigint", - "num-traits", - "paste", - "radix-engine-common", - "radix-engine-derive", - "radix-engine-interface", - "sbor", - "scrypto-derive", - "scrypto-schema", - "strum", - "utils", -] - -[[package]] -name = "scrypto-derive" -version = "1.1.0-rc1" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=anemone-e212f2ea#e212f2ea33f05f7980ef6b4026edf60e162aaae3" -dependencies = [ - "proc-macro2", - "quote", - "radix-engine-common", - "regex", - "sbor", - "scrypto-schema", - "serde", - "serde_json", - "syn 1.0.93", -] - -[[package]] -name = "scrypto-schema" -version = "1.1.0-rc1" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=anemone-e212f2ea#e212f2ea33f05f7980ef6b4026edf60e162aaae3" -dependencies = [ - "bitflags 1.3.2", - "radix-engine-common", - "sbor", - "serde", -] - [[package]] name = "secp256k1" version = "0.24.3" @@ -2189,13 +2108,13 @@ dependencies = [ "radix-engine", "radix-engine-common", "radix-engine-interface", - "radix-engine-queries", - "radix-engine-store-interface", - "radix-engine-stores", "rand 0.8.5", "rocksdb", "sbor", "slotmap", + "substate-store-impls", + "substate-store-interface", + "substate-store-queries", "tempfile", "tokio", "tracing", @@ -2226,6 +2145,48 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "substate-store-impls" +version = "1.2.0-dev" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=develop-839137f1#839137f1b34f45273c51429459221080b4d41b1d" +dependencies = [ + "hex", + "itertools 0.10.5", + "radix-engine-common", + "sbor", + "substate-store-interface", + "utils", +] + +[[package]] +name = "substate-store-interface" +version = "1.2.0-dev" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=develop-839137f1#839137f1b34f45273c51429459221080b4d41b1d" +dependencies = [ + "hex", + "itertools 0.10.5", + "radix-engine-common", + "sbor", + "utils", +] + +[[package]] +name = "substate-store-queries" +version = "1.2.0-dev" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=develop-839137f1#839137f1b34f45273c51429459221080b4d41b1d" +dependencies = [ + "hex", + "itertools 0.10.5", + "paste", + "radix-engine", + "radix-engine-common", + "radix-engine-interface", + "sbor", + "substate-store-interface", + "transaction", + "utils", +] + [[package]] name = "subtle" version = "2.5.0" @@ -2517,8 +2478,8 @@ dependencies = [ [[package]] name = "transaction" -version = "1.1.0-rc1" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=anemone-e212f2ea#e212f2ea33f05f7980ef6b4026edf60e162aaae3" +version = "1.2.0-dev" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=develop-839137f1#839137f1b34f45273c51429459221080b4d41b1d" dependencies = [ "bech32", "hex", @@ -2532,17 +2493,18 @@ dependencies = [ [[package]] name = "transaction-scenarios" -version = "1.1.0-rc1" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=anemone-e212f2ea#e212f2ea33f05f7980ef6b4026edf60e162aaae3" +version = "1.2.0-dev" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=develop-839137f1#839137f1b34f45273c51429459221080b4d41b1d" dependencies = [ + "blueprint-schema-init", "hex", "itertools 0.10.5", "radix-engine", + "radix-engine-common", "radix-engine-interface", - "radix-engine-store-interface", - "radix-engine-stores", "sbor", - "scrypto", + "substate-store-impls", + "substate-store-interface", "transaction", "utils", "walkdir", @@ -2589,8 +2551,8 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "utils" -version = "1.1.0-rc1" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=anemone-e212f2ea#e212f2ea33f05f7980ef6b4026edf60e162aaae3" +version = "1.2.0-dev" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=develop-839137f1#839137f1b34f45273c51429459221080b4d41b1d" dependencies = [ "indexmap 2.0.0-pre", "serde", diff --git a/core-rust/Cargo.toml b/core-rust/Cargo.toml index 6869b93b7e..8276747b14 100644 --- a/core-rust/Cargo.toml +++ b/core-rust/Cargo.toml @@ -22,16 +22,17 @@ resolver = "2" # $ git push origin "release_name-BLAH" # * Then use tag="release_name-BLAH" in the below dependencies. # -sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "anemone-e212f2ea", features = ["serde"] } -transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "anemone-e212f2ea" } -transaction-scenarios = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "anemone-e212f2ea" } -radix-engine-common = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "anemone-e212f2ea", features = ["serde"] } -radix-engine-interface = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "anemone-e212f2ea" } -radix-engine = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "anemone-e212f2ea" } -radix-engine-stores = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "anemone-e212f2ea" } -radix-engine-store-interface = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "anemone-e212f2ea" } -radix-engine-queries = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "anemone-e212f2ea" } -utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "anemone-e212f2ea", features = ["serde"] } +sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-839137f1", features = ["serde"] } +transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-839137f1" } +transaction-scenarios = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-839137f1" } +radix-engine-common = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-839137f1", features = ["serde"] } +radix-engine-interface = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-839137f1" } +radix-engine = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-839137f1" } +substate-store-impls = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-839137f1" } +substate-store-interface = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-839137f1" } +substate-store-queries = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-839137f1" } +utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-839137f1", features = ["serde"] } +blueprint-schema-init = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-839137f1", features = ["serde"] } itertools = { version = "0.11.0" } jni = { version = "0.19.0" } diff --git a/core-rust/core-api-server/Cargo.toml b/core-rust/core-api-server/Cargo.toml index cadd7ac886..b75f9aa1f7 100644 --- a/core-rust/core-api-server/Cargo.toml +++ b/core-rust/core-api-server/Cargo.toml @@ -12,9 +12,10 @@ transaction = { workspace = true } radix-engine-common = { workspace = true } radix-engine-interface = { workspace = true } radix-engine = { workspace = true } -radix-engine-stores = { workspace = true } -radix-engine-store-interface = { workspace = true } -radix-engine-queries = { workspace = true } +substate-store-impls = { workspace = true } +substate-store-interface = { workspace = true } +substate-store-queries = { workspace = true } +blueprint-schema-init = { workspace = true } utils = { workspace = true } # Non-Radix Engine Dependencies: diff --git a/core-rust/core-api-server/src/core_api/conversions/addressing.rs b/core-rust/core-api-server/src/core_api/conversions/addressing.rs index 069fec52d2..f915b9ceb8 100644 --- a/core-rust/core-api-server/src/core_api/conversions/addressing.rs +++ b/core-rust/core-api-server/src/core_api/conversions/addressing.rs @@ -1,20 +1,7 @@ use crate::core_api::models; use crate::core_api::*; +use crate::engine_prelude::*; use models::SubstateType; -use radix_engine::blueprints::account::{AccountField, AccountTypedSubstateKey}; -use radix_engine::blueprints::pool::v1::substates::multi_resource_pool::{ - MultiResourcePoolField, MultiResourcePoolTypedSubstateKey, -}; -use radix_engine::blueprints::pool::v1::substates::one_resource_pool::{ - OneResourcePoolField, OneResourcePoolTypedSubstateKey, -}; -use radix_engine::blueprints::pool::v1::substates::two_resource_pool::{ - TwoResourcePoolField, TwoResourcePoolTypedSubstateKey, -}; -use radix_engine::types::*; - -use radix_engine_queries::typed_substate_layout::*; -use radix_engine_store_interface::db_key_mapper::*; pub fn to_api_global_address( context: &MappingContext, diff --git a/core-rust/core-api-server/src/core_api/conversions/common.rs b/core-rust/core-api-server/src/core_api/conversions/common.rs index 23b1621a92..0d00cea0be 100644 --- a/core-rust/core-api-server/src/core_api/conversions/common.rs +++ b/core-rust/core-api-server/src/core_api/conversions/common.rs @@ -1,6 +1,4 @@ -use radix_engine::types::*; - -use sbor::representations::*; +use crate::engine_prelude::*; use state_manager::LedgerHeader; use crate::core_api::handlers::to_api_epoch_round; diff --git a/core-rust/core-api-server/src/core_api/conversions/context.rs b/core-rust/core-api-server/src/core_api/conversions/context.rs index 96c05299aa..8bc600fd25 100644 --- a/core-rust/core-api-server/src/core_api/conversions/context.rs +++ b/core-rust/core-api-server/src/core_api/conversions/context.rs @@ -1,6 +1,4 @@ -use radix_engine::types::{AddressBech32Decoder, AddressBech32Encoder}; -use radix_engine_interface::network::NetworkDefinition; -use transaction::model::{TransactionHashBech32Decoder, TransactionHashBech32Encoder}; +use crate::engine_prelude::*; use crate::core_api::models; diff --git a/core-rust/core-api-server/src/core_api/conversions/errors.rs b/core-rust/core-api-server/src/core_api/conversions/errors.rs index 9e8abea0d3..64ce85fb63 100644 --- a/core-rust/core-api-server/src/core_api/conversions/errors.rs +++ b/core-rust/core-api-server/src/core_api/conversions/errors.rs @@ -1,11 +1,6 @@ -use radix_engine::types::NonFungibleIdType; -use radix_engine_common::{address::AddressBech32EncodeError, types::PartitionNumber}; -use radix_engine_interface::data::scrypto::model::ParseNonFungibleLocalIdError; -use sbor::{DecodeError, EncodeError}; +use crate::engine_prelude::*; use state_manager::StateVersion; use tracing::warn; -use transaction::errors::TransactionValidationError; -use transaction::model::TransactionHashBech32EncodeError; use crate::core_api::*; diff --git a/core-rust/core-api-server/src/core_api/conversions/hashes.rs b/core-rust/core-api-server/src/core_api/conversions/hashes.rs index 73ef9ed00e..5aef7f647c 100644 --- a/core-rust/core-api-server/src/core_api/conversions/hashes.rs +++ b/core-rust/core-api-server/src/core_api/conversions/hashes.rs @@ -1,6 +1,5 @@ -use radix_engine_interface::blueprints::package::CodeHash; +use crate::engine_prelude::*; use state_manager::{transaction::*, ReceiptTreeHash, StateHash, TransactionTreeHash}; -use transaction::prelude::*; use crate::core_api::*; diff --git a/core-rust/core-api-server/src/core_api/conversions/keys_and_sigs.rs b/core-rust/core-api-server/src/core_api/conversions/keys_and_sigs.rs index 3727e2596b..8d9aef2f6c 100644 --- a/core-rust/core-api-server/src/core_api/conversions/keys_and_sigs.rs +++ b/core-rust/core-api-server/src/core_api/conversions/keys_and_sigs.rs @@ -1,7 +1,4 @@ -use radix_engine::types::PublicKey; -use radix_engine_interface::crypto::{Ed25519PublicKey, Secp256k1PublicKey}; -use transaction::model::{SignatureV1, SignatureWithPublicKeyV1}; -use transaction::prelude::{Ed25519Signature, Secp256k1Signature}; +use crate::engine_prelude::*; use crate::core_api::*; diff --git a/core-rust/core-api-server/src/core_api/conversions/lts.rs b/core-rust/core-api-server/src/core_api/conversions/lts.rs index d66c43bea6..d8a30b9e00 100644 --- a/core-rust/core-api-server/src/core_api/conversions/lts.rs +++ b/core-rust/core-api-server/src/core_api/conversions/lts.rs @@ -1,19 +1,10 @@ -use models::*; -use radix_engine::{ - system::system_modules::costing::RoyaltyRecipient, - transaction::BalanceChange, - types::{Decimal, GlobalAddress, IndexMap, ResourceAddress}, -}; - +use crate::engine_prelude::*; use state_manager::store::{traits::SubstateNodeAncestryStore, StateManagerDatabase}; use state_manager::{ CommittedTransactionIdentifiers, LedgerTransactionOutcome, LocalTransactionReceipt, StateVersion, TransactionTreeHash, }; -use radix_engine::transaction::{FeeDestination, FeeSource, TransactionFeeSummary}; -use transaction::prelude::*; - use crate::core_api::*; #[tracing::instrument(skip_all)] @@ -89,14 +80,14 @@ pub fn to_api_lts_committed_transaction_outcome( pub fn to_api_lts_entity_non_fungible_balance_changes( context: &MappingContext, global_balance_summary: &IndexMap>, -) -> Result, MappingError> { +) -> Result, MappingError> { let mut changes = Vec::new(); for (address, balance_changes) in global_balance_summary.iter() { for (resource, balance_change) in balance_changes.iter() { match balance_change { BalanceChange::Fungible(_) => {} BalanceChange::NonFungible { added, removed } => { - changes.push(LtsEntityNonFungibleBalanceChanges { + changes.push(models::LtsEntityNonFungibleBalanceChanges { entity_address: to_api_global_address(context, address)?, resource_address: to_api_resource_address(context, resource)?, added: added diff --git a/core-rust/core-api-server/src/core_api/conversions/numerics.rs b/core-rust/core-api-server/src/core_api/conversions/numerics.rs index a659d794e2..60caf7b648 100644 --- a/core-rust/core-api-server/src/core_api/conversions/numerics.rs +++ b/core-rust/core-api-server/src/core_api/conversions/numerics.rs @@ -1,9 +1,6 @@ use std::any::type_name; -use radix_engine_common::math::*; -use radix_engine_interface::blueprints::package::BlueprintVersion; -use radix_engine_interface::prelude::*; -use sbor::WellKnownTypeId; +use crate::engine_prelude::*; use state_manager::store::traits::scenario::ScenarioSequenceNumber; use state_manager::StateVersion; diff --git a/core-rust/core-api-server/src/core_api/conversions/pagination.rs b/core-rust/core-api-server/src/core_api/conversions/pagination.rs index 6914db6fbe..9b545fb856 100644 --- a/core-rust/core-api-server/src/core_api/conversions/pagination.rs +++ b/core-rust/core-api-server/src/core_api/conversions/pagination.rs @@ -1,6 +1,5 @@ -use radix_engine::types::*; - use crate::core_api::*; +use crate::engine_prelude::*; pub struct SizeRange { pub min: usize, diff --git a/core-rust/core-api-server/src/core_api/conversions/receipt.rs b/core-rust/core-api-server/src/core_api/conversions/receipt.rs index d2940cbed1..0e915a3776 100644 --- a/core-rust/core-api-server/src/core_api/conversions/receipt.rs +++ b/core-rust/core-api-server/src/core_api/conversions/receipt.rs @@ -2,21 +2,8 @@ use super::addressing::*; use crate::core_api::*; -use radix_engine::blueprints::models::KeyValueKeyPayload; -use radix_engine::types::*; - -use radix_engine::system::system_modules::costing::*; -use radix_engine::transaction::{ - CostingParameters, EventSystemStructure, FeeDestination, FeeSource, - IndexPartitionEntryStructure, KeyValuePartitionEntryStructure, KeyValueStoreEntryStructure, - ObjectInstanceTypeReference, ObjectSubstateTypeReference, PackageTypeReference, - SortedIndexPartitionEntryStructure, StateUpdateSummary, SubstateSystemStructure, - SystemFieldKind, SystemFieldStructure, TransactionFeeSummary, -}; -use radix_engine_queries::typed_substate_layout::*; -use radix_engine_store_interface::db_key_mapper::{MappedSubstateDatabase, SpreadPrefixKeyMapper}; +use crate::engine_prelude::*; use state_manager::store::StateManagerDatabase; -use transaction::prelude::TransactionCostingParameters; use state_manager::{ ApplicationEvent, BySubstate, DetailedTransactionOutcome, LedgerStateChanges, diff --git a/core-rust/core-api-server/src/core_api/conversions/substates/access_controller.rs b/core-rust/core-api-server/src/core_api/conversions/substates/access_controller.rs index a8ee8efd88..bce1fae150 100644 --- a/core-rust/core-api-server/src/core_api/conversions/substates/access_controller.rs +++ b/core-rust/core-api-server/src/core_api/conversions/substates/access_controller.rs @@ -1,10 +1,7 @@ use super::super::*; use super::*; use crate::core_api::models; - -use radix_engine::types::*; -use radix_engine_interface::blueprints::access_controller::{RecoveryProposal, RuleSet}; -use radix_engine_queries::typed_substate_layout::*; +use crate::engine_prelude::*; pub fn to_api_access_controller_substate( context: &MappingContext, diff --git a/core-rust/core-api-server/src/core_api/conversions/substates/access_rules_module.rs b/core-rust/core-api-server/src/core_api/conversions/substates/access_rules_module.rs index a51b7c1c6f..fba157124a 100644 --- a/core-rust/core-api-server/src/core_api/conversions/substates/access_rules_module.rs +++ b/core-rust/core-api-server/src/core_api/conversions/substates/access_rules_module.rs @@ -1,10 +1,7 @@ use super::super::*; use super::*; use crate::core_api::models; -use radix_engine::system::system_substates::KeyValueEntrySubstate; - -use radix_engine::types::*; -use radix_engine_queries::typed_substate_layout::*; +use crate::engine_prelude::*; pub fn to_api_owner_role_substate( context: &MappingContext, diff --git a/core-rust/core-api-server/src/core_api/conversions/substates/account.rs b/core-rust/core-api-server/src/core_api/conversions/substates/account.rs index bcec302d9a..6f0db9ae64 100644 --- a/core-rust/core-api-server/src/core_api/conversions/substates/account.rs +++ b/core-rust/core-api-server/src/core_api/conversions/substates/account.rs @@ -1,16 +1,7 @@ use super::super::*; use super::*; use crate::core_api::models; -use radix_engine::blueprints::account::{ - AccountAuthorizedDepositorEntrySubstate, AccountAuthorizedDepositorKeyPayload, - AccountDepositRuleFieldSubstate, AccountResourcePreferenceEntrySubstate, - AccountResourcePreferenceKeyPayload, AccountResourceVaultEntrySubstate, - AccountResourceVaultKeyPayload, AccountSubstate, AccountTypedSubstateKey, -}; - -use radix_engine::types::*; -use radix_engine_interface::blueprints::account::*; -use radix_engine_queries::typed_substate_layout::*; +use crate::engine_prelude::*; pub fn to_api_account_state_substate( _context: &MappingContext, diff --git a/core-rust/core-api-server/src/core_api/conversions/substates/consensus_manager.rs b/core-rust/core-api-server/src/core_api/conversions/substates/consensus_manager.rs index 8ba7ce8102..17fa0515b4 100644 --- a/core-rust/core-api-server/src/core_api/conversions/substates/consensus_manager.rs +++ b/core-rust/core-api-server/src/core_api/conversions/substates/consensus_manager.rs @@ -1,12 +1,7 @@ -use radix_engine::blueprints::models::SortedIndexKeyPayload; - use super::super::*; use super::*; use crate::core_api::models; -use radix_engine_interface::blueprints::consensus_manager::*; - -use radix_engine::types::*; -use radix_engine_queries::typed_substate_layout::*; +use crate::engine_prelude::*; pub fn to_api_registered_validators_by_stake_index_entry_substate( context: &MappingContext, diff --git a/core-rust/core-api-server/src/core_api/conversions/substates/generic.rs b/core-rust/core-api-server/src/core_api/conversions/substates/generic.rs index 8f59f8f0ff..595f41240c 100644 --- a/core-rust/core-api-server/src/core_api/conversions/substates/generic.rs +++ b/core-rust/core-api-server/src/core_api/conversions/substates/generic.rs @@ -1,10 +1,7 @@ use super::super::*; use super::*; use crate::core_api::models; -use radix_engine::system::system_substates::{FieldSubstate, KeyValueEntrySubstate}; - -use radix_engine::types::*; -use radix_engine_queries::typed_substate_layout::*; +use crate::engine_prelude::*; pub fn to_api_generic_scrypto_component_state_substate( context: &MappingContext, diff --git a/core-rust/core-api-server/src/core_api/conversions/substates/metadata_module.rs b/core-rust/core-api-server/src/core_api/conversions/substates/metadata_module.rs index d1b580965e..8c2be435f5 100644 --- a/core-rust/core-api-server/src/core_api/conversions/substates/metadata_module.rs +++ b/core-rust/core-api-server/src/core_api/conversions/substates/metadata_module.rs @@ -1,9 +1,7 @@ use super::super::*; use super::*; use crate::core_api::models; - -use radix_engine::types::*; -use radix_engine_queries::typed_substate_layout::*; +use crate::engine_prelude::*; pub fn to_api_metadata_value_substate( context: &MappingContext, diff --git a/core-rust/core-api-server/src/core_api/conversions/substates/mod.rs b/core-rust/core-api-server/src/core_api/conversions/substates/mod.rs index b85fe17e53..7090f53c3c 100644 --- a/core-rust/core-api-server/src/core_api/conversions/substates/mod.rs +++ b/core-rust/core-api-server/src/core_api/conversions/substates/mod.rs @@ -31,7 +31,7 @@ pub use type_info_module::*; //==================================== use super::MappingError; -use radix_engine::system::system_substates::{KeyValueEntrySubstate, LockStatus}; +use crate::engine_prelude::*; macro_rules! assert_key_type { ( diff --git a/core-rust/core-api-server/src/core_api/conversions/substates/package.rs b/core-rust/core-api-server/src/core_api/conversions/substates/package.rs index afb593a38e..6c29516817 100644 --- a/core-rust/core-api-server/src/core_api/conversions/substates/package.rs +++ b/core-rust/core-api-server/src/core_api/conversions/substates/package.rs @@ -1,11 +1,7 @@ use super::super::*; use super::*; use crate::core_api::models; -use radix_engine::system::system_substates::KeyValueEntrySubstate; -use radix_engine::transaction::PackageTypeReference; - -use radix_engine::types::*; -use radix_engine_queries::typed_substate_layout::*; +use crate::engine_prelude::*; pub fn to_api_package_royalty_accumulator_substate( context: &MappingContext, diff --git a/core-rust/core-api-server/src/core_api/conversions/substates/pools.rs b/core-rust/core-api-server/src/core_api/conversions/substates/pools.rs index 6d3b51c9d4..efaa14e274 100644 --- a/core-rust/core-api-server/src/core_api/conversions/substates/pools.rs +++ b/core-rust/core-api-server/src/core_api/conversions/substates/pools.rs @@ -1,17 +1,7 @@ use super::super::*; use super::*; use crate::core_api::models; -use radix_engine::blueprints::pool::v1::substates::multi_resource_pool::{ - MultiResourcePoolState, MultiResourcePoolStateFieldSubstate, -}; -use radix_engine::blueprints::pool::v1::substates::one_resource_pool::{ - OneResourcePoolState, OneResourcePoolStateFieldSubstate, -}; -use radix_engine::blueprints::pool::v1::substates::two_resource_pool::{ - TwoResourcePoolState, TwoResourcePoolStateFieldSubstate, -}; - -use radix_engine::types::*; +use crate::engine_prelude::*; pub fn to_api_one_resource_pool_substate( context: &MappingContext, diff --git a/core-rust/core-api-server/src/core_api/conversions/substates/resource.rs b/core-rust/core-api-server/src/core_api/conversions/substates/resource.rs index e3c6d188a0..c81c3c4dda 100644 --- a/core-rust/core-api-server/src/core_api/conversions/substates/resource.rs +++ b/core-rust/core-api-server/src/core_api/conversions/substates/resource.rs @@ -1,9 +1,7 @@ use super::super::*; use super::*; use crate::core_api::models; - -use radix_engine::types::*; -use radix_engine_queries::typed_substate_layout::*; +use crate::engine_prelude::*; pub fn to_api_fungible_vault_balance_substate( _context: &MappingContext, diff --git a/core-rust/core-api-server/src/core_api/conversions/substates/royalty_module.rs b/core-rust/core-api-server/src/core_api/conversions/substates/royalty_module.rs index 58ff45bdc0..bc76b4688f 100644 --- a/core-rust/core-api-server/src/core_api/conversions/substates/royalty_module.rs +++ b/core-rust/core-api-server/src/core_api/conversions/substates/royalty_module.rs @@ -1,9 +1,7 @@ use super::super::*; use super::*; use crate::core_api::models; - -use radix_engine::types::*; -use radix_engine_queries::typed_substate_layout::*; +use crate::engine_prelude::*; pub fn to_api_component_royalty_substate( context: &MappingContext, diff --git a/core-rust/core-api-server/src/core_api/conversions/substates/substate.rs b/core-rust/core-api-server/src/core_api/conversions/substates/substate.rs index c4e0331652..43d52ac7f2 100644 --- a/core-rust/core-api-server/src/core_api/conversions/substates/substate.rs +++ b/core-rust/core-api-server/src/core_api/conversions/substates/substate.rs @@ -1,24 +1,8 @@ use super::super::*; +use super::*; use crate::core_api::models; -use radix_engine::blueprints::account::{ - AccountTypedFieldSubstateValue, AccountTypedSubstateValue, -}; -use radix_engine::blueprints::pool::v1::substates::multi_resource_pool::{ - MultiResourcePoolTypedFieldSubstateValue, MultiResourcePoolTypedSubstateValue, -}; -use radix_engine::blueprints::pool::v1::substates::one_resource_pool::{ - OneResourcePoolTypedFieldSubstateValue, OneResourcePoolTypedSubstateValue, -}; -use radix_engine::blueprints::pool::v1::substates::two_resource_pool::{ - TwoResourcePoolTypedFieldSubstateValue, TwoResourcePoolTypedSubstateValue, -}; - -use radix_engine::types::*; -use radix_engine_queries::typed_substate_layout::*; - -use super::super::MappingError; -use super::*; +use crate::engine_prelude::*; pub fn to_api_substate( context: &MappingContext, diff --git a/core-rust/core-api-server/src/core_api/conversions/substates/transaction_tracker.rs b/core-rust/core-api-server/src/core_api/conversions/substates/transaction_tracker.rs index b5e5f7ca3e..71effdc48a 100644 --- a/core-rust/core-api-server/src/core_api/conversions/substates/transaction_tracker.rs +++ b/core-rust/core-api-server/src/core_api/conversions/substates/transaction_tracker.rs @@ -1,10 +1,7 @@ use super::super::*; use super::*; use crate::core_api::models; -use radix_engine::system::system_substates::{FieldSubstate, KeyValueEntrySubstate}; - -use radix_engine::types::*; -use radix_engine_queries::typed_substate_layout::*; +use crate::engine_prelude::*; pub fn to_api_transaction_tracker_substate( context: &MappingContext, diff --git a/core-rust/core-api-server/src/core_api/conversions/substates/type_info_module.rs b/core-rust/core-api-server/src/core_api/conversions/substates/type_info_module.rs index 69fda0f0ff..605b1e19a5 100644 --- a/core-rust/core-api-server/src/core_api/conversions/substates/type_info_module.rs +++ b/core-rust/core-api-server/src/core_api/conversions/substates/type_info_module.rs @@ -2,9 +2,7 @@ use super::super::*; use super::*; use crate::core_api::models; -use radix_engine::types::*; -use radix_engine::vm::VmBoot; -use radix_engine_queries::typed_substate_layout::*; +use crate::engine_prelude::*; pub fn to_api_vm_boot_substate( _context: &MappingContext, diff --git a/core-rust/core-api-server/src/core_api/errors.rs b/core-rust/core-api-server/src/core_api/errors.rs index 4deba49e2d..5be3348f72 100644 --- a/core-rust/core-api-server/src/core_api/errors.rs +++ b/core-rust/core-api-server/src/core_api/errors.rs @@ -6,8 +6,8 @@ use axum::{ use models::stream_proofs_error_details::StreamProofsErrorDetails; use std::any::Any; +use crate::engine_prelude::*; use hyper::StatusCode; -use radix_engine_interface::network::NetworkDefinition; use tower_http::catch_panic::ResponseForPanic; use super::{models, CoreApiState}; diff --git a/core-rust/core-api-server/src/core_api/handlers/lts/state_account_all_fungible_resource_balances.rs b/core-rust/core-api-server/src/core_api/handlers/lts/state_account_all_fungible_resource_balances.rs index 455e96f278..5771cb49d5 100644 --- a/core-rust/core-api-server/src/core_api/handlers/lts/state_account_all_fungible_resource_balances.rs +++ b/core-rust/core-api-server/src/core_api/handlers/lts/state_account_all_fungible_resource_balances.rs @@ -1,6 +1,6 @@ use crate::core_api::*; -use radix_engine::types::*; -use radix_engine_queries::typed_substate_layout::*; +use crate::engine_prelude::*; + use state_manager::query::{dump_component_state, VaultData}; use std::ops::Deref; diff --git a/core-rust/core-api-server/src/core_api/handlers/lts/state_account_deposit_behaviour.rs b/core-rust/core-api-server/src/core_api/handlers/lts/state_account_deposit_behaviour.rs index 145d163a52..a1351fc930 100644 --- a/core-rust/core-api-server/src/core_api/handlers/lts/state_account_deposit_behaviour.rs +++ b/core-rust/core-api-server/src/core_api/handlers/lts/state_account_deposit_behaviour.rs @@ -1,16 +1,10 @@ use crate::core_api::*; -use radix_engine::blueprints::account::{ - AccountAuthorizedDepositorEntryPayload, AccountCollection, AccountDepositRuleFieldSubstate, - AccountField, AccountResourcePreference, AccountResourcePreferenceEntryPayload, - AccountResourcePreferenceV1, AccountResourceVaultEntryPayload, -}; -use radix_engine::types::*; +use crate::engine_prelude::*; use state_manager::LedgerHeader; use std::ops::Deref; use node_common::utils::IsAccountExt; -use radix_engine_interface::blueprints::account::{DefaultDepositRule, ResourcePreference}; /// Maximum number of resource addresses allowed in the request. /// Must be aligned with the `maxItems` in the API documentation. diff --git a/core-rust/core-api-server/src/core_api/handlers/lts/state_account_resource_balance.rs b/core-rust/core-api-server/src/core_api/handlers/lts/state_account_resource_balance.rs index ba6fb414dd..0e5e800494 100644 --- a/core-rust/core-api-server/src/core_api/handlers/lts/state_account_resource_balance.rs +++ b/core-rust/core-api-server/src/core_api/handlers/lts/state_account_resource_balance.rs @@ -1,7 +1,5 @@ use crate::core_api::*; -use radix_engine::blueprints::account::{AccountCollection, AccountResourceVaultEntryPayload}; -use radix_engine::types::*; -use radix_engine_queries::typed_substate_layout::*; +use crate::engine_prelude::*; use state_manager::LedgerHeader; use std::ops::Deref; diff --git a/core-rust/core-api-server/src/core_api/handlers/lts/transaction_construction.rs b/core-rust/core-api-server/src/core_api/handlers/lts/transaction_construction.rs index 121200d2bb..f89e191e29 100644 --- a/core-rust/core-api-server/src/core_api/handlers/lts/transaction_construction.rs +++ b/core-rust/core-api-server/src/core_api/handlers/lts/transaction_construction.rs @@ -1,6 +1,6 @@ use crate::core_api::*; -use radix_engine::types::*; -use radix_engine_queries::typed_substate_layout::*; +use crate::engine_prelude::*; + use std::ops::Deref; #[tracing::instrument(skip(state))] diff --git a/core-rust/core-api-server/src/core_api/handlers/lts/transaction_status.rs b/core-rust/core-api-server/src/core_api/handlers/lts/transaction_status.rs index 917b72dc34..9dc0d95ca3 100644 --- a/core-rust/core-api-server/src/core_api/handlers/lts/transaction_status.rs +++ b/core-rust/core-api-server/src/core_api/handlers/lts/transaction_status.rs @@ -1,15 +1,15 @@ use std::collections::{HashMap, HashSet}; use crate::core_api::*; +use crate::engine_prelude::*; use state_manager::{ - AlreadyCommittedError, DetailedTransactionOutcome, RejectionReason, StateVersion, + AlreadyCommittedError, DetailedTransactionOutcome, MempoolRejectionReason, StateVersion, }; use state_manager::mempool::pending_transaction_result_cache::PendingTransactionRecord; use state_manager::query::StateManagerSubstateQueries; use state_manager::store::traits::*; -use transaction::prelude::*; #[tracing::instrument(skip(state))] pub(crate) async fn handle_lts_transaction_status( @@ -223,7 +223,7 @@ fn map_rejected_payloads_due_to_known_commit( // commit, and we may see a "not-yet-updated" entry - luckily, in such case, we can // precisely tell the transaction's status ourselves: .unwrap_or_else(|| { - RejectionReason::AlreadyCommitted(AlreadyCommittedError { + MempoolRejectionReason::AlreadyCommitted(AlreadyCommittedError { notarized_transaction_hash, committed_state_version, committed_notarized_transaction_hash: *committed_notarized_transaction_hash, diff --git a/core-rust/core-api-server/src/core_api/handlers/lts/transaction_submit.rs b/core-rust/core-api-server/src/core_api/handlers/lts/transaction_submit.rs index 0b6c15ff46..14e5ba1e1a 100644 --- a/core-rust/core-api-server/src/core_api/handlers/lts/transaction_submit.rs +++ b/core-rust/core-api-server/src/core_api/handlers/lts/transaction_submit.rs @@ -1,10 +1,10 @@ use crate::core_api::*; +use crate::engine_prelude::*; use crate::core_api::handlers::to_api_committed_intent_metadata; use hyper::StatusCode; use models::lts_transaction_submit_error_details::LtsTransactionSubmitErrorDetails; use state_manager::{MempoolAddError, MempoolAddSource}; -use transaction::prelude::RawNotarizedTransaction; #[tracing::instrument(level = "debug", skip(state))] pub(crate) async fn handle_lts_transaction_submit( diff --git a/core-rust/core-api-server/src/core_api/handlers/state_access_controller.rs b/core-rust/core-api-server/src/core_api/handlers/state_access_controller.rs index f0fa60f182..522de04942 100644 --- a/core-rust/core-api-server/src/core_api/handlers/state_access_controller.rs +++ b/core-rust/core-api-server/src/core_api/handlers/state_access_controller.rs @@ -1,8 +1,7 @@ use crate::core_api::*; -use radix_engine::blueprints::access_controller::AccessControllerField; -use radix_engine::system::attached_modules::role_assignment::RoleAssignmentField; -use radix_engine::types::*; +use crate::engine_prelude::*; + use state_manager::query::dump_component_state; use std::ops::Deref; diff --git a/core-rust/core-api-server/src/core_api/handlers/state_account.rs b/core-rust/core-api-server/src/core_api/handlers/state_account.rs index f197f2e375..ff69c3ea0a 100644 --- a/core-rust/core-api-server/src/core_api/handlers/state_account.rs +++ b/core-rust/core-api-server/src/core_api/handlers/state_account.rs @@ -1,7 +1,6 @@ use crate::core_api::*; -use radix_engine::blueprints::account::AccountField; -use radix_engine::system::attached_modules::role_assignment::RoleAssignmentField; -use radix_engine::types::*; +use crate::engine_prelude::*; + use state_manager::query::{dump_component_state, VaultData}; use std::ops::Deref; diff --git a/core-rust/core-api-server/src/core_api/handlers/state_component.rs b/core-rust/core-api-server/src/core_api/handlers/state_component.rs index d3a635c118..45ebf8b15a 100644 --- a/core-rust/core-api-server/src/core_api/handlers/state_component.rs +++ b/core-rust/core-api-server/src/core_api/handlers/state_component.rs @@ -1,7 +1,6 @@ use crate::core_api::*; -use radix_engine::types::*; -use radix_engine_queries::typed_substate_layout::*; -use radix_engine_store_interface::db_key_mapper::{DatabaseKeyMapper, SpreadPrefixKeyMapper}; +use crate::engine_prelude::*; + use state_manager::query::{dump_component_state, ComponentStateDump, DescendantParentOpt}; use std::ops::Deref; diff --git a/core-rust/core-api-server/src/core_api/handlers/state_consensus_manager.rs b/core-rust/core-api-server/src/core_api/handlers/state_consensus_manager.rs index b7b6682635..830bd09bf2 100644 --- a/core-rust/core-api-server/src/core_api/handlers/state_consensus_manager.rs +++ b/core-rust/core-api-server/src/core_api/handlers/state_consensus_manager.rs @@ -1,6 +1,5 @@ use crate::core_api::*; -use radix_engine::blueprints::consensus_manager::*; -use radix_engine::types::*; +use crate::engine_prelude::*; use state_manager::protocol::ProtocolVersionName; use state_manager::StateManagerDatabase; diff --git a/core-rust/core-api-server/src/core_api/handlers/state_non_fungible.rs b/core-rust/core-api-server/src/core_api/handlers/state_non_fungible.rs index 745dd110bc..e657e46d0c 100644 --- a/core-rust/core-api-server/src/core_api/handlers/state_non_fungible.rs +++ b/core-rust/core-api-server/src/core_api/handlers/state_non_fungible.rs @@ -1,11 +1,8 @@ -use radix_engine::blueprints::resource::*; -use radix_engine::types::*; -use radix_engine_queries::typed_substate_layout::{TypedMainModuleSubstateKey, TypedSubstateKey}; +use crate::engine_prelude::*; use std::ops::Deref; use crate::core_api::*; -use radix_engine_common::types::SubstateKey; use crate::core_api::models::StateNonFungibleResponse; diff --git a/core-rust/core-api-server/src/core_api/handlers/state_package.rs b/core-rust/core-api-server/src/core_api/handlers/state_package.rs index a967678f62..75389a3d8c 100644 --- a/core-rust/core-api-server/src/core_api/handlers/state_package.rs +++ b/core-rust/core-api-server/src/core_api/handlers/state_package.rs @@ -1,7 +1,5 @@ use crate::core_api::*; -use radix_engine::blueprints::package::PackageField; -use radix_engine::system::attached_modules::role_assignment::RoleAssignmentField; -use radix_engine::types::*; +use crate::engine_prelude::*; use std::ops::Deref; diff --git a/core-rust/core-api-server/src/core_api/handlers/state_resource.rs b/core-rust/core-api-server/src/core_api/handlers/state_resource.rs index 6b5f2b27a7..6a3662a118 100644 --- a/core-rust/core-api-server/src/core_api/handlers/state_resource.rs +++ b/core-rust/core-api-server/src/core_api/handlers/state_resource.rs @@ -1,12 +1,8 @@ use crate::core_api::*; - -use radix_engine::types::*; -use radix_engine_queries::typed_substate_layout::*; +use crate::engine_prelude::*; use std::ops::Deref; -use radix_engine_common::types::EntityType; - enum ManagerByType { Fungible( FungibleResourceManagerDivisibilityFieldSubstate, diff --git a/core-rust/core-api-server/src/core_api/handlers/state_validator.rs b/core-rust/core-api-server/src/core_api/handlers/state_validator.rs index 3e595ecf85..69dd1caaa1 100644 --- a/core-rust/core-api-server/src/core_api/handlers/state_validator.rs +++ b/core-rust/core-api-server/src/core_api/handlers/state_validator.rs @@ -1,8 +1,6 @@ use crate::core_api::*; -use radix_engine::types::*; +use crate::engine_prelude::*; -use radix_engine::blueprints::consensus_manager::ValidatorField; -use radix_engine::system::attached_modules::role_assignment::RoleAssignmentField; use state_manager::query::dump_component_state; use std::ops::Deref; diff --git a/core-rust/core-api-server/src/core_api/handlers/status_network_configuration.rs b/core-rust/core-api-server/src/core_api/handlers/status_network_configuration.rs index bf721293b8..8d0e3a0afa 100644 --- a/core-rust/core-api-server/src/core_api/handlers/status_network_configuration.rs +++ b/core-rust/core-api-server/src/core_api/handlers/status_network_configuration.rs @@ -1,7 +1,5 @@ use crate::core_api::*; -use radix_engine::types::*; -use radix_engine_common::types::EntityType; -use radix_engine_interface::address::HrpSet; +use crate::engine_prelude::*; #[tracing::instrument(skip(state))] pub(crate) async fn handle_status_network_configuration( diff --git a/core-rust/core-api-server/src/core_api/handlers/status_network_status.rs b/core-rust/core-api-server/src/core_api/handlers/status_network_status.rs index 8a36af653a..c6b2d86050 100644 --- a/core-rust/core-api-server/src/core_api/handlers/status_network_status.rs +++ b/core-rust/core-api-server/src/core_api/handlers/status_network_status.rs @@ -1,6 +1,6 @@ use crate::core_api::*; -use radix_engine_interface::prelude::*; +use crate::engine_prelude::*; use state_manager::query::TransactionIdentifierLoader; use state_manager::store::traits::*; diff --git a/core-rust/core-api-server/src/core_api/handlers/status_scenarios.rs b/core-rust/core-api-server/src/core_api/handlers/status_scenarios.rs index 02985bf0fd..6fc6bfdd54 100644 --- a/core-rust/core-api-server/src/core_api/handlers/status_scenarios.rs +++ b/core-rust/core-api-server/src/core_api/handlers/status_scenarios.rs @@ -1,6 +1,6 @@ use crate::core_api::*; -use radix_engine_interface::prelude::*; +use crate::engine_prelude::*; use state_manager::store::traits::scenario::{ ExecutedGenesisScenario, ExecutedGenesisScenarioStore, ExecutedScenarioTransaction, diff --git a/core-rust/core-api-server/src/core_api/handlers/stream_proofs.rs b/core-rust/core-api-server/src/core_api/handlers/stream_proofs.rs index 2b04f326df..02245004c7 100644 --- a/core-rust/core-api-server/src/core_api/handlers/stream_proofs.rs +++ b/core-rust/core-api-server/src/core_api/handlers/stream_proofs.rs @@ -1,10 +1,8 @@ use crate::core_api::*; - +use crate::engine_prelude::*; use state_manager::store::{traits::*, StateManagerDatabase}; use state_manager::{LedgerProof, LedgerProofOrigin, StateVersion}; -use transaction::prelude::*; - #[tracing::instrument(skip(state))] pub(crate) async fn handle_stream_proofs( state: State, diff --git a/core-rust/core-api-server/src/core_api/handlers/stream_transactions.rs b/core-rust/core-api-server/src/core_api/handlers/stream_transactions.rs index 8f7485c503..5c8beb3b9f 100644 --- a/core-rust/core-api-server/src/core_api/handlers/stream_transactions.rs +++ b/core-rust/core-api-server/src/core_api/handlers/stream_transactions.rs @@ -1,13 +1,9 @@ -use radix_engine::track::{ - BatchPartitionStateUpdate, NodeStateUpdates, PartitionStateUpdates, StateUpdates, -}; +use crate::engine_prelude::*; + use std::iter; use crate::core_api::*; -use radix_engine::types::hash; -use radix_engine_store_interface::interface::{DatabaseUpdate, DbSubstateValue}; - use state_manager::store::{traits::*, StateManagerDatabase}; use state_manager::transaction::*; use state_manager::{ @@ -15,9 +11,6 @@ use state_manager::{ LocalTransactionReceipt, StateVersion, }; -use transaction::manifest; -use transaction::prelude::*; - use super::to_api_committed_state_identifiers; #[tracing::instrument(skip(state))] diff --git a/core-rust/core-api-server/src/core_api/handlers/transaction_callpreview.rs b/core-rust/core-api-server/src/core_api/handlers/transaction_callpreview.rs index a239e66040..800d794cb6 100644 --- a/core-rust/core-api-server/src/core_api/handlers/transaction_callpreview.rs +++ b/core-rust/core-api-server/src/core_api/handlers/transaction_callpreview.rs @@ -1,29 +1,15 @@ use crate::core_api::*; -use models::{ - target_identifier::TargetIdentifier, - transaction_call_preview_response::TransactionCallPreviewResponse, - transaction_status::TransactionStatus, -}; -use radix_engine::{ - transaction::{PreviewError, TransactionOutcome, TransactionResult}, - types::Decimal, -}; +use crate::engine_prelude::*; -use radix_engine_interface::constants::FAUCET; -use radix_engine_interface::manifest_args; -use radix_engine_interface::{ - blueprints::transaction_processor::InstructionOutput, data::scrypto::scrypto_encode, -}; use state_manager::PreviewRequest; -use transaction::prelude::*; macro_rules! args_from_bytes_vec { ($args: expr) => {{ let mut fields = Vec::new(); for arg in $args { - fields.push(::radix_engine::types::manifest_decode(&arg).unwrap()); + fields.push(crate::engine_prelude::manifest_decode(&arg).unwrap()); } - ::radix_engine::types::ManifestValue::Tuple { fields } + crate::engine_prelude::ManifestValue::Tuple { fields } }}; } @@ -47,7 +33,7 @@ pub(crate) async fn handle_transaction_callpreview( .ok_or_else(|| client_error("Missing target from request".to_string()))?; let requested_call = match call_target { - TargetIdentifier::BlueprintFunctionTargetIdentifier { + models::TargetIdentifier::BlueprintFunctionTargetIdentifier { package_address, blueprint_name, function_name, @@ -63,7 +49,7 @@ pub(crate) async fn handle_transaction_callpreview( args: args_from_bytes_vec!(args), } } - TargetIdentifier::ComponentMethodTargetIdentifier { + models::TargetIdentifier::ComponentMethodTargetIdentifier { component_address, method_name, } => { @@ -93,7 +79,7 @@ pub(crate) async fn handle_transaction_callpreview( }, requested_call, ], - blobs: btreemap!(), + blobs: index_map_new(), }, explicit_epoch_range: None, notary_public_key: None, @@ -136,15 +122,19 @@ pub(crate) async fn handle_transaction_callpreview( Some(Err(err)) => Err(server_error(format!("{err:?}")))?, }; - (TransactionStatus::Succeeded, output, None) - } - TransactionOutcome::Failure(f) => { - (TransactionStatus::Failed, None, Some(format!("{f:?}"))) + (models::TransactionStatus::Succeeded, output, None) } + TransactionOutcome::Failure(f) => ( + models::TransactionStatus::Failed, + None, + Some(format!("{f:?}")), + ), }, - TransactionResult::Reject(r) => { - (TransactionStatus::Rejected, None, Some(format!("{r:?}"))) - } + TransactionResult::Reject(r) => ( + models::TransactionStatus::Rejected, + None, + Some(format!("{r:?}")), + ), TransactionResult::Abort(_) => { // TODO: Should remove this panic!("Should not be aborting"); @@ -152,7 +142,7 @@ pub(crate) async fn handle_transaction_callpreview( } }; - Ok(Json(TransactionCallPreviewResponse { + Ok(Json(models::TransactionCallPreviewResponse { at_ledger_state: Box::new(to_api_ledger_state_summary( &mapping_context, &result.base_ledger_header, diff --git a/core-rust/core-api-server/src/core_api/handlers/transaction_parse.rs b/core-rust/core-api-server/src/core_api/handlers/transaction_parse.rs index 3686f6cb23..0dcb1d1b83 100644 --- a/core-rust/core-api-server/src/core_api/handlers/transaction_parse.rs +++ b/core-rust/core-api-server/src/core_api/handlers/transaction_parse.rs @@ -1,18 +1,15 @@ use crate::core_api::*; use std::ops::Deref; use std::time::SystemTime; -use transaction::validation::{ - NotarizedTransactionValidator, TransactionValidator, ValidationConfig, -}; use models::transaction_parse_request::{ParseMode, ResponseMode, ValidationMode}; use models::transaction_parse_response::TransactionParseResponse; -use state_manager::mempool::pending_transaction_result_cache::RejectionReason; +use state_manager::mempool::pending_transaction_result_cache::MempoolRejectionReason; use state_manager::transaction::*; +use crate::engine_prelude::*; use state_manager::store::StateManagerDatabase; -use transaction::prelude::*; use super::{ to_api_intent, to_api_ledger_transaction, to_api_notarized_transaction, to_api_signed_intent, @@ -116,7 +113,7 @@ fn attempt_parsing_as_any_payload_type_and_map_for_api( struct ParsedNotarizedTransactionV1 { model: NotarizedTransactionV1, prepared: PreparedNotarizedTransactionV1, - validation: Option>, + validation: Option>, } fn attempt_parsing_as_notarized_transaction( @@ -147,7 +144,7 @@ fn attempt_parsing_as_notarized_transaction( .user_transaction_validator .validate(prepared.clone()) .map(|_| ()) - .map_err(RejectionReason::ValidationError), + .map_err(MempoolRejectionReason::ValidationError), ); ParsedNotarizedTransactionV1 { model, @@ -160,7 +157,7 @@ fn attempt_parsing_as_notarized_transaction( context .user_transaction_validator .validate(prepared.clone()) - .map_err(RejectionReason::ValidationError) + .map_err(MempoolRejectionReason::ValidationError) .and_then(|validated| { let rejection = context .committability_validator diff --git a/core-rust/core-api-server/src/core_api/handlers/transaction_preview.rs b/core-rust/core-api-server/src/core_api/handlers/transaction_preview.rs index 6dbd291ca4..fd0ffda0b6 100644 --- a/core-rust/core-api-server/src/core_api/handlers/transaction_preview.rs +++ b/core-rust/core-api-server/src/core_api/handlers/transaction_preview.rs @@ -1,18 +1,10 @@ use crate::core_api::*; -use radix_engine::prelude::*; -use radix_engine::transaction::*; +use crate::engine_prelude::*; + use std::ops::Range; use state_manager::transaction::ProcessedPreviewResult; use state_manager::{ExecutionFeeData, LocalTransactionReceipt, PreviewRequest}; -use transaction::manifest; -use transaction::manifest::BlobProvider; -use transaction::model::{ - AesGcmPayload, AesWrapped128BitKey, DecryptorsByCurve, EncryptedMessageV1, MessageV1, - PlaintextMessageV1, PreviewFlags, PublicKeyFingerprint, -}; -use transaction::prelude::MessageContentsV1; -use utils::copy_u8_array; pub(crate) async fn handle_transaction_preview( state: State, diff --git a/core-rust/core-api-server/src/core_api/handlers/transaction_status.rs b/core-rust/core-api-server/src/core_api/handlers/transaction_status.rs index 6067edb5a9..6a19ac874d 100644 --- a/core-rust/core-api-server/src/core_api/handlers/transaction_status.rs +++ b/core-rust/core-api-server/src/core_api/handlers/transaction_status.rs @@ -1,15 +1,15 @@ use std::collections::{HashMap, HashSet}; use crate::core_api::*; +use crate::engine_prelude::*; use state_manager::{ - AlreadyCommittedError, DetailedTransactionOutcome, RejectionReason, StateVersion, + AlreadyCommittedError, DetailedTransactionOutcome, MempoolRejectionReason, StateVersion, }; use state_manager::mempool::pending_transaction_result_cache::PendingTransactionRecord; use state_manager::query::StateManagerSubstateQueries; use state_manager::store::traits::*; -use transaction::prelude::*; #[tracing::instrument(skip(state))] pub(crate) async fn handle_transaction_status( @@ -223,7 +223,7 @@ fn map_rejected_payloads_due_to_known_commit( // commit, and we may see a "not-yet-updated" entry - luckily, in such case, we can // precisely tell the transaction's status ourselves: .unwrap_or_else(|| { - RejectionReason::AlreadyCommitted(AlreadyCommittedError { + MempoolRejectionReason::AlreadyCommitted(AlreadyCommittedError { notarized_transaction_hash, committed_state_version, committed_notarized_transaction_hash: *committed_notarized_transaction_hash, diff --git a/core-rust/core-api-server/src/core_api/handlers/transaction_submit.rs b/core-rust/core-api-server/src/core_api/handlers/transaction_submit.rs index 00a0f93bd9..c557a9a680 100644 --- a/core-rust/core-api-server/src/core_api/handlers/transaction_submit.rs +++ b/core-rust/core-api-server/src/core_api/handlers/transaction_submit.rs @@ -1,9 +1,9 @@ use crate::core_api::*; +use crate::engine_prelude::*; use hyper::StatusCode; use models::transaction_submit_error_details::TransactionSubmitErrorDetails; use state_manager::{AlreadyCommittedError, MempoolAddError, MempoolAddSource}; -use transaction::prelude::*; #[tracing::instrument(level = "debug", skip(state))] pub(crate) async fn handle_transaction_submit( diff --git a/core-rust/core-api-server/src/core_api/helpers.rs b/core-rust/core-api-server/src/core_api/helpers.rs index 26d6a49d12..bdc9238ecc 100644 --- a/core-rust/core-api-server/src/core_api/helpers.rs +++ b/core-rust/core-api-server/src/core_api/helpers.rs @@ -1,8 +1,4 @@ -use radix_engine::types::*; - -use radix_engine::system::system_substates::{FieldSubstate, KeyValueEntrySubstate}; -use radix_engine_interface::api::CollectionIndex; -use radix_engine_store_interface::{db_key_mapper::*, interface::SubstateDatabase}; +use crate::engine_prelude::*; use serde::Serialize; use state_manager::store::traits::*; use state_manager::store::StateManagerDatabase; diff --git a/core-rust/core-api-server/src/core_api/server.rs b/core-rust/core-api-server/src/core_api/server.rs index 425b3ca1a9..17c71e73e6 100644 --- a/core-rust/core-api-server/src/core_api/server.rs +++ b/core-rust/core-api-server/src/core_api/server.rs @@ -77,9 +77,8 @@ use axum::{ Router, }; +use crate::engine_prelude::*; use prometheus::Registry; -use radix_engine_common::network::NetworkDefinition; -use radix_engine_common::ScryptoSbor; use state_manager::StateManager; use tower_http::catch_panic::CatchPanicLayer; use tracing::{debug, error, info, trace, warn, Level}; diff --git a/core-rust/core-api-server/src/jni/mod.rs b/core-rust/core-api-server/src/jni/mod.rs index 3b5b450e6d..4c83711c89 100644 --- a/core-rust/core-api-server/src/jni/mod.rs +++ b/core-rust/core-api-server/src/jni/mod.rs @@ -63,20 +63,20 @@ */ use crate::core_api::{create_server, CoreApiServerConfig, CoreApiState}; +use crate::engine_prelude::*; use futures::channel::oneshot; use futures::channel::oneshot::Sender; use futures::FutureExt; use jni::objects::{JClass, JObject}; use jni::sys::jbyteArray; use jni::JNIEnv; +use node_common::java::*; use prometheus::*; use state_manager::jni::node_rust_environment::JNINodeRustEnvironment; use std::str; use std::sync::{Arc, MutexGuard}; use tokio::runtime::Runtime; -use node_common::java::*; - const POINTER_JNI_FIELD_NAME: &str = "rustCoreApiServerPointer"; pub struct RunningServer { diff --git a/core-rust/core-api-server/src/lib.rs b/core-rust/core-api-server/src/lib.rs index dadec04605..08ce258ac4 100644 --- a/core-rust/core-api-server/src/lib.rs +++ b/core-rust/core-api-server/src/lib.rs @@ -67,3 +67,38 @@ extern crate serde_json; mod core_api; pub mod jni; + +pub(crate) mod engine_prelude { + pub use blueprint_schema_init::*; + pub use radix_engine::blueprints::account::*; + pub use radix_engine::blueprints::models::*; + pub use radix_engine::blueprints::transaction_tracker::*; + pub use radix_engine::object_modules::metadata::*; + pub use radix_engine::system::system_modules::costing::*; + pub use radix_engine::system::system_substates::*; + pub use radix_engine::transaction::*; + pub use radix_engine::vm::*; + pub use radix_engine_common::prelude::*; + pub use radix_engine_interface::blueprints::access_controller::*; + pub use radix_engine_interface::blueprints::account::*; + pub use radix_engine_interface::blueprints::transaction_processor::*; + pub use radix_engine_interface::prelude::*; + pub use sbor::representations::*; + pub use substate_store_impls::hash_tree::tree_store::*; + pub use substate_store_interface::db_key_mapper::*; + pub use substate_store_interface::interface::*; + pub use substate_store_queries::typed_substate_layout::multi_resource_pool::*; + pub use substate_store_queries::typed_substate_layout::one_resource_pool::*; + pub use substate_store_queries::typed_substate_layout::two_resource_pool::*; + pub use substate_store_queries::typed_substate_layout::*; + pub use transaction::errors::*; + pub use transaction::manifest::*; + pub use transaction::model::*; + pub use transaction::validation::*; + pub use transaction::*; + + // Note: plain `pub use radix_engine::track::*` would clash with the top-level `utils::prelude` + // (because it contains a private module of the same name) + pub use radix_engine::track::interface::*; + pub use radix_engine::track::state_updates::*; +} diff --git a/core-rust/jni-export/Cargo.toml b/core-rust/jni-export/Cargo.toml index 49c5cf8ed2..73741a740e 100644 --- a/core-rust/jni-export/Cargo.toml +++ b/core-rust/jni-export/Cargo.toml @@ -14,9 +14,9 @@ transaction-scenarios = { workspace = true } radix-engine-common = { workspace = true } radix-engine-interface = { workspace = true } radix-engine = { workspace = true } -radix-engine-stores = { workspace = true } -radix-engine-store-interface = { workspace = true } -radix-engine-queries = { workspace = true } +substate-store-impls = { workspace = true } +substate-store-interface = { workspace = true } +substate-store-queries = { workspace = true } utils = { workspace = true } # Non-Radix Engine Dependencies: diff --git a/core-rust/node-common/Cargo.toml b/core-rust/node-common/Cargo.toml index bde87f2402..5e01fb8914 100644 --- a/core-rust/node-common/Cargo.toml +++ b/core-rust/node-common/Cargo.toml @@ -9,9 +9,9 @@ transaction = { workspace = true } radix-engine-common = { workspace = true } radix-engine-interface = { workspace = true } radix-engine = { workspace = true } -radix-engine-stores = { workspace = true } -radix-engine-store-interface = { workspace = true } -radix-engine-queries = { workspace = true } +substate-store-impls = { workspace = true } +substate-store-interface = { workspace = true } +substate-store-queries = { workspace = true } utils = { workspace = true } # Non-Radix Engine Dependencies: diff --git a/core-rust/node-common/src/config/limits.rs b/core-rust/node-common/src/config/limits.rs index daefc615a6..7e86eb4f00 100644 --- a/core-rust/node-common/src/config/limits.rs +++ b/core-rust/node-common/src/config/limits.rs @@ -62,7 +62,7 @@ * permissions under this License. */ -use radix_engine_common::prelude::*; +use crate::engine_prelude::*; // TODO: revisit & tune before Babylon pub const DEFAULT_MAX_VERTEX_TRANSACTION_COUNT: u32 = 100; diff --git a/core-rust/node-common/src/config/mod.rs b/core-rust/node-common/src/config/mod.rs index eec01b1b94..a7c74ab577 100644 --- a/core-rust/node-common/src/config/mod.rs +++ b/core-rust/node-common/src/config/mod.rs @@ -62,7 +62,7 @@ * permissions under this License. */ -use sbor::*; +use crate::engine_prelude::*; pub mod limits; diff --git a/core-rust/node-common/src/java/result.rs b/core-rust/node-common/src/java/result.rs index 8e16fb296b..fe44c2ee1d 100644 --- a/core-rust/node-common/src/java/result.rs +++ b/core-rust/node-common/src/java/result.rs @@ -62,8 +62,7 @@ * permissions under this License. */ -use radix_engine_interface::*; -use sbor::{DecodeError, EncodeError}; +use crate::engine_prelude::*; #[derive(Debug, ScryptoSbor)] pub struct JavaError(pub String); diff --git a/core-rust/node-common/src/java/structure.rs b/core-rust/node-common/src/java/structure.rs index 0498404d1d..6b19c64bd6 100644 --- a/core-rust/node-common/src/java/structure.rs +++ b/core-rust/node-common/src/java/structure.rs @@ -62,10 +62,8 @@ * permissions under this License. */ +use crate::engine_prelude::*; use crate::java::result::JavaResult; -use radix_engine::types::{scrypto_decode, scrypto_encode, ScryptoDecode, ScryptoEncode}; - -pub use sbor::{Decode, Encode}; pub trait StructFromJava { fn from_java(data: &[u8]) -> JavaResult diff --git a/core-rust/node-common/src/java/types.rs b/core-rust/node-common/src/java/types.rs index d42531a227..c70b34d836 100644 --- a/core-rust/node-common/src/java/types.rs +++ b/core-rust/node-common/src/java/types.rs @@ -62,7 +62,7 @@ * permissions under this License. */ -use sbor::{Categorize, Decode, Encode}; +use crate::engine_prelude::*; #[derive(Debug, PartialEq, Eq, Categorize, Encode, Decode)] pub struct JavaHashCode(Vec); diff --git a/core-rust/node-common/src/java/utils.rs b/core-rust/node-common/src/java/utils.rs index bed6c3807c..5af40d96c1 100644 --- a/core-rust/node-common/src/java/utils.rs +++ b/core-rust/node-common/src/java/utils.rs @@ -62,10 +62,9 @@ * permissions under this License. */ +use crate::engine_prelude::*; use jni::sys::jbyteArray; use jni::JNIEnv; -use radix_engine::types::{ScryptoDecode, ScryptoEncode}; -use sbor::Sbor; use std::panic; use std::panic::AssertUnwindSafe; diff --git a/core-rust/node-common/src/jni/addressing.rs b/core-rust/node-common/src/jni/addressing.rs index f852f11d61..2e362e0e75 100644 --- a/core-rust/node-common/src/jni/addressing.rs +++ b/core-rust/node-common/src/jni/addressing.rs @@ -62,15 +62,12 @@ * permissions under this License. */ +use crate::engine_prelude::*; use crate::java::utils::jni_sbor_coded_call; use bech32::{FromBase32, ToBase32, Variant}; use jni::objects::JClass; use jni::sys::jbyteArray; use jni::JNIEnv; -use radix_engine::types::ComponentAddress; -use radix_engine_common::prelude::{AddressBech32Encoder, NetworkDefinition}; -use radix_engine_common::types::{EntityType, NodeId, ResourceAddress}; -use radix_engine_interface::crypto::Secp256k1PublicKey; #[no_mangle] extern "system" fn Java_com_radixdlt_identifiers_Bech32mCoder_encodeAddress( diff --git a/core-rust/node-common/src/jni/scrypto_constants.rs b/core-rust/node-common/src/jni/scrypto_constants.rs index 4f04d36168..e4e60e6d23 100644 --- a/core-rust/node-common/src/jni/scrypto_constants.rs +++ b/core-rust/node-common/src/jni/scrypto_constants.rs @@ -66,9 +66,8 @@ use jni::objects::JClass; use jni::sys::jbyteArray; use jni::JNIEnv; +use crate::engine_prelude::*; use crate::java::utils::jni_sbor_coded_call; -use radix_engine::types::{CONSENSUS_MANAGER, VALIDATOR_OWNER_BADGE, XRD}; -use radix_engine_interface::constants::FAUCET; #[no_mangle] extern "system" fn Java_com_radixdlt_rev2_ScryptoConstants_getXrdResourceAddress( diff --git a/core-rust/node-common/src/lib.rs b/core-rust/node-common/src/lib.rs index fa9d2e4b13..feffde036a 100644 --- a/core-rust/node-common/src/lib.rs +++ b/core-rust/node-common/src/lib.rs @@ -70,3 +70,7 @@ pub mod locks; pub mod metrics; pub mod scheduler; pub mod utils; + +pub(crate) mod engine_prelude { + pub use radix_engine_common::prelude::*; +} diff --git a/core-rust/node-common/src/utils.rs b/core-rust/node-common/src/utils.rs index da92488070..eb4d836bbf 100644 --- a/core-rust/node-common/src/utils.rs +++ b/core-rust/node-common/src/utils.rs @@ -62,8 +62,7 @@ * permissions under this License. */ -use radix_engine::types::GlobalAddress; -use radix_engine_common::types::EntityType; +use crate::engine_prelude::*; pub trait IsAccountExt { fn is_account(&self) -> bool; diff --git a/core-rust/state-manager/Cargo.toml b/core-rust/state-manager/Cargo.toml index 924ad43bf3..967fdf0438 100644 --- a/core-rust/state-manager/Cargo.toml +++ b/core-rust/state-manager/Cargo.toml @@ -12,9 +12,9 @@ transaction-scenarios = { workspace = true } radix-engine-common = { workspace = true } radix-engine-interface = { workspace = true } radix-engine = { workspace = true } -radix-engine-stores = { workspace = true } -radix-engine-store-interface = { workspace = true } -radix-engine-queries = { workspace = true } +substate-store-impls = { workspace = true } +substate-store-interface = { workspace = true } +substate-store-queries = { workspace = true } utils = { workspace = true } # Non-Radix Engine Dependencies: diff --git a/core-rust/state-manager/src/accumulator_tree/mod.rs b/core-rust/state-manager/src/accumulator_tree/mod.rs index 79ae1253da..994b221e37 100644 --- a/core-rust/state-manager/src/accumulator_tree/mod.rs +++ b/core-rust/state-manager/src/accumulator_tree/mod.rs @@ -62,7 +62,7 @@ * permissions under this License. */ -use radix_engine_interface::prelude::*; +use crate::engine_prelude::*; use tree_builder::Merklizable; pub mod slice_merger; diff --git a/core-rust/state-manager/src/accumulator_tree/storage.rs b/core-rust/state-manager/src/accumulator_tree/storage.rs index ea68e03eee..55a2a089e3 100644 --- a/core-rust/state-manager/src/accumulator_tree/storage.rs +++ b/core-rust/state-manager/src/accumulator_tree/storage.rs @@ -62,8 +62,8 @@ * permissions under this License. */ +use crate::engine_prelude::*; use enum_dispatch::enum_dispatch; -use radix_engine::types::{ScryptoCategorize, ScryptoDecode, ScryptoEncode}; /// The "read" part of an accumulator tree storage SPI. /// Both the key type and node type are implementation-dependent. diff --git a/core-rust/state-manager/src/accumulator_tree/test.rs b/core-rust/state-manager/src/accumulator_tree/test.rs index 5dd0ea3b0d..70b1759165 100644 --- a/core-rust/state-manager/src/accumulator_tree/test.rs +++ b/core-rust/state-manager/src/accumulator_tree/test.rs @@ -66,7 +66,7 @@ use super::slice_merger::AccuTreeSliceMerger; use super::storage::{ReadableAccuTreeStore, WriteableAccuTreeStore}; use super::storage::{TreeSlice, TreeSliceLevel}; use super::tree_builder::{AccuTree, Merklizable}; -use radix_engine_interface::crypto::{blake2b_256_hash, Hash}; +use crate::engine_prelude::*; use std::collections::HashMap; // Simple smoke tests using the actual hashing coming from our business use-cases: diff --git a/core-rust/state-manager/src/jni/fatal_panic_handler.rs b/core-rust/state-manager/src/jni/fatal_panic_handler.rs index 74a7953d4d..f7c05b56fd 100644 --- a/core-rust/state-manager/src/jni/fatal_panic_handler.rs +++ b/core-rust/state-manager/src/jni/fatal_panic_handler.rs @@ -67,7 +67,6 @@ use jni::objects::{GlobalRef, JObject}; use jni::{JNIEnv, JavaVM}; use std::ops::Deref; use tracing::error; -use transaction::prelude::*; /// An interface for notifying Java about a fatal panic. pub struct FatalPanicHandler { diff --git a/core-rust/state-manager/src/jni/mempool.rs b/core-rust/state-manager/src/jni/mempool.rs index 29063a1eb4..c168258a23 100644 --- a/core-rust/state-manager/src/jni/mempool.rs +++ b/core-rust/state-manager/src/jni/mempool.rs @@ -71,12 +71,10 @@ use jni::objects::{JClass, JObject}; use jni::sys::jbyteArray; use jni::JNIEnv; +use crate::engine_prelude::*; use crate::mempool::*; use crate::MempoolAddSource; use node_common::java::*; -use sbor::{Categorize, Decode, Encode}; -use transaction::errors::TransactionValidationError; -use transaction::model::*; use super::node_rust_environment::JNINodeRustEnvironment; use super::transaction_preparer::JavaPreparedNotarizedTransaction; diff --git a/core-rust/state-manager/src/jni/mod.rs b/core-rust/state-manager/src/jni/mod.rs index fefcce14ac..a5bd6d5c5d 100644 --- a/core-rust/state-manager/src/jni/mod.rs +++ b/core-rust/state-manager/src/jni/mod.rs @@ -74,7 +74,7 @@ pub mod transaction_preparer; pub mod transaction_store; pub mod vertex_store_recovery; -use radix_engine::prelude::*; +use crate::engine_prelude::*; /// Limits regarding the granularity of ledger sync (and thus of ledger proofs kept in storage). /// This struct is defined publicly here, since it is used by the transaction store and the ledger diff --git a/core-rust/state-manager/src/jni/node_rust_environment.rs b/core-rust/state-manager/src/jni/node_rust_environment.rs index fbb8fe5a89..ab0a3d5263 100644 --- a/core-rust/state-manager/src/jni/node_rust_environment.rs +++ b/core-rust/state-manager/src/jni/node_rust_environment.rs @@ -66,6 +66,7 @@ use std::ops::Deref; use std::str::FromStr; use std::sync::Arc; +use crate::engine_prelude::*; use jni::objects::{JClass, JObject}; use jni::sys::jbyteArray; use jni::JNIEnv; @@ -73,7 +74,6 @@ use node_common::environment::setup_tracing; use node_common::java::{jni_call, jni_jbytearray_to_vector, StructFromJava}; use node_common::locks::*; use prometheus::Registry; -use radix_engine_common::prelude::NetworkDefinition; use node_common::scheduler::{Scheduler, UntilDropTracker}; use tokio::runtime::Runtime; diff --git a/core-rust/state-manager/src/jni/protocol_update.rs b/core-rust/state-manager/src/jni/protocol_update.rs index 05742df131..77e3d2f486 100644 --- a/core-rust/state-manager/src/jni/protocol_update.rs +++ b/core-rust/state-manager/src/jni/protocol_update.rs @@ -62,11 +62,11 @@ * permissions under this License. */ +use crate::engine_prelude::*; use crate::{protocol::*, ProtocolUpdateResult}; use jni::objects::{JClass, JObject}; use jni::sys::jbyteArray; use jni::JNIEnv; -use radix_engine::types::*; use node_common::java::*; diff --git a/core-rust/state-manager/src/jni/state_computer.rs b/core-rust/state-manager/src/jni/state_computer.rs index a365b7bf69..bf05c25646 100644 --- a/core-rust/state-manager/src/jni/state_computer.rs +++ b/core-rust/state-manager/src/jni/state_computer.rs @@ -62,22 +62,17 @@ * permissions under this License. */ +use crate::engine_prelude::*; use crate::protocol::ProtocolVersionName; use crate::{protocol::ProtocolState, CommitSummary, LedgerProof}; use jni::objects::{JClass, JObject}; use jni::sys::jbyteArray; use jni::JNIEnv; -use radix_engine::types::*; -use radix_engine_interface::blueprints::consensus_manager::{ - ConsensusManagerConfig, EpochChangeCondition, -}; use node_common::java::*; use crate::types::{CommitRequest, InvalidCommitRequestError, PrepareRequest, PrepareResult}; -use radix_engine::system::bootstrap::GenesisDataChunk; - use super::node_rust_environment::JNINodeRustEnvironment; // diff --git a/core-rust/state-manager/src/jni/state_reader.rs b/core-rust/state-manager/src/jni/state_reader.rs index b2a5caafdf..dea9748291 100644 --- a/core-rust/state-manager/src/jni/state_reader.rs +++ b/core-rust/state-manager/src/jni/state_reader.rs @@ -62,17 +62,10 @@ * permissions under this License. */ +use crate::engine_prelude::*; use jni::objects::{JClass, JObject}; use jni::sys::jbyteArray; use jni::JNIEnv; -use radix_engine::system::system_substates::FieldSubstate; -use radix_engine::types::*; - -use radix_engine_store_interface::db_key_mapper::*; - -use radix_engine::blueprints::consensus_manager::{ - ValidatorField, ValidatorProtocolUpdateReadinessSignalFieldPayload, -}; use node_common::java::*; diff --git a/core-rust/state-manager/src/jni/test_state_reader.rs b/core-rust/state-manager/src/jni/test_state_reader.rs index 85d7a9a955..08d1050913 100644 --- a/core-rust/state-manager/src/jni/test_state_reader.rs +++ b/core-rust/state-manager/src/jni/test_state_reader.rs @@ -62,28 +62,22 @@ * permissions under this License. */ +use crate::engine_prelude::*; use crate::{DetailedTransactionOutcome, LedgerTransactionOutcome, StateVersion}; use jni::objects::{JClass, JObject}; use jni::sys::jbyteArray; use jni::JNIEnv; -use radix_engine::types::*; - -use radix_engine_queries::query::ResourceAccounter; use std::ops::Deref; use crate::jni::node_rust_environment::JNINodeRustEnvironment; use crate::query::StateManagerSubstateQueries; use node_common::java::*; -use radix_engine::blueprints::consensus_manager::{ValidatorField, ValidatorStateFieldSubstate}; -use radix_engine::system::type_info::TypeInfoSubstate; - use crate::store::traits::{ gc::StateHashTreeGcStore, IterableProofStore, QueryableProofStore, QueryableTransactionStore, SubstateNodeAncestryStore, }; use crate::transaction::LedgerTransactionHash; -use radix_engine_store_interface::db_key_mapper::{MappedSubstateDatabase, SpreadPrefixKeyMapper}; // // JNI Interface (for test purposes only) diff --git a/core-rust/state-manager/src/jni/transaction_preparer.rs b/core-rust/state-manager/src/jni/transaction_preparer.rs index ff2591c268..80c5acbf90 100644 --- a/core-rust/state-manager/src/jni/transaction_preparer.rs +++ b/core-rust/state-manager/src/jni/transaction_preparer.rs @@ -62,17 +62,12 @@ * permissions under this License. */ +use crate::engine_prelude::*; use crate::transaction::*; use jni::objects::JClass; use jni::sys::jbyteArray; use jni::JNIEnv; use node_common::java::*; -use radix_engine::types::PublicKey; -use radix_engine_common::types::Epoch; -use radix_engine_interface::network::NetworkDefinition; -use radix_engine_interface::*; -use transaction::manifest::{compile, BlobProvider}; -use transaction::model::*; #[derive(Debug, Clone, PartialEq, Eq, ScryptoCategorize, ScryptoEncode, ScryptoDecode)] struct PrepareIntentRequest { diff --git a/core-rust/state-manager/src/jni/transaction_store.rs b/core-rust/state-manager/src/jni/transaction_store.rs index c9e50da2c0..31c9211b2c 100644 --- a/core-rust/state-manager/src/jni/transaction_store.rs +++ b/core-rust/state-manager/src/jni/transaction_store.rs @@ -62,6 +62,7 @@ * permissions under this License. */ +use crate::engine_prelude::*; use crate::jni::node_rust_environment::JNINodeRustEnvironment; use crate::jni::LedgerSyncLimitsConfig; use crate::protocol::epoch_change_iter; @@ -71,7 +72,6 @@ use jni::objects::{JClass, JObject}; use jni::sys::jbyteArray; use jni::JNIEnv; use node_common::java::*; -use radix_engine::types::*; use std::ops::Deref; #[derive(Debug, ScryptoCategorize, ScryptoEncode, ScryptoDecode)] diff --git a/core-rust/state-manager/src/lib.rs b/core-rust/state-manager/src/lib.rs index 552b8097e9..c58fac7cb5 100644 --- a/core-rust/state-manager/src/lib.rs +++ b/core-rust/state-manager/src/lib.rs @@ -91,3 +91,35 @@ pub use crate::state_computer::*; pub use crate::state_manager::*; pub use crate::store::*; pub use crate::types::*; + +pub(crate) mod engine_prelude { + pub use radix_engine::errors::*; + pub use radix_engine::system::bootstrap::*; + pub use radix_engine::system::system_db_reader::*; + pub use radix_engine::system::system_substates::*; + pub use radix_engine::transaction::*; + pub use radix_engine::utils::*; + pub use radix_engine::vm::wasm::*; + pub use radix_engine::vm::*; + pub use radix_engine_common::prelude::*; + pub use radix_engine_interface::blueprints::transaction_processor::*; + pub use radix_engine_interface::prelude::*; + pub use substate_store_impls::hash_tree::tree_store::*; + pub use substate_store_impls::hash_tree::*; + pub use substate_store_interface::db_key_mapper::*; + pub use substate_store_interface::interface::*; + pub use substate_store_queries::query::*; + pub use substate_store_queries::typed_substate_layout::*; + pub use transaction::builder::*; + pub use transaction::errors::*; + pub use transaction::manifest::*; + pub use transaction::model::*; + pub use transaction::prelude::*; + pub use transaction::validation::*; + pub use transaction::*; + + // Note: plain `pub use radix_engine::track::*` would clash with the top-level `utils::prelude` + // (because it contains a private module of the same name) + pub use radix_engine::track::interface::*; + pub use radix_engine::track::state_updates::*; +} diff --git a/core-rust/state-manager/src/limits.rs b/core-rust/state-manager/src/limits.rs index 0fb63bf503..a8fb52481c 100644 --- a/core-rust/state-manager/src/limits.rs +++ b/core-rust/state-manager/src/limits.rs @@ -62,9 +62,8 @@ * permissions under this License. */ +use crate::engine_prelude::*; use node_common::config::limits::VertexLimitsConfig; -use radix_engine::transaction::TransactionFeeSummary; -use radix_engine::types::*; #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum VertexLimitsExceeded { diff --git a/core-rust/state-manager/src/mempool/mempool_manager.rs b/core-rust/state-manager/src/mempool/mempool_manager.rs index d2de8a0289..40b6a0a72b 100644 --- a/core-rust/state-manager/src/mempool/mempool_manager.rs +++ b/core-rust/state-manager/src/mempool/mempool_manager.rs @@ -68,7 +68,6 @@ use crate::mempool::*; use crate::MempoolAddSource; use node_common::metrics::TakesMetricLabels; use prometheus::Registry; -use transaction::model::*; use std::cmp::max; use std::collections::HashSet; diff --git a/core-rust/state-manager/src/mempool/mempool_relay_dispatcher.rs b/core-rust/state-manager/src/mempool/mempool_relay_dispatcher.rs index 87cacd884f..516f6cabce 100644 --- a/core-rust/state-manager/src/mempool/mempool_relay_dispatcher.rs +++ b/core-rust/state-manager/src/mempool/mempool_relay_dispatcher.rs @@ -62,11 +62,11 @@ * permissions under this License. */ +use crate::engine_prelude::*; use jni::errors::Result; use jni::objects::{GlobalRef, JObject, JValue}; use jni::{JNIEnv, JavaVM}; use std::ops::Deref; -use transaction::prelude::*; use node_common::java::*; diff --git a/core-rust/state-manager/src/mempool/metrics.rs b/core-rust/state-manager/src/mempool/metrics.rs index 61a3dcc1a0..7ff7e3dcc9 100644 --- a/core-rust/state-manager/src/mempool/metrics.rs +++ b/core-rust/state-manager/src/mempool/metrics.rs @@ -65,7 +65,7 @@ use node_common::metrics::*; use prometheus::*; -use crate::{MempoolAddError, MempoolAddSource, RejectionReason}; +use crate::{MempoolAddError, MempoolAddSource, MempoolRejectionReason}; pub struct MempoolMetrics { pub current_transactions: IntGauge, @@ -142,9 +142,9 @@ impl MetricLabel for MempoolAddError { match self { MempoolAddError::PriorityThresholdNotMet { .. } => "PriorityThresholdNotMet", MempoolAddError::Rejected(rejection) => match &rejection.reason { - RejectionReason::AlreadyCommitted(_) => "AlreadyCommitted", - RejectionReason::FromExecution(_) => "ExecutionError", - RejectionReason::ValidationError(_) => "ValidationError", + MempoolRejectionReason::AlreadyCommitted(_) => "AlreadyCommitted", + MempoolRejectionReason::FromExecution(_) => "ExecutionError", + MempoolRejectionReason::ValidationError(_) => "ValidationError", }, MempoolAddError::Duplicate(_) => "Duplicate", } diff --git a/core-rust/state-manager/src/mempool/mod.rs b/core-rust/state-manager/src/mempool/mod.rs index fda37aa12c..3e3af71033 100644 --- a/core-rust/state-manager/src/mempool/mod.rs +++ b/core-rust/state-manager/src/mempool/mod.rs @@ -62,8 +62,7 @@ * permissions under this License. */ -use radix_engine_common::types::Epoch; -use transaction::{errors::TransactionValidationError, prelude::NotarizedTransactionHash}; +use crate::engine_prelude::*; use std::string::ToString; @@ -87,7 +86,7 @@ pub enum MempoolAddError { #[derive(Debug)] pub struct MempoolAddRejection { - pub reason: RejectionReason, + pub reason: MempoolRejectionReason, pub against_state: AtState, pub retry_from: RetryFrom, pub was_cached: bool, @@ -99,7 +98,7 @@ pub struct MempoolAddRejection { impl MempoolAddRejection { pub fn for_static_rejection(validation_error: TransactionValidationError) -> Self { Self { - reason: RejectionReason::ValidationError(validation_error), + reason: MempoolRejectionReason::ValidationError(validation_error), against_state: AtState::Static, retry_from: RetryFrom::Never, was_cached: false, diff --git a/core-rust/state-manager/src/mempool/pending_transaction_result_cache.rs b/core-rust/state-manager/src/mempool/pending_transaction_result_cache.rs index 91154f4650..9af61dca4e 100644 --- a/core-rust/state-manager/src/mempool/pending_transaction_result_cache.rs +++ b/core-rust/state-manager/src/mempool/pending_transaction_result_cache.rs @@ -1,5 +1,4 @@ -use radix_engine_common::types::Epoch; -use transaction::{errors::TransactionValidationError, model::*}; +use crate::engine_prelude::*; use crate::{ transaction::{CheckMetadata, StaticValidation}, @@ -18,7 +17,7 @@ use std::{ pub type ExecutionRejectionReason = radix_engine::errors::RejectionReason; #[derive(Debug, Clone, PartialEq, Eq)] -pub enum RejectionReason { +pub enum MempoolRejectionReason { AlreadyCommitted(AlreadyCommittedError), FromExecution(Box), ValidationError(TransactionValidationError), @@ -31,13 +30,13 @@ pub struct AlreadyCommittedError { pub committed_notarized_transaction_hash: NotarizedTransactionHash, } -impl From for RejectionReason { +impl From for MempoolRejectionReason { fn from(value: TransactionValidationError) -> Self { Self::ValidationError(value) } } -impl RejectionReason { +impl MempoolRejectionReason { pub fn is_permanent_for_payload(&self) -> bool { self.permanence().is_permanent_for_payload() } @@ -48,8 +47,8 @@ impl RejectionReason { pub fn is_rejected_because_intent_already_committed(&self) -> bool { match self { - RejectionReason::AlreadyCommitted(_) => true, - RejectionReason::FromExecution(rejection_reason) => match **rejection_reason { + MempoolRejectionReason::AlreadyCommitted(_) => true, + MempoolRejectionReason::FromExecution(rejection_reason) => match **rejection_reason { ExecutionRejectionReason::SuccessButFeeLoanNotRepaid => false, ExecutionRejectionReason::ErrorBeforeLoanAndDeferredCostsRepaid(_) => false, ExecutionRejectionReason::TransactionEpochNotYetValid { .. } => false, @@ -57,25 +56,25 @@ impl RejectionReason { ExecutionRejectionReason::IntentHashPreviouslyCommitted => true, ExecutionRejectionReason::IntentHashPreviouslyCancelled => true, }, - RejectionReason::ValidationError(_) => false, + MempoolRejectionReason::ValidationError(_) => false, } } pub fn already_committed_error(&self) -> Option<&AlreadyCommittedError> { match self { - RejectionReason::AlreadyCommitted(error) => Some(error), + MempoolRejectionReason::AlreadyCommitted(error) => Some(error), _ => None, } } pub fn permanence(&self) -> RejectionPermanence { match self { - RejectionReason::AlreadyCommitted(_) => { + MempoolRejectionReason::AlreadyCommitted(_) => { // This is permanent for the intent - because even other, non-committed transactions // of the same intent will fail with `ExecutionRejectionReason::IntentHashPreviouslyCommitted` RejectionPermanence::PermanentForAnyPayloadWithThisIntent } - RejectionReason::FromExecution(rejection_error) => match **rejection_error { + MempoolRejectionReason::FromExecution(rejection_error) => match **rejection_error { ExecutionRejectionReason::SuccessButFeeLoanNotRepaid => { RejectionPermanence::Temporary { retry: RetrySettings::AfterDelay { @@ -105,7 +104,7 @@ impl RejectionReason { RejectionPermanence::PermanentForAnyPayloadWithThisIntent } }, - RejectionReason::ValidationError(validation_error) => match validation_error { + MempoolRejectionReason::ValidationError(validation_error) => match validation_error { // The size is a property of the payload, not the intent TransactionValidationError::TransactionTooLarge => { RejectionPermanence::PermanentForPayload @@ -174,12 +173,16 @@ pub enum RetrySettings { FromEpoch { epoch: Epoch }, } -impl fmt::Display for RejectionReason { +impl fmt::Display for MempoolRejectionReason { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { - RejectionReason::AlreadyCommitted(error) => write!(f, "Already committed: {error:?}"), - RejectionReason::FromExecution(rejection_error) => write!(f, "{rejection_error}"), - RejectionReason::ValidationError(validation_error) => { + MempoolRejectionReason::AlreadyCommitted(error) => { + write!(f, "Already committed: {error:?}") + } + MempoolRejectionReason::FromExecution(rejection_error) => { + write!(f, "{rejection_error}") + } + MempoolRejectionReason::ValidationError(validation_error) => { write!(f, "Validation Error: {validation_error:?}") } } @@ -214,7 +217,7 @@ pub struct PendingTransactionRecord { #[derive(Debug, Clone, PartialEq, Eq)] pub struct TransactionAttempt { - pub rejection: Option, + pub rejection: Option, pub against_state: AtState, pub timestamp: SystemTime, } @@ -370,7 +373,7 @@ impl PendingTransactionRecord { } } - pub fn most_applicable_status(&self) -> Option<&RejectionReason> { + pub fn most_applicable_status(&self) -> Option<&MempoolRejectionReason> { self.earliest_permanent_rejection .as_ref() .and_then(|r| r.rejection.as_ref()) @@ -511,11 +514,13 @@ impl PendingTransactionResultCache { // We even overwrite the record for transaction which got committed here // because this is a cache for pending transactions, and it can't be re-committed record.track_attempt(TransactionAttempt { - rejection: Some(RejectionReason::AlreadyCommitted(AlreadyCommittedError { - notarized_transaction_hash: *cached_payload_hash, - committed_state_version: committed_transaction.state_version, - committed_notarized_transaction_hash, - })), + rejection: Some(MempoolRejectionReason::AlreadyCommitted( + AlreadyCommittedError { + notarized_transaction_hash: *cached_payload_hash, + committed_state_version: committed_transaction.state_version, + committed_notarized_transaction_hash, + }, + )), against_state: AtState::Committed { state_version: committed_transaction.state_version, }, @@ -544,12 +549,14 @@ impl PendingTransactionResultCache { *intent_hash, None, TransactionAttempt { - rejection: Some(RejectionReason::AlreadyCommitted(AlreadyCommittedError { - notarized_transaction_hash: *notarized_transaction_hash, - committed_state_version: committed_intent_record.state_version, - committed_notarized_transaction_hash: committed_intent_record - .notarized_transaction_hash, - })), + rejection: Some(MempoolRejectionReason::AlreadyCommitted( + AlreadyCommittedError { + notarized_transaction_hash: *notarized_transaction_hash, + committed_state_version: committed_intent_record.state_version, + committed_notarized_transaction_hash: committed_intent_record + .notarized_transaction_hash, + }, + )), against_state: AtState::Committed { state_version: committed_intent_record.state_version, }, @@ -629,7 +636,6 @@ struct CommittedIntentRecord { #[cfg(test)] mod tests { - use radix_engine_interface::crypto::blake2b_256_hash; use super::*; @@ -661,7 +667,7 @@ mod tests { let intent_hash_3 = intent_hash(3); let example_attempt_1 = TransactionAttempt { - rejection: Some(RejectionReason::ValidationError( + rejection: Some(MempoolRejectionReason::ValidationError( TransactionValidationError::TransactionTooLarge, )), against_state: AtState::Static, @@ -669,7 +675,7 @@ mod tests { }; let example_attempt_2 = TransactionAttempt { - rejection: Some(RejectionReason::FromExecution(Box::new( + rejection: Some(MempoolRejectionReason::FromExecution(Box::new( ExecutionRejectionReason::SuccessButFeeLoanNotRepaid, ))), against_state: AtState::Committed { @@ -837,7 +843,7 @@ mod tests { let intent_hash_2 = intent_hash(2); let attempt_with_temporary_rejection = TransactionAttempt { - rejection: Some(RejectionReason::FromExecution(Box::new( + rejection: Some(MempoolRejectionReason::FromExecution(Box::new( ExecutionRejectionReason::SuccessButFeeLoanNotRepaid, ))), against_state: AtState::Committed { @@ -846,7 +852,7 @@ mod tests { timestamp: start, }; let attempt_with_rejection_until_epoch_10 = TransactionAttempt { - rejection: Some(RejectionReason::FromExecution(Box::new( + rejection: Some(MempoolRejectionReason::FromExecution(Box::new( ExecutionRejectionReason::TransactionEpochNotYetValid { valid_from: Epoch::of(10), current_epoch: Epoch::of(9), @@ -858,7 +864,7 @@ mod tests { timestamp: start, }; let attempt_with_permanent_rejection = TransactionAttempt { - rejection: Some(RejectionReason::ValidationError( + rejection: Some(MempoolRejectionReason::ValidationError( TransactionValidationError::TransactionTooLarge, )), against_state: AtState::Committed { diff --git a/core-rust/state-manager/src/mempool/priority_mempool.rs b/core-rust/state-manager/src/mempool/priority_mempool.rs index 6e53c6cc27..25f5b164ac 100644 --- a/core-rust/state-manager/src/mempool/priority_mempool.rs +++ b/core-rust/state-manager/src/mempool/priority_mempool.rs @@ -67,8 +67,6 @@ use node_common::metrics::TakesMetricLabels; use prometheus::Registry; use rand::seq::index::sample; use tracing::warn; -use transaction::model::*; -use utils::prelude::indexmap::IndexMap; use crate::mempool::*; use itertools::Itertools; @@ -544,11 +542,6 @@ impl PriorityMempool { mod tests { use std::time::Duration; - use radix_engine::types::PublicKey; - use radix_engine_common::crypto::{Secp256k1PublicKey, Secp256k1Signature}; - use radix_engine_common::types::Epoch; - use transaction::model::*; - use crate::mempool::priority_mempool::*; fn create_fake_pub_key() -> PublicKey { diff --git a/core-rust/state-manager/src/metrics.rs b/core-rust/state-manager/src/metrics.rs index 81d9abbb1a..47e95bcc1a 100644 --- a/core-rust/state-manager/src/metrics.rs +++ b/core-rust/state-manager/src/metrics.rs @@ -75,14 +75,12 @@ use node_common::metrics::*; use prometheus::{ Gauge, GaugeVec, Histogram, IntCounter, IntCounterVec, IntGauge, IntGaugeVec, Opts, Registry, }; -use radix_engine::blueprints::consensus_manager::EpochChangeEvent; +use crate::engine_prelude::*; use crate::protocol::{ PendingProtocolUpdateState, ProtocolState, ProtocolUpdateEnactmentCondition, }; use crate::store::traits::measurement::CategoryDbVolumeStatistic; -use radix_engine::transaction::TransactionFeeSummary; -use radix_engine_common::prelude::*; pub struct LedgerMetrics { address_encoder: AddressBech32Encoder, // for label rendering only diff --git a/core-rust/state-manager/src/protocol/protocol_config.rs b/core-rust/state-manager/src/protocol/protocol_config.rs index 9be1e3af57..897881b40a 100644 --- a/core-rust/state-manager/src/protocol/protocol_config.rs +++ b/core-rust/state-manager/src/protocol/protocol_config.rs @@ -1,13 +1,6 @@ -use radix_engine::prelude::ScryptoSbor; -use radix_engine_common::math::Decimal; -use radix_engine_common::network::NetworkDefinition; -use radix_engine_common::prelude::{hash, scrypto_encode}; - -use radix_engine_common::types::Epoch; -use sbor::Sbor; +use crate::engine_prelude::*; use crate::protocol::*; -use utils::prelude::*; // This file contains types for node's local static protocol configuration diff --git a/core-rust/state-manager/src/protocol/protocol_configs/config_printer.rs b/core-rust/state-manager/src/protocol/protocol_configs/config_printer.rs index 7aa23279b1..aa8a2a1453 100644 --- a/core-rust/state-manager/src/protocol/protocol_configs/config_printer.rs +++ b/core-rust/state-manager/src/protocol/protocol_configs/config_printer.rs @@ -1,5 +1,4 @@ -use radix_engine::prelude::*; - +use crate::engine_prelude::*; use chrono::prelude::*; use chrono::Duration; diff --git a/core-rust/state-manager/src/protocol/protocol_configs/dumunet_protocol_config.rs b/core-rust/state-manager/src/protocol/protocol_configs/dumunet_protocol_config.rs index 668fbcefbc..d45594ec28 100644 --- a/core-rust/state-manager/src/protocol/protocol_configs/dumunet_protocol_config.rs +++ b/core-rust/state-manager/src/protocol/protocol_configs/dumunet_protocol_config.rs @@ -1,4 +1,4 @@ -use radix_engine::prelude::*; +use crate::engine_prelude::*; use crate::protocol::*; use ProtocolUpdateEnactmentCondition::*; diff --git a/core-rust/state-manager/src/protocol/protocol_configs/mainnet_protocol_config.rs b/core-rust/state-manager/src/protocol/protocol_configs/mainnet_protocol_config.rs index ecee873afa..0fba12eb69 100644 --- a/core-rust/state-manager/src/protocol/protocol_configs/mainnet_protocol_config.rs +++ b/core-rust/state-manager/src/protocol/protocol_configs/mainnet_protocol_config.rs @@ -1,4 +1,4 @@ -use radix_engine::prelude::*; +use crate::engine_prelude::*; use crate::protocol::*; use ProtocolUpdateEnactmentCondition::*; diff --git a/core-rust/state-manager/src/protocol/protocol_configs/mod.rs b/core-rust/state-manager/src/protocol/protocol_configs/mod.rs index ca8c4e4f82..56cdb1defa 100644 --- a/core-rust/state-manager/src/protocol/protocol_configs/mod.rs +++ b/core-rust/state-manager/src/protocol/protocol_configs/mod.rs @@ -5,8 +5,8 @@ mod mainnet_protocol_config; mod stokenet_protocol_config; mod testnet_protocol_config; +use crate::engine_prelude::*; use crate::protocol::*; -use radix_engine_common::network::NetworkDefinition; pub fn resolve_protocol_config(network: &NetworkDefinition) -> ProtocolConfig { match network.logical_name.as_str() { diff --git a/core-rust/state-manager/src/protocol/protocol_configs/stokenet_protocol_config.rs b/core-rust/state-manager/src/protocol/protocol_configs/stokenet_protocol_config.rs index 343bab55fd..ef48a1339c 100644 --- a/core-rust/state-manager/src/protocol/protocol_configs/stokenet_protocol_config.rs +++ b/core-rust/state-manager/src/protocol/protocol_configs/stokenet_protocol_config.rs @@ -1,4 +1,4 @@ -use radix_engine::prelude::*; +use crate::engine_prelude::*; use crate::protocol::*; use ProtocolUpdateEnactmentCondition::*; diff --git a/core-rust/state-manager/src/protocol/protocol_configs/testnet_protocol_config.rs b/core-rust/state-manager/src/protocol/protocol_configs/testnet_protocol_config.rs index fab239156b..502bcc5033 100644 --- a/core-rust/state-manager/src/protocol/protocol_configs/testnet_protocol_config.rs +++ b/core-rust/state-manager/src/protocol/protocol_configs/testnet_protocol_config.rs @@ -1,4 +1,4 @@ -use radix_engine::prelude::*; +use crate::engine_prelude::*; use crate::protocol::*; use ProtocolUpdateEnactmentCondition::*; diff --git a/core-rust/state-manager/src/protocol/protocol_state.rs b/core-rust/state-manager/src/protocol/protocol_state.rs index ba53c05451..ce5f9bdd02 100644 --- a/core-rust/state-manager/src/protocol/protocol_state.rs +++ b/core-rust/state-manager/src/protocol/protocol_state.rs @@ -1,17 +1,7 @@ -use radix_engine::blueprints::consensus_manager::EpochChangeEvent; -use radix_engine::prelude::{ScryptoCategorize, ScryptoDecode, ScryptoEncode}; +use crate::engine_prelude::*; use std::cmp::Ordering; use std::collections::BTreeMap; -use radix_engine_common::constants::CONSENSUS_MANAGER; - -use radix_engine_common::math::Decimal; -use radix_engine_common::prelude::scrypto_decode; - -use radix_engine_common::types::Epoch; -use radix_engine_interface::api::ModuleId; -use radix_engine_interface::prelude::CheckedMul; -use radix_engine_interface::prelude::Emitter; use tracing::info; use crate::protocol::*; diff --git a/core-rust/state-manager/src/protocol/protocol_updates/definitions/anemone_definition.rs b/core-rust/state-manager/src/protocol/protocol_updates/definitions/anemone_definition.rs index 53f8bb6192..d65e566ce8 100644 --- a/core-rust/state-manager/src/protocol/protocol_updates/definitions/anemone_definition.rs +++ b/core-rust/state-manager/src/protocol/protocol_updates/definitions/anemone_definition.rs @@ -1,11 +1,6 @@ +use crate::engine_prelude::*; use crate::protocol::*; use crate::transaction::FlashTransactionV1; -use radix_engine::types::*; -use radix_engine::utils::{ - generate_pools_v1_1_state_updates, generate_seconds_precision_state_updates, - generate_validator_fee_fix_state_updates, generate_vm_boot_scrypto_minor_version_state_updates, -}; -use radix_engine_store_interface::interface::SubstateDatabase; pub struct AnemoneProtocolUpdateDefinition; diff --git a/core-rust/state-manager/src/protocol/protocol_updates/definitions/custom_definition.rs b/core-rust/state-manager/src/protocol/protocol_updates/definitions/custom_definition.rs index ab195bb1e0..d7657f5a74 100644 --- a/core-rust/state-manager/src/protocol/protocol_updates/definitions/custom_definition.rs +++ b/core-rust/state-manager/src/protocol/protocol_updates/definitions/custom_definition.rs @@ -1,6 +1,5 @@ +use crate::engine_prelude::*; use crate::protocol::*; -use radix_engine::types::*; -use radix_engine_store_interface::interface::SubstateDatabase; /// Any protocol update beginning `custom-` can have content injected via config. pub struct CustomProtocolUpdateDefinition; diff --git a/core-rust/state-manager/src/protocol/protocol_updates/definitions/default_definition.rs b/core-rust/state-manager/src/protocol/protocol_updates/definitions/default_definition.rs index ee4a3d0a00..99ef461f10 100644 --- a/core-rust/state-manager/src/protocol/protocol_updates/definitions/default_definition.rs +++ b/core-rust/state-manager/src/protocol/protocol_updates/definitions/default_definition.rs @@ -1,5 +1,5 @@ +use crate::engine_prelude::*; use crate::protocol::*; -use radix_engine::types::*; pub struct DefaultConfigOnlyProtocolDefinition; diff --git a/core-rust/state-manager/src/protocol/protocol_updates/definitions/test_definition.rs b/core-rust/state-manager/src/protocol/protocol_updates/definitions/test_definition.rs index ef884a919b..615142abf2 100644 --- a/core-rust/state-manager/src/protocol/protocol_updates/definitions/test_definition.rs +++ b/core-rust/state-manager/src/protocol/protocol_updates/definitions/test_definition.rs @@ -1,5 +1,5 @@ +use crate::engine_prelude::*; use crate::{protocol::*, transaction::FlashTransactionV1}; -use radix_engine::{track::StateUpdates, types::*}; /// Any protocol update beginning `test-` just injects a single transaction. pub struct TestProtocolUpdateDefinition; diff --git a/core-rust/state-manager/src/protocol/protocol_updates/protocol_content_overrides.rs b/core-rust/state-manager/src/protocol/protocol_updates/protocol_content_overrides.rs index baa400ab5a..a17e84e4c8 100644 --- a/core-rust/state-manager/src/protocol/protocol_updates/protocol_content_overrides.rs +++ b/core-rust/state-manager/src/protocol/protocol_updates/protocol_content_overrides.rs @@ -1,10 +1,6 @@ use super::definitions::*; +use crate::engine_prelude::*; use crate::protocol::*; -use radix_engine::types::scrypto_encode; -use sbor::Sbor; - -use radix_engine_common::ScryptoSbor; -use utils::prelude::*; type Overrides = ::Overrides; diff --git a/core-rust/state-manager/src/protocol/protocol_updates/protocol_update_committer.rs b/core-rust/state-manager/src/protocol/protocol_updates/protocol_update_committer.rs index d85645c988..5d86651973 100644 --- a/core-rust/state-manager/src/protocol/protocol_updates/protocol_update_committer.rs +++ b/core-rust/state-manager/src/protocol/protocol_updates/protocol_update_committer.rs @@ -3,10 +3,8 @@ use std::ops::Deref; use std::sync::Arc; +use crate::engine_prelude::*; use node_common::locks::{LockFactory, RwLock, StateLock}; -use radix_engine::prelude::*; - -use transaction::prelude::*; use crate::epoch_handling::EpochAwareAccuTreeFactory; use crate::protocol::*; diff --git a/core-rust/state-manager/src/protocol/protocol_updates/protocol_update_definition.rs b/core-rust/state-manager/src/protocol/protocol_updates/protocol_update_definition.rs index 60af84a717..f2e9711b75 100644 --- a/core-rust/state-manager/src/protocol/protocol_updates/protocol_update_definition.rs +++ b/core-rust/state-manager/src/protocol/protocol_updates/protocol_update_definition.rs @@ -1,12 +1,10 @@ // This file contains the protocol update logic for specific protocol versions +use crate::engine_prelude::*; use crate::protocol::*; -use radix_engine::transaction::CostingParameters; -use radix_engine::types::*; use crate::transaction::*; use crate::LoggingConfig; -use transaction::validation::{NotarizedTransactionValidator, ValidationConfig}; /// A protocol update definition consists of two parts: /// 1) Updating the current (state computer) configuration ("transaction processing rules"). diff --git a/core-rust/state-manager/src/protocol/protocol_updates/protocol_updaters.rs b/core-rust/state-manager/src/protocol/protocol_updates/protocol_updaters.rs index cc097e3c98..8313cb9510 100644 --- a/core-rust/state-manager/src/protocol/protocol_updates/protocol_updaters.rs +++ b/core-rust/state-manager/src/protocol/protocol_updates/protocol_updaters.rs @@ -2,8 +2,10 @@ use node_common::locks::StateLock; use std::ops::Deref; use std::sync::Arc; +use crate::engine_prelude::*; + use crate::protocol::*; -use crate::traits::*; + use crate::StateManagerDatabase; pub trait ProtocolUpdater { diff --git a/core-rust/state-manager/src/protocol/test.rs b/core-rust/state-manager/src/protocol/test.rs index 9bb0b60c26..ab231268c8 100644 --- a/core-rust/state-manager/src/protocol/test.rs +++ b/core-rust/state-manager/src/protocol/test.rs @@ -63,28 +63,15 @@ */ use prometheus::Registry; -use utils::prelude::*; +use crate::engine_prelude::*; use crate::traits::QueryableProofStore; -use radix_engine::blueprints::consensus_manager::{ - ConsensusManagerConfigurationFieldPayload, ConsensusManagerField, -}; -use radix_engine::prelude::dec; -use radix_engine::system::system_substates::FieldSubstate; -use radix_engine::utils::generate_validator_fee_fix_state_updates; - -use radix_engine_common::prelude::{Epoch, CONSENSUS_MANAGER}; -use radix_engine_interface::prelude::MAIN_BASE_PARTITION; -use radix_engine_store_interface::db_key_mapper::{MappedSubstateDatabase, SpreadPrefixKeyMapper}; - -use sbor::HasLatestVersion; use node_common::locks::LockFactory; use node_common::scheduler::Scheduler; use crate::protocol::*; use crate::{LedgerProof, LedgerProofOrigin, StateManager, StateManagerConfig}; -use radix_engine_common::types::Round; use std::ops::Deref; use crate::test::prepare_and_commit_round_update; diff --git a/core-rust/state-manager/src/query/component_dumper.rs b/core-rust/state-manager/src/query/component_dumper.rs index 72783254c1..829c592716 100644 --- a/core-rust/state-manager/src/query/component_dumper.rs +++ b/core-rust/state-manager/src/query/component_dumper.rs @@ -62,12 +62,7 @@ * permissions under this License. */ -use radix_engine::types::*; -use radix_engine_interface::blueprints::resource::{ - LiquidFungibleResource, LiquidNonFungibleVault, -}; -use radix_engine_queries::query::{StateTreeTraverser, StateTreeVisitor}; -use radix_engine_store_interface::interface::SubstateDatabase; +use crate::engine_prelude::*; pub enum VaultData { Fungible { diff --git a/core-rust/state-manager/src/query/state_manager_substate_queries.rs b/core-rust/state-manager/src/query/state_manager_substate_queries.rs index ec2cfd721e..c280570551 100644 --- a/core-rust/state-manager/src/query/state_manager_substate_queries.rs +++ b/core-rust/state-manager/src/query/state_manager_substate_queries.rs @@ -1,10 +1,4 @@ -use radix_engine::blueprints::consensus_manager::{ - ConsensusManagerField, ConsensusManagerStateFieldSubstate, -}; -use radix_engine::types::*; - -use radix_engine_store_interface::db_key_mapper::{MappedSubstateDatabase, SpreadPrefixKeyMapper}; -use radix_engine_store_interface::interface::SubstateDatabase; +use crate::engine_prelude::*; pub trait StateManagerSubstateQueries { fn get_epoch(&self) -> Epoch; diff --git a/core-rust/state-manager/src/receipt.rs b/core-rust/state-manager/src/receipt.rs index 106d72c784..edfa64a099 100644 --- a/core-rust/state-manager/src/receipt.rs +++ b/core-rust/state-manager/src/receipt.rs @@ -1,18 +1,4 @@ -use radix_engine_interface::blueprints::transaction_processor::InstructionOutput; -use radix_engine_queries::typed_substate_layout::EpochChangeEvent; - -use radix_engine::errors::RuntimeError; - -use radix_engine::transaction::{ - CommitResult, CostingParameters, EventSystemStructure, FeeDestination, FeeSource, - StateUpdateSummary, SubstateSystemStructure, TransactionFeeSummary, TransactionOutcome, -}; -use radix_engine::types::*; - -use radix_engine_interface::types::EventTypeIdentifier; -use radix_engine_store_interface::interface::DbSubstateValue; -use sbor::rust::collections::IndexMap; -use transaction::prelude::TransactionCostingParameters; +use crate::engine_prelude::*; use crate::accumulator_tree::storage::{ReadableAccuTreeStore, TreeSlice, WriteableAccuTreeStore}; use crate::accumulator_tree::tree_builder::{AccuTree, Merklizable}; diff --git a/core-rust/state-manager/src/staging/cache.rs b/core-rust/state-manager/src/staging/cache.rs index c074ae80a0..3563016f5f 100644 --- a/core-rust/state-manager/src/staging/cache.rs +++ b/core-rust/state-manager/src/staging/cache.rs @@ -68,31 +68,21 @@ use super::stage_tree::{Accumulator, Delta, DerivedStageKey, StageKey, StageTree use super::ReadableStore; use crate::accumulator_tree::storage::{ReadableAccuTreeStore, TreeSlice}; +use crate::engine_prelude::*; use crate::protocol::ProtocolState; +use crate::staging::overlays::{ + MapSubstateNodeAncestryStore, StagedSubstateNodeAncestryStore, SubstateOverlayIterator, +}; use crate::staging::{ AccuTreeDiff, HashStructuresDiff, HashUpdateContext, ProcessedTransactionReceipt, StateHashTreeDiff, }; +use crate::transaction::{LedgerTransactionHash, TransactionLogic}; use crate::{EpochTransactionIdentifiers, ReceiptTreeHash, StateVersion, TransactionTreeHash}; use im::hashmap::HashMap as ImmutableHashMap; use itertools::Itertools; -use radix_engine_common::prelude::NodeId; - -use radix_engine_store_interface::db_key_mapper::SpreadPrefixKeyMapper; - -use crate::staging::overlays::{ - MapSubstateNodeAncestryStore, StagedSubstateNodeAncestryStore, SubstateOverlayIterator, -}; -use crate::transaction::{LedgerTransactionHash, TransactionLogic}; -use radix_engine_store_interface::interface::{ - DatabaseUpdate, DbPartitionKey, DbSortKey, DbSubstateValue, PartitionDatabaseUpdates, - PartitionEntry, SubstateDatabase, -}; -use radix_engine_stores::hash_tree::tree_store::{NodeKey, ReadableTreeStore, TreeNode}; - use crate::store::traits::{SubstateNodeAncestryRecord, SubstateNodeAncestryStore}; -use sbor::rust::collections::HashMap; use slotmap::SecondaryMap; #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd)] diff --git a/core-rust/state-manager/src/staging/mod.rs b/core-rust/state-manager/src/staging/mod.rs index b4c5b3bb8f..b9a36c573e 100644 --- a/core-rust/state-manager/src/staging/mod.rs +++ b/core-rust/state-manager/src/staging/mod.rs @@ -70,9 +70,8 @@ mod result; mod stage_tree; use crate::accumulator_tree::storage::ReadableAccuTreeStore; +use crate::engine_prelude::*; use crate::{ReceiptTreeHash, StateVersion, TransactionTreeHash}; -use radix_engine_store_interface::interface::SubstateDatabase; -use radix_engine_stores::hash_tree::tree_store::ReadableTreeStore; use crate::store::traits::SubstateNodeAncestryStore; pub use cache::*; diff --git a/core-rust/state-manager/src/staging/node_ancestry_resolver.rs b/core-rust/state-manager/src/staging/node_ancestry_resolver.rs index 72a59e488e..05b367a28d 100644 --- a/core-rust/state-manager/src/staging/node_ancestry_resolver.rs +++ b/core-rust/state-manager/src/staging/node_ancestry_resolver.rs @@ -62,13 +62,12 @@ * permissions under this License. */ +use crate::engine_prelude::*; use crate::store::traits::*; use crate::{SubstateChangeAction, SubstateReference}; use std::borrow::Borrow; use std::collections::hash_map::Entry; -use radix_engine::types::*; - /// A parent Substate and its owned Nodes. /// This structure may be used to represent only directly owned Nodes (i.e. all immediate children), /// or all transitively owned Nodes (i.e. all descendants: children, grand-children, grand-grand-...). @@ -297,7 +296,6 @@ impl NodeAncestryResolver { #[cfg(test)] mod tests { use super::*; - use sbor::Value; #[test] pub fn newly_created_child_nodes_are_recorded_under_their_existing_parents() { diff --git a/core-rust/state-manager/src/staging/overlays.rs b/core-rust/state-manager/src/staging/overlays.rs index 7312e29b44..ac54cbdc0e 100644 --- a/core-rust/state-manager/src/staging/overlays.rs +++ b/core-rust/state-manager/src/staging/overlays.rs @@ -1,11 +1,9 @@ -use radix_engine_store_interface::interface::{DatabaseUpdate, DbSortKey, PartitionEntry}; +use crate::engine_prelude::*; use std::cmp::Ordering; use std::hash::Hash; use std::iter::Peekable; use crate::store::traits::{SubstateNodeAncestryRecord, SubstateNodeAncestryStore}; -use radix_engine_common::types::NodeId; -use utils::prelude::NonIterMap; pub struct SubstateOverlayIterator<'a> { root_db: Peekable + 'a>>, diff --git a/core-rust/state-manager/src/staging/result.rs b/core-rust/state-manager/src/staging/result.rs index a2aaaf3df3..2c4b540fcb 100644 --- a/core-rust/state-manager/src/staging/result.rs +++ b/core-rust/state-manager/src/staging/result.rs @@ -65,6 +65,7 @@ use super::ReadableStateTreeStore; use crate::accumulator_tree::storage::{ReadableAccuTreeStore, TreeSlice, WriteableAccuTreeStore}; +use crate::engine_prelude::*; use crate::protocol::{ProtocolState, ProtocolVersionName}; use crate::staging::epoch_handling::EpochAwareAccuTreeFactory; use crate::transaction::LedgerTransactionHash; @@ -74,29 +75,13 @@ use crate::{ NextEpoch, PartitionChangeAction, ReceiptTreeHash, StateHash, StateVersion, SubstateChangeAction, SubstateReference, TransactionTreeHash, }; -use radix_engine::blueprints::consensus_manager::EpochChangeEvent; -use radix_engine::blueprints::resource::{FungibleVaultBalanceFieldSubstate, FungibleVaultField}; -use radix_engine::transaction::{ - AbortResult, BalanceChange, CommitResult, CostingParameters, RejectResult, - TransactionFeeSummary, TransactionReceipt, TransactionResult, -}; -use radix_engine_interface::prelude::*; use crate::staging::ReadableStore; -use radix_engine::track::{ - BatchPartitionStateUpdate, NodeStateUpdates, PartitionStateUpdates, StateUpdates, -}; - use crate::staging::node_ancestry_resolver::NodeAncestryResolver; use crate::staging::overlays::{MapSubstateNodeAncestryStore, StagedSubstateNodeAncestryStore}; use crate::store::traits::{KeyedSubstateNodeAncestryRecord, SubstateNodeAncestryStore}; use node_common::utils::IsAccountExt; -use radix_engine_store_interface::db_key_mapper::*; -use radix_engine_store_interface::interface::*; -use radix_engine_stores::hash_tree::tree_store::*; -use radix_engine_stores::hash_tree::*; -use transaction::prelude::TransactionCostingParameters; pub enum ProcessedTransactionReceipt { Commit(ProcessedCommitResult), diff --git a/core-rust/state-manager/src/staging/stage_tree.rs b/core-rust/state-manager/src/staging/stage_tree.rs index ecba0c2e99..49c7d08bab 100644 --- a/core-rust/state-manager/src/staging/stage_tree.rs +++ b/core-rust/state-manager/src/staging/stage_tree.rs @@ -62,9 +62,7 @@ * permissions under this License. */ -use radix_engine::types::*; - -use sbor::rust::vec::Vec; +use crate::engine_prelude::*; use slotmap::{new_key_type, SlotMap}; new_key_type! { @@ -309,9 +307,8 @@ impl> StageTree { #[cfg(test)] mod tests { use super::*; - use radix_engine::types::rust::iter::zip; - use sbor::rust::collections::HashMap; - use sbor::rust::vec::Vec; + + use std::iter::zip; struct TestDelta(Vec<(u8, u32)>); diff --git a/core-rust/state-manager/src/state_computer.rs b/core-rust/state-manager/src/state_computer.rs index c791af2152..f2ac086b7d 100644 --- a/core-rust/state-manager/src/state_computer.rs +++ b/core-rust/state-manager/src/state_computer.rs @@ -71,16 +71,11 @@ use crate::store::traits::*; use crate::transaction::*; use crate::types::{CommitRequest, PrepareRequest, PrepareResult}; use crate::*; -use ::transaction::errors::TransactionValidationError; -use ::transaction::model::{IntentHash, NotarizedTransactionHash}; -use ::transaction::prelude::*; use node_common::config::limits::VertexLimitsConfig; -use radix_engine::system::bootstrap::*; -use radix_engine::transaction::TransactionReceipt; -use radix_engine_interface::blueprints::consensus_manager::{ - ConsensusManagerConfig, EpochChangeCondition, -}; +use crate::engine_prelude::*; +use ::transaction::model::PrepareError; // disambiguation needed because of a wide prelude + use transaction_scenarios::scenario::DescribedAddress as ScenarioDescribedAddress; use transaction_scenarios::scenario::*; use transaction_scenarios::scenarios::*; @@ -556,7 +551,7 @@ where intent_hash, notarized_transaction_hash, invalid_at_epoch, - rejection_reason: Some(RejectionReason::ValidationError( + rejection_reason: Some(MempoolRejectionReason::ValidationError( error.into_user_validation_error(), )), }); @@ -639,7 +634,7 @@ where intent_hash, notarized_transaction_hash, invalid_at_epoch, - rejection_reason: Some(RejectionReason::FromExecution(Box::new( + rejection_reason: Some(MempoolRejectionReason::FromExecution(Box::new( result.reason, ))), }); @@ -1459,13 +1454,14 @@ struct PendingTransactionResult { pub intent_hash: IntentHash, pub notarized_transaction_hash: NotarizedTransactionHash, pub invalid_at_epoch: Epoch, - pub rejection_reason: Option, + pub rejection_reason: Option, } #[cfg(test)] mod tests { use std::ops::Deref; + use crate::engine_prelude::*; use crate::transaction::{LedgerTransaction, RoundUpdateTransactionV1}; use crate::{ LedgerProof, PrepareRequest, PrepareResult, RoundHistory, StateManager, StateManagerConfig, @@ -1474,11 +1470,7 @@ mod tests { use node_common::locks::LockFactory; use node_common::scheduler::Scheduler; use prometheus::Registry; - use radix_engine_common::prelude::NetworkDefinition; - use radix_engine_common::types::{Epoch, Round}; use tempfile::TempDir; - use transaction::builder::ManifestBuilder; - use transaction::prelude::*; // TODO: maybe move/refactor testing infra as we add more Rust tests fn build_unit_test_round_history(proof: &LedgerProof) -> RoundHistory { diff --git a/core-rust/state-manager/src/state_manager.rs b/core-rust/state-manager/src/state_manager.rs index bf837e94a3..9fb95f071f 100644 --- a/core-rust/state-manager/src/state_manager.rs +++ b/core-rust/state-manager/src/state_manager.rs @@ -66,15 +66,7 @@ use std::ops::Deref; use std::sync::Arc; use std::time::Duration; -use node_common::scheduler::{Metrics, Scheduler, Spawner, Tracker}; -use node_common::{ - config::{limits::VertexLimitsConfig, MempoolConfig}, - locks::*, -}; -use prometheus::Registry; - -use radix_engine_common::prelude::*; - +use crate::engine_prelude::*; use crate::jni::LedgerSyncLimitsConfig; use crate::protocol::{ProtocolConfig, ProtocolState, ProtocolVersionName}; use crate::store::jmt_gc::StateHashTreeGcConfig; @@ -92,6 +84,12 @@ use crate::{ transaction::{CachedCommittabilityValidator, CommittabilityValidator, TransactionPreviewer}, PendingTransactionResultCache, ProtocolUpdateResult, StateComputer, }; +use node_common::scheduler::{Metrics, Scheduler, Spawner, Tracker}; +use node_common::{ + config::{limits::VertexLimitsConfig, MempoolConfig}, + locks::*, +}; +use prometheus::Registry; /// An interval between time-intensive measurement of raw DB metrics. /// Some of our raw DB metrics take ~a few milliseconds to collect. We cannot afford the overhead of diff --git a/core-rust/state-manager/src/store/codecs.rs b/core-rust/state-manager/src/store/codecs.rs index 3cc0d1903e..ca5c44751d 100644 --- a/core-rust/state-manager/src/store/codecs.rs +++ b/core-rust/state-manager/src/store/codecs.rs @@ -66,10 +66,7 @@ use std::ops::Range; use crate::StateVersion; -use radix_engine::types::*; -use radix_engine_store_interface::interface::*; -use radix_engine_stores::hash_tree::tree_store::{encode_key, NodeKey}; - +use crate::engine_prelude::*; use crate::store::traits::scenario::ScenarioSequenceNumber; use crate::store::typed_cf_api::*; use crate::transaction::RawLedgerTransaction; diff --git a/core-rust/state-manager/src/store/db.rs b/core-rust/state-manager/src/store/db.rs index 0b257ae8b5..2003a3310e 100644 --- a/core-rust/state-manager/src/store/db.rs +++ b/core-rust/state-manager/src/store/db.rs @@ -68,20 +68,13 @@ use crate::transaction::LedgerTransactionHash; use std::path::PathBuf; use crate::accumulator_tree::storage::{ReadableAccuTreeStore, TreeSlice}; +use crate::engine_prelude::*; use crate::query::TransactionIdentifierLoader; use crate::{ CommittedTransactionIdentifiers, LedgerHashes, ReceiptTreeHash, StateVersion, TransactionTreeHash, }; use enum_dispatch::enum_dispatch; -use radix_engine_common::network::NetworkDefinition; -use radix_engine_store_interface::interface::{ - DbPartitionKey, DbSortKey, DbSubstateValue, PartitionEntry, SubstateDatabase, -}; -use transaction::model::*; - -use radix_engine_stores::hash_tree::tree_store::{NodeKey, ReadableTreeStore, TreeNode}; -use sbor::{Categorize, Decode, Encode}; #[derive(Debug, Categorize, Encode, Decode, Clone)] pub struct DatabaseBackendConfig { diff --git a/core-rust/state-manager/src/store/jmt_gc.rs b/core-rust/state-manager/src/store/jmt_gc.rs index 42af1994b1..95268966c3 100644 --- a/core-rust/state-manager/src/store/jmt_gc.rs +++ b/core-rust/state-manager/src/store/jmt_gc.rs @@ -62,10 +62,7 @@ * permissions under this License. */ -use radix_engine::types::{Categorize, Decode, Encode}; -use radix_engine_stores::hash_tree::tree_store::{ - NodeKey, ReadableTreeStore, StaleTreePart, TreeChildEntry, TreeNode, -}; +use crate::engine_prelude::*; use std::iter; use std::ops::Deref; use std::sync::Arc; @@ -260,13 +257,6 @@ fn recurse_children_and_append_parent<'s, S: ReadableTreeStore + 's>( mod tests { use super::*; - use radix_engine::types::indexmap::indexmap; - use radix_engine_store_interface::interface::{ - DatabaseUpdate, DatabaseUpdates, DbSortKey, NodeDatabaseUpdates, PartitionDatabaseUpdates, - }; - use radix_engine_stores::hash_tree::put_at_next_version; - use radix_engine_stores::hash_tree::tree_store::{NibblePath, TypedInMemoryTreeStore}; - use utils::prelude::{index_set_new, IndexSet}; #[test] fn iterates_substates_from_deleted_partition_in_dfs_order() { diff --git a/core-rust/state-manager/src/store/proofs_gc.rs b/core-rust/state-manager/src/store/proofs_gc.rs index 21367881f2..d62a8b2c2a 100644 --- a/core-rust/state-manager/src/store/proofs_gc.rs +++ b/core-rust/state-manager/src/store/proofs_gc.rs @@ -62,9 +62,7 @@ * permissions under this License. */ -use radix_engine::types::{Categorize, Decode, Encode}; - -use radix_engine_common::types::Epoch; +use crate::engine_prelude::*; use std::sync::Arc; use std::time::Duration; use tracing::{error, info}; @@ -312,6 +310,7 @@ impl ProofPruneRange { #[cfg(test)] mod tests { + use crate::engine_prelude::*; use crate::jni::LedgerSyncLimitsConfig; use crate::proofs_gc::{LedgerProofsGc, LedgerProofsGcConfig}; use crate::protocol::*; @@ -322,10 +321,6 @@ mod tests { use node_common::locks::LockFactory; use node_common::scheduler::Scheduler; use prometheus::Registry; - use radix_engine_common::prelude::*; - use radix_engine_interface::blueprints::consensus_manager::{ - ConsensusManagerConfig, EpochChangeCondition, - }; use std::time::Duration; #[test] diff --git a/core-rust/state-manager/src/store/rocks_db.rs b/core-rust/state-manager/src/store/rocks_db.rs index f0f7c8db4a..34563ab7b6 100644 --- a/core-rust/state-manager/src/store/rocks_db.rs +++ b/core-rust/state-manager/src/store/rocks_db.rs @@ -65,6 +65,7 @@ use std::collections::HashSet; use std::fmt; +use crate::engine_prelude::*; use crate::store::traits::*; use crate::{ CommittedTransactionIdentifiers, LedgerProof, LedgerProofOrigin, LedgerTransactionReceipt, @@ -73,16 +74,8 @@ use crate::{ VersionedLedgerProof, VersionedLedgerTransactionReceipt, VersionedLocalTransactionExecution, }; use node_common::utils::IsAccountExt; -use radix_engine::types::*; -use radix_engine_stores::hash_tree::tree_store::{ - NodeKey, ReadableTreeStore, TreeNode, VersionedTreeNode, -}; use rocksdb::{ColumnFamilyDescriptor, Direction, Options, DB}; -use transaction::model::*; - -use radix_engine_store_interface::interface::*; -use radix_engine_store_interface::db_key_mapper::{DatabaseKeyMapper, SpreadPrefixKeyMapper}; use std::path::PathBuf; use tracing::{error, info, warn}; diff --git a/core-rust/state-manager/src/store/traits.rs b/core-rust/state-manager/src/store/traits.rs index 8af821954c..191a7d1e6c 100644 --- a/core-rust/state-manager/src/store/traits.rs +++ b/core-rust/state-manager/src/store/traits.rs @@ -65,6 +65,7 @@ use std::cmp::Ordering; use std::iter::Peekable; +use crate::engine_prelude::*; use crate::staging::StateHashTreeDiff; use crate::store::StateManagerDatabase; use crate::transaction::*; @@ -72,14 +73,10 @@ use crate::{CommittedTransactionIdentifiers, LedgerProof, LocalTransactionReceip pub use commit::*; use enum_dispatch::enum_dispatch; pub use proofs::*; -use radix_engine_common::{Categorize, Decode, Encode}; pub use substate::*; pub use transactions::*; pub use vertex::*; -use radix_engine::types::{ScryptoCategorize, ScryptoDecode, ScryptoEncode}; -use sbor::define_single_versioned; - #[derive(Debug, Clone)] pub enum DatabaseConfigValidationError { AccountChangeIndexRequiresLocalTransactionExecutionIndex, @@ -177,13 +174,9 @@ pub mod vertex { pub mod substate { use super::*; - use radix_engine_common::types::NodeId; use std::slice; use crate::SubstateReference; - pub use radix_engine_store_interface::interface::{ - CommittableSubstateDatabase, SubstateDatabase, - }; /// A low-level storage of [`SubstateNodeAncestryRecord`]. /// API note: this trait defines a simple "get by ID" method, and also a performance-driven @@ -296,7 +289,6 @@ pub mod transactions { } pub mod proofs { - use radix_engine_common::types::Epoch; use super::*; @@ -369,11 +361,6 @@ pub mod commit { use crate::accumulator_tree::storage::TreeSlice; use crate::{ReceiptTreeHash, StateVersion, TransactionTreeHash}; - use radix_engine_store_interface::interface::{ - DatabaseUpdate, DatabaseUpdates, NodeDatabaseUpdates, PartitionDatabaseUpdates, - }; - use radix_engine_stores::hash_tree::tree_store::{NodeKey, StaleTreePart, TreeNode}; - pub struct CommitBundle { pub transactions: Vec, pub proof: LedgerProof, @@ -537,8 +524,6 @@ pub mod commit { pub mod scenario { use super::*; - use transaction::model::IntentHash; - pub type ScenarioSequenceNumber = u32; define_single_versioned! { @@ -584,8 +569,6 @@ pub mod scenario { pub mod extensions { use super::*; - use radix_engine::types::GlobalAddress; - use radix_engine_common::network::NetworkDefinition; #[enum_dispatch] pub trait AccountChangeIndexExtension { @@ -673,8 +656,6 @@ pub mod measurement { pub mod gc { use super::*; use crate::LedgerHeader; - use radix_engine_common::types::Epoch; - use radix_engine_stores::hash_tree::tree_store::NodeKey; /// A storage API tailored for the [`StateHashTreeGc`]. #[enum_dispatch] diff --git a/core-rust/state-manager/src/store/typed_cf_api.rs b/core-rust/state-manager/src/store/typed_cf_api.rs index 568da182c7..70e0e0f42c 100644 --- a/core-rust/state-manager/src/store/typed_cf_api.rs +++ b/core-rust/state-manager/src/store/typed_cf_api.rs @@ -62,8 +62,8 @@ * permissions under this License. */ +use crate::engine_prelude::*; use itertools::Itertools; -use radix_engine::types::*; use rocksdb::{ColumnFamily, Direction, IteratorMode, WriteBatch, DB}; use std::ops::Range; diff --git a/core-rust/state-manager/src/test/mod.rs b/core-rust/state-manager/src/test/mod.rs index eca3faf2da..de250c701e 100644 --- a/core-rust/state-manager/src/test/mod.rs +++ b/core-rust/state-manager/src/test/mod.rs @@ -1,11 +1,10 @@ +use crate::engine_prelude::*; use crate::query::TransactionIdentifierLoader; use crate::traits::QueryableProofStore; use crate::{ CommitRequest, CommitSummary, LedgerHeader, LedgerProof, LedgerProofOrigin, PrepareRequest, PrepareResult, RoundHistory, StateManager, }; -use radix_engine_common::crypto::Hash; -use radix_engine_common::prelude::{Epoch, Round}; /// A bunch of test utils diff --git a/core-rust/state-manager/src/transaction/executable_logic.rs b/core-rust/state-manager/src/transaction/executable_logic.rs index 44fdf21006..663b23b571 100644 --- a/core-rust/state-manager/src/transaction/executable_logic.rs +++ b/core-rust/state-manager/src/transaction/executable_logic.rs @@ -1,25 +1,13 @@ -use radix_engine::system::bootstrap::FlashReceipt; -use radix_engine::system::system_db_reader::SystemDatabaseReader; -use radix_engine::track::StateUpdates; -use radix_engine::transaction::{ - execute_transaction, CommitResult, CostingParameters, ExecutionConfig, SubstateSchemaMapper, - SystemStructure, TransactionOutcome, TransactionReceipt, -}; -use radix_engine::vm::wasm::DefaultWasmEngine; -use radix_engine::vm::{DefaultNativeVm, ScryptoVm, Vm}; -use radix_engine_common::network::NetworkDefinition; +use crate::engine_prelude::*; +// disambiguation needed because of a wide prelude + +use crate::LoggingConfig; use std::collections::HashMap; -use std::time::{Duration, Instant}; -use radix_engine_interface::*; -use radix_engine_store_interface::interface::SubstateDatabase; +use std::time::{Duration, Instant}; use tracing::warn; -use crate::LoggingConfig; -use transaction::model::*; -use utils::prelude::index_map_new; - use super::ValidatedLedgerTransaction; /// A logic of an already-validated transaction, ready to be executed against an arbitrary state of diff --git a/core-rust/state-manager/src/transaction/ledger_transaction.rs b/core-rust/state-manager/src/transaction/ledger_transaction.rs index 0770cd7198..c0e4538d6b 100644 --- a/core-rust/state-manager/src/transaction/ledger_transaction.rs +++ b/core-rust/state-manager/src/transaction/ledger_transaction.rs @@ -1,13 +1,7 @@ -use radix_engine::system::bootstrap::create_substate_flash_for_genesis; - -use radix_engine::track::StateUpdates; - -use radix_engine_interface::api::node_modules::auth::AuthAddresses; -use radix_engine_interface::prelude::*; +use crate::engine_prelude::*; +use ::transaction::model::PrepareError; // disambiguation needed because of a wide prelude use crate::transaction::{ConfigType, ConfiguredExecutable}; -use transaction::define_raw_transaction_payload; -use transaction::prelude::*; use super::{ HasRoundUpdateTransactionHash, PreparedRoundUpdateTransactionV1, RoundUpdateTransactionHash, diff --git a/core-rust/state-manager/src/transaction/preview.rs b/core-rust/state-manager/src/transaction/preview.rs index 7aace47232..b9ce02136f 100644 --- a/core-rust/state-manager/src/transaction/preview.rs +++ b/core-rust/state-manager/src/transaction/preview.rs @@ -1,6 +1,5 @@ +use crate::engine_prelude::*; use node_common::locks::{RwLock, StateLock}; -use radix_engine::transaction::{PreviewError, TransactionReceipt, TransactionResult}; -use radix_engine_store_interface::db_key_mapper::SpreadPrefixKeyMapper; use std::ops::{Deref, Range}; use std::sync::Arc; @@ -11,11 +10,6 @@ use crate::transaction::*; use crate::{ GlobalBalanceSummary, LedgerHeader, LedgerStateChanges, PreviewRequest, ProcessedCommitResult, }; -use radix_engine_common::prelude::*; -use transaction::model::*; -use transaction::prelude::Secp256k1PrivateKey; -use transaction::validation::NotarizedTransactionValidator; -use transaction::validation::ValidationConfig; /// A transaction preview runner. pub struct TransactionPreviewer { @@ -132,12 +126,11 @@ impl Trans #[cfg(test)] mod tests { + use crate::engine_prelude::*; use crate::{PreviewRequest, StateManager, StateManagerConfig}; use node_common::locks::LockFactory; use node_common::scheduler::Scheduler; use prometheus::Registry; - use transaction::builder::ManifestBuilder; - use transaction::model::{MessageV1, PreviewFlags}; #[test] fn test_preview_processed_substate_changes() { diff --git a/core-rust/state-manager/src/transaction/round_update_transaction.rs b/core-rust/state-manager/src/transaction/round_update_transaction.rs index b4b40e35ef..369b1b5470 100644 --- a/core-rust/state-manager/src/transaction/round_update_transaction.rs +++ b/core-rust/state-manager/src/transaction/round_update_transaction.rs @@ -1,10 +1,7 @@ -use radix_engine::types::*; +use crate::engine_prelude::*; +use ::transaction::model::PrepareError; // disambiguation needed because of a wide prelude use crate::{LedgerHeader, RoundHistory, ValidatorId}; -use radix_engine_interface::api::node_modules::auth::AuthAddresses; -use radix_engine_interface::blueprints::consensus_manager::*; -use sbor::FixedEnumVariant; -use transaction::{define_raw_transaction_payload, model::*}; #[derive(Debug, Clone, Categorize, Encode, Decode, PartialEq, Eq)] pub struct RoundUpdateTransactionV1 { diff --git a/core-rust/state-manager/src/transaction/series_execution.rs b/core-rust/state-manager/src/transaction/series_execution.rs index 93d4759fe8..3c54dcc18c 100644 --- a/core-rust/state-manager/src/transaction/series_execution.rs +++ b/core-rust/state-manager/src/transaction/series_execution.rs @@ -71,9 +71,8 @@ use crate::store::traits::*; use crate::transaction::*; use crate::*; -use ::transaction::prelude::*; +use crate::engine_prelude::*; use node_common::locks::{Mutex, RwLock}; -use radix_engine::blueprints::consensus_manager::EpochChangeEvent; /// An internal delegate for executing a series of consecutive transactions while tracking their /// progress. diff --git a/core-rust/state-manager/src/transaction/validation.rs b/core-rust/state-manager/src/transaction/validation.rs index 2b0053f25a..6ca0ef04e9 100644 --- a/core-rust/state-manager/src/transaction/validation.rs +++ b/core-rust/state-manager/src/transaction/validation.rs @@ -2,24 +2,19 @@ use node_common::locks::{RwLock, StateLock}; use std::ops::Deref; use std::sync::Arc; use std::time::SystemTime; -use transaction::errors::TransactionValidationError; -use radix_engine::transaction::{AbortReason, RejectResult, TransactionReceipt, TransactionResult}; - -use radix_engine_common::network::NetworkDefinition; +use crate::engine_prelude::*; +use ::transaction::model::PrepareError; // disambiguation needed because of a wide prelude use crate::query::StateManagerSubstateQueries; use crate::staging::ReadableStore; use crate::store::traits::{QueryableProofStore, TransactionIndex}; use crate::transaction::{ExecutionConfigurator, TransactionLogic}; use crate::{ - AlreadyCommittedError, AtState, ExecutionRejectionReason, PendingTransactionRecord, - PendingTransactionResultCache, RejectionReason, TransactionAttempt, + AlreadyCommittedError, AtState, ExecutionRejectionReason, MempoolRejectionReason, + PendingTransactionRecord, PendingTransactionResultCache, TransactionAttempt, }; -use transaction::prelude::*; -use transaction::validation::*; - use super::{ LedgerTransaction, PreparedLedgerTransaction, PreparedLedgerTransactionInner, RawLedgerTransaction, ValidatedLedgerTransaction, ValidatedLedgerTransactionInner, @@ -236,16 +231,20 @@ where .expect("transaction of a state version obtained from an index"); return TransactionAttempt { - rejection: Some(RejectionReason::AlreadyCommitted(AlreadyCommittedError { - notarized_transaction_hash: transaction.prepared.notarized_transaction_hash(), - committed_state_version: state_version, - committed_notarized_transaction_hash: *committed_transaction_identifiers - .payload - .typed - .user() - .expect("non-user transaction located by intent hash") - .notarized_transaction_hash, - })), + rejection: Some(MempoolRejectionReason::AlreadyCommitted( + AlreadyCommittedError { + notarized_transaction_hash: transaction + .prepared + .notarized_transaction_hash(), + committed_state_version: state_version, + committed_notarized_transaction_hash: *committed_transaction_identifiers + .payload + .typed + .user() + .expect("non-user transaction located by intent hash") + .notarized_transaction_hash, + }, + )), against_state: AtState::Committed { state_version: executed_at_state_version, }, @@ -265,7 +264,7 @@ where transaction.prepared.intent_hash() ); } - Err(RejectionReason::FromExecution(Box::new(reason))) + Err(MempoolRejectionReason::FromExecution(Box::new(reason))) } TransactionResult::Commit(..) => Ok(()), TransactionResult::Abort(abort_result) => { @@ -289,7 +288,7 @@ where &self, root_store: &S, transaction: &ValidatedNotarizedTransactionV1, - ) -> TransactionReceipt { + ) -> TransactionReceiptV1 { self.execution_configurator .read() .wrap_pending_transaction(transaction) @@ -456,7 +455,7 @@ where Err(validation_error) => { // The transaction is statically invalid let attempt = TransactionAttempt { - rejection: Some(RejectionReason::ValidationError(validation_error)), + rejection: Some(MempoolRejectionReason::ValidationError(validation_error)), against_state: AtState::Static, timestamp: current_time, }; diff --git a/core-rust/state-manager/src/types.rs b/core-rust/state-manager/src/types.rs index 75ef264e9d..f334c5fbfa 100644 --- a/core-rust/state-manager/src/types.rs +++ b/core-rust/state-manager/src/types.rs @@ -63,17 +63,15 @@ */ use crate::accumulator_tree::IsMerklizableHash; +use crate::engine_prelude::*; use crate::protocol::ProtocolVersionName; use crate::transaction::*; use crate::{LedgerTransactionOutcome, PartitionChange, SubstateChange}; -use radix_engine::types::*; -use radix_engine_common::prelude::IsHash; use std::fmt; use std::fmt::Formatter; use std::mem::size_of; use std::num::TryFromIntError; use std::ops::Range; -use transaction::prelude::*; /// A complete ID of a Substate. #[derive(Debug, Clone, Hash, Eq, PartialEq, ScryptoCategorize, ScryptoEncode, ScryptoDecode)]