diff --git a/beacon-chain/rpc/beaconv1/state.go b/beacon-chain/rpc/beaconv1/state.go index 30553809fac6..0ee94a2e290d 100644 --- a/beacon-chain/rpc/beaconv1/state.go +++ b/beacon-chain/rpc/beaconv1/state.go @@ -137,11 +137,7 @@ func (bs *Server) stateRoot(ctx context.Context, stateId []byte) ([]byte, error) case "justified": root, err = bs.justifiedStateRoot(ctx) default: - ok, matchErr := bytesutil.IsBytes32Hex(stateId) - if matchErr != nil { - return nil, errors.Wrap(err, "could not parse ID") - } - if ok { + if len(stateId) == 32 { root, err = bs.stateRootByHex(ctx, stateId) } else { slotNumber, parseErr := strconv.ParseUint(stateIdString, 10, 64) diff --git a/beacon-chain/rpc/statefetcher/fetcher.go b/beacon-chain/rpc/statefetcher/fetcher.go index f7b52170cbbf..94fcd6e3f69e 100644 --- a/beacon-chain/rpc/statefetcher/fetcher.go +++ b/beacon-chain/rpc/statefetcher/fetcher.go @@ -67,11 +67,7 @@ func (p *StateProvider) State(ctx context.Context, stateId []byte) (iface.Beacon return nil, errors.Wrap(err, "could not get justified state") } default: - ok, matchErr := bytesutil.IsBytes32Hex(stateId) - if matchErr != nil { - return nil, errors.Wrap(err, "could not parse ID") - } - if ok { + if len(stateId) == 32 { s, err = p.stateByHex(ctx, stateId) } else { slotNumber, parseErr := strconv.ParseUint(stateIdString, 10, 64)