From 445feaeef58bd89a113743dccf6fd5df55cde6fa Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Thu, 20 Oct 2016 13:36:29 +0200 Subject: core, core/state, trie: EIP158, reprice & skip empty account write This commit implements EIP158 part 1, 2, 3 & 4 1. If an account is empty it's no longer written to the trie. An empty account is defined as (balance=0, nonce=0, storage=0, code=0). 2. Delete an empty account if it's touched 3. An empty account is redefined as either non-existent or empty. 4. Zero value calls and zero value suicides no longer consume the 25k reation costs. params: moved core/config to params Signed-off-by: Jeffrey Wilcke --- eth/helper_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'eth/helper_test.go') diff --git a/eth/helper_test.go b/eth/helper_test.go index d5295b398..73af04fcf 100644 --- a/eth/helper_test.go +++ b/eth/helper_test.go @@ -35,6 +35,7 @@ import ( "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/p2p/discover" + "github.com/ethereum/go-ethereum/params" ) var ( @@ -54,10 +55,10 @@ func newTestProtocolManager(fastSync bool, blocks int, generator func(int, *core pow = new(core.FakePow) db, _ = ethdb.NewMemDatabase() genesis = core.WriteGenesisBlockForTesting(db, testBank) - chainConfig = &core.ChainConfig{HomesteadBlock: big.NewInt(0)} // homestead set to 0 because of chain maker + chainConfig = ¶ms.ChainConfig{HomesteadBlock: big.NewInt(0)} // homestead set to 0 because of chain maker blockchain, _ = core.NewBlockChain(db, chainConfig, pow, evmux) ) - chain, _ := core.GenerateChain(nil, genesis, db, blocks, generator) + chain, _ := core.GenerateChain(chainConfig, genesis, db, blocks, generator) if _, err := blockchain.InsertChain(chain); err != nil { panic(err) } -- cgit v1.2.3 From 4dca5d4db7fc2c1fac5a2e24dcc99b15573f0188 Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Wed, 2 Nov 2016 13:44:13 +0100 Subject: core/types, params: EIP#155 --- eth/helper_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'eth/helper_test.go') diff --git a/eth/helper_test.go b/eth/helper_test.go index 73af04fcf..f23976785 100644 --- a/eth/helper_test.go +++ b/eth/helper_test.go @@ -110,7 +110,7 @@ func (p *testTxPool) Pending() map[common.Address]types.Transactions { batches := make(map[common.Address]types.Transactions) for _, tx := range p.pool { - from, _ := tx.From() + from, _ := types.Sender(types.HomesteadSigner{}, tx) batches[from] = append(batches[from], tx) } for _, batch := range batches { @@ -122,7 +122,7 @@ func (p *testTxPool) Pending() map[common.Address]types.Transactions { // newTestTransaction create a new dummy transaction. func newTestTransaction(from *ecdsa.PrivateKey, nonce uint64, datasize int) *types.Transaction { tx := types.NewTransaction(nonce, common.Address{}, big.NewInt(0), big.NewInt(100000), big.NewInt(0), make([]byte, datasize)) - tx, _ = tx.SignECDSA(from) + tx, _ = tx.SignECDSA(types.HomesteadSigner{}, from) return tx } -- cgit v1.2.3