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

Sync to 1.8.7 #8

Merged
merged 106 commits into from
May 8, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
85ea915
params, VERSION: v1.8.4 unstable
fjl Mar 26, 2018
6134990
core/vm: Fixed typos in core/vm/interpreter.go
hydai Mar 27, 2018
d763e20
Merge pull request #16394 from hydai/fix_typo
karalabe Mar 27, 2018
45bd4fe
light: new CHT for ropsten (#16393)
zsfelfoldi Mar 27, 2018
8044971
whisper: fix issue in topic list copy (#16381)
gballet Mar 27, 2018
1a8894b
core/state: uniform parameter style (#16398)
LLLeon Mar 28, 2018
958ed4f
core/state: rework dirty handling to avoid quadratic overhead
holiman Oct 1, 2017
d985b90
core/state: avoid linear overhead on journal dirty listing
karalabe Mar 27, 2018
a095b84
travis.yml: remove sudo requirement for PPA and Azure purge builders …
fjl Mar 28, 2018
6cdfb9a
.gitattributes: enable solidity highlighting on github (#16425)
ldct Apr 3, 2018
d1af4e1
crypto/secp256k1: catch curve parameter parse errors (#16392)
DavidHuie Apr 3, 2018
5909482
core/state: avoid redundant addition to code size cache (#16427)
LLLeon Apr 3, 2018
2a4bd55
cmd/geth: remove relOracle variable (#16434)
thanhson1085 Apr 4, 2018
7aad81f
eth: fix typos (#16414)
lsgrep Apr 4, 2018
6ab9f0a
accounts/abi: improve test coverage (#16044)
ricardohsd Apr 4, 2018
1e248f3
README: change 'built in' to 'built-in'
realgio95 Apr 4, 2018
ec8ee61
core/types: remove String methods from struct types (#16205)
stevenroose Apr 5, 2018
50dbe8e
Dockerfile: use non-privileged user account (#16052)
fgimenez Apr 5, 2018
c43792a
cmd/geth: update template for 'geth bug' command (#16350)
niuzhenguo Apr 6, 2018
3ebcf92
cmd/evm: print vm output when debug flag is on (#16326)
dm4 Apr 6, 2018
8de655e
bmt: fix comment typos (#16461)
D-or Apr 9, 2018
315b9b1
ethclient: remove empty object in newHeads subscription call (#16454)
Apr 9, 2018
0fac705
compression/rle: delete RLE compression (#16468)
fjl Apr 9, 2018
1100e8b
eth/downloader: flush state sync data before exit (#16280)
rjl493456442 Apr 9, 2018
14c9215
state: handle nil in journal dirties
holiman Apr 7, 2018
8c31d28
core: add blockchain benchmarks
holiman Apr 7, 2018
39f4c80
Merge pull request #15225 from holiman/test_removefrom_dirtyset
karalabe Apr 10, 2018
7c1e9a5
cmd/puppeth: fix node deploys for updated dockerfile user
karalabe Apr 10, 2018
149f706
Merge pull request #16477 from karalabe/puppeth-dockerfile-permission…
karalabe Apr 10, 2018
29213b1
Dockerfile.alltools: fix invalid command
karalabe Apr 10, 2018
c7ab3e5
common: delete StringToAddress, StringToHash (#16436)
fjl Apr 10, 2018
989ab26
Merge pull request #16478 from karalabe/fix-alltools-dockerfile
karalabe Apr 10, 2018
30deb60
build: add -e and -X flags to get more information on #16433 (#16443)
ligi Apr 10, 2018
3caf16b
core: remove stray account creations in state transition (#16470)
fjl Apr 10, 2018
95d5c22
travis, appveyor: bump to Go 1.10.1
karalabe Apr 10, 2018
2e24770
travis.yml: add TEST_PACKAGES to speed up swarm testing (#16456)
acud Apr 10, 2018
34ecb49
Merge pull request #16481 from karalabe/go1.10.1
karalabe Apr 11, 2018
e7cc5b4
les: add ps.lock.Unlock() before return (#16360)
cpusoft Apr 11, 2018
0c7b99b
core/state: fix bug in copy of copy State
holiman Apr 10, 2018
5a79aca
Merge pull request #16485 from holiman/fixcopycopy
karalabe Apr 11, 2018
7205366
core/state: fix ripemd-cornercase in Copy
holiman Apr 11, 2018
7e911b8
Merge pull request #16491 from holiman/fix_copy_again
karalabe Apr 12, 2018
db48d31
core: txpool stable underprice drop order, perf fixes
karalabe Apr 12, 2018
60516c8
Merge pull request #16494 from karalabe/txpool-stable-pricedelete
karalabe Apr 12, 2018
2a1fc3d
miner: remove contention on currentMu for pending data retrievals (#1…
ryanschneider Apr 16, 2018
6b2b328
ethdb: add leveldb write delay statistic (#16499)
rjl493456442 Apr 16, 2018
de2a7bb
eth/downloader: wait for all fetcher goroutines to exit before termin…
rjl493456442 Apr 16, 2018
ec3db0f
cmd/clef, signer: initial poc of the standalone signer (#16154)
holiman Apr 16, 2018
92c6d13
light: new CHTs (#16515)
zsfelfoldi Apr 17, 2018
2423ae0
params: release Geth v1.8.4
karalabe Apr 17, 2018
7605e63
VERSION, params: begin v1.8.5 release cycle
karalabe Apr 17, 2018
ba1030b
build: enable goimports and varcheck linters (#16446)
thomasmodeneis Apr 17, 2018
49e38c9
core/asm: remove unused condition (#16487)
dm4 Apr 17, 2018
661f5f3
cmd/utils: fix help template issue for subcommands (#16351)
niuzhenguo Apr 17, 2018
52b046c
rpc: clean up IPC handler (#16524)
fjl Apr 18, 2018
c514fbc
core/asm: accept uppercase instructions (#16531)
dm4 Apr 19, 2018
8f8774c
all: fix various typos (#16533)
wuxiangzhou2010 Apr 19, 2018
8feb318
rpc: handle HTTP response error codes (#16500)
holiman Apr 19, 2018
a16f12b
whisper/whisperv6: post returns the hash of sent message (#16495)
gluk256 Apr 19, 2018
b15eb66
ethclient: add DialContext and Close (#16318)
Apr 19, 2018
744428c
vendor: update elastic/gosigar so that it compiles on OpenBSD (#16542)
Mischi Apr 21, 2018
7cf83ce
eth/downloader: fix for Issue #16539 (#16546)
Apr 23, 2018
cbdaa0c
params: release Geth v1.8.5 - Dirty Derivative²
karalabe Apr 23, 2018
50aa1dc
VERSION, params: begin Geth 1.8.6 release cycle
karalabe Apr 23, 2018
26a4dbb
cmd/geth: update the copyright year in the geth command usage (#16537)
vieyang Apr 23, 2018
3f2583d
Revert "Dockerfile.alltools: fix invalid command"
karalabe Apr 23, 2018
4f91831
Merge pull request #16550 from ethereum/revert-16478-fix-alltools-doc…
karalabe Apr 23, 2018
abd881f
Revert "cmd/puppeth: fix node deploys for updated dockerfile user"
karalabe Apr 23, 2018
7d2c730
Merge pull request #16551 from ethereum/revert-16477-puppeth-dockerfi…
karalabe Apr 23, 2018
96a6c8b
Dockerfile: revert the user change PR that broke all APIs
karalabe Apr 23, 2018
16a78b0
Merge pull request #16552 from karalabe/revert-docker-user
karalabe Apr 23, 2018
49371bf
Dockerfile: drop legacy discovery v5 port mappings
karalabe Apr 23, 2018
12683fe
params: release v1.8.6 to fix docker images
karalabe Apr 23, 2018
9586f2a
VERSION, params: begin release cycle 1.8.7
karalabe Apr 23, 2018
e7067be
cmd/geth, mobile: add memsize to pprof server (#16532)
fjl Apr 23, 2018
86be91b
core/types: avoid duplicating transactions on changing signer (#16435)
countvonzero Apr 24, 2018
b724d1a
core/state: cache missing storage entries (#16584)
fjl Apr 27, 2018
852aa14
cmd/utils: point users to --syncmode under DEPRECATED (#16572)
martinklepsch Apr 27, 2018
cfe8f5f
trie: remove unused `buf` parameter (#16583)
xincaosu Apr 27, 2018
7a7428a
core, eth: fix tracer dirty finalization
karalabe Apr 27, 2018
1da3302
Merge pull request #16588 from karalabe/tracer-dirty-fix
karalabe Apr 27, 2018
ea171d5
travis.yml: remove obsolete brew-cask install
reductionista May 1, 2018
9f6af6f
whisper: Golint fixes in whisper packages (#16637)
roveneliah May 2, 2018
a1949d0
vendor: fix leveldb crash when bigger than 1 TiB
May 1, 2018
9922943
Merge pull request #16636 from reductionista/travis
karalabe May 2, 2018
448d17b
Merge pull request #16630 from tstranex/master
karalabe May 2, 2018
0afd767
core: ensure local transactions aren't discarded as underpriced
Apr 26, 2018
8dfa4f4
evm/main: use blocknumber from genesis
holiman Apr 26, 2018
c1ea527
accounts: golint updates for this or self warning (#16627)
kielbarry May 2, 2018
d76c5ca
tests: golint fixes for tests directory (#16640)
roveneliah May 2, 2018
4a8d5d2
trie: golint iterator fixes (#16639)
roveneliah May 2, 2018
670bae4
internal: golint updates for this or self warning (#16634)
kielbarry May 2, 2018
a7720b5
core: golint updates for this or self warning (#16633)
kielbarry May 2, 2018
579ac62
Merge pull request #16576 from CrispinFlowerday/bugfix/local_underpri…
karalabe May 2, 2018
5449139
Merge pull request #16569 from holiman/evm_blocknum
karalabe May 2, 2018
58c4e03
build: Add ldflags -s -w when building aar
ligi May 2, 2018
6a01363
Merge pull request #16644 from ligi/reduce_aar_size
karalabe May 2, 2018
5d4d79a
cmd/clef: documentation about setup (#16568)
holiman May 2, 2018
66432f3
params: release geth 1.8.7
karalabe May 2, 2018
ee00e53
Zero Block Reward Post Byzantium
TuitionCoin Apr 15, 2018
5d0e95c
Remove Difficulty Bomb
TuitionCoin Apr 15, 2018
83f0fb0
1 Second Block
TuitionCoin Apr 15, 2018
80b405c
Lower Minimum Difficulty (#4)
TuitionCoin Apr 15, 2018
def7154
1 Second Blocks (#5)
TuitionCoin Apr 15, 2018
21f17a6
Lower minimum difficulty (#6)
TuitionCoin Apr 29, 2018
e9610cb
Enable geth compile.solidity for rpc (#7)
TuitionCoin May 8, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
core: remove stray account creations in state transition (ethereum#16470
)

The 'from' and 'to' methods on StateTransitions are reader methods and
shouldn't have inadvertent side effects on state.

It is safe to remove the check in 'from' because account existence is
implicitly checked by the nonce and balance checks. If the account has
non-zero balance or nonce, it must exist. Even if the sender account has
nonce zero at the start of the state transition or no balance, the nonce
is incremented before execution and the account will be created at that
time.

It is safe to remove the check in 'to' because the EVM creates the
account if necessary.

Fixes ethereum#15119
  • Loading branch information
fjl committed Apr 10, 2018
commit 3caf16b15f0b6a30717acb245fa8d347b2f06c3f
58 changes: 16 additions & 42 deletions core/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,28 +132,12 @@ func ApplyMessage(evm *vm.EVM, msg Message, gp *GasPool) ([]byte, uint64, bool,
return NewStateTransition(evm, msg, gp).TransitionDb()
}

func (st *StateTransition) from() vm.AccountRef {
f := st.msg.From()
if !st.state.Exist(f) {
st.state.CreateAccount(f)
// to returns the recipient of the message.
func (st *StateTransition) to() common.Address {
if st.msg == nil || st.msg.To() == nil /* contract creation */ {
return common.Address{}
}
return vm.AccountRef(f)
}

func (st *StateTransition) to() vm.AccountRef {
if st.msg == nil {
return vm.AccountRef{}
}
to := st.msg.To()
if to == nil {
return vm.AccountRef{} // contract creation
}

reference := vm.AccountRef(*to)
if !st.state.Exist(*to) {
st.state.CreateAccount(*to)
}
return reference
return *st.msg.To()
}

func (st *StateTransition) useGas(amount uint64) error {
Expand All @@ -166,12 +150,8 @@ func (st *StateTransition) useGas(amount uint64) error {
}

func (st *StateTransition) buyGas() error {
var (
state = st.state
sender = st.from()
)
mgval := new(big.Int).Mul(new(big.Int).SetUint64(st.msg.Gas()), st.gasPrice)
if state.GetBalance(sender.Address()).Cmp(mgval) < 0 {
if st.state.GetBalance(st.msg.From()).Cmp(mgval) < 0 {
return errInsufficientBalanceForGas
}
if err := st.gp.SubGas(st.msg.Gas()); err != nil {
Expand All @@ -180,20 +160,17 @@ func (st *StateTransition) buyGas() error {
st.gas += st.msg.Gas()

st.initialGas = st.msg.Gas()
state.SubBalance(sender.Address(), mgval)
st.state.SubBalance(st.msg.From(), mgval)
return nil
}

func (st *StateTransition) preCheck() error {
msg := st.msg
sender := st.from()

// Make sure this transaction's nonce is correct
if msg.CheckNonce() {
nonce := st.state.GetNonce(sender.Address())
if nonce < msg.Nonce() {
// Make sure this transaction's nonce is correct.
if st.msg.CheckNonce() {
nonce := st.state.GetNonce(st.msg.From())
if nonce < st.msg.Nonce() {
return ErrNonceTooHigh
} else if nonce > msg.Nonce() {
} else if nonce > st.msg.Nonce() {
return ErrNonceTooLow
}
}
Expand All @@ -208,8 +185,7 @@ func (st *StateTransition) TransitionDb() (ret []byte, usedGas uint64, failed bo
return
}
msg := st.msg
sender := st.from() // err checked in preCheck

sender := vm.AccountRef(msg.From())
homestead := st.evm.ChainConfig().IsHomestead(st.evm.BlockNumber)
contractCreation := msg.To() == nil

Expand All @@ -233,8 +209,8 @@ func (st *StateTransition) TransitionDb() (ret []byte, usedGas uint64, failed bo
ret, _, st.gas, vmerr = evm.Create(sender, st.data, st.gas, st.value)
} else {
// Increment the nonce for the next transaction
st.state.SetNonce(sender.Address(), st.state.GetNonce(sender.Address())+1)
ret, st.gas, vmerr = evm.Call(sender, st.to().Address(), st.data, st.gas, st.value)
st.state.SetNonce(msg.From(), st.state.GetNonce(sender.Address())+1)
ret, st.gas, vmerr = evm.Call(sender, st.to(), st.data, st.gas, st.value)
}
if vmerr != nil {
log.Debug("VM returned with error", "err", vmerr)
Expand All @@ -260,10 +236,8 @@ func (st *StateTransition) refundGas() {
st.gas += refund

// Return ETH for remaining gas, exchanged at the original rate.
sender := st.from()

remaining := new(big.Int).Mul(new(big.Int).SetUint64(st.gas), st.gasPrice)
st.state.AddBalance(sender.Address(), remaining)
st.state.AddBalance(st.msg.From(), remaining)

// Also return remaining gas to the block gas counter so it is
// available for the next transaction.
Expand Down
1 change: 0 additions & 1 deletion tests/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ func TestState(t *testing.T) {
// Expected failures:
st.fails(`^stRevertTest/RevertPrecompiledTouch\.json/EIP158`, "bug in test")
st.fails(`^stRevertTest/RevertPrecompiledTouch\.json/Byzantium`, "bug in test")
st.fails(`^stRandom2/randomStatetest64[45]\.json/(EIP150|Frontier|Homestead)/.*`, "known bug #15119")

st.walk(t, stateTestDir, func(t *testing.T, name string, test *StateTest) {
for _, subtest := range test.Subtests() {
Expand Down