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

test: add simple Handlers.on_block test #475

Merged
merged 5 commits into from
Nov 30, 2023
Merged
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
29 changes: 29 additions & 0 deletions test/integration/fork_choice/handlers_test.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
defmodule Integration.ForkChoice.HandlersTest do
use ExUnit.Case

alias LambdaEthereumConsensus.ForkChoice.Handlers
alias LambdaEthereumConsensus.ForkChoice.Helpers
alias LambdaEthereumConsensus.Store.BlockStore
alias LambdaEthereumConsensus.Store.Db
alias LambdaEthereumConsensus.Store.StateStore

setup_all do
start_supervised!(Db)
:ok
end

@tag :skip
test "on_block w/data from DB" do
# NOTE: this test requires a DB with a state, and blocks for the state's slot and the next slot.
# WARN: sometimes fails with "OffsetOutOfBounds" errors. Re-run the test in those cases.
{:ok, state} = StateStore.get_latest_state()

{:ok, signed_block} = BlockStore.get_block_by_slot(state.slot)
{:ok, new_signed_block} = BlockStore.get_block_by_slot(state.slot + 1)

assert {:ok, store} = Helpers.get_forkchoice_store(state, signed_block.message)
new_store = Handlers.on_tick(store, :os.system_time(:second))

assert {:ok, _} = Handlers.on_block(new_store, new_signed_block)
end
end
Loading