Page MenuHomePhabricator

Add a facility to parse and validate script bitfields.
ClosedPublic

Authored by deadalnix on Jul 25 2019, 01:53.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC9364c3a392e7: Add a facility to parse and validate script bitfields.
Summary

As per title. Bitfield are little endian and has a size proportional to the number of bits they represent. The decoder validates that there are no out of bound bits.

Test Plan

Added unit tests.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

deadalnix created this revision.Jul 25 2019, 01:53
Herald added a reviewer: Restricted Project. · View Herald TranscriptJul 25 2019, 01:53
deadalnix updated this revision to Diff 10459.Jul 25 2019, 02:01

Add error messages

Fabien requested changes to this revision.Thu, Jul 25, 07:32
Fabien added a subscriber: Fabien.

The build is failing

src/script/bitfield.cpp
11 ↗(On Diff #10459)

Why do you need size to be signed ?

src/script/bitfield.h
13 ↗(On Diff #10459)

count => size

This revision now requires changes to proceed.Thu, Jul 25, 07:32
deadalnix added inline comments.Thu, Jul 25, 10:35
src/script/bitfield.cpp
11 ↗(On Diff #10459)

Clearly, no.

deadalnix updated this revision to Diff 10465.Thu, Jul 25, 10:38

Make the size unsigned.
count => size

deadalnix updated this revision to Diff 10466.Thu, Jul 25, 10:59

Include stddef to get size_t

Fabien accepted this revision.Thu, Jul 25, 11:42
This revision is now accepted and ready to land.Thu, Jul 25, 11:42
This revision was landed with ongoing or failed builds.Thu, Jul 25, 13:21
This revision was automatically updated to reflect the committed changes.