Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#[derive(Debug)] do not work for many types. #1139

Open
yjhmelody opened this issue Mar 1, 2024 · 2 comments
Open

#[derive(Debug)] do not work for many types. #1139

yjhmelody opened this issue Mar 1, 2024 · 2 comments
Labels
good first issue Good for newcomers refactor Refactor of the code

Comments

@yjhmelody
Copy link
Contributor

such as DatabaseComponents/State/StateDBBox.

There is a problem with the current code. Debug needs to be implemented manually, or only if all dependent types have implemented Debug, automatic derivation can be successful.

@rakita
Copy link
Member

rakita commented Mar 2, 2024

Would try to put derive(Debug) and see if ti works

@rakita rakita added the refactor Refactor of the code label Mar 2, 2024
@rakita rakita added the good first issue Good for newcomers label Mar 12, 2024
@developeruche
Copy link
Contributor

Please could you add more context?

#[derive(Debug)]
pub struct DatabaseComponents<S, BH> {
    pub state: S,
    pub block_hash: BH,
}

#[derive(Debug)]
pub struct State<DB> {
    /// Cached state contains both changed from evm execution and cached/loaded account/storages
    /// from database. This allows us to have only one layer of cache where we can fetch data.
    /// Additionally we can introduce some preloading of data from database.
    pub cache: CacheState,
    /// Optional database that we use to fetch data from. If database is not present, we will
    /// return not existing account and storage.
    ///
    /// Note: It is marked as Send so database can be shared between threads.
    pub database: DB,
    /// Block state, it aggregates transactions transitions into one state.
    ///
    /// Build reverts and state that gets applied to the state.
    pub transition_state: Option<TransitionState>,
    /// After block is finishes we merge those changes inside bundle.
    /// Bundle is used to update database and create changesets.
    /// Bundle state can be set on initialization if we want to use preloaded bundle.
    pub bundle_state: BundleState,
    /// Addition layer that is going to be used to fetched values before fetching values
    /// from database.
    ///
    /// Bundle is the main output of the state execution and this allows setting previous bundle
    /// and using its values for execution.
    pub use_preloaded_bundle: bool,
    /// If EVM asks for block hash we will first check if they are found here.
    /// and then ask the database.
    ///
    /// This map can be used to give different values for block hashes if in case
    /// The fork block is different or some blocks are not saved inside database.
    pub block_hashes: BTreeMap<u64, B256>,
}

This debug macro works fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers refactor Refactor of the code
Projects
None yet
Development

No branches or pull requests

3 participants