Page MenuHomePhabricator

[electrum] implement eMPP parsing
ClosedPublic

Authored by PiRK on Thu, Mar 6, 16:41.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC3e0722f77bc2: [electrum] implement eMPP parsing
Summary

Depends on D17558

Test Plan

python test_runner.py

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PiRK requested review of this revision.Thu, Mar 6, 16:41

add tests for incorrect data length in otherwise valid succession of push ops

electrum/electrumabc/transaction.py
788 ↗(On Diff #52950)

OpCodes is an IntEnum, so in theory it is already an alias for int. But various code quality tools will not be happy if we pass an int instead of one of the enum values without this change, and some push opcodes (17 to 0x4e) are not explicitly listed.

electrum/electrumabc/transaction.py
788 ↗(On Diff #52950)

correction: 0x01 to 0x4B (push n bytes, with 1 <= n <= 0x4B)

Fabien requested changes to this revision.Fri, Mar 7, 10:19
Fabien added a subscriber: Fabien.
Fabien added inline comments.
electrum/electrumabc/tokens/empp.py
52 ↗(On Diff #52950)

min_data_size of 2 is excluding 0x01 which is fine (single byte push)

This revision now requires changes to proceed.Fri, Mar 7, 10:19

support opcode 0x01, write more tests, find out that the op == OpCodes.OP_PUSHDATA4 branch is wrong, fix it

electrum/electrumabc/tests/test_empp.py
19 ↗(On Diff #52963)

this is minimally encoded as OP_2

This revision is now accepted and ready to land.Fri, Mar 7, 15:26
This revision was automatically updated to reflect the committed changes.