Skip to content

Conversation

jnewbery
Copy link
Contributor

@jnewbery jnewbery commented Sep 7, 2021

These small cleanups to the asmap code are the first 4 commits from #22910. They're minor improvements that are independently useful whether or not 22910 is merged.

This data member was introduced in ec45646 but never used.
SanityCheckASMap(asmap, bits) simply calls through to SanityCheckASMap(asmap)
in util/asmap. Update all callers to simply call that function.
DecopeAsmap is a pure utility function and doesn't have any
dependencies on addrman, so move it to util/asmap.

Reviewer hint: use:

`git diff --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space`
This saves passing around a reference to the asmap std::vector<bool>.
@fanquake
Copy link
Member

fanquake commented Sep 8, 2021

Concept ACK

@naumenkogs
Copy link
Member

ACK 853c4ed

@practicalswift
Copy link
Contributor

Concept ACK

Copy link
Contributor

@theStack theStack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept and code-review ACK 853c4ed 🗺️

An alternative solution in bfdf4ef would be to simply set bits = 128 as default argument for the global SanityCheckASMap function (no need to update callers, deduplicates the magic number).

Copy link
Member

@fanquake fanquake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 853c4ed

@fanquake fanquake merged commit 5446070 into bitcoin:master Sep 10, 2021
@jnewbery jnewbery deleted the 2021-09-asmap-cleanup branch September 10, 2021 07:01
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Sep 11, 2021
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jan 10, 2022
Summary:
This data member was introduced in ec45646de9e but never used.

This is a backport of [[bitcoin/bitcoin#22911 | core#22911]] [1/4]
bitcoin/bitcoin@07a9ecc

Test Plan: `ninja all check-all`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D10779
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jan 10, 2022
Summary:
SanityCheckASMap(asmap, bits) simply calls through to SanityCheckASMap(asmap)
in util/asmap. Update all callers to simply call that function.

This is a backport of [[bitcoin/bitcoin#22911 | core#22911]] [2/4]
bitcoin/bitcoin@bfdf4ef

Depends on D10779

Test Plan: `ninja all check-all`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D10780
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jan 10, 2022
Summary:
DecopeAsmap is a pure utility function and doesn't have any
dependencies on addrman, so move it to util/asmap.

Reviewer hint: use:
`git diff --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space`

This is a backport of [[bitcoin/bitcoin#22911 | core#22911]] [3/4]
bitcoin/bitcoin@9fd5618

Depends on D10780

Test Plan: `ninja all check-all`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D10781
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jan 10, 2022
Summary:
This saves passing around a reference to the asmap std::vector<bool>.

This is a backport of [[bitcoin/bitcoin#22911 | core#22911]] [4/4]
bitcoin/bitcoin@853c4ed

Depends on D10781

Test Plan:
`ninja all check-all`

Compile and run the fuzzer:
```
cmake -GNinja .. -DCMAKE_C_COMPILER=$AFLPATH/afl-clang -DCMAKE_CXX_COMPILER=$AFLPATH/afl-clang++
ninja bitcoin-fuzzers
AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES=1 AFL_SKIP_CPUFREQ=1 ${AFLPATH}/afl-fuzz -i ${DIR_FUZZ_IN}/net -o ${AFLOUT}/net -m250 -- src/test/fuzz/net
```

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D10782
@bitcoin bitcoin locked and limited conversation to collaborators Oct 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants