8000 fuzz: FlatChainstore targets by Davidson-Souza · Pull Request #529 · vinteumorg/Floresta · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fuzz: FlatChainstore targets #529

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Davidson-Souza
Copy link
Collaborator

What is the purpose of this pull request?

  • Bug fix
  • Documentation update
  • New feature
  • Test
  • Other: New fuzz target

Which crates are being modified?

  • floresta-chain
  • floresta-cli
  • floresta-common
  • floresta-compact-filters
  • floresta-electrum
  • floresta-watch-only
  • floresta-wire
  • floresta
  • florestad
  • Other: fuzz

Description

This commit adds three fuzz targets for FlatChainstore, that makes sure our code memory access is sane. We insert, retrieve headers and reorg the chain to stress multiple code paths and check their soundness.

PSA: These targets were generated by A.I. O.o I was testing some A.I. tool and the end result was actually great, so I've decided to fix some minor problems I've found and make a PR with it.

Copy link
Contributor
@brunoerg brunoerg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add these new fuzz targets in doc/fuzzing.md

@Davidson-Souza Davidson-Souza added enhancement New feature or request fuzz This PR/issue relates to our fuzz testing labels Jun 20, 2025
This commit adds three fuzz targets for `FlatChainstore`, that makes
sure our code memory access is sane. We insert, retrieve headers and reorg the
chain to stress multiple code paths and check their soundness.
@Davidson-Souza
Copy link
Collaborator Author

@brunoerg removed the non-determinism and added the targets to fuzzing.md

@Davidson-Souza Davidson-Souza marked this pull request as ready for review June 23, 2025 20:46

// Create a temporary directory for our chainstore
let mut id: [u8; 4] = [0; 4];
id.copy_from_slice(&data[0..4]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't make sense that way it is playing with data. Instead of consuming it, it's simply accessing it. Note that it's using the same part of data in different places here.

};

// Initialize the chainstore
let mut store = match FlatChainStore::new(config) {
Copy link
Contributor
@brunoerg brunoerg Jun 26, 2025
88AC

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is creating a FlatChainStore from a simple FlatChainStoreConfig (and static?), so we can surely expect it to succeed. In this case, it makes sense to crash when Err?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fuzz This PR/issue relates to our fuzz testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0