Page MenuHomePhabricator

[WIP] Introduce block size policy interface
AbandonedPublic

Authored by dagurval on Jul 28 2017, 01:03.

Details

Reviewers
deadalnix
Group Reviewers
Restricted Project
Summary

Allows implementing different strategies for calculating the maximum block size limit.

BIP101 block size policy

Test Plan

This is WIP. The BIP101 code is untested. This diff is for presenting the concept of multiple block size policies and requesting feedback.

Diff Detail

Repository
rABC Bitcoin ABC
Branch
ec
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 601
Build 601: arc lint + arc unit

Event Timeline

deadalnix added inline comments.
src/blockencodings.cpp
57

BU uses the vocable "Excessive block size" . I think we should use the same.

src/config.h
16

I'm not sure why this should be a policy itself.

src/init.cpp
1412

bip100 will have to go in another diff.

src/policy/blocksizepolicy.h
23

This isn't a very good API overall. See https://pragprog.com/articles/tell-dont-ask

This class should also be non copyable. Maybe prefix with an I to explicit this is actually an interface.

src/test/config_tests.cpp
16

You mark this static instead of using an anonymous namespace (the semantic is the same).

25

It's unclear what's throwing here. Just have a test for the construction of StaticBlockSize .

This I think is missing the key feature we want: being able to reconsider a block that goes over the limit when some condition is reached.

deadalnix requested changes to this revision.Jul 31 2017, 14:32
This revision now requires changes to proceed.Jul 31 2017, 14:32
src/blockencodings.cpp
57

This is not the same as Excessive block size.

For example BU has AD, where blocks exceed excessive block size. BU nodes still have DoS limit though, which if I remember correctly is EB * 10.

src/config.h
16

Because, currently, it wraps the API anyway. Inheriting the interface has two upsides:

  • It allows you to pass on Config as a BlockSizePolicy reference if that's the only methods you need to access.
  • Ensures the interfaces stay the same.
src/init.cpp
1412

Agree. I wanted it in this WIP as a proof of concept for review.