forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PoW connection slots to handle DDoS slot exhaustion attacks #2
Open
kallewoof
wants to merge
14
commits into
master
Choose a base branch
from
pow-connection-slots
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Commits on Jun 8, 2017
-
Added ProbabilityTarget/Estimate support to arith_uint256.
In order to make the probability target (nBits-style) more intuitive to generate based on an expected probability, two functions were added to arith_uint256 -- SetProbabilityTarget(pt) and GetProbabilityEstimate(). The former will set the arith_uint256 to a difficulty approximately equal to pt, i.e. if pt = 1.0 (100% probability), the result will be 0b1111... and if pt = 0.5 (50%), the result will be 0b01111... and so on. The latter will do the inverse, i.e. take the arith_uint256 value as a difficulty target and return a probability that a random hash will be lower than the target.
Configuration menu - View commit details
-
Copy full SHA for ae6bf7a - Browse repository at this point
Copy the full SHA ae6bf7aView commit details -
Configuration menu - View commit details
-
Copy full SHA for c1e4764 - Browse repository at this point
Copy the full SHA c1e4764View commit details -
[pow] Added generic proof of work class.
A new set of classes in pow/pow.h/cpp which serve as the parents for all the proof of work algorithms (contained in the powa:: namespace). The powa::challenge class is a container for challenges offered by peers, and powa::solution is a container for solutions to challenges. powa::callback is used to ping-back solvers when a solution was found. There's a helper-class powa::callback_proxy which is used when an instance needs to use itself as the callback (as opposed to creating a new instance and handing ownership over to the prover). powa::pow is the base algorithm class inherited by the algorithm implementations, and finally powa::powchain is a simple wrapper for chaining algorithms together (e.g. sha256(cuckoo-cycle)).
Configuration menu - View commit details
-
Copy full SHA for cc9b380 - Browse repository at this point
Copy the full SHA cc9b380View commit details -
Origin: https://github.com/tromp/cuckoo This commit is purposefully left as closely resembling the original source as possible, although some tweaks have been put in (in particular namespace embedding). A separate commit adapts it for the Bitcoin codebase.
Configuration menu - View commit details
-
Copy full SHA for 2608574 - Browse repository at this point
Copy the full SHA 2608574View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9cb4074 - Browse repository at this point
Copy the full SHA 9cb4074View commit details -
Configuration menu - View commit details
-
Copy full SHA for ea9bd67 - Browse repository at this point
Copy the full SHA ea9bd67View commit details -
A new set of classes specifically targeting anti-DoS via POW in src/ados.h/cpp in the ados:: namespace. ados::offer is an offered service provided for solving a POW challenge, including expiration and purpose according to BIP-154. ados::callback extends powa::callback as a general-purpose anti-DoS callback. ados::connection_challenge is an ados::callback specialization which retains a CAddress taken from a CNode which is connected to with the given challenge/solution when/if solved. There are also a number of helper functions: - ados::begin_solving() takes an offer and an investment (number of ticks) and will attempt to solve the offer in the background - ados::expected_solution_time(o) gives an estimate in seconds on how long it would take on average to solve the challenge in the offer - ados::solvable(o) returns a bool on whether the given offer's challenge is considered solvable within the time constraints - ados::challenge_peer(peer, purpose, pressure) constructs and sends a challenge to peer for the given purpose; pressure determines the difficulty of the challenge, and is in the range [0..1] - ados::check_solution(o) takes an offer and checks if its given solution is a valid solution to the contained challenge
Configuration menu - View commit details
-
Copy full SHA for fcbf410 - Browse repository at this point
Copy the full SHA fcbf410View commit details -
[net] Added support for POW slots.
A new nPOWConnectionSlots ivar is added to connection options and fRequirePOW is added to CNode. The logic upon incoming connections for evictions is changed to (1) include a fRequirePOW bool which defaults to false and is set to true if the number of inbound connections exceeds nMaxInbound - nPOWConnectionSlots, and (2) to attempt eviction if the number of inbound exceeds nMaxInbound. Assuming the connection is accepted, fRequirePOW is set in the node as appropriate. CConnman::OpenNetworkConnection has an added ados::offer which, if set, is inserted into the newly connected node and subsequently sent before the version message. NetMsgType::SOLUTION and NetMsgType::CHALLENGE are added and handled in net_processing, and NODE_DOSPROT is added as bit 5 (note: this needs to be explicitly defined probably in BIP-154).
Configuration menu - View commit details
-
Copy full SHA for b06e602 - Browse repository at this point
Copy the full SHA b06e602View commit details -
Configuration menu - View commit details
-
Copy full SHA for 36dd466 - Browse repository at this point
Copy the full SHA 36dd466View commit details -
Configuration menu - View commit details
-
Copy full SHA for ddb2d2a - Browse repository at this point
Copy the full SHA ddb2d2aView commit details
Commits on Jun 14, 2017
-
Configuration menu - View commit details
-
Copy full SHA for f1b5a74 - Browse repository at this point
Copy the full SHA f1b5a74View commit details -
Configuration menu - View commit details
-
Copy full SHA for d0e402b - Browse repository at this point
Copy the full SHA d0e402bView commit details -
Modified base cuckoo cycle implementation for Bitcoin.
Makes use of e.g. CSHA256 instead of openssl, as well as numerous fixes and clean ups of unused stuff. Note: Still using a built-in siphash instead of the available one, which should probably be addressed.
Configuration menu - View commit details
-
Copy full SHA for dd06cd7 - Browse repository at this point
Copy the full SHA dd06cd7View commit details -
Configuration menu - View commit details
-
Copy full SHA for b98fd4d - Browse repository at this point
Copy the full SHA b98fd4dView commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.