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

feat: introduce safe and finalized as block number filters #412

Merged
merged 2 commits into from
Oct 30, 2024

Conversation

Stefan-Ethernal
Copy link

@Stefan-Ethernal Stefan-Ethernal commented Oct 30, 2024

Description

The PR introduces finalized and safe keywords for block numbers in the JSON RPC layer. Because of the instant finality and there are no reorgs, safe and finalized behave the same way as the latest (namely the latest block from the store is returned).

Also, values are aligned with those used in the Ethereum spec (https://docs.tatum.io/docs/evm-block-finality-and-confidence#block-tags-and-their-meanings). See ethereum/go-ethereum#25165.

const (
	SafeBlockNumber      = BlockNumber(-4)
	FinalizedBlockNumber = BlockNumber(-3)
	LatestBlockNumber    = BlockNumber(-2)
	PendingBlockNumber   = BlockNumber(-1)
	EarliestBlockNumber  = BlockNumber(0)
)

Changes include

  • Bugfix (non-breaking change that solves an issue)
  • Hotfix (change that solves an urgent issue, and requires immediate attention)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (change that is not backwards-compatible and/or changes current functionality)

jsonrpc/helper.go Outdated Show resolved Hide resolved
jsonrpc/helper.go Show resolved Hide resolved
@Stefan-Ethernal Stefan-Ethernal merged commit a044bd1 into develop Oct 30, 2024
10 checks passed
@Stefan-Ethernal Stefan-Ethernal deleted the feat/introduce-safe-block-number branch October 30, 2024 15:05
@Stefan-Ethernal Stefan-Ethernal changed the title feat: introduce safe and finalized as block number filters feat: introduce safe and finalized as block number filters Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants