1. 08 Jun, 2020 1 commit
  2. 12 Mar, 2019 1 commit
    • Martin Holst Swende's avatar
      core/vm: 64 bit memory and gas calculations (#19210) · 7504dbd6
      Martin Holst Swende authored
      * core/vm: remove function call for stack validation from evm runloop
      
      * core/vm: separate gas  calc into static + dynamic
      
      * core/vm: optimize push1
      
      * core/vm: reuse pooled bigints for ADDRESS, ORIGIN and CALLER
      
      * core/vm: use generic error message for jump/jumpi, to avoid string interpolation
      
      * testdata: fix tests for new error message
      
      * core/vm: use 64-bit memory calculations
      
      * core/vm: fix error in memory calculation
      
      * core/vm: address review concerns
      
      * core/vm: avoid unnecessary use of big.Int:BitLen()
      7504dbd6
  3. 14 Aug, 2017 1 commit
  4. 28 Feb, 2017 1 commit
    • Felix Lange's avatar
      all: unify big.Int zero checks, use common/math in more places (#3716) · 5f782627
      Felix Lange authored
      * common/math: optimize PaddedBigBytes, use it more
      
      name              old time/op    new time/op    delta
      PaddedBigBytes-8    71.1ns ± 5%    46.1ns ± 1%  -35.15%  (p=0.000 n=20+19)
      
      name              old alloc/op   new alloc/op   delta
      PaddedBigBytes-8     48.0B ± 0%     32.0B ± 0%  -33.33%  (p=0.000 n=20+20)
      
      * all: unify big.Int zero checks
      
      Various checks were in use. This commit replaces them all with Int.Sign,
      which is cheaper and less code.
      
      eg templates:
      
          func before(x *big.Int) bool { return x.BitLen() == 0 }
          func after(x *big.Int) bool  { return x.Sign() == 0 }
      
          func before(x *big.Int) bool { return x.BitLen() > 0 }
          func after(x *big.Int) bool  { return x.Sign() != 0 }
      
          func before(x *big.Int) int { return x.Cmp(common.Big0) }
          func after(x *big.Int) int  { return x.Sign() }
      
      * common/math, crypto/secp256k1: make ReadBits public in package math
      5f782627
  5. 26 Feb, 2017 1 commit
    • Felix Lange's avatar
      common: move big integer math to common/math (#3699) · 5c8fe28b
      Felix Lange authored
      * common: remove CurrencyToString
      
      Move denomination values to params instead.
      
      * common: delete dead code
      
      * common: move big integer operations to common/math
      
      This commit consolidates all big integer operations into common/math and
      adds tests and documentation.
      
      There should be no change in semantics for BigPow, BigMin, BigMax, S256,
      U256, Exp and their behaviour is now locked in by tests.
      
      The BigD, BytesToBig and Bytes2Big functions don't provide additional
      value, all uses are replaced by new(big.Int).SetBytes().
      
      BigToBytes is now called PaddedBigBytes, its minimum output size
      parameter is now specified as the number of bytes instead of bits. The
      single use of this function is in the EVM's MSTORE instruction.
      
      Big and String2Big are replaced by ParseBig, which is slightly stricter.
      It previously accepted leading zeros for hexadecimal inputs but treated
      decimal inputs as octal if a leading zero digit was present.
      
      ParseUint64 is used in places where String2Big was used to decode a
      uint64.
      
      The new functions MustParseBig and MustParseUint64 are now used in many
      places where parsing errors were previously ignored.
      
      * common: delete unused big integer variables
      
      * accounts/abi: replace uses of BytesToBig with use of encoding/binary
      
      * common: remove BytesToBig
      
      * common: remove Bytes2Big
      
      * common: remove BigTrue
      
      * cmd/utils: add BigFlag and use it for error-checked integer flags
      
      While here, remove environment variable processing for DirectoryFlag
      because we don't use it.
      
      * core: add missing error checks in genesis block parser
      
      * common: remove String2Big
      
      * cmd/evm: use utils.BigFlag
      
      * common/math: check for 256 bit overflow in ParseBig
      
      This is supposed to prevent silent overflow/truncation of values in the
      genesis block JSON. Without this check, a genesis block that set a
      balance larger than 256 bits would lead to weird behaviour in the VM.
      
      * cmd/utils: fixup import
      5c8fe28b
  6. 13 Feb, 2017 2 commits
    • Jeffrey Wilcke's avatar
      params: core, core/vm, miner: 64bit gas instructions · c12f4df9
      Jeffrey Wilcke authored
      Reworked the EVM gas instructions to use 64bit integers rather than
      arbitrary size big ints. All gas operations, be it additions,
      multiplications or divisions, are checked and guarded against 64 bit
      integer overflows.
      
      In additon, most of the protocol paramaters in the params package have
      been converted to uint64 and are now constants rather than variables.
      
      * common/math: added overflow check ops
      * core: vmenv, env renamed to evm
      * eth, internal/ethapi, les: unmetered eth_call and cancel methods
      * core/vm: implemented big.Int pool for evm instructions
      * core/vm: unexported intPool methods & verification methods
      * core/vm: added memoryGasCost overflow check and test
      c12f4df9
    • Jeffrey Wilcke's avatar
      57f4e902
  7. 02 Feb, 2017 1 commit
    • Jeffrey Wilcke's avatar
      params: core, core/vm, miner: 64bit gas instructions (#3514) · 8b57c494
      Jeffrey Wilcke authored
      Reworked the EVM gas instructions to use 64bit integers rather than
      arbitrary size big ints. All gas operations, be it additions,
      multiplications or divisions, are checked and guarded against 64 bit
      integer overflows.
      
      In additon, most of the protocol paramaters in the params package have
      been converted to uint64 and are now constants rather than variables.
      
      * common/math: added overflow check ops
      * core: vmenv, env renamed to evm
      * eth, internal/ethapi, les: unmetered eth_call and cancel methods
      * core/vm: implemented big.Int pool for evm instructions
      * core/vm: unexported intPool methods & verification methods
      * core/vm: added memoryGasCost overflow check and test
      8b57c494
  8. 23 Mar, 2016 1 commit
  9. 22 Mar, 2016 1 commit
  10. 02 Feb, 2016 1 commit
  11. 03 Oct, 2015 2 commits
    • Jeffrey Wilcke's avatar
      cmd/geth, cmd/utils, core, rpc: renamed to blockchain · 7c769293
      Jeffrey Wilcke authored
      * Renamed ChainManager to BlockChain
      * Checkpointing is no longer required and never really properly worked
      when the state was corrupted.
      7c769293
    • Jeffrey Wilcke's avatar
      cmd/evm, core/vm, test: refactored VM and core · 361082ec
      Jeffrey Wilcke authored
      * Moved `vm.Transfer` to `core` package and changed execution to call
      `env.Transfer` instead of `core.Transfer` directly.
      * core/vm: byte code VM moved to jump table instead of switch
      * Moved `vm.Transfer` to `core` package and changed execution to call
        `env.Transfer` instead of `core.Transfer` directly.
      * Byte code VM now shares the same code as the JITVM
      * Renamed Context to Contract
      * Changed initialiser of state transition & unexported methods
      * Removed the Execution object and refactor `Call`, `CallCode` &
        `Create` in to their own functions instead of being methods.
      * Removed the hard dep on the state for the VM. The VM now
        depends on a Database interface returned by the environment. In the
        process the core now depends less on the statedb by usage of the env
      * Moved `Log` from package `core/state` to package `core/vm`.
      361082ec
  12. 23 Jul, 2015 1 commit
  13. 22 Jul, 2015 1 commit
  14. 07 Jul, 2015 1 commit
  15. 04 Apr, 2015 1 commit
  16. 02 Apr, 2015 1 commit
    • Gustav Simonsson's avatar
      Read most protocol params from common/params.json · c26c8d3a
      Gustav Simonsson authored
      * Add params package with exported variables generated from
        github.com/ethereum/common/blob/master/params.json
      * Use params package variables in applicable places
      * Add check for minimum gas limit in validation of block's gas limit
      * Remove common/params.json from go-ethereum to avoid
        outdated version of it
      c26c8d3a
  17. 28 Mar, 2015 2 commits
    • obscuren's avatar
      Cleanup VM. · 368ebe63
      obscuren authored
      * CALLDATA use getData
      * removed old context get range value
      * removed casting big => int for some cases
      * pc now big int #457
      368ebe63
    • obscuren's avatar
      Cleanup VM · 3b7e4173
      obscuren authored
      3b7e4173
  18. 23 Mar, 2015 1 commit
  19. 19 Mar, 2015 2 commits
  20. 16 Mar, 2015 2 commits
  21. 13 Mar, 2015 1 commit
  22. 06 Mar, 2015 1 commit
  23. 03 Mar, 2015 3 commits
  24. 02 Mar, 2015 1 commit
  25. 01 Feb, 2015 1 commit
  26. 19 Jan, 2015 1 commit
  27. 12 Jan, 2015 1 commit
  28. 06 Jan, 2015 1 commit
  29. 05 Jan, 2015 1 commit
  30. 18 Dec, 2014 1 commit
  31. 17 Dec, 2014 1 commit
    • obscuren's avatar
      Moved pre-compiled, moved depth check · 4dbdcaec
      obscuren authored
      * Depth check has been moved to the execution
      * Pre compiled execution has been moved to the VM
      * PrecompiledAddress has been renamed to PrecompiledAccount
      4dbdcaec
  32. 12 Dec, 2014 2 commits