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

Add Dynamic fee transactions, EIP-1559 for London #2013

Merged
merged 16 commits into from
Aug 19, 2021

Commits on Aug 6, 2021

  1. First steps for EIP-1559 support

    - add initial EIP-1559 transaction validation
    - add initial EIP-1559 transaction execution
    - rename gas_target to gas_limit
    - add london VM in existing tests
    - update block according to latest EIP updates
    ftruzzi authored and carver committed Aug 6, 2021
    Configuration menu
    Copy the full SHA
    5b205e6 View commit details
    Browse the repository at this point in the history

Commits on Aug 19, 2021

  1. Implement more of EIP-1559

    - prefer exceptions for base gas fee to None, where feasible
    - update mainnet block number for London
    - increase default gas price in tests to 10 gwei to easily out-price the 1559 min gas fee of 1gwei
    - make old transactions understand max_priority_fee_per_gas and
        max_fee_per_gas (just return the gas_price, as the 1559 spec suggests)
    - validate the transaction nonce on new london transactions
    - enable creating a genesis London header (was hard-coded to pre-London-style)
        generally allow create_header_from_parent to accept a None parent, for genesis creation
    - use the correct VM's block header when creating a temp block for txn evaluation
    - update tests that were configured with a gas price of < 1 gwei
    - Drop support for Header.from_parent which is essentially always wrong.
        Should use vm_class.create_header_from_parent instead.
    - Make eth_call free again
      - when running a call, set the header's base gas fee to 0
      - API update: state_in_temp_block -> in_costless_state to reference ^
    - Correctly load uncles across fork boundary
      - Add test to validate uncles across chain VMs
      - Use a universal header sedes, since we can't load the VM before decoding the header
      - Decode block bodies with both London and pre-London uncles
      - Bonus bugfix: must double the header's gas limit at the VM boundary
    - Implement base fee adjustment, with tests
      - target must be half of limit
      - gas_used_delta bug when parent_gas_used > parent_gas_target: was
        subtracting base fee instead of target
    - Apply gas limit rules correctly
        Note that the 'diff' approach had a bug when 'diff' was negative. That
        approach needed a math.abs() to correctly validate the limit.
    carver committed Aug 19, 2021
    Configuration menu
    Copy the full SHA
    645aa70 View commit details
    Browse the repository at this point in the history
  2. Skip all the default values for the genesis header

    The alternative is to modify create_header_from_parent to accept and
    assign all the rest of the header fields. Since none of these values are
    important to customize, I'm going with this easier/smaller change.
    carver committed Aug 19, 2021
    Configuration menu
    Copy the full SHA
    48bf83c View commit details
    Browse the repository at this point in the history
  3. Update usages of BlockHeader() and .from_parent()

    Direct invocation of the header object is not allowed anymore, because
    different VMs now have different header types (as of EIP-1559 in
    London). So we must always invoke header creation through the VM.
    
    - Remove the BlockHeader() init in test_blockchain.
    - Remove HeaderChain, which seems to be completely unused in the code
        base.
    - Embrace that we need one global type that can decode all headers.
    - Add VM.create_genesis_header
        The genesis header now needs to be VM-aware, to handle EIP-1559. Rather
        than pass in a parent of None, it looks a bit cleaner to use the new
        create_genesis_header.
    - Create header from VM in opcode test (we need a proper London header
        at genesis)
    carver committed Aug 19, 2021
    Configuration menu
    Copy the full SHA
    bd5f34c View commit details
    Browse the repository at this point in the history
  4. Fix flake8 & mypy

    carver committed Aug 19, 2021
    Configuration menu
    Copy the full SHA
    da79f10 View commit details
    Browse the repository at this point in the history
  5. Choose correct header timestamp, if none supplied

    Actually look at the clock, in UTC, and compare it to the parent. Related:
    
    - Fix doctests: set timestamp manually for reproducible results (new
    MiningChain API)
    - clique should verify timestamp in UTC (bug uncovered)
    - Only guess timestamp on non-genesis headers (when parent & VM are
    unavailable), so manually set in a test where headers are built manually
    carver committed Aug 19, 2021
    Configuration menu
    Copy the full SHA
    ba7cf8d View commit details
    Browse the repository at this point in the history
  6. Validate London txn gas costs, plus tests

    - Test London validation of sender sufficient funds
    carver committed Aug 19, 2021
    Configuration menu
    Copy the full SHA
    804dfbd View commit details
    Browse the repository at this point in the history
  7. Log transaction fields dynamically

    Each transaction object should now how to display itself, whether it's
    a legacy, access list, or dynamic fee transaction.
    carver committed Aug 19, 2021
    Configuration menu
    Copy the full SHA
    cfdc701 View commit details
    Browse the repository at this point in the history
  8. Calculate miner tip correctly for EIP-1559

    - add tests to verify
    - Push backwards-compatible usages of get_tip() to Frontier
    - Bonus fix: setting coinbase when mining
      The coinbase address was not correctly receiving transaction fees when
      the address is passed as a kwarg to MiningChain.mine_all or .mine_block
    - Bonus fix: Correctly decode dynamic-fee txns in London
    carver committed Aug 19, 2021
    Configuration menu
    Copy the full SHA
    373c18a View commit details
    Browse the repository at this point in the history
  9. Rename base gas fee transaction to dynamic fee txn

    This seems to be a commonly used name, and is definitely better than
    BaseGasFee.
    carver committed Aug 19, 2021
    Configuration menu
    Copy the full SHA
    7cff454 View commit details
    Browse the repository at this point in the history
  10. Fix test: only thing wrong should be block number

    The old test implementation was finding other problems, like a
    base_fee_per_gas that did not match the parent.
    carver committed Aug 19, 2021
    Configuration menu
    Copy the full SHA
    5e0a2a2 View commit details
    Browse the repository at this point in the history
  11. Fix test: was testing incompatible VMs

    It just didn't show up because this is the first time that the VM header
    validation rules vary so significantly.
    carver committed Aug 19, 2021
    Configuration menu
    Copy the full SHA
    f10c227 View commit details
    Browse the repository at this point in the history
  12. Fallback to get a fixture name

    Not really getting anything useful from crashing there. It's an ugly
    crash that should be caught somewhere else.
    carver committed Aug 19, 2021
    Configuration menu
    Copy the full SHA
    3594624 View commit details
    Browse the repository at this point in the history
  13. Run newer version of lint test

    carver committed Aug 19, 2021
    Configuration menu
    Copy the full SHA
    e4fdeb0 View commit details
    Browse the repository at this point in the history
  14. Halt loop if header doesn't validate gas limit

    Otherwise, get an infinite loop, where test hangs.
    carver committed Aug 19, 2021
    Configuration menu
    Copy the full SHA
    3937a0c View commit details
    Browse the repository at this point in the history
  15. Release notes for ethereum#2013

    carver committed Aug 19, 2021
    Configuration menu
    Copy the full SHA
    295cc29 View commit details
    Browse the repository at this point in the history