-
Notifications
You must be signed in to change notification settings - Fork 0
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
[FreshEyes] test: Validate UTXO snapshot with coin height > base height & amount > MAX_MONEY supply #2
base: bitcoin-fresheyes-staging-master-29617
Are you sure you want to change the base?
Conversation
… money_supply You can use this tool to decode the utxo snapshot https://github.com/jrakibi/utxo-live Here’s an overview of how it’s done: The serialization forma for a UTXO in the snapshot is as follows: 1. Transaction ID (txid) - 32 bytes 2. Output Index (outnum)- 4 bytes 3. VARINT (code) - A varible-length integer encoding the height and whether the transaction is a coinbase. The format of this VARINT is (height << 1) | coinbase_flag. 4. VARINT (amount_v) - A variable-length integer that represents a compressed format of the output amount (in satoshis). For the test cases mentioned: * b"\x84\x58" - This value corresponds to a VARINT representing the height and coinbase flag. Once we decode this code, we can extract the height and coinbase using height = code_decoded >> 1 and coinbase = code_decoded & 0x01. In our case, with code_decoded = 728, it results in height = 364 and coinbase = 0. * b"\xCA\xD2\x8F\x5A" - This byte sequence represents a compressed amount value. The decompression function takes this value and translates it into a full amount in satoshis. In our case, the decompression of this amount translates to a number larger than the maximum allowed value of coins (21 million BTC) test:Validate UTXO snapshot with coin_height > base_height & amount > money_supply test:Validate UTXO snapshot with coin_height > base_height & amount > money_supply
An author commented here with:
|
An author commented here with:
|
This is an OUTDATED review comment as the original pull request may have been rebased or force-pushed
|
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.
An author reviewed and commented here with:
- comment link
https://github.com/bitcoin/bitcoin/pull/29617#pullrequestreview-1928106989
at 2024/03/11, 15:16:17 UTC.
This is an OUTDATED review comment as the original pull request may have been rebased or force-pushed
|
This is an OUTDATED review comment as the original pull request may have been rebased or force-pushed
|
This is an OUTDATED review comment as the original pull request may have been rebased or force-pushed
|
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.
An author reviewed and commented here with:
- comment link
https://github.com/bitcoin/bitcoin/pull/29617#pullrequestreview-1928222108
at 2024/03/11, 15:58:28 UTC.
An author commented here with:
|
This is an OUTDATED review comment as the original pull request may have been rebased or force-pushed
|
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.
An author reviewed and commented here with:
- comment link
https://github.com/bitcoin/bitcoin/pull/29617#pullrequestreview-1929052753
at 2024/03/11, 19:54:12 UTC.
This is an OUTDATED review comment as the original pull request may have been rebased or force-pushed
|
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.
An author reviewed and commented here with:
- comment link
https://github.com/bitcoin/bitcoin/pull/29617#pullrequestreview-1929073517
at 2024/03/11, 20:00:01 UTC.
An author commented here with:
|
An author commented here with:
|
An author commented here with:
|
This is an OUTDATED review comment as the original pull request may have been rebased or force-pushed
|
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.
An author reviewed and approved here with:
- comment link
https://github.com/bitcoin/bitcoin/pull/29617#pullrequestreview-2000245020
at 2024/04/15, 07:48:30 UTC.
This is an OUTDATED review comment as the original pull request may have been rebased or force-pushed
|
This is an OUTDATED review comment as the original pull request may have been rebased or force-pushed
|
This is an OUTDATED review comment as the original pull request may have been rebased or force-pushed
|
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.
An author reviewed and commented here with:
- comment link
https://github.com/bitcoin/bitcoin/pull/29617#pullrequestreview-2000312610
at 2024/04/15, 08:33:10 UTC.
This is an OUTDATED review comment as the original pull request may have been rebased or force-pushed
|
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.
An author reviewed and commented here with:
- comment link
https://github.com/bitcoin/bitcoin/pull/29617#pullrequestreview-2014792959
at 2024/04/22, 13:39:16 UTC.
An author commented here with:
|
This is an OUTDATED review comment as the original pull request may have been rebased or force-pushed
|
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.
An author reviewed and commented here with:
- comment link
https://github.com/bitcoin/bitcoin/pull/29617#pullrequestreview-2015164071
at 2024/04/22, 16:53:01 UTC.
This is an OUTDATED review comment as the original pull request may have been rebased or force-pushed
|
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.
An author reviewed and commented here with:
- comment link
https://github.com/bitcoin/bitcoin/pull/29617#pullrequestreview-2015956968
at 2024/04/22, 23:28:19 UTC.
An author commented here with:
|
An author commented here with:
|
An author commented here with:
|
The author jrakibi wrote the following PR called test: Validate UTXO snapshot with coin height > base height & amount > MAX_MONEY supply, issue number 29617 in bitcoin/bitcoin cloned by FreshEyes below:
Ensure snapshot loading fails for coins exceeding base height
Objective: This test verifies that snapshot loading is correctly rejected for coins with a height greater than the base height.
Update:
test_invalid_snapshot_wrong_coin_code
tofeature_assumeutxo.py
.This implementation addresses the request for enhancing
assumeutxo
testing as outlined in issue#28648
Edit: This is an explanation on how I arrive at content values: b"\x84\x58" and b"\xCA\xD2\x8F\x5A"
You can use this tool to decode the utxo snapshot
https://github.com/jrakibi/utxo-live
Here’s an overview of how it’s done:
The serialization format for a UTXO in the snapshot is as follows:
For the test cases mentioned:
b"\x84\x58"
- This value corresponds to a VARINT representing the height and coinbase flag. Once we decode this code, we can extract the height and coinbase usingheight = code_decoded >> 1
andcoinbase = code_decoded & 0x01
. In our case, with code_decoded = 728, it results inheight = 364
andcoinbase = 0
.b"\xCA\xD2\x8F\x5A"
- This byte sequence represents a compressed amount value. The decompression function takes this value and translates it into a full amount in satoshis. In our case, the decompression of this amount translates to a number larger than the maximum allowed value of coins (21 million BTC)