-
Notifications
You must be signed in to change notification settings - Fork 93
Conversation
change []byte type to common.Address
This reverts commit 99f3d70.
use inverted index instead of bruteforce
@Qjawko plz create Erigon's PR (without merging this PR) to see if Erigon's CI shows green light. |
I also wanna ask you to replace: |
txpool/pool.go
Outdated
|
||
addr, ok := p.senders.senderID2Addr[metaTx.Tx.SenderID] | ||
if !ok { | ||
log.Warn("sender address not found by ID", metaTx.Tx.SenderID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
erigon has many components - plz add prefix [txpool] flush:
to understand where this log comes from
@@ -1723,7 +1725,7 @@ func (p *TxPool) fromDB(ctx context.Context, tx kv.Tx, coreTx kv.Tx) error { | |||
txs.Resize(uint(i + 1)) | |||
txs.Txs[i] = txn | |||
txs.IsLocal[i] = isLocalTx | |||
copy(txs.Senders.At(i), addr) | |||
copy(txs.Senders.At(i), addr[:]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this line is broken - because At
now returns copy of data instead of reference on underlying buffer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this line is not broken, method At still returns a pointer to array, only SliceHeader is copying (len, cap and pointer to array)
@@ -1701,7 +1703,7 @@ func (p *TxPool) fromDB(ctx context.Context, tx kv.Tx, coreTx kv.Tx) error { | |||
if err != nil { | |||
return err | |||
} | |||
addr, txRlp := v[:20], v[20:] | |||
addr, txRlp := *(*[20]byte)(v[:20]), v[20:] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's use BytesToAddress
func
and maybe change implementation of BytesToAddress
to use this "casting trick".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good advice, will try to implement
FYI: can run on local machine: |
While reviewed this task - found task for another PR: to replace |
You mean change them only in txpool package, right? |
yes. we moved |
@Qjawko hi. next steps:
then i can merge |
use ThreadUnsafeSet instead of DefaultSet
merged by: erigontech/erigon#7118 |
Reduce memory allocations and using inverted index (instead of brute-force). Use common.Address type instead of []byte [Related issue](erigontech/erigon#7002)
Reduce memory allocations and using inverted index (instead of brute-force). Use common.Address type instead of []byte [Related issue](erigontech/erigon#7002)
Reduce memory allocations and using inverted index (instead of brute-force). Use common.Address type instead of []byte [Related issue](erigontech/erigon#7002)
Reduce memory allocations and using inverted index (instead of brute-force). Use common.Address type instead of []byte [Related issue](erigontech/erigon#7002)
Reduce memory allocations and using inverted index (instead of brute-force).
Use common.Address type instead of []byte
Related issue