Load actor to resolve address

This commit is contained in:
Ian Davis 2022-11-16 11:50:00 +00:00
parent d5177a394a
commit 41bf2a0297
2 changed files with 7 additions and 6 deletions

View File

@ -1252,7 +1252,6 @@ var (
func ethFilterResultFromEvents(evs []*filter.CollectedEvent) (*api.EthFilterResult, error) { func ethFilterResultFromEvents(evs []*filter.CollectedEvent) (*api.EthFilterResult, error) {
res := &api.EthFilterResult{} res := &api.EthFilterResult{}
for _, ev := range evs { for _, ev := range evs {
log := api.EthLog{ log := api.EthLog{
Removed: ev.Reverted, Removed: ev.Reverted,

View File

@ -79,19 +79,21 @@ func EthEventAPI(cfg config.ActorEventConfig) func(helpers.MetricsCtx, fx.Lifecy
if err != nil { if err != nil {
return address.Undef, false return address.Undef, false
} }
addr, err := sm.LookupRobustAddress(ctx, idAddr, ts)
if err != nil { actor, err := sm.LoadActor(ctx, idAddr, ts)
if err != nil || actor.Address == nil {
return address.Undef, false return address.Undef, false
} }
// if robust address is not f4 then we won't match against it so bail early // if robust address is not f4 then we won't match against it so bail early
if addr.Protocol() != address.Delegated { if actor.Address.Protocol() != address.Delegated {
return address.Undef, false return address.Undef, false
} }
// we have an f4 address, make sure it's assigned by the EAM // we have an f4 address, make sure it's assigned by the EAM
if namespace, _, err := varint.FromUvarint(addr.Payload()); err != nil || namespace != builtintypes.EthereumAddressManagerActorID { if namespace, _, err := varint.FromUvarint(actor.Address.Payload()); err != nil || namespace != builtintypes.EthereumAddressManagerActorID {
return address.Undef, false return address.Undef, false
} }
return addr, true return *actor.Address, true
}, },
MaxFilterResults: cfg.MaxFilterResults, MaxFilterResults: cfg.MaxFilterResults,