aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm/evm.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/vm/evm.go')
-rw-r--r--core/vm/evm.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/core/vm/evm.go b/core/vm/evm.go
index 34933a1dc..caf8b4507 100644
--- a/core/vm/evm.go
+++ b/core/vm/evm.go
@@ -25,6 +25,10 @@ import (
"github.com/ethereum/go-ethereum/params"
)
+// emptyCodeHash is used by create to ensure deployment is disallowed to already
+// deployed contract addresses (relevant after the account abstraction).
+var emptyCodeHash = crypto.Keccak256Hash(nil)
+
type (
CanTransferFunc func(StateDB, common.Address, *big.Int) bool
TransferFunc func(StateDB, common.Address, common.Address, *big.Int)
@@ -307,13 +311,17 @@ func (evm *EVM) Create(caller ContractRef, code []byte, gas uint64, value *big.I
if !evm.CanTransfer(evm.StateDB, caller.Address(), value) {
return nil, common.Address{}, gas, ErrInsufficientBalance
}
-
- // Create a new account on the state
+ // Ensure there's no existing contract already at the designated address
nonce := evm.StateDB.GetNonce(caller.Address())
evm.StateDB.SetNonce(caller.Address(), nonce+1)
- snapshot := evm.StateDB.Snapshot()
contractAddr = crypto.CreateAddress(caller.Address(), nonce)
+ contractHash := evm.StateDB.GetCodeHash(contractAddr)
+ if evm.StateDB.GetNonce(contractAddr) != 0 || (contractHash != (common.Hash{}) && contractHash != emptyCodeHash) {
+ return nil, common.Address{}, 0, ErrContractAddressCollision
+ }
+ // Create a new account on the state
+ snapshot := evm.StateDB.Snapshot()
evm.StateDB.CreateAccount(contractAddr)
if evm.ChainConfig().IsEIP158(evm.BlockNumber) {
evm.StateDB.SetNonce(contractAddr, 1)
='commitgraph'>| * - Update to 20161105danilo2016-11-063-4/+19 | * - Update to 20160925danilo2016-09-263-4/+154 | * - Update to 20160626danilo2016-06-293-10/+10 | * - Update to 20160604danilo2016-06-053-3/+154 | * - Update to 20160409danilo2016-04-103-4/+11 | * Combine print/cups-base, print/cups-client and print/cups-image intotijl2016-03-111-8/+5 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | print/cups and update it to 2.1.3. Also remove print/cups-pstoraster, improve print/cups-filters, print/foomatic-* and update print/hplip to 3.16.2. Long description: First some background. When you hand a file to cups it sets up a chain of filter programs that converts the file to something a printer understands. Each filter has a cost associated with it and cups tries to find the cheapest chain. Costs used to be configured in such a way that files were first converted to PostScript. This could then be manipulated further (e.g. putting multiple pages on one sheet) before finally being sent to a PostScript printer or another filter like pstoraster which produces a raster format understood by non-PostScript printer drivers. Nowadays most filters have been moved from cups to cups-filters and they have been configured to use PDF as an intermediate format instead of PostScript. Merging of cups-base, cups-client and cups-image into print/cups: - cups-image provides a library to work with the cups raster format. It is only used to implement filters and printer drivers and these only exist in the context of a cups server so there's no need to separate this from cups-base. - cups-client provides a library that allows applications to print via cups. It is possible to use the library to access a remote cups server without running a local cups server, but such a setup is discouraged and the configuration file to set this up has been marked deprecated. It is better to run a local cups server and let that talk to the remote cups server because then you have the benefits of local job queuing in case the remote server is down or busy. Given this and the fact that without filters cups-base is now smaller than it used to be it makes sense to merge the ports. The patch also adds options IPPTOOL, DOCS and NLS which when disabled make the new cups package smaller than the current cups-client package. Merging the ports also prevents problems with options like ZEROCONF being configured differently in both ports. - print/cups was a metaport that depended on cups-base and some filters. There isn't really a need for such a metaport so cups-base can be renamed to cups. The filters can be depended on by printer drivers such as hplip if they need them. Additional changes to the new print/cups: - Clean up the patches. They seem to have been regenerated with post-patch changes included. - Add a patch to prevent intermediate conversion to PDF when a PostScript file is sent to a PostScript printer when cups-filters is installed. - Fix the PAM configuration file. - Add a patch to let the server search /usr/local/share/ppd like on Linux so other ports don't have to add links to it. - Remove ulpt(4) helper scripts. The port uses libusb with ugen(4). - Remove support for mDNSResponder. cups-filters only supports Avahi. - Combine ICONS and XDG_OPEN options into an X11 option to support WITHOUT_X11. - Optionally depend on colord for ICC profile support. - Various smaller changes. Changes to print/cups-filters: - Let the cups_browsed rc.d script depend on cupsd and avahi_daemon instead of LOGIN. - Development of foomatic-filters has been moved to cups-filters so let this port install foomatic related files and add foomatic-filters to CONFLICTS. - Fix location of liblouis tables. - Add patch to fix ICC support. Changes to print/cups-pstoraster: This port is essentially an old version of Ghostscript plus a cups filter. It's no longer developed. This commit removes it and changes existing dependencies to print/cups-filters which depends on print/ghostscript* and includes a gstoraster filter that can handle both PostScript and PDF. Changes to print/foomatic-db*: Remove old MASTER_SITES and dependencies and eliminate PKGNAMEPREFIX. Changes to print/foomatic-filters: Install beh backend with its original name again and add cups-filters to CONFLICTS. Changes to print/hplip: - Stop installing hpijs/foomatic-rip support. This is no longer supported upstream. - Stop installing hpcups PPDs. These are now automatically generated. The bundled PPDs are generated for an older version of cups. - Rename the QT option to X11 to support WITHOUT_X11. - Simplify the patches now that ports are installed in a staging area. - Add a patch to set SO_REUSEPORT (next to SO_REUSEADDR) on the mDNS socket like avahi-daemon does. This fixes Zeroconf support for HP network printers. PR: 207746 Exp-run by: antoine Approved by: portmgr (antoine) * - Update to 20160226danilo2016-02-273-3/+21 | * - Update to 20160222danilo2016-02-233-5/+119 | | | | - Uses tar:xz * Remove trailing whitespace from Makefiles, M-X.olgeni2015-10-081-1/+1 | * - Update to 20150819danilo2015-08-263-3/+125 | * MASTER_SITES cleanup.mat2015-05-141-2/+1 | | | | | | | | | | | | | | | | | | | - Replace ${MASTER_SITE_FOO} with FOO. - Merge MASTER_SITE_SUBDIR into MASTER_SITES when possible. (This means 99.9% of the time.) - Remove occurrences of MASTER_SITE_LOCAL when no subdirectory was present and no hint of what it should be was present. - Fix some logic. - And generally, make things more simple and easy to understand. While there, add magic values to the FESTIVAL, GENTOO, GIMP, GNUPG, QT and SAMBA macros. Also, replace some EXTRACT_SUFX occurences with USES=tar:*. Checked by: make fetch-urlall-list With hat: portmgr Sponsored by: Absolight * - Update to 20150415danilo2015-04-233-5/+468 | * - Update to 20150214danilo2015-02-17