Skip to content
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

Better Bolt 11 parsing spec compliance #1302

Closed
wants to merge 4 commits into from
Closed

Conversation

t-bast
Copy link
Member

@t-bast t-bast commented Feb 4, 2020

Add more Bolt 11 spec tests.
Ignore hashed fields with invalid length as the spec requires:

A reader:
    * MUST skip over unknown fields, OR an f field with unknown version, OR p, h, s or n fields that do NOT have data_lengths of 52, 52, 52 or 53, respectively.

See lightning/bolts#699 and lightning/bolts#736.

Correctly implement skipping over hashed tags with invalid length.

See lightning/bolts#736.
@t-bast t-bast requested review from sstone and pm47 February 4, 2020 10:46
@t-bast t-bast changed the title Invoice parsing spec compliance Better Bolt 11 parsing spec compliance Feb 4, 2020
@codecov-io
Copy link

Codecov Report

Merging #1302 into master will increase coverage by 0.83%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #1302      +/-   ##
==========================================
+ Coverage   77.52%   78.35%   +0.83%     
==========================================
  Files         144      144              
  Lines       10098    10756     +658     
  Branches      390      429      +39     
==========================================
+ Hits         7828     8428     +600     
- Misses       2270     2328      +58
Impacted Files Coverage Δ
...scala/fr/acinq/eclair/payment/PaymentRequest.scala 93.03% <100%> (+0.48%) ⬆️
...clair/blockchain/electrum/ElectrumClientPool.scala 78.49% <0%> (-6.46%) ⬇️
...cala/fr/acinq/eclair/db/sqlite/SqliteAuditDb.scala 99.24% <0%> (+0.17%) ⬆️
...r/acinq/eclair/payment/send/PaymentInitiator.scala 96.77% <0%> (+0.22%) ⬆️
...nq/eclair/blockchain/electrum/ElectrumClient.scala 73.64% <0%> (+0.36%) ⬆️
...in/scala/fr/acinq/eclair/api/JsonSerializers.scala 96% <0%> (+0.54%) ⬆️
...c/main/scala/fr/acinq/eclair/channel/Helpers.scala 95.36% <0%> (+0.77%) ⬆️
...c/main/scala/fr/acinq/eclair/payment/Auditor.scala 95.49% <0%> (+1.3%) ⬆️
...r-core/src/main/scala/fr/acinq/eclair/Eclair.scala 55.78% <0%> (+1.75%) ⬆️
...c/main/scala/fr/acinq/eclair/channel/Channel.scala 85.94% <0%> (+2.38%) ⬆️
... and 3 more

@t-bast t-bast requested a review from sstone February 4, 2020 16:47
Copy link
Member

@pm47 pm47 left a comment

Choose a reason for hiding this comment

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

I think I have another idea, will try and let you know.


// @formatter:off
case class UnknownTag0(data: BitVector) extends UnknownTaggedField
case class UnknownTag1(data: BitVector) extends UnknownTaggedField
Copy link
Member

Choose a reason for hiding this comment

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

Nice catch

@pm47
Copy link
Member

pm47 commented Feb 7, 2020

Here is my take: #1308.

@t-bast
Copy link
Member Author

t-bast commented Feb 10, 2020

Closing in favor of #1308

@t-bast t-bast closed this Feb 10, 2020
@t-bast t-bast deleted the invoice-pico-amount branch February 10, 2020 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants