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

fix(events): check for sync-in-progress #6353

Merged
merged 1 commit into from
Jun 13, 2024
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
3 changes: 1 addition & 2 deletions app/submodule/eth/eth_event_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ var _ v1.IETHEvent = (*ethEventAPI)(nil)

func newEthEventAPI(ctx context.Context, em *EthSubModule) (*ethEventAPI, error) {
chainAPI := em.chainModule.API()
bsstore := em.chainModule.ChainReader.Blockstore()
cfg := em.cfg.FevmConfig
ee := &ethEventAPI{
em: em,
Expand Down Expand Up @@ -70,7 +69,7 @@ func newEthEventAPI(ctx context.Context, em *EthSubModule) (*ethEventAPI, error)

ee.EventFilterManager = &filter.EventFilterManager{
MessageStore: ee.em.chainModule.MessageStore,
ChainStore: bsstore,
ChainStore: ee.em.chainModule.ChainReader,
EventIndex: eventIndex, // will be nil unless EnableHistoricFilterAPI is true
AddressResolver: func(ctx context.Context, emitter abi.ActorID, ts *types.TipSet) (address.Address, bool) {
// we only want to match using f4 addresses
Expand Down
9 changes: 6 additions & 3 deletions pkg/events/filter/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
blockadt "github.com/filecoin-project/specs-actors/actors/util/adt"
"github.com/filecoin-project/venus/pkg/chain"
"github.com/filecoin-project/venus/venus-shared/actors/adt"
"github.com/filecoin-project/venus/venus-shared/blockstore"
"github.com/filecoin-project/venus/venus-shared/types"
cbor "github.com/ipfs/go-ipld-cbor"
)
Expand Down Expand Up @@ -303,7 +302,7 @@ func (e *executedMessage) Events() []*types.Event {

type EventFilterManager struct {
MessageStore *chain.MessageStore
ChainStore blockstore.Blockstore
ChainStore *chain.Store
AddressResolver func(ctx context.Context, emitter abi.ActorID, ts *types.TipSet) (address.Address, bool)
MaxFilterResults int
EventIndex *EventIndex
Expand Down Expand Up @@ -378,6 +377,10 @@ func (m *EventFilterManager) Revert(ctx context.Context, from, to *types.TipSet)
func (m *EventFilterManager) Install(ctx context.Context, minHeight, maxHeight abi.ChainEpoch, tipsetCid cid.Cid, addresses []address.Address,
keysWithCodec map[string][]types.ActorEventBlock, excludeReverted bool) (EventFilter, error) {
m.mu.Lock()
if m.currentHeight == 0 {
// sync in progress, we haven't had an Apply
m.currentHeight = m.ChainStore.GetHead().Height()
}
currentHeight := m.currentHeight
m.mu.Unlock()

Expand Down Expand Up @@ -433,7 +436,7 @@ func (m *EventFilterManager) loadExecutedMessages(ctx context.Context, msgTS, rc
return nil, xerrors.Errorf("read messages: %w", err)
}

st := adt.WrapStore(ctx, cbor.NewCborStore(m.ChainStore))
st := adt.WrapStore(ctx, cbor.NewCborStore(m.ChainStore.Blockstore()))

arr, err := blockadt.AsArray(st, rctTS.Blocks()[0].ParentMessageReceipts)
if err != nil {
Expand Down
Loading