Page MenuHomePhabricator

Add a facility to parse and validate script bitfields.
ClosedPublic

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

Details

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.Jul 25 2019, 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.Jul 25 2019, 07:32
deadalnix added inline comments.Jul 25 2019, 10:35
src/script/bitfield.cpp
11 ↗(On Diff #10459)

Clearly, no.

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

Make the size unsigned.
count => size

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

Include stddef to get size_t

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