OpenZeppelin / OpenZeppelin/Event-Scanner
Add `transaction_index` Scanner Field to Scanners That Rely on `from_block`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 19
- Forks
- 7
- Avg merge
- 2h 15m
- Merged PRs (30d)
- 4
Description
sync::from_block and historic builders would have the additional optional transaction_index builder function, that would allow devs to specify the exact transaction index in the from_block from which to start streaming.
let mut scanner = EventScannerBuilder::sync()
.from_block(100)
.transaction_index(5)
.connect(provider)
.await?;
// this means: "start streaming from block 100, discarding all logs prior to transaction index 5"
// Historical block range mode
let scanner = EventScannerBuilder::historic()
.from_block(1000)
.transaction_index(15)
.to_block(2000)
.max_block_range(500)
.connect(provider.clone());
// "stream logs from block 1000 to block 2000, discarding all logs prior to transaction index 15"
DEFAULT_TRANSACTION_INDEX = 0- if the set transaction index is higher than the number of transactions that the specified block contains, the scanner would skip the whole block completely.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the EventScannerBuilder::sync and EventScannerBuilder::historic implementations and their from_block handling. Add the optional transaction_index behavior described in the issue, including the default of 0 and skipping blocks when the index is out of range; done means both scanner modes honor the requested starting transaction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- blockchain
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100