Skip to content

Commit a05c092

Browse files
authored
Merge e013a6b into 7135c22
2 parents 7135c22 + e013a6b commit a05c092

File tree

10 files changed

+17
-17
lines changed

10 files changed

+17
-17
lines changed

accounts/keystore/passphrase.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ func DecryptKey(keyjson []byte, auth string) (*Key, error) {
230230
key := crypto.ToECDSAUnsafe(keyBytes)
231231

232232
return &Key{
233-
Id: uuid.UUID(keyId),
233+
Id: keyId,
234234
Address: crypto.PubkeyToAddress(key.PublicKey),
235235
PrivateKey: key,
236236
}, nil

contracts/checkpointoracle/oracle.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func (oracle *CheckpointOracle) LookupCheckpointEvents(blockLogs [][]*types.Log,
5959
if err != nil {
6060
continue
6161
}
62-
if event.Index == section && common.Hash(event.CheckpointHash) == hash {
62+
if event.Index == section && event.CheckpointHash == hash {
6363
votes = append(votes, event)
6464
}
6565
}

core/state/statedb.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ func (s *StateDB) GetSolidityBytes(addr common.Address, slot common.Hash) ([]byt
391391
func (s *StateDB) GetProof(a common.Address) ([][]byte, error) {
392392
var proof proofList
393393
err := s.trie.Prove(crypto.Keccak256(a.Bytes()), 0, &proof)
394-
return [][]byte(proof), err
394+
return proof, err
395395
}
396396

397397
// GetProof returns the StorageProof for given key
@@ -402,7 +402,7 @@ func (s *StateDB) GetStorageProof(a common.Address, key common.Hash) ([][]byte,
402402
return proof, errors.New("storage trie for requested address does not exist")
403403
}
404404
err := trie.Prove(crypto.Keccak256(key.Bytes()), 0, &proof)
405-
return [][]byte(proof), err
405+
return proof, err
406406
}
407407

408408
// GetCommittedState retrieves a value from the given account's committed storage trie.

core/tx_pool_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1138,7 +1138,7 @@ func TestTransactionAllowedTxSize(t *testing.T) {
11381138
t.Fatalf("expected rejection on slightly oversize transaction")
11391139
}
11401140
// Try adding a transaction of random not allowed size
1141-
if err := pool.addRemoteSync(pricedDataTransaction(2, pool.currentMaxGas, big.NewInt(1), key, dataSize+1+uint64(rand.Intn(int(10*txMaxSize))))); err == nil {
1141+
if err := pool.addRemoteSync(pricedDataTransaction(2, pool.currentMaxGas, big.NewInt(1), key, dataSize+1+uint64(rand.Intn(10*txMaxSize)))); err == nil {
11421142
t.Fatalf("expected rejection on oversize transaction")
11431143
}
11441144
// Run some sanity checks on the pool internals

core/vm/cvm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ func (cvm *CVM) Create2(caller ContractRef, code []byte, gas uint64, endowment *
550550
//contractAddr = crypto.CreateAddress2(caller.Address(), common.BigToHash(salt), code)
551551
// return cvm.create(caller, code, gas, endowment, contractAddr)
552552
codeAndHash := &codeAndHash{code: code}
553-
contractAddr = crypto.CreateAddress2(caller.Address(), common.Hash(salt.Bytes32()), codeAndHash.Hash().Bytes())
553+
contractAddr = crypto.CreateAddress2(caller.Address(), salt.Bytes32(), codeAndHash.Hash().Bytes())
554554
return cvm.create(caller, codeAndHash, gas, endowment, contractAddr)
555555
}
556556

core/vm/gas_table.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ func gasReturnDataCopy(gt params.GasTable, cvm *CVM, contract *Contract, stack *
163163
func gasSStore(gt params.GasTable, cvm *CVM, contract *Contract, stack *Stack, mem *Memory, memorySize uint64) (uint64, error) {
164164
var (
165165
y, x = stack.Back(1), stack.Back(0)
166-
current = cvm.StateDB.GetState(contract.Address(), common.Hash(x.Bytes32()))
166+
current = cvm.StateDB.GetState(contract.Address(), x.Bytes32())
167167
)
168168
// The legacy gas metering only takes into consideration the current state
169169
// Legacy rules should be applied if we are in Petersburg (removal of EIP-1283)
@@ -202,7 +202,7 @@ func gasSStore(gt params.GasTable, cvm *CVM, contract *Contract, stack *Stack, m
202202
if current == value { // noop (1)
203203
return params.NetSstoreNoopGas, nil
204204
}
205-
original := cvm.StateDB.GetCommittedState(contract.Address(), common.Hash(x.Bytes32()))
205+
original := cvm.StateDB.GetCommittedState(contract.Address(), x.Bytes32())
206206
if original == current {
207207
if original == (common.Hash{}) { // create slot (2.1.1)
208208
return params.NetSstoreInitGas, nil
@@ -250,14 +250,14 @@ func gasSStoreEIP2200(gt params.GasTable, cvm *CVM, contract *Contract, stack *S
250250
// Gas sentry honoured, do the actual gas calculation based on the stored value
251251
var (
252252
y, x = stack.Back(1), stack.Back(0)
253-
current = cvm.StateDB.GetState(contract.Address(), common.Hash(x.Bytes32()))
253+
current = cvm.StateDB.GetState(contract.Address(), x.Bytes32())
254254
)
255255
value := common.Hash(y.Bytes32())
256256

257257
if current == value { // noop (1)
258258
return params.SloadGasEIP2200, nil
259259
}
260-
original := cvm.StateDB.GetCommittedState(contract.Address(), common.Hash(x.Bytes32()))
260+
original := cvm.StateDB.GetCommittedState(contract.Address(), x.Bytes32())
261261
if original == current {
262262
if original == (common.Hash{}) { // create slot (2.1.1)
263263
return params.SstoreSetGasEIP2200, nil

core/vm/instructions.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ func opReturnDataCopy(pc *uint64, interpreter *CVMInterpreter, callContext *call
359359

360360
func opExtCodeSize(pc *uint64, interpreter *CVMInterpreter, callContext *callCtx) ([]byte, error) {
361361
slot := callContext.stack.peek()
362-
slot.SetUint64(uint64(interpreter.cvm.StateDB.GetCodeSize(common.Address(slot.Bytes20()))))
362+
slot.SetUint64(uint64(interpreter.cvm.StateDB.GetCodeSize(slot.Bytes20())))
363363

364364
return nil, nil
365365
}
@@ -536,7 +536,7 @@ func opSstore(pc *uint64, interpreter *CVMInterpreter, callContext *callCtx) ([]
536536
loc := callContext.stack.pop()
537537
val := callContext.stack.pop()
538538
interpreter.cvm.StateDB.SetState(callContext.contract.Address(),
539-
common.Hash(loc.Bytes32()), common.Hash(val.Bytes32()))
539+
loc.Bytes32(), val.Bytes32())
540540
return nil, nil
541541
}
542542

@@ -1026,7 +1026,7 @@ func opStop(pc *uint64, interpreter *CVMInterpreter, callContext *callCtx) ([]by
10261026
func opSuicide(pc *uint64, interpreter *CVMInterpreter, callContext *callCtx) ([]byte, error) {
10271027
beneficiary := callContext.stack.pop()
10281028
balance := interpreter.cvm.StateDB.GetBalance(callContext.contract.Address())
1029-
interpreter.cvm.StateDB.AddBalance(common.Address(beneficiary.Bytes20()), balance)
1029+
interpreter.cvm.StateDB.AddBalance(beneficiary.Bytes20(), balance)
10301030
interpreter.cvm.StateDB.Suicide(callContext.contract.Address())
10311031
return nil, nil
10321032
}
@@ -1039,7 +1039,7 @@ func makeLog(size int) executionFunc {
10391039
mStart, mSize := stack.pop(), stack.pop()
10401040
for i := 0; i < size; i++ {
10411041
addr := stack.pop()
1042-
topics[i] = common.Hash(addr.Bytes32())
1042+
topics[i] = addr.Bytes32()
10431043
}
10441044

10451045
d := callContext.memory.GetCopy(int64(mStart.Uint64()), int64(mSize.Uint64()))

p2p/enode/nodedb.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ func splitNodeItemKey(key []byte) (id ID, ip net.IP, field string) {
163163
}
164164
key = key[len(dbDiscoverRoot)+1:]
165165
// Split out the IP.
166-
ip = net.IP(key[:16])
166+
ip = key[:16]
167167
if ip4 := ip.To4(); ip4 != nil {
168168
ip = ip4
169169
}

trie/database.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func (n rawNode) cache() (hashNode, bool) { panic("this should never end up in
100100
func (n rawNode) fstring(ind string) string { panic("this should never end up in a live trie") }
101101

102102
func (n rawNode) EncodeRLP(w io.Writer) error {
103-
_, err := w.Write([]byte(n))
103+
_, err := w.Write(n)
104104
return err
105105
}
106106

trie/iterator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ func (it *nodeIterator) LeafKey() []byte {
173173
func (it *nodeIterator) LeafBlob() []byte {
174174
if len(it.stack) > 0 {
175175
if node, ok := it.stack[len(it.stack)-1].node.(valueNode); ok {
176-
return []byte(node)
176+
return node
177177
}
178178
}
179179
panic("not at leaf")

0 commit comments

Comments
 (0)