aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm/contracts.go
Commit message (Collapse)AuthorAgeFilesLines
* Change import go github.com/dexon-foundation/dexonWei-Ning Huang2019-04-091-5/+5
|
* core/vm: fix typo in cryptographic hash function name (#17285)Ha ĐANG2018-07-311-1/+1
|
* core/vm, crypto/bn256: switch over to cloudflare library (#16203)Péter Szilágyi2018-03-051-25/+6
| | | | | | | | | | * core/vm, crypto/bn256: switch over to cloudflare library * crypto/bn256: unmarshal constraint + start pure go impl * crypto/bn256: combo cloudflare and google lib * travis: drop 386 test job
* consensus, core, params: rebrand Metro to ByzantiumPéter Szilágyi2017-09-141-3/+3
|
* core/vm, crypto/bn256: fix bn256 use and pairing corner casePéter Szilágyi2017-08-171-6/+7
|
* core/vm: optimize copy-less data retrievalsPéter Szilágyi2017-08-141-48/+55
|
* core/vm: polish precompile contract code, add tests and benchesPéter Szilágyi2017-08-141-157/+192
| | | | | * Update modexp gas calculation to new version * Fix modexp modulo 0 special case to return zero
* core: add Metropolis pre-compiles (EIP 197, 198 and 213)Jeffrey Wilcke2017-08-111-0/+202
|
* core/vm: remove logging and add section labels to struct logs (#14782)Felix Lange2017-07-191-3/+0
|
* consensus, core/*, params: metropolis preparation refactorJeffrey Wilcke2017-05-181-24/+25
| | | | | | | | | | | | | | | | | | | | | | | | This commit is a preparation for the upcoming metropolis hardfork. It prepares the state, core and vm packages such that integration with metropolis becomes less of a hassle. * Difficulty calculation requires header instead of individual parameters * statedb.StartRecord renamed to statedb.Prepare and added Finalise method required by metropolis, which removes unwanted accounts from the state (i.e. selfdestruct) * State keeps record of destructed objects (in addition to dirty objects) * core/vm pre-compiles may now return errors * core/vm pre-compiles gas check now take the full byte slice as argument instead of just the size * core/vm now keeps several hard-fork instruction tables instead of a single instruction table and removes the need for hard-fork checks in the instructions * core/vm contains a empty restruction function which is added in preparation of metropolis write-only mode operations * Adds the bn256 curve * Adds and sets the metropolis chain config block parameters (2^64-1)
* all: next batch of log polishes to contextual versionsPéter Szilágyi2017-02-281-2/+1
|
* common: move big integer math to common/math (#3699)Felix Lange2017-02-271-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* all: blidly swap out glog to our log15, logs need reworkPéter Szilágyi2017-02-231-4/+4
|
* crypto: add btcec fallback for sign/recover without cgo (#3680)Felix Lange2017-02-181-10/+16
| | | | | | | | | | | * vendor: add github.com/btcsuite/btcd/btcec * crypto: add btcec fallback for sign/recover without cgo This commit adds a non-cgo fallback implementation of secp256k1 operations. * crypto, core/vm: remove wrappers for sha256, ripemd160
* params: core, core/vm, miner: 64bit gas instructionsJeffrey Wilcke2017-02-141-18/+21
| | | | | | | | | | | | | | | | | 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
* Revert "params: core, core/vm, miner: 64bit gas instructions (#3514)"Jeffrey Wilcke2017-02-131-21/+18
| | | | This reverts commit 8b57c494908637a5c0e74f8f7a13b3218e026757.
* params: core, core/vm, miner: 64bit gas instructions (#3514)Jeffrey Wilcke2017-02-021-18/+21
| | | | | | | | | | | | | | | | 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
* core/vm: improved EVM run loop & instruction calling (#3378)Jeffrey Wilcke2017-01-051-48/+62
| | | | | | | | | | | | | | | 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.
* accounts, core, crypto, internal: use normalised V during signature handling ↵Péter Szilágyi2017-01-051-10/+4
| | | | | | | | | (#3455) 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.
* core/vm: hide ecrecover error messageFelix Lange2016-08-061-2/+2
| | | | Fixes #2825
* all: Rename crypto.Sha3{,Hash}() to crypto.Keccak256{,Hash}()Ricardo Catalinas Jiménez2016-02-221-1/+1
| | | | As we aren't really using the standarized SHA-3
* parmas, crypto, core, core/vm: homestead consensus protocol changesGustav Simonsson2016-02-181-1/+2
| | | | | | | | * change gas cost for contract creating txs * invalidate signature with s value greater than secp256k1 N / 2 * OOG contract creation if not enough gas to store code * new difficulty adjustment algorithm * new DELEGATECALL op code
* cmd/evm, core/vm, test: refactored VM and coreJeffrey Wilcke2015-10-041-5/+5
| | | | | | | | | | | | | | | | | * 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`.
* core/vm, tests: implemented semi-jit vmJeffrey Wilcke2015-08-071-1/+1
| | | | * changed stack and removed stack ptr. Let go decide on slice reuse.
* all: fix license headers one more timeFelix Lange2015-07-241-1/+1
| | | | I forgot to update one instance of "go-ethereum" in commit 3f047be5a.
* all: update license headers to distiguish GPL/LGPLFelix Lange2015-07-231-4/+4
| | | | | All code outside of cmd/ is licensed as LGPL. The headers now reflect this by calling the whole work "the go-ethereum library".
* all: update license informationFelix Lange2015-07-071-0/+16
|
* Remove unneeded if check on EC recover paddingGustav Simonsson2015-06-091-3/+1
|
* Pad precompiled EC recover input and add validationsGustav Simonsson2015-06-091-8/+14
|
* core/vm: cleanup and renamesobscuren2015-06-041-0/+98