mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-05 10:42:13 +02:00
Merge bitcoin/bitcoin#28792: build: Embedded ASMap [3/3]: Build binary dump header file
24699fec84doc: Add initial asmap data documentation (Fabian Jahr)bab085d282ci: Use without embedded asmap build option in one ci job (Fabian Jahr)e53934422adoc: Expand documentation on asmap feature and tooling (Fabian Jahr)6244212a55init, net: Implement usage of binary-embedded asmap data (Fabian Jahr)6202b50fb9build: Generate ip_asn.dat.h during build process (Fabian Jahr)634cd60dc8build: Add embedded asmap data (Fabian Jahr) Pull request description: This is the final in a series of PRs that implement the necessary changes for embedding of asmap data into the binary. This last part add the initial asmap data, implements the build changes and adds further documentation. Currently an asmap file needs to be acquired by there user from some location or the user needs to generate one themselves. Then they need to move the file to the right place in datadir or pass the path to the file as `-asmap=PATH` in order to use the asmap feature. The change here allows for builds to embed asmap data into the bitcoind binary which makes it possible to use the feature without handling of the asmap file by the user. If the user starts bitcoind with `-asmap` the embedded data will be used for bucketing of nodes. The data lives in the repository at `src/node/data/ip_asn.dat` and can be replaced with a new version at any time. The idea is that the data should be updated with every release. By default the data at that location is embedded into the binary but there is also a build option to prevent this (`-DWITH_EMBEDDED_ASMAP=OFF`). In this case the original behavior of the `-asmap` option is maintained. ACKs for top commit: achow101: ACK24699fec84sipa: ACK24699fec84hodlinator: ACK24699fec84Tree-SHA512: c2e33dbeea387efdfd3d415432bf8fa64de80f272c1207015ea53b85bb77f5c29f1dae5644513a23c844a98fb0a4bb257bf765f38b15bfc4c41984f0315b4c6a
This commit is contained in:
59
doc/asmap-data.md
Normal file
59
doc/asmap-data.md
Normal file
@@ -0,0 +1,59 @@
|
||||
# Embedded ASMap data
|
||||
|
||||
## Background
|
||||
|
||||
The ASMap feature (available via `-asmap`) makes it possible to use a peer's AS Number (ASN), an ISP/hoster identifier,
|
||||
in netgroup bucketing in order to ensure a higher diversity in the peer
|
||||
set. When not using this, the default behavior is to have the buckets formed
|
||||
based on IP prefixes but this does not
|
||||
prevent having connections dominated by peers at the same large-scale hoster,
|
||||
for example, since such companies usually control many diverse IP ranges.
|
||||
In order to use ASMap, the mapping between IP prefixes and AS Numbers needs
|
||||
to be available. This mapping data can be provided through an external file
|
||||
but Bitcoin Core also embeds a default map in its builds to make the feature
|
||||
available to users when they are unable to provide a file.
|
||||
|
||||
## Data sourcing and tools
|
||||
|
||||
ASMap is a mapping of IP prefix to ASN, essentially a snapshot of the
|
||||
internet routing table at some point in time. Due to the high volatility
|
||||
of parts of this routing table and the known vulnerabilities in the BGP
|
||||
protocol it is challenging to collect this data and prove its consistency.
|
||||
Sourcing the data from a single trusted source is problematic as well.
|
||||
|
||||
The [Kartograf](https://github.com/asmap/kartograf) tool was created to
|
||||
deal with these uncertainties as good as possible. The mapping data is sourced from RPKI, IRR and
|
||||
Routeviews. The former two are themselves used as security mechanisms to
|
||||
protect against BGP security issues, which is why they are considered more secure and
|
||||
their data takes precedence. The latter is a trusted collector of BGP traffic
|
||||
and only used for IP space that is not covered by RPKI and IRR.
|
||||
|
||||
The process in which the Kartograf project parses, processes and merges these
|
||||
data sources is deterministic. Given the raw download files from these
|
||||
different sources, anyone can build their own map file and verify the content
|
||||
matches with other users' results. Before the map is usable by Bitcoin Core
|
||||
it needs to be encoded as well. This is done using `asmap-tool.py` in `contrib/asmap`
|
||||
and this step is deterministic as well.
|
||||
|
||||
When it comes to obtaining the initial input data, the high volatility remains
|
||||
a challenge if users don't want to trust a single creator of the used ASMap file.
|
||||
To overcome this, multiple users can start the download process at the exact
|
||||
same time which leads to a high likelihood that their downloaded data will be
|
||||
similar enough that they receive the same output at the end of the process.
|
||||
This process is regularly coordinated at the [asmap-data](https://github.com/asmap/asmap-data)
|
||||
project. If enough participants have joined the effort (5 or more is recommended) and a majority of the
|
||||
participants have received the same result, the resulting ASMap file is added
|
||||
to the repository for public use. Files will not be merged to the repository
|
||||
without at least two additional reviewers confirming that the process described
|
||||
above was followed as expected and that the encoding step yielded the same
|
||||
file hash. New files are created on an ongoing basis but without any central planning
|
||||
or an explicit schedule.
|
||||
|
||||
## Release process
|
||||
|
||||
As an upcoming release approaches the embedded ASMap data should be updated
|
||||
by replacing the `ip_asn.dat` with a newer ASMap file from the asmap-data
|
||||
repository so that its data is embedded in the release. Ideally, there may be a file
|
||||
already created recently that can be selected for an upcoming release. Alternatively,
|
||||
a new creation process can be initiated with the goal of obtaining a fresh map
|
||||
for use in the upcoming release.
|
||||
@@ -30,6 +30,7 @@ Release Process
|
||||
|
||||
* Update translations see [translation_process.md](/doc/translation_process.md#synchronising-translations).
|
||||
* Update hardcoded [seeds](/contrib/seeds/README.md), see [this pull request](https://github.com/bitcoin/bitcoin/pull/27488) for an example.
|
||||
* Update embedded asmap data at `/src/node/data/ip_asn.dat`, see [asmap data documentation](./asmap-data.md).
|
||||
* Update the following variables in [`src/kernel/chainparams.cpp`](/src/kernel/chainparams.cpp) for mainnet, testnet, and signet:
|
||||
- `m_assumed_blockchain_size` and `m_assumed_chain_state_size` with the current size plus some overhead (see
|
||||
[this](#how-to-calculate-assumed-blockchain-and-chain-state-size) for information on how to calculate them).
|
||||
|
||||
Reference in New Issue
Block a user