Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to getting logs via block hash instead of block number #156

Merged
merged 2 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Fixed
- Fetching logs via block height resulting in invalid results. Block hash is now used to ensure correct results. (#156)

## [2.12.1] - 2023-09-01
### Fixed
Expand All @@ -15,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fallback to singular provider if batch provider is not supported (#144)
- Fix missing ds option for event in dictionary query entries (#145)
- Update `node-core` to 4.2.5, fix dictionary failed to get token issue.

### Added
- Custom provider for Celo (#147)

Expand All @@ -27,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [2.10.0] - 2023-07-31
### Added
- Added `!null` filter for logs (#135)

### Changed
- Update license to GPL-3.0 (#137)
- Updated retry logic for eth requests (#134)
Expand Down
9 changes: 2 additions & 7 deletions packages/node/src/ethereum/api.ethereum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,8 @@ export class EthereumApi implements ApiWrapper<EthereumBlockWrapper> {
includeTx?: boolean,
): Promise<EthereumBlockWrapped> {
try {
const [block, logs] = await Promise.all([
this.getBlockPromise(blockNumber, includeTx),
this.client.getLogs({
fromBlock: hexValue(blockNumber),
toBlock: hexValue(blockNumber),
}),
]);
const block = await this.getBlockPromise(blockNumber, includeTx);
const logs = await this.client.getLogs({ blockHash: block.hash });
ianhe8x marked this conversation as resolved.
Show resolved Hide resolved

const ret = new EthereumBlockWrapped(
block,
Expand Down
Loading