Skip to content
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

Implement BIP 101 and accurate sigop/sighash counting #22

Closed
wants to merge 19 commits into from

Commits on Jul 3, 2015

  1. assets-attribution: Update typicons to MIT license

    stephenhutchings commented 3 Jul 2015, 6:35 GMT:
    > Hi Luke, happy for these to be distributed under the terms of the MIT licence.
    > Let me know if you need anything further from me.
    luke-jr committed Jul 3, 2015
    Configuration menu
    Copy the full SHA
    dae0a89 View commit details
    Browse the repository at this point in the history
  2. Merge pull request #6369

    dae0a89 assets-attribution: Update typicons to MIT license (Luke Dashjr)
    laanwj committed Jul 3, 2015
    Configuration menu
    Copy the full SHA
    7bf37e1 View commit details
    Browse the repository at this point in the history

Commits on Jul 6, 2015

  1. Configuration menu
    Copy the full SHA
    9a2469e View commit details
    Browse the repository at this point in the history
  2. Merge pull request #6383

    9a2469e release notes for fee estimation changes (Alex Morcos)
    laanwj committed Jul 6, 2015
    Configuration menu
    Copy the full SHA
    ebad618 View commit details
    Browse the repository at this point in the history

Commits on Jul 8, 2015

  1. Fix typo in release notes.

    spinza committed Jul 8, 2015
    Configuration menu
    Copy the full SHA
    5460b24 View commit details
    Browse the repository at this point in the history
  2. Merge pull request #6397

    5460b24 Fix typo in release notes. (spin)
    laanwj committed Jul 8, 2015
    Configuration menu
    Copy the full SHA
    757ceaa View commit details
    Browse the repository at this point in the history

Commits on Jul 10, 2015

  1. Configuration menu
    Copy the full SHA
    d26f951 View commit details
    Browse the repository at this point in the history

Commits on Jul 27, 2015

  1. Refactor: protect mapNodeState with its own lock

    Encapsulate mapNodeState in a smart-pointer class with its own lock.
    
    Why? So Misbehaving() can be called from the sanity-check-a-message code without holding cs_main.
    
    And to get better exception safety (the smart-pointer approach gives RAII semantics).
    
    And because protecting fewer things with cs_main is a good idea.
    
    Tested by compiling with -DDEBUG_LOCKORDER, running all of the qa/rpc-tests, and running a node on the main network overnight.
    gavinandresen committed Jul 27, 2015
    Configuration menu
    Copy the full SHA
    1e67b90 View commit details
    Browse the repository at this point in the history
  2. Refactor, new CNode::FinalizeHeader method

    I need this to write some unit tests for the
    CNode::ReceiveMsgBytes() function.
    gavinandresen committed Jul 27, 2015
    Configuration menu
    Copy the full SHA
    59fd6fc View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    c0dbdd5 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    4004cda View commit details
    Browse the repository at this point in the history
  5. Testing infrastructure: mocktime fixes

    New, undocumented-on-purpose -mocktime=timestamp command-line
    argument to startup with mocktime set. Needed because
    time-related blockchain sanity checks are done on startup, before a
    test has a chance to make a setmocktime RPC call.
    
    And changed the setmocktime RPC call so calling it will not result in
    currently connected peers being disconnected due to inactivity timeouts.
    gavinandresen committed Jul 27, 2015
    Configuration menu
    Copy the full SHA
    b4f2d1d View commit details
    Browse the repository at this point in the history
  6. Testing: remove coinbase payment key from keypool

    Blocks generated in -regtest mode would pay to a key that was left
    in the keypool, which can cause subtle bugs. In particular, I expected
    every block generated to be unique, but got duplicate blocks between
    calls to setgenerate.
    
    Fixes Bitcoin Core issue 6268.
    gavinandresen committed Jul 27, 2015
    Configuration menu
    Copy the full SHA
    4d03e8d View commit details
    Browse the repository at this point in the history

Commits on Aug 4, 2015

  1. Implement hard fork to allow bigger blocks

    Unit test and code for a bigger-block hard fork.
    Parameters are:
      8MB cap
      ... doubling every two years (so 16MB in 2018)
      ... for twenty years
      ... earliest possible chain fork: 11 Jan 2016
      ... after miner supermajority
      ... and grace period once miner supermajority achieved
    
    qa/rpc-tests/bigblocks.py mines a 50% upgraded -regtest chain,
    generates 4MB of transactions, and then tests the upgrade and
    mining code to make sure larger blocks are only created when
    the fork conditions are met.
    
    The activation state of the fork is stored in the block tree database;
    it is written when the threshold is met (and unwritten if the
    threshold block is re-orged out of the best chain), and read at startup.
    
    Code review and bug fixes by Mike Hearn.
    gavinandresen committed Aug 4, 2015
    Configuration menu
    Copy the full SHA
    bd82dd5 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    2264ba1 View commit details
    Browse the repository at this point in the history
  3. Set default block size for miners to be equal to the hard limit by de…

    …fault.
    
    This avoids the situation that has happened several times where the network starts running out of capacity and miners must be manually contacted in a rush to tell them about the command line flag.
    mikehearn authored and gavinandresen committed Aug 4, 2015
    Configuration menu
    Copy the full SHA
    ae1cc25 View commit details
    Browse the repository at this point in the history
  4. Make fork warning use version bit masking, on the assumption that fro…

    …m this point on all changes will be triggered by a bit in nVersion rather than an incrementing integer.
    mikehearn authored and gavinandresen committed Aug 4, 2015
    Configuration menu
    Copy the full SHA
    13d2024 View commit details
    Browse the repository at this point in the history
  5. Allow precise tracking of validation sigops / bytes hashed

    Adds a BlockValidationResourceTracker class that is passed to
    CheckInputs() / CScriptCheck() to keep track of the exact number
    of signature operations required to validate a block, and the
    exact number of bytes hashed to compute signature hashes.
    
    Also extends CHashWriter to keep track of number of bytes hashed.
    
    Intended to be the starting point for consensus rule changes
    to replace the incorrect, messy sigop counting and size-limiting
    rules currently in place.
    gavinandresen committed Aug 4, 2015
    Configuration menu
    Copy the full SHA
    b1e5f5b View commit details
    Browse the repository at this point in the history
  6. Implement accurate sigop / sighashbytes counting block consensus rules

    Replace the inaccurate / somewhat ineffective consensus rule for
    number of signature operations per block with new consensus rules
    that accurately count the number of ECDSA signature operations needed
    to validate a block, and the number of bytes of data needed to compute
    signature hashes (to mitigate the attack described in CVE-2013-2292).
    
    BIP number for this to be determined. Constants were chosen such that
    any 'non-attack' transaction valid under the old rules is also valid
    under the new rules, but maximum possible block validation times
    are well-bounded, but tied to block size increases.
    
    Summary of old rules / new rules:
    
    Old rules: 20,000 inaccurately-counted-sigops for a 1MB block
    New: 80,000 accurately-counted sigops for an 8MB block
    
    A scan of the last 100,000 blocks for high-sigop blocks gets
    a maximum of 7,350 sigops in block 364,773 (in a single, huge,
    ~1MB transaction).
    
    For reference, Pieter Wuille's libsecp256k1 validation code
    validates about 10,000 signatures per second on a single
    2.7GHZ CPU core.
    
    Old rules: no limit for number of bytes hashed to generate
    signature hashes
    
    New rule: 1.3gigabytes hashed per 8MB block to generate
    signature hashes
    
    Block 364,422 contains a single ~1MB transaction that requires
    1.2GB of data hashed to generate signature hashes.
    gavinandresen committed Aug 4, 2015
    Configuration menu
    Copy the full SHA
    2030a5a View commit details
    Browse the repository at this point in the history