Skip to content

Better Bolt 11 parsing spec compliance#1302

Closed
t-bast wants to merge 4 commits into
masterfrom
invoice-pico-amount
Closed

Better Bolt 11 parsing spec compliance#1302
t-bast wants to merge 4 commits into
masterfrom
invoice-pico-amount

Conversation

@t-bast
Copy link
Copy Markdown
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 pm47 and sstone 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
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

pm47 commented Feb 7, 2020

Here is my take: #1308.

@t-bast
Copy link
Copy Markdown
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