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

TraceContext draft #162

Closed
wants to merge 5 commits into from
Closed

TraceContext draft #162

wants to merge 5 commits into from

Conversation

maciejka
Copy link
Collaborator

@maciejka maciejka commented Sep 9, 2024

Draft of TraceContext. Maintains context which allows to construct more meaningful errors and trace messages.

Initialization:

        let mut context = TraceContextTrait::new();
        context.push(Frame::BlockHeight(block_height));

Errors:

    maturity_result = context
        .err_with_context(
            format!(
                "coinbase input not mature (current height: {}, coinbase height: {})",
                block_height,
                coinbase_block_height
            )
        );

Frame struct is a very rough draft, subject for discussion.

With macros or conditional compilation(to be added later to the prototype) most of the runtime cost can be eliminated for provable(vs test) executions.

Even with macros I don't see a clean way to get rid of explicit context argument. Any ideas? Maybe it is ok to add let's say 5% to the proving cost for current simplicity of the construction?

Copy link

vercel bot commented Sep 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
raito ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 10, 2024 1:03pm

@m-kus
Copy link
Collaborator

m-kus commented Sep 9, 2024

It would be nice to have this kind of inspection provided by the Cairo runtime :)

I wonder what would be the overhead if we replaced the context with an empty struct (Cairo seems to allow that) 🤔
Generally I really like the idea that you print the context only when you got an error, and that the context data kind is somewhat standardized.

Note also, that we will have a mutable context anyways (Utreexo and local cache), so it might not necessarily be an overhead in the end.

@maciejka
Copy link
Collaborator Author

Closing for now, we will probably go simple logging macro route.

@maciejka maciejka closed this Sep 11, 2024
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants