stacks-core icon indicating copy to clipboard operation
stacks-core copied to clipboard

AAC: Investigate ChainstateError::InvalidStracksBlocks(String)

Open fdefelici opened this issue 2 months ago • 2 comments

As reported in this discussion https://github.com/stacks-network/stacks-core/pull/6531/files#r2389233969

append_block wraps ChainstateError variant types as String for the variant ChainstateError::InvalidStracksBlocks(String)

An example: https://github.com/stacks-network/stacks-core/blob/fe868ea6a1bf993793f1e09c3d397b5dde49b93d/stackslib/src/chainstate/nakamoto/mod.rs#L4612-L4618

To be understood if this is the right approach, or if it would be better to expose the native errors.

Potentially this kind of change could be consensus breaking.

fdefelici avatar Sep 30 '25 08:09 fdefelici

The inner String is just to be an informative message. I don't think there are any consensus-critical code branches that depend on the message contents.

jcnelson avatar Sep 30 '25 17:09 jcnelson

The inner String is just to be an informative message. I don't think there are any consensus-critical code branches that depend on the message contents.

I think the bigger concern is that we may have consensus critical paths that match on ChainstateError::InvalidStacksBlock rather than ChainstateError::{Error type that was converted to a string and shoved into InvalidStacksBlock}

I.e. it is converting its own error type into itself but as a different variant and perhaps this is because of a code path that ONLY triggers for that specific converted type rather than the original.

Should probably complete https://github.com/stacks-network/stacks-core/issues/6597 before making any changes here.

jferrant avatar Oct 14 '25 12:10 jferrant