Skip to content

Conversation

@fanquake
Copy link
Member

@fanquake fanquake commented Apr 27, 2020

16101de: Per BIP 141, the witness commitment structure is at least 38 bytes,
OP_RETURN (0x6a) + 36 (0x24) + 4 byte header (0xaa21a9ed) + 32 byte
SHA256 hash. It can be longer, however any additional data has no
consensus meaning.

54f8c48: As per BIP 141, if there is more than 1 pubkey that matches the witness
commitment structure, the one with the highest output index should be
chosen. This adds a sanity check that we are doing that, which will fail
if anyone tries to "optimize" GetWitnessCommitmentIndex() by returning
early.

@fanquake fanquake requested a review from sipa April 27, 2020 05:50
Copy link
Member

@maflcko maflcko left a comment

Choose a reason for hiding this comment

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

Concept ACK. Thanks for adding the test.

@DrahtBot
Copy link
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

Copy link
Contributor

@ajtowns ajtowns left a comment

Choose a reason for hiding this comment

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

ACK a9db322e017281811e5039c80cd3114c5025ee27

Copy link
Member

@maflcko maflcko left a comment

Choose a reason for hiding this comment

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

ACK, only style-nits. Feel free to ignore if you don't have to push for other reasons.

Per BIP 141, the witness commitment structure is atleast 38 bytes,
OP_RETURN (0x6a) + 36 (0x24) + 4 byte header (0xaa21a9ed) + 32 byte
SHA256 hash. It can be longer, however any additional data has no
consensus meaning.
As per BIP 141, if there is more than 1 pubkey that matches the witness
commitment structure, the one with the highest output index should be
chosen. This adds a sanity check that we are doing that, which will fail
if anyone trys to "optimise" GetWitnessCommitmentIndex() be returning
early.
@fanquake fanquake force-pushed the minimum_witness_size branch from a9db322 to 692f830 Compare April 29, 2020 03:25
@laanwj
Copy link
Member

laanwj commented Apr 29, 2020

ACK 692f830

@maflcko
Copy link
Member

maflcko commented Apr 29, 2020

ACK 692f830 🌵

Show signature and timestamp

Signature:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

ACK 692f8307fc1449299b90182e7d79efb81a55d7ab 🌵
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUichAwAuEMVEDQF3EgTUf50uRHePnrKLa4HtuTzm7DoVwZYx/7h2WHmnOaFUxNr
WN00g4AnUP98j4bKJIhiy+1MOwBjJKgkG9vk45MUfqy2ULU2YlP1mJyfaQOIL+3g
pWvKRHIITbYF9+KM0NlF4eTdg+92uhm6Amt3VH6NA410B5gtDHaB4f3uP5814qkl
v/e2jjxTeJQEMqBVXzxd3IsdV/t5kaNX7FQyZcWQr8FPFQtgM03KrA3rX+/0jiLW
Fc+EUxdj1e7ub8d2zyls3fl+DevmNwIDD22tGZoG4+mPvXJ75vlS6CaxDaBFEaeY
sZCQ6ptrhafb25KSwj3gQeTNtsc/GSab+jDMvazp72PgRN4ZkUqM6+E0o6rg9mEt
kohPV9BX85hDblH72pPsd7DAslpUB84/iCUAMLKxvuGTd2uqaLyUsuAs915undbm
t/g5stIrN63anYVBFW9kMb6uA/vdczn6WBO97QfFvCeMPc6ERQ0raRQbF+4COtd6
c59QjzLf
=sydW
-----END PGP SIGNATURE-----

Timestamp of file with hash 1559b3b98f5ec3d13a900bc1b3f63ad4a5ef128875774ede7f164cc133dabb52 -

Copy link
Member

@jonatack jonatack left a comment

Choose a reason for hiding this comment

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

Code review ACK 692f830

Copy link
Contributor

@jnewbery jnewbery left a comment

Choose a reason for hiding this comment

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

utACK 692f830

@ajtowns
Copy link
Contributor

ajtowns commented Apr 30, 2020

ACK 692f830

Copy link
Contributor

@kallewoof kallewoof left a comment

Choose a reason for hiding this comment

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

Code review ACK

@fanquake fanquake merged commit 64673b1 into bitcoin:master Apr 30, 2020
@fanquake fanquake deleted the minimum_witness_size branch May 1, 2020 01:11
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request May 2, 2020
…ment size

692f830 test: add test for witness commitment index (fanquake)
0644254 validation: Add minimum witness commitment size constant (fanquake)

Pull request description:

  bitcoin@16101de: Per [BIP 141](https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#Commitment_structure), the witness commitment structure is at least 38 bytes,
  OP_RETURN (0x6a) + 36 (0x24) + 4 byte header (0xaa21a9ed) + 32 byte
  SHA256 hash. It can be longer, however any additional data has no
  consensus meaning.

  bitcoin@54f8c48: As per BIP 141, if there is more than 1 pubkey that matches the witness
  commitment structure, the one with the highest output index should be
  chosen. This adds a sanity check that we are doing that, which will fail
  if anyone tries to "optimize" GetWitnessCommitmentIndex() by returning
  early.

ACKs for top commit:
  MarcoFalke:
    ACK 692f830 🌵
  jonatack:
    Code review ACK 692f830
  ajtowns:
    ACK 692f830
  jnewbery:
    utACK 692f830
  laanwj:
    ACK 692f830

Tree-SHA512: 7af3fe4b8a52fea2cdd0aec95f7bb935351a77b73d934bc88d6625a3503311b2a062cba5190b2228f97caa76840db3889032d910fc8e318ca8e7810a8afbafa0
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants