1. 23 3月, 2017 1 次提交
    • F
      all: import "context" instead of "golang.org/x/net/context" · c213fd1f
      Felix Lange 提交于
      There is no need to depend on the old context package now that the
      minimum Go version is 1.7. The move to "context" eliminates our weird
      vendoring setup. Some vendored code still uses golang.org/x/net/context
      and it is now vendored in the normal way.
      
      This change triggered new vet checks around context.WithTimeout which
      didn't fire with golang.org/x/net/context.
      c213fd1f
  2. 16 3月, 2017 1 次提交
  3. 09 3月, 2017 1 次提交
  4. 28 2月, 2017 2 次提交
    • F
      all: unify big.Int zero checks, use common/math in more places (#3716) · 5f782627
      Felix Lange 提交于
      * 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
    • P
      e588e0ca
  5. 27 2月, 2017 2 次提交
    • P
      46eea4d1
    • F
      common: move big integer math to common/math (#3699) · 5c8fe28b
      Felix Lange 提交于
      * 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. 23 2月, 2017 2 次提交
  7. 13 2月, 2017 1 次提交
  8. 21 1月, 2017 1 次提交
    • P
      accounts/abi/bind, internal/ethapi: binary search gas estimation (#3587) · 682875ad
      Péter Szilágyi 提交于
      Gas estimation currently mostly works, but can underestimate for more funky
      refunds. This is because various ops (e.g. CALL) need more gas to run than they
      actually consume (e.g. 2300 stipend that is refunded if not used). With more
      intricate contract interplays, it becomes almost impossible to return a proper
      value to the user.
      
      This commit swaps out the simplistic gas estimation to a binary search approach,
      honing in on the correct gas use. This does mean that gas estimation needs to
      rerun the transaction log(max-price) times to measure whether it fails or not,
      but it's a price paid by the transaction issuer, and it should be worth it to
      support proper estimates.
      682875ad
  9. 17 1月, 2017 1 次提交
  10. 09 1月, 2017 1 次提交
  11. 07 1月, 2017 1 次提交
  12. 05 1月, 2017 3 次提交
    • F
      e171bf74
    • J
      core/vm: improved EVM run loop & instruction calling (#3378) · bbc4ea4a
      Jeffrey Wilcke 提交于
      The run loop, which previously contained custom opcode executes have been
      removed and has been simplified to a few checks.
      
      Each operation consists of 4 elements: execution function, gas cost function,
      stack validation function and memory size function. The execution function
      implements the operation's runtime behaviour, the gas cost function implements
      the operation gas costs function and greatly depends on the memory and stack,
      the stack validation function validates the stack and makes sure that enough
      items can be popped off and pushed on and the memory size function calculates
      the memory required for the operation and returns it.
      
      This commit also allows the EVM to go unmetered. This is helpful for offline
      operations such as contract calls.
      bbc4ea4a
    • P
      accounts, core, crypto, internal: use normalised V during signature handling (#3455) · 08eea0f0
      Péter Szilágyi 提交于
      To address increasing complexity in code that handles signatures, this PR
      discards all notion of "different" signature types at the library level. Both
      the crypto and accounts package is reduced to only be able to produce plain
      canonical secp256k1 signatures. This makes the crpyto APIs much cleaner,
      simpler and harder to abuse.
      08eea0f0
  13. 06 12月, 2016 1 次提交
    • J
      core, core/vm: implemented a generic environment (#3348) · 3fc7c978
      Jeffrey Wilcke 提交于
      Environment is now a struct (not an interface). This
      reduces a lot of tech-debt throughout the codebase where a virtual
      machine environment had to be implemented in order to test or run it.
      
      The new environment is suitable to be used en the json tests, core
      consensus and light client.
      3fc7c978
  14. 15 11月, 2016 1 次提交
  15. 14 11月, 2016 1 次提交
  16. 13 11月, 2016 2 次提交
  17. 09 11月, 2016 1 次提交
  18. 29 10月, 2016 1 次提交
    • B
      internal/ethapi: add personal_sign and fix eth_sign to hash message (#2940) · b59c8399
      bas-vk 提交于
      This commit includes several API changes:
      
      - The behavior of eth_sign is changed. It now accepts an arbitrary
        message, prepends the well-known string
      
              \x19Ethereum Signed Message:\n<length of message>
      
        hashes the result using keccak256 and calculates the signature of
        the hash. This breaks backwards compatability!
        
      - personal_sign(hash, address [, password]) is added. It has the same
        semantics as eth_sign but also accepts a password. The private key
        used to sign the hash is temporarily unlocked in the scope of the
        request.
        
      - personal_recover(message, signature) is added and returns the
        address for the account that created a signature.
      b59c8399
  19. 06 10月, 2016 1 次提交
    • F
      core/state: implement reverts by journaling all changes · 1f1ea18b
      Felix Lange 提交于
      This commit replaces the deep-copy based state revert mechanism with a
      linear complexity journal. This commit also hides several internal
      StateDB methods to limit the number of ways in which calling code can
      use the journal incorrectly.
      
      As usual consultation and bug fixes to the initial implementation were
      provided by @karalabe, @obscuren and @Arachnid. Thank you!
      1f1ea18b
  20. 26 9月, 2016 1 次提交
  21. 23 8月, 2016 1 次提交
    • F
      accounts/abi/bind: add utilities for waiting on transactions · c97df052
      Felix Lange 提交于
      The need for these functions comes up in code that actually deploys and
      uses contracts. As of this commit, they can be used with both
      SimulatedBackend and ethclient.
      
      SimulatedBackend gains some additional methods in the process and is now
      safe for concurrent use.
      c97df052
  22. 22 8月, 2016 1 次提交
    • F
      accounts/abi/bind: use ethereum interfaces · d62d5fe5
      Felix Lange 提交于
      In this commit, contract bindings and their backend start using the
      Ethereum Go API interfaces offered by ethclient. This makes ethclient a
      suitable replacement for the old remote backend and gets us one step
      closer to the final stable Go API that is planned for go-ethereum 1.5.
      
      The changes in detail:
      
      * Pending state is optional for read only contract bindings.
        BoundContract attempts to discover the Pending* methods via an
        interface assertion. There are a couple of advantages to this:
        ContractCaller is just two methods and can be implemented on top of
        pretty much anything that provides Ethereum data. Since the backend
        interfaces are now disjoint, ContractBackend can simply be declared as
        a union of the reader and writer side.
      
      * Caching of HasCode is removed. The caching could go wrong in case of
        chain reorganisations and removing it simplifies the code a lot.
        We'll figure out a performant way of providing ErrNoCode before the
        1.5 release.
      
      * BoundContract now ensures that the backend receives a non-nil context
        with every call.
      d62d5fe5
  23. 21 8月, 2016 1 次提交
    • F
      accounts/abi/bind/backends: remove nil and remote backends · 056f15aa
      Felix Lange 提交于
      The remote backend is superseded by ethclient.
      
      The nil backend's stated purpose was to enable testing of
      accounts/abi/bind. None of its methods actually worked. A much simpler
      way to get a crashing backend is to simply pass nil as the backend. With
      a one-line change to the generator (removing two explicit interface
      assertions), passing nil actually works.
      
      Removing these backends means that less changes are required later.
      056f15aa
  24. 23 7月, 2016 1 次提交
  25. 15 7月, 2016 1 次提交
  26. 11 7月, 2016 1 次提交
  27. 16 6月, 2016 1 次提交
  28. 20 5月, 2016 1 次提交
  29. 12 5月, 2016 1 次提交
  30. 02 5月, 2016 1 次提交
  31. 27 4月, 2016 1 次提交
  32. 15 4月, 2016 1 次提交
  33. 12 4月, 2016 1 次提交
    • F
      accounts, crypto: move keystore to package accounts · 85e6c40c
      Felix Lange 提交于
      The account management API was originally implemented as a thin layer
      around crypto.KeyStore, on the grounds that several kinds of key stores
      would be implemented later on. It turns out that this won't happen so
      KeyStore is a superflous abstraction.
      
      In this commit crypto.KeyStore and everything related to it moves to
      package accounts and is unexported.
      85e6c40c
  34. 05 4月, 2016 1 次提交