-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
test: introduce basic unit tests for instantsend #6606
base: develop
Are you sure you want to change the base?
test: introduce basic unit tests for instantsend #6606
Conversation
WalkthroughThe changes introduce a new test file, 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🧰 Additional context used🪛 Cppcheck (2.10-2)src/test/evo_islock_tests.cpp[error] 13-13: There is an unknown macro here somewhere. Configuration is required. If BOOST_AUTO_TEST_SUITE is a macro then please configure it. (unknownMacro) 🪛 GitHub Actions: Clang Diff Format Checksrc/test/evo_islock_tests.cpp[error] 1-1: Clang format differences found. Please run 'clang-format' to fix formatting issues. ⏰ Context from checks skipped due to timeout of 90000ms (3)
🔇 Additional comments (5)
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
// Now add two dummy inputs to the lock | ||
islock.inputs.clear(); | ||
// Construct two dummy outpoints (using uint256S for a dummy hash) | ||
COutPoint op1(uint256S("0x0000000000000000000000000000000000000000000000000000000000000001"), 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: coule use uint256::ONE
and uint256::TWO
here
CHashWriter hw(SER_GETHASH, 0); | ||
hw << std::string_view("islock"); | ||
hw << islock.inputs; | ||
const uint256 expected = hw.GetHash(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: refactor it to a function so far as it is used twice (see below)
BOOST_CHECK_EQUAL(input.n, expectedInputN); | ||
|
||
// Compute the expected request ID: it is the hash of the constant prefix "islock" followed by the inputs. | ||
CHashWriter hw(SER_GETHASH, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: refactor it to a function so far as it is used twice
ss >> islock; | ||
|
||
// Verify the calculated signHash | ||
auto signHash = llmq::BuildSignHash(Consensus::LLMQType::LLMQ_60_75, uint256S(quorumHash), islock.GetRequestId(), islock.txid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's add one more unit test with other quorum type to be sure that this argument is used?
I think a check such as BOOST_CHECK(signHash.ToString() != expectedSignHash)
is enough.
What was done?
Introduce unit tests for some instantsend logic
How Has This Been Tested?
Running tests
Breaking Changes
Checklist:
Go over all the following points, and put an
x
in all the boxes that apply.