diff --git a/core/state_processor_test.go b/core/state_processor_test.go index 21c72c31a0e7..031bd66048d5 100644 --- a/core/state_processor_test.go +++ b/core/state_processor_test.go @@ -382,17 +382,17 @@ func TestProcessStateless(t *testing.T) { blockchain, _ := NewBlockChain(db, nil, gspec.Config, ethash.NewFaker(), vm.Config{}, nil, nil) defer blockchain.Stop() var blockGasUsedExpected uint64 - chain, _ := GenerateVerkleChain(gspec.Config, genesis, ethash.NewFaker(), db, 1, func(i int, gen *BlockGen) { + chain, _ := GenerateVerkleChain(gspec.Config, genesis, ethash.NewFaker(), db, 2, func(i int, gen *BlockGen) { // TODO need to check that the tx cost provided is the exact amount used (no remaining left-over) txCost := params.WitnessBranchWriteCost*2 + params.WitnessBranchReadCost*2 + params.WitnessChunkWriteCost*3 + params.WitnessChunkReadCost*12 + params.TxGas blockGasUsedExpected += txCost * 2 - tx, _ := types.SignTx(types.NewTransaction(uint64(i) * 3, common.Address{1, 2, 3}, big.NewInt(999), txCost, big.NewInt(875000000), nil), signer, testKey) + tx, _ := types.SignTx(types.NewTransaction(uint64(i)*3, common.Address{1, 2, 3}, big.NewInt(999), txCost, big.NewInt(875000000), nil), signer, testKey) gen.AddTx(tx) - tx, _ = types.SignTx(types.NewTransaction(uint64(i) * 3 + 1, common.Address{}, big.NewInt(999), txCost, big.NewInt(875000000), nil), signer, testKey) + tx, _ = types.SignTx(types.NewTransaction(uint64(i)*3+1, common.Address{}, big.NewInt(999), txCost, big.NewInt(875000000), nil), signer, testKey) gen.AddTx(tx) txCost = params.WitnessBranchWriteCost + params.WitnessBranchReadCost*2 + params.WitnessChunkWriteCost*2 + params.WitnessChunkReadCost*10 + params.TxGas blockGasUsedExpected += txCost - tx, _ = types.SignTx(types.NewTransaction(uint64(i) * 3 + 2, common.Address{}, big.NewInt(0), txCost, big.NewInt(875000000), nil), signer, testKey) + tx, _ = types.SignTx(types.NewTransaction(uint64(i)*3+2, common.Address{}, big.NewInt(0), txCost, big.NewInt(875000000), nil), signer, testKey) gen.AddTx(tx) }) diff --git a/core/types/access_witness.go b/core/types/access_witness.go index b2274cb9a880..7f6caddccf39 100644 --- a/core/types/access_witness.go +++ b/core/types/access_witness.go @@ -95,10 +95,6 @@ func (aw *AccessWitness) touchAddressOnWrite(addr []byte) (bool, bool, bool) { chunkValue.mode |= AccessWitnessWriteFlag aw.Chunks[common.BytesToHash(addr)] = chunkValue } - gas += aw.TouchAddressAndChargeGas(utils.GetTreeKeyCodeSize(addr[:]), nil) - gas += aw.TouchAddressAndChargeGas(utils.GetTreeKeyCodeKeccak(addr[:]), nil) - return gas -} // TODO charge chunk filling costs if the leaf was previously empty in the state /*