profile
viewpoint
Tim Kevin Oxley timoxley unit.io Singapore https://twitter.com/timkevinoxley JavaScript specialist. NodeJS & React Freelancer. Founder of @campjs & @SingaporeJS. NodeJS in Action 2nd edition co-author.

hughsk/flat 1122

:steam_locomotive: Flatten/unflatten nested Javascript objects

thlorenz/es6ify 605

browserify >=v2 transform to compile JavaScript.next (ES6) to JavaScript.current (ES5) on the fly.

deoxxa/npmrc 351

Switch between different .npmrc files with ease and grace.

choojs/wayfarer 317

:eyeglasses: composable trie based router

mikeal/sequest 259

Simplified API for SSH and SFTP similar to request.

hughsk/smokestack 244

Pipe your JavaScript into a browser, logging console output in Node

groupdock/mongoose-nested-set 101

A mongoose plugin implementing the nested set pattern for mongoose models

heapwolf/paramify 89

Parameterized routes without a big bloated router, e.g. "showtimes/:start/:end" and "files/*"

hughsk/npm-me 41

Get a list of download counts over the last month for a particular user's packages

feross/standard-react 36

JavaScript Standard Style for React Users

push eventstreamr-dev/streamr-platform

Tim Oxley

commit sha beec1a40acc864326d992f4634de4160f1c5a3f4

[test] Increase default timeout to 30s.

view details

push time in 16 hours

push eventstreamr-dev/streamr-platform

Tim Oxley

commit sha 561227b76b00b81df6357b72152d97ff15a7f1cb

[test] Increase default timeout to 15s.

view details

push time in 17 hours

Pull request review commentstreamr-dev/streamr-platform

[PLATFORM-1283] Render 404 page in place

 export const getStream = (id: StreamId) => (dispatch: Function) => {         .then((id) => dispatch(getStreamSuccess(id)))         .catch((e) => {             dispatch(getStreamFailure(e))-            Notification.push({

yeah notifications should have never been in here

mondoreale

comment created time in 19 hours

push eventstreamr-dev/streamr-platform

Tim Kevin Oxley

commit sha 1975c9aff0599b379e024a57225a64aa9ae4b48e

[editor/shared ModuleSubscription] Relax tests so they're less likely to fail if backend is feeling sluggish. (#952)

view details

Matthew

commit sha bd1b3455e885b61c80db7f4257865f697dada3cc

higher gas limits for uniswap (#954)

view details

Tim Oxley

commit sha 7c973e3a3c72cba28865e4392a75060b64e5dab8

[ci] Use Node 10 on travis, bump min version of npm. Version 8 is very old and no longer supported, plus Node 10 should be faster.

view details

push time in 19 hours

Pull request review commentstreamr-dev/streamr-platform

[PLATFORM-1316] Workaround for Marketplace expired token

+import React, { useContext } from 'react'+import { mount } from 'enzyme'+import { act } from 'react-dom/test-utils'++import Context from '$auth/contexts/Session'++import SessionProvider, { SESSION_TOKEN_KEY, SESSION_EXPIRES_AT } from '$auth/components/SessionProvider'++describe('SessionProvider', () => {+    beforeEach(() => {+        global.localStorage.clear()+    })++    afterAll(() => {+        global.localStorage.clear()+    })++    it('returns no token by default', () => {+        let currentContext++        const Test = () => {+            currentContext = useContext(Context)++            return null+        }++        mount((+            <SessionProvider>+                <Test />+            </SessionProvider>+        ))++        expect(global.localStorage.getItem(SESSION_TOKEN_KEY)).toBeFalsy()+        expect(currentContext.token).toBeFalsy()+    })++    it('returns empty token if no expires date set', () => {+        let currentContext++        const Test = () => {+            currentContext = useContext(Context)++            return null+        }++        global.localStorage.setItem(SESSION_TOKEN_KEY, 'myToken')++        mount((+            <SessionProvider>+                <Test />+            </SessionProvider>+        ))++        expect(currentContext.token).toBeFalsy()+    })++    it('returns stored token if not expired', () => {+        let currentContext++        const Test = () => {+            currentContext = useContext(Context)++            return null+        }++        const date = new Date()+        date.setHours(date.getHours() + 2)+        global.localStorage.setItem(SESSION_TOKEN_KEY, 'myToken')+        global.localStorage.setItem(SESSION_EXPIRES_AT, date)++        mount((+            <SessionProvider>+                <Test />+            </SessionProvider>+        ))++        expect(currentContext.token).toBe('myToken')+    })++    it('does not return token if expired', () => {+        let currentContext++        const Test = () => {+            currentContext = useContext(Context)++            return null+        }++        const date = new Date()+        date.setHours(date.getHours() - 2)+        global.localStorage.setItem(SESSION_TOKEN_KEY, 'myToken')+        global.localStorage.setItem(SESSION_EXPIRES_AT, date)++        mount((+            <SessionProvider>+                <Test />+            </SessionProvider>+        ))++        expect(currentContext.token).toBeFalsy()+    })++    it('returns token if now = 5am and date = 10am', () => {+        const realDate = Date.now+        global.Date.now = jest.fn(() => new Date('2020-01-01T05:00:00.000Z').getTime())++        const date = new Date('2020-01-01T10:00:00.000Z')+        global.localStorage.setItem(SESSION_TOKEN_KEY, 'myToken')+        global.localStorage.setItem(SESSION_EXPIRES_AT, date)++        let currentContext++        const Test = () => {+            currentContext = useContext(Context)++            return null+        }++        mount((+            <SessionProvider>+                <Test />+            </SessionProvider>+        ))++        expect(currentContext.token).toBe('myToken')+        global.Date.now = realDate

This should probably happen in a beforeEach/afterAll, if the test fails then this line won't be executed and it might lead to confusing subsequent behaviour/test failure.

juhah

comment created time in 2 days

Pull request review commentstreamr-dev/streamr-platform

[PLATFORM-1316] Workaround for Marketplace expired token

+import React, { useContext } from 'react'+import { mount } from 'enzyme'+import { act } from 'react-dom/test-utils'++import Context from '$auth/contexts/Session'++import SessionProvider, { SESSION_TOKEN_KEY, SESSION_EXPIRES_AT } from '$auth/components/SessionProvider'++describe('SessionProvider', () => {+    beforeEach(() => {+        global.localStorage.clear()+    })++    afterAll(() => {+        global.localStorage.clear()+    })

👍 I like that you handled both cases

juhah

comment created time in 2 days

Pull request review commentstreamr-dev/streamr-platform

[PLATFORM-1316] Workaround for Marketplace expired token

+import React, { useContext } from 'react'+import { mount } from 'enzyme'+import { act } from 'react-dom/test-utils'++import Context from '$auth/contexts/Session'++import SessionProvider, { SESSION_TOKEN_KEY, SESSION_EXPIRES_AT } from '$auth/components/SessionProvider'++describe('SessionProvider', () => {

👍 good

juhah

comment created time in 2 days

Pull request review commentstreamr-dev/streamr-platform

[PLATFORM-1316] Workaround for Marketplace expired token

 type Props = { const storage = isLocalStorageAvailable() ? window.localStorage : null  let cachedToken // fallback if no webstorage+let cachedDate  function getStoredToken(): ?string {-    if (!storage) { return cachedToken || null }-    return storage.getItem(SESSION_TOKEN_KEY) || null+    let date+    let token+    if (!storage) {+        token = cachedToken || null+        date = cachedDate || null+    } else {+        token = storage.getItem(SESSION_TOKEN_KEY) || null+        date = storage.getItem(SESSION_EXPIRES_AT) || null

Perhaps if we store the time that the session started, rather than the time it ends, then we could adjust the EXPIRES_AT_VALID_HOURS in the future and that change would work immediately, even for tokens stored with the previous EXPIRES_AT_VALID_HOURS?

juhah

comment created time in 2 days

Pull request review commentstreamr-dev/streamr-platform

[PLATFORM-1283] Render 404 page in place

+// @flow++export default class ResourceNotFoundError {

Also thinking maybe it should capture some info about which resource wasn't found? If I'm seeing this and I'm loading multiple resources, which resource didn't load? Will I be able to track it down without a stack?

mondoreale

comment created time in 2 days

Pull request review commentstreamr-dev/streamr-platform

[PLATFORM-1283] Render 404 page in place

 async function loginRedirect() {     await wait(3000) // stall a moment to let redirect happen } -export async function notFoundRedirect() {-    window.location = routes.notFound()-    await wait(3000) // stall a moment to let redirect happen-}

👍

mondoreale

comment created time in 2 days

Pull request review commentstreamr-dev/streamr-platform

[PLATFORM-1283] Render 404 page in place

+// @flow++export default class ResourceNotFoundError {

Might be worthwhile extending Error anyway just to get the stack trace for future debugging. Remember to Error.captureStackTrace() though. Alternatively don't call it an Error? throw new ResourceNotFoundMessage()?

mondoreale

comment created time in 2 days

Pull request review commentstreamr-dev/streamr-platform

[PLATFORM-1283] Render 404 page in place

 function StreamLoader(props: Props) {     const propsRef = useRef(props)     propsRef.current = props     const { id: streamId } = props.match.params || {}+    const fail = useFailure()      const initStream = useCallback(async (id: StreamId) => {         let { current: currentProps } = propsRef         await propsRef.current.getKeys()         if (!isMounted()) { return }         currentProps = propsRef.current-        return Promise.all([-            currentProps.getStream(id).then(async () => {-                if (!isMounted()) { return }-                // get stream status before copying state to edit stream object-                try {-                    // the status query might fail due to cassandra problems.-                    // Ignore error to prevent the stream page from getting stuck while loading-                    await currentProps.refreshStreamStatus(id)-                } catch (e) {-                    console.warn(e)-                }-                currentProps.openStream(id)-                currentProps.initEditStream()-            }),-            currentProps.getMyStreamPermissions(id),-        ])-    }, [isMounted, propsRef])++        try {+            await Promise.all([

Note that you actually end up returning the promise implicitly due to the await.

mondoreale

comment created time in 2 days

Pull request review commentstreamr-dev/streamr-platform

[PLATFORM-1307] Publish dialog refactor

 describe('Canvas Subscriptions', () => {             done()         }, 15000) -        it('should get canvas module subscription messages in restarted canvas', async (done) => {+        xit('should get canvas module subscription messages in restarted canvas', async (done) => {

perhaps no longer needed with https://github.com/streamr-dev/streamr-platform/pull/952

juhah

comment created time in 2 days

Pull request review commentstreamr-dev/streamr-platform

[DOCS-106] Docs search

+// @flow++import { useState, useEffect, useMemo } from 'react'+import lunr from 'lunr'++const InvalidIndexError = Error('Lunr index could not be parsed. Check that your index exists and is valid.')+const InvalidStoreError = Error('Lunr store could not be parsed. Check that your store exists and is valid.')++const useLunr = (query: string, providedIndex: any, providedStore: any) => {+    const [index, setIndex] = useState(null)+    const [store, setStore] = useState(null)++    useEffect(() => {+        const processedIndex =+            typeof providedIndex === 'string'+                ? lunr.Index.load(JSON.parse(providedIndex))+                : providedIndex++        if (!processedIndex) {+            throw InvalidIndexError+        }++        setIndex(processedIndex)+    }, [providedIndex])++    useEffect(() => {+        const processedStore =+            typeof providedStore === 'string'+                ? JSON.parse(providedStore)+                : providedStore++        if (!processedStore) {+            throw InvalidStoreError+        }++        setStore(processedStore)+    }, [providedStore])++    return useMemo(() => {+        if (!query || !index || !store) { return [] }++        // removeTrimmer fixes some unexpected crashes while searching+        lunr(function () {+            this.pipeline.remove(lunr.trimmer)+        })++        const lunrResults = () =>+            index.query((q) => {+                q.term(lunr.tokenizer(query), {+                    fields: ['content'],+                    boost: 100,+                    usePipeline: true,+                })+                q.term(lunr.tokenizer(query), {+                    fields: ['content'],+                    boost: 10,+                    usePipeline: false,+                    wildcard: lunr.Query.wildcard.TRAILING,+                })+            })+        // TODO: Tidy this up, move it to its own function+        const searchResults = lunrResults().map(({ ref, matchData }) => {+            const res = store[ref]+            res.matchData = matchData+            const fullContent = String(res.content).replace(/\n/g, ' ')+            // matchData is an object+            // keys are the keyword matches,++            // number of characters into the string, where the match is.+            // Only look at the first matching word for now.+            const matchPosition = []+            const matchLength = []+            Object.values(matchData).forEach((match, matchIndex) => {+                if (matchIndex === 0) {+                    // $FlowFixMe+                    Object.values(match).forEach(({ content }, contentIndex) => {+                        // $FlowFixMe+                        if (contentIndex === 0 && content && content.position) {+                            // $FlowFixMe+                            matchPosition.push(content.position[0][0])+                            matchLength.push(content.position[0][1])+                        }+                    })+                }+            })++            let textSnippet = ''+            let startHighlightPosition = matchPosition[0]+            let endHighlightPosition = matchPosition[0] + matchLength[0]++            if (matchPosition[0] < 50 && fullContent.length < 180) {+                textSnippet = fullContent.slice(0, fullContent.length)

textSnippet = fullContent perhaps ?

fonty1

comment created time in 2 days

Pull request review commentstreamr-dev/streamr-platform

[DOCS-106] Docs search

+// @flow++import { useState, useEffect, useMemo } from 'react'+import lunr from 'lunr'++const InvalidIndexError = Error('Lunr index could not be parsed. Check that your index exists and is valid.')+const InvalidStoreError = Error('Lunr store could not be parsed. Check that your store exists and is valid.')

Could do something like

const InvalidIndexError = () => new Error(…)
// then
throw InvalidIndexError() // generates new error object with appropriate stack trace
fonty1

comment created time in 2 days

Pull request review commentstreamr-dev/streamr-platform

[DOCS-106] Docs search

+// @flow++import { useState, useEffect, useMemo } from 'react'+import lunr from 'lunr'++const InvalidIndexError = Error('Lunr index could not be parsed. Check that your index exists and is valid.')+const InvalidStoreError = Error('Lunr store could not be parsed. Check that your store exists and is valid.')++const useLunr = (query: string, providedIndex: any, providedStore: any) => {+    const [index, setIndex] = useState(null)+    const [store, setStore] = useState(null)++    useEffect(() => {+        const processedIndex =+            typeof providedIndex === 'string'+                ? lunr.Index.load(JSON.parse(providedIndex))+                : providedIndex++        if (!processedIndex) {+            throw InvalidIndexError+        }++        setIndex(processedIndex)+    }, [providedIndex])++    useEffect(() => {+        const processedStore =+            typeof providedStore === 'string'+                ? JSON.parse(providedStore)+                : providedStore++        if (!processedStore) {+            throw InvalidStoreError+        }++        setStore(processedStore)+    }, [providedStore])

So the way the state and these effects are set up will cause the useMemo to re-run once for each parameter that's updated.

so on the first run, it'll do something like:

  1. run the memo without either index or store
  2. run the index processing effect. setIndex in the effect queues a re-render.
  3. re-run the memo with the newly processed index
  4. run the store processing effect. setStore in the effect queues a re-render.
  5. re-run the memo with the newly processed store

I'm thinking the effects and state could go away entirely and instead useMemo like this:

const index = useMemo(() => {
    const processedStore =
            typeof providedStore === 'string'
                ? JSON.parse(providedStore)
                : providedStore

        if (!processedStore) {
            throw InvalidStoreError()
        }
        return processedStore
}, [providedStore])

const index = useMemo(() => {
        const processedIndex =
            typeof providedIndex === 'string'
                ? lunr.Index.load(JSON.parse(providedIndex))
                : providedIndex

        if (!processedIndex) {
            throw InvalidIndexError()
        }
        return processedIndex
}, [providedIndex])
// etc

This should have the following benefits:

  • both the store and index will always be updated (if necessary) in the same render, instead of staggered and possibly using stale data.
  • they will be available on the first render when all parameters are set
  • they don't enqueue any additional renders
fonty1

comment created time in 2 days

Pull request review commentstreamr-dev/streamr-platform

[DOCS-106] Docs search

+// @flow++import { useState, useEffect, useMemo } from 'react'+import lunr from 'lunr'++const InvalidIndexError = Error('Lunr index could not be parsed. Check that your index exists and is valid.')+const InvalidStoreError = Error('Lunr store could not be parsed. Check that your store exists and is valid.')

Note that throwing these errors won't include appropriate stack traces, the stack trace is generated when the new Error() is created and these are created during initialisation, rather than when the error occurs

fonty1

comment created time in 2 days

Pull request review commentstreamr-dev/streamr-platform

[DOCS-106] Docs search

+// @flow++import { useState, useEffect, useMemo } from 'react'+import lunr from 'lunr'++const InvalidIndexError = Error('Lunr index could not be parsed. Check that your index exists and is valid.')+const InvalidStoreError = Error('Lunr store could not be parsed. Check that your store exists and is valid.')++const useLunr = (query: string, providedIndex: any, providedStore: any) => {+    const [index, setIndex] = useState(null)+    const [store, setStore] = useState(null)++    useEffect(() => {+        const processedIndex =+            typeof providedIndex === 'string'+                ? lunr.Index.load(JSON.parse(providedIndex))+                : providedIndex++        if (!processedIndex) {+            throw InvalidIndexError+        }++        setIndex(processedIndex)+    }, [providedIndex])++    useEffect(() => {+        const processedStore =+            typeof providedStore === 'string'+                ? JSON.parse(providedStore)+                : providedStore++        if (!processedStore) {+            throw InvalidStoreError

Should probably be throw new InvalidStoreError() or something

fonty1

comment created time in 2 days

Pull request review commentstreamr-dev/streamr-platform

[DOCS-106] Docs search

+// @flow++import { useState, useEffect, useMemo } from 'react'+import lunr from 'lunr'++const InvalidIndexError = Error('Lunr index could not be parsed. Check that your index exists and is valid.')+const InvalidStoreError = Error('Lunr store could not be parsed. Check that your store exists and is valid.')++const useLunr = (query: string, providedIndex: any, providedStore: any) => {+    const [index, setIndex] = useState(null)+    const [store, setStore] = useState(null)++    useEffect(() => {+        const processedIndex =+            typeof providedIndex === 'string'+                ? lunr.Index.load(JSON.parse(providedIndex))+                : providedIndex++        if (!processedIndex) {+            throw InvalidIndexError

should probably be throw new InvalidIndexError() or something

fonty1

comment created time in 2 days

Pull request review commentstreamr-dev/streamr-platform

[DOCS-106] Docs search

+// @flow++import { useState, useEffect, useMemo } from 'react'+import lunr from 'lunr'++const InvalidIndexError = Error('Lunr index could not be parsed. Check that your index exists and is valid.')+const InvalidStoreError = Error('Lunr store could not be parsed. Check that your store exists and is valid.')++const useLunr = (query: string, providedIndex: any, providedStore: any) => {+    const [index, setIndex] = useState(null)+    const [store, setStore] = useState(null)++    useEffect(() => {+        const processedIndex =+            typeof providedIndex === 'string'+                ? lunr.Index.load(JSON.parse(providedIndex))+                : providedIndex++        if (!processedIndex) {+            throw InvalidIndexError+        }++        setIndex(processedIndex)+    }, [providedIndex])++    useEffect(() => {+        const processedStore =+            typeof providedStore === 'string'+                ? JSON.parse(providedStore)+                : providedStore++        if (!processedStore) {+            throw InvalidStoreError+        }++        setStore(processedStore)+    }, [providedStore])++    return useMemo(() => {

I feel like a function of this size should probably go outside the hook.

e.g.

function runQuery({ query, store, index }) {
  // …
}

// …

return useMemo(() => runQuery({ query, store, index }), [query, store, index])
fonty1

comment created time in 2 days

Pull request review commentstreamr-dev/streamr-platform

[DOCS-106] Docs search

+// @flow++import React, { useState, useCallback, useEffect } from 'react'+import { Link } from 'react-router-dom'+import { Translate } from 'react-redux-i18n'++import links from '$shared/../links'+import SvgIcon from '$shared/components/SvgIcon'++import SearchInput from '$mp/components/ActionBar/SearchInput'+import useLunr from '$docs/hooks/useLunr'+import useGetIndexStore from '$docs/hooks/useGetIndexStore'+import RawHtml from '$shared/components/RawHtml'+import BodyClass from '$shared/components/BodyClass'++import styles from './search.pcss'++type Props = {+    toggleOverlay: () => void,+}++const Search = ({ toggleOverlay }: Props) => {+    const [index, store] = useGetIndexStore()+    const [query, setQuery] = useState('')+    const [overlayVisible, setOverlayVisible] = useState(true)+    const searchResults = useLunr(query, index, store)++    const onSearchChange = (searchValue) => {+        setQuery(searchValue)+    }++    const resultClick = () => {+        setOverlayVisible(false)+    }++    const closeOverlay = () => {+        setOverlayVisible(false)+        toggleOverlay()+    }++    const onKeyDown = useCallback((event) => {+        if (event.key === 'Escape') {+            setOverlayVisible(false)+        }+    }, [])++    useEffect(() => {+        window.addEventListener('keydown', onKeyDown)+        return () => {+            window.removeEventListener('keydown', onKeyDown)+        }+    }, [onKeyDown])++    return (overlayVisible+        ? (+            <div+                className={styles.searchOverlay}+            >+                <BodyClass className={overlayVisible && 'overflow-hidden'} />+                <div className={styles.searchContainer}>+                    <SearchInput+                        value={query}+                        onChange={onSearchChange}+                        placeholder="Search"+                        className={styles.docsSearchInput}+                        hideClearButton+                        autoFocus+                    />+                    <button+                        type="button"+                        className={styles.exitButton}+                        onClick={closeOverlay}+                    >+                        <SvgIcon name="cross" />+                    </button>+                </div>+                <div className={styles.searchResults}>+                    <ul>+                        {searchResults.map((result, resultIndex) => (+                            resultIndex <= 10+                                ? (+                                    <li key={result.id}>+                                        <Link onClick={resultClick} className={styles.resultHeading} to={result.id}>+                                            {result.title}+                                        </Link>+                                        <RawHtml className={styles.searchResultSnippet}>+                                            {result.textSnippet}+                                        </RawHtml>+                                        <span className={styles.resultSection}>+                                            {result.section}+                                        </span>+                                    </li>)+                                : null+                        ))}+                        {!searchResults.length && !!query.length && (+                            <React.Fragment>+                                <p className={styles.noResults}>No results found for <strong>{query}</strong></p>+                                <p className={styles.noResultsMoreInfo}>+                                    <Translate value="docs.search.noResults" tag="span" />+                                    <br className={styles.mobileOnlyBreak} />+                                    <a rel="noopener noreferrer" target="_blank" href={links.community.devForum}> Community Dev Forum </a>

I've done exactly this too and not saying it needs to change here but we really need to find a better way to do these translations in general, sentences split over multiple translation strings then with bits that aren't translated… it's just overall clumsy and not sure it's even useful.

fonty1

comment created time in 2 days

Pull request review commentstreamr-dev/streamr-platform

[DOCS-106] Docs search

+// @flow++import React, { useState, useCallback, useEffect } from 'react'+import { Link } from 'react-router-dom'+import { Translate } from 'react-redux-i18n'++import links from '$shared/../links'+import SvgIcon from '$shared/components/SvgIcon'++import SearchInput from '$mp/components/ActionBar/SearchInput'+import useLunr from '$docs/hooks/useLunr'+import useGetIndexStore from '$docs/hooks/useGetIndexStore'+import RawHtml from '$shared/components/RawHtml'+import BodyClass from '$shared/components/BodyClass'++import styles from './search.pcss'++type Props = {+    toggleOverlay: () => void,+}++const Search = ({ toggleOverlay }: Props) => {+    const [index, store] = useGetIndexStore()+    const [query, setQuery] = useState('')+    const [overlayVisible, setOverlayVisible] = useState(true)+    const searchResults = useLunr(query, index, store)++    const onSearchChange = (searchValue) => {+        setQuery(searchValue)+    }++    const resultClick = () => {+        setOverlayVisible(false)+    }++    const closeOverlay = () => {+        setOverlayVisible(false)+        toggleOverlay()+    }++    const onKeyDown = useCallback((event) => {+        if (event.key === 'Escape') {+            setOverlayVisible(false)+        }+    }, [])++    useEffect(() => {+        window.addEventListener('keydown', onKeyDown)+        return () => {+            window.removeEventListener('keydown', onKeyDown)+        }+    }, [onKeyDown])++    return (overlayVisible+        ? (+            <div+                className={styles.searchOverlay}+            >+                <BodyClass className={overlayVisible && 'overflow-hidden'} />+                <div className={styles.searchContainer}>+                    <SearchInput+                        value={query}+                        onChange={onSearchChange}+                        placeholder="Search"+                        className={styles.docsSearchInput}+                        hideClearButton+                        autoFocus+                    />+                    <button+                        type="button"+                        className={styles.exitButton}+                        onClick={closeOverlay}+                    >+                        <SvgIcon name="cross" />+                    </button>+                </div>+                <div className={styles.searchResults}>+                    <ul>+                        {searchResults.map((result, resultIndex) => (+                            resultIndex <= 10

Perhaps: searchResults.slice(0, 10).map((result) => ()) then you can drop the ternary?

Also means that it doesn't have to pointlessly iterate over every result after index 10.

fonty1

comment created time in 2 days

Pull request review commentstreamr-dev/streamr-platform

[DOCS-106] Docs search

 class Navigation extends React.Component<Props, State> {         })     } +    toggleOverlay = () => {+        this.setState({+            isSearching: !this.state.isSearching,+        })

Same problem with toggleExpand.

fonty1

comment created time in 2 days

Pull request review commentstreamr-dev/streamr-platform

[DOCS-106] Docs search

 class Navigation extends React.Component<Props, State> {         })     } +    toggleOverlay = () => {+        this.setState({+            isSearching: !this.state.isSearching,+        })

This isn't async friendly. This.state.isSearching may be stale when this is called.

whenever you need state that depends on other state, need to use the callback version of setState. i.e.

this.setState(({ isSearching }) => ({
    isSearching: !isSearching,
})
fonty1

comment created time in 2 days

Pull request review commentstreamr-dev/streamr-platform

[DOCS-106] Docs search

 class Navigation extends React.Component<Props, State> {         })     } +    toggleOverlay = () => {+        this.setState({+            isSearching: !this.state.isSearching,+        })

https://reactjs.org/docs/state-and-lifecycle.html#state-updates-may-be-asynchronous

image

fonty1

comment created time in 2 days

PR opened streamr-dev/streamr-platform

Reviewers
Relax ModuleSubscription Tests

Makes ModuleSubscription tests less likely to fail if backend is feeling sluggish.

+2 -4

0 comment

1 changed file

pr created time in 2 days

create barnchstreamr-dev/streamr-platform

branch : relax-module-subscription-tests

created branch time in 2 days

PR opened streamr-dev/streamr-platform

Reviewers
Use Node 10 on Travis

Minor change but Node 8 is very old and no longer maintained:

image

Node 10 should be faster too so CI install/builds/tests might be a little faster?

+2 -2

0 comment

1 changed file

pr created time in 2 days

create barnchstreamr-dev/streamr-platform

branch : update-node-10-on-travis

created branch time in 2 days

Pull request review commentstreamr-dev/streamr-client-javascript

Await before disconnect and update all libs

 describe('StreamrClient', () => {         })          c.send = (msgToSend) => {-            const next = c.expectedMessagesToSend.shift()-            if (!next) {-                throw new Error(`Sending unexpected message: ${JSON.stringify(msgToSend)}`)-            }-            next.verificationFunction(msgToSend, next.msgToExpect)+            return new Promise((resolve, reject) => {+                const next = c.expectedMessagesToSend.shift()+                if (!next) {+                    throw new Error(`Sending unexpected message: ${JSON.stringify(msgToSend)}`)

Note this doesn't cause the promise to reject, the promise hasn't even been created yet. This causes c.send to throw synchronously.

Might consider just changing it to an async function i.e. c.send = async (msgToSend) => this will return a promise and any errors will always be converted to promise rejections

mirpo

comment created time in 2 days

Pull request review commentstreamr-dev/streamr-client-javascript

Await before disconnect and update all libs

 export default class StreamrClient extends EventEmitter {          if (request) {             debug('_requestResend: %o', request)-            this.connection.send(request)+            await this.connection.send(request).catch((err) => console.error(`Failed to send resend request: ${err}`))

and here

mirpo

comment created time in 2 days

Pull request review commentstreamr-dev/streamr-client-javascript

Await before disconnect and update all libs

 export default class StreamrClient extends EventEmitter {         }     } -    _requestUnsubscribe(sub) {+    async _requestUnsubscribe(sub) {         debug('Client unsubscribing stream %o partition %o', sub.streamId, sub.streamPartition)-        this.connection.send(UnsubscribeRequest.create(sub.streamId, sub.streamPartition))+        const unsubscribeRequest = UnsubscribeRequest.create(sub.streamId, sub.streamPartition)+        await this.connection.send(unsubscribeRequest).catch((err) => console.error(`Failed to send unsubscribe request: ${err}`))

Yeah same here

mirpo

comment created time in 2 days

Pull request review commentstreamr-dev/streamr-client-javascript

Await before disconnect and update all libs

 export default class StreamrClient extends EventEmitter {             const request = SubscribeRequest.create(sub.streamId, sub.streamPartition, sessionToken)             debug('_requestSubscribe: subscribing client: %o', request)             sp.setSubscribing(true)-            this.connection.send(request)+            await this.connection.send(request).catch((err) => console.error(`Failed to send subscribe request: ${err}`))

perhaps this is wip but seems weird to not cause the subscription request to reject

mirpo

comment created time in 2 days

delete branch streamr-dev/engine-and-editor

delete branch : CORE-1885-add-custom-client-header

delete time in 5 days

push eventstreamr-dev/engine-and-editor

Tim Kevin Oxley

commit sha 807673a3ef0a905af39b27eeea203f967842c7f7

Add Streamr-Client to Access-Control-Allow-Headers in CORS responses. (#746) * Add Access-Control-Allow-Headers=Streamr-Client to CORS responses. * Add existing headers to CORS allowed headers. * Add comment about custom client http header in Access-Control-Allow-Headers. * Add test for CORS headers in rest-e2e-tests. * Make CORS headers test more minimal.

view details

push time in 5 days

PR merged streamr-dev/engine-and-editor

Add Streamr-Client to Access-Control-Allow-Headers in CORS responses.

For CORE-1885, there's a new custom HTTP header sent along with client requests containing the streamr-client version:

PR where this is added in the JS Client: https://github.com/streamr-dev/streamr-client-javascript/pull/131

image

This header needs to be whitelisted otherwise the browser will prevent CORS requests that contain this header:

image

By default, the Access-Control-Allow-Headers look like:

origin, authorization, accept, content-type, x-requested-with

I've added these along with the new Streamr-Client header.

image


Alternatively, this PR could be changed to allow all headers in CORS requests with 'Access-Control-Allow-Headers': '*'

Also possible this should be changed in CorsResourceMapper.groovy instead.

Open to suggestion on how to add a test for this.

+31 -0

3 comments

2 changed files

timoxley

pr closed time in 5 days

push eventstreamr-dev/streamr-platform

Juha Haavisto

commit sha 3d41e6871ab2404c2b42514231afec6ca117da6f

Hide eth login button behind flag

view details

juhah

commit sha a486a254b0b6cc41899e0cc768e3afe5a60e49f4

Merge pull request #933 from streamr-dev/hotfix-hide-eth-login-button Hide eth login button behind flag

view details

Juha Haavisto

commit sha 3d269c8882422b1fa8fcaaa4415eaf64b2eb532a

Upgrade to 2.1.19

view details

Juha Haavisto

commit sha 1779884562c38e8e96d829ed3793225a8d31aef5

Revert hide eth login button behind flag

view details

juhah

commit sha 66372e4a8a91e77259bc567077371c5add0f1477

Merge pull request #934 from streamr-dev/hotfix-revert-hide-eth-login Revert hide eth login button behind flag

view details

Juha Haavisto

commit sha 07234fec5feaa102f8300abd3a9b795c39cd0140

Upgrade to 2.1.20

view details

Juha Haavisto

commit sha 4630e095f9da1ba8a6e861d2d1f79fccb5578f71

Merge remote-tracking branch 'origin/master' into development

view details

Mariusz Roliński

commit sha b919b4d3bf49e36330ebd529658314f515c50978

Drop the unused usePublish

view details

Mariusz Roliński

commit sha ed6f7e9c6b0cac3c89702a712c87c6f09e7c1f89

Revert "Drop the unused usePublish" This reverts commit b919b4d3bf49e36330ebd529658314f515c50978.

view details

Mariusz Roliński

commit sha c1531ac644831c18c82575c596bec195f114bc4b

Auto-close CompletePurchaseDialog after 10s

view details

Mariusz Roliński

commit sha 129b7b0d413cce0628bbc7c9612d6f22486c86bb

[PLATFORM-1314] Don’t let “x” button flex and give it a fixed size Fixes “Safari’s” bug (it’s on us!) with the button scaling up a little (1.05x) giving a fake impression of moving left and right. Tricky one to investigate, really. And again, incorrect usage of flexbox brought us here. All fixed.

view details

Mariusz Roliński

commit sha 48cf77d3874f3ed97696e85371209a5b4dbd7262

[PLATFORM-1288] Remove extra latter spacing from buttons on “auth” pages

view details

Juha Haavisto

commit sha 5c83d96abc8cd2e1c7c1caeff5ecbe76a7860bc5

Add tests around NEW_MP_CONTRACT dependent routes

view details

Mariusz Roliński

commit sha f22e84dd63131db600a9eacf662e09ba7b03b166

Merge pull request #935 from streamr-dev/PLATFORM-1296-autoclose-transaction-complete-dialog [PLATFORM-1296] Auto-close CompletePurchaseDialog after 10s (when confirmed)

view details

Juha Haavisto

commit sha 2a21417e863b45fa485a7e0140dd2ab4e5a3f730

Delete variables in test instead of just setting to empty string

view details

juhah

commit sha 0b0e7f9f8f12575e8b002f272c55cb6f50638fdb

Merge pull request #938 from streamr-dev/test-new-mp-contract-flag-routes Add tests around NEW_MP_CONTRACT dependent routes

view details

Mariusz Roliński

commit sha 55f78a2a3a9f73991cd2ddb9ef24706f833d0ea8

Tweaks

view details

Mariusz Roliński

commit sha 4f6585e11bc19842e98ea62e0ef5c095d5a32ade

Shrink price fields to fit available space This in combination with the previous changes makes SetPrice component look good on ALL modern browsers.

view details

Mariusz Roliński

commit sha 2a0d776fb8e35ca0421ede2ffc5b11466ecaca9b

Center cells vertically to help Safari align them better I got you Saf! There’s someone caring about your well-being. <3

view details

Mariusz Roliński

commit sha b9c626c03dfdddba3e1e1f238c91870ba1d1a83a

Merge pull request #939 from streamr-dev/PLATFORM-1254-fix-set-price-on-ff [PLATFORM-1254] Fix SetPrice's layout on Firefox

view details

push time in 6 days

push eventstreamr-dev/streamr-platform

Tim Oxley

commit sha 98500b9ada02a65b96e1bf9bc86b43562177567e

[userpages ShareSidebar] Add some comments.

view details

push time in 6 days

pull request commentstreamr-dev/engine-and-editor

Add Streamr-Client to Access-Control-Allow-Headers in CORS responses.

Rebased on master, added a loose test for checking CORS headers https://github.com/streamr-dev/engine-and-editor/pull/746/commits/dca4d1136f57e08d51742f1f259393e69547e89e

timoxley

comment created time in 6 days

push eventstreamr-dev/engine-and-editor

Tim Oxley

commit sha dca4d1136f57e08d51742f1f259393e69547e89e

Add test for CORS headers in rest-e2e-tests.

view details

push time in 6 days

push eventstreamr-dev/engine-and-editor

Kare Nuorteva

commit sha dbf06c6bab5e0507205bcdfe83594d2f06823507

Set Travis Node version (#747) * Increase REST API test timeouts * Add .nvmrc * Move scripts/git-change-branch to Makefile * Update IntelliJ IDEA .gitiginore * .travis.yml: Setup correct Node version

view details

Tim Oxley

commit sha d0861b3b8829255fbede1b5106712263d1cf8321

Add Access-Control-Allow-Headers=Streamr-Client to CORS responses.

view details

Tim Oxley

commit sha 45bafa342536a248b6c86e43e14144811ff56336

Add existing headers to CORS allowed headers.

view details

Tim Oxley

commit sha c5a72fcddc55a06802ffe79e8eddda3d75233ad6

Add comment about custom client http header in Access-Control-Allow-Headers.

view details

push time in 6 days

push eventstreamr-dev/data-union-server

Tim Oxley

commit sha d6d361f48c0ae8c721d4506a9d1eabffd4838c9f

Add scrypt.js package-lock changes.

view details

push time in 6 days

delete branch streamr-dev/data-union-server

delete branch : fix/flat-folder-permission

delete time in 7 days

push eventstreamr-dev/data-union-server

Juuso Takalainen

commit sha 7f59c9583397ca7c968c2c66949ac3d2fc317fa9

DU-111: add version to contract

view details

Juuso Takalainen

commit sha d3d1bff339a77560c877a9f42fccf9bb71e1608a

Change community -> dataunion, fix server test

view details

Juuso Takalainen

commit sha 6ba8d46006d92bee34c474cae6c9055a5b470be6

Merge branch 'master' into DU-111-contract-version Large number of conflicts due to re-renaming community -> dataunion. Ouch. # Conflicts: # README.md # build/ERC20Detailed.json # build/ERC20Mintable.json # build/Monoplasma.json # build/TestToken.json # contracts/CommunityProduct.sol # contracts/DataUnion.sol # contracts/DataunionVault.sol # cps # package.json # scripts/README.md # scripts/check_dataunion.js # scripts/check_member.js # scripts/deploy.js # scripts/deploy_community.js # scripts/deploy_contract.js # scripts/join.js # scripts/join_community.js # scripts/join_dataunion.js # scripts/replay_joins.js # scripts/send_tokens.js # scripts/start_operator.js # scripts/start_server.js # scripts/watch_dataunion.js # scripts/withdraw.js # src/server.js # src/utils/deploy.js # src/utils/deployCommunity.js # src/utils/deployContract.js # test/contracts/DataUnion.js # test/scripts/deploy-community.js # test/system/dataunion-demo.js # test/system/demo-using-client.js # test/system/engine-and-editor-api.js # test/unit/dataunions.js # test/unit/server.js # test/unit/watcher.js # test/utils/deployTestDataunion.js

view details

Juuso Takalainen

commit sha dde7c28bc023bde514c3555c92e049fa545f24a4

Delete duplicates result from merge and double renaming...

view details

Juuso Takalainen

commit sha 9c1e13fe56e4f1b2e62ec893b19d776a4797ce0f

Ask Travis to attempt a build

view details

Juuso Takalainen

commit sha 111cd2b0e7b81bec3cce69e53fdfc759c4f4c9e1

Ask Travis to build in a different way

view details

Juuso Takalainen

commit sha 14b2399f1ed9a3a1f036513185cd81f280a00229

Fix problem with rm in build-contracts on Travis, it said ``` > rm -rf build flat && etherlime --solcVersion=0.5.16 compile && npm run flatten rm: cannot remove 'flat/DataunionVault_flat.sol': Permission denied rm: cannot remove 'flat/DataUnion_flat.sol': Permission denied npm ERR! code ELIFECYCLE npm ERR! errno 1 ``` maybe that cleaning isn't really necessary anyway

view details

Juuso Takalainen

commit sha 781a68bddfbc5a4842898afc3346a7e9ee40adf7

commit flattened files

view details

Juuso Takalainen

commit sha fa49589cad49392ff6bbe4444346626ad623f244

Merge branch 'master' into DU-111-contract-version

view details

Juuso Takalainen

commit sha 43d873dcee4e9638cb1f7dbd1b9b6e392f709560

Add explicit os/dist Travis spec those are defaults, and they're also in engine-and-editor/.travis.yml

view details

Juuso Takalainen

commit sha 99443bf663dd8aa10f0d72d2cfbf5a132848fb27

fix script

view details

Juuso Takalainen

commit sha 38dbb174a053e53a30d5d60713f38ac8d3fe1d44

streamr-client upgrade

view details

Juuso Takalainen

commit sha e83a14d35ccb32d55ad5abf30017efc9c5f671f2

added comments well, mostly

view details

Juuso Takalainen

commit sha 90bc6a927efeab754900d4f9fb19c54d5e19a1b9

less log spam large blocks have lots of members

view details

Juuso Takalainen

commit sha 87f20eb70c50231e568f10c52b075de834a8655b

longer timeout default is 2s, not enough for Travis

view details

Juuso Takalainen

commit sha c11d18b3075f56e39b0a370f70f5ee868213d3ff

fix copy-paste hazard

view details

jtakalai

commit sha 971e6218e8935b430d8872ffa0a30acaee4153e8

Merge pull request #51 from streamr-dev/DU-111-contract-version DU-111: add version to contract

view details

mikhaelsantos

commit sha 85365860abcac86dbad983e6dd673cce19565678

fix: EACCES: permission denied, open ./flat/DataunionVault_flat.sol: * Change folder owner to node user

view details

Juuso Takalainen

commit sha 10dee66e0da7fc9e85fce36f0f63dc02921ee731

Travis is working again, no need to build twice in PR

view details

jtakalai

commit sha a07f45b481bb944dc2539d259453502c3dd3dd2a

Merge pull request #52 from streamr-dev/fix/flat-folder-permission fix: EACCES: permission denied, open ./flat/DataunionVault_flat.sol:

view details

push time in 7 days

push eventstreamr-dev/engine-and-editor

Tim Oxley

commit sha 2616eb2909d5e64c46e1c8cb6a7984651077ffdf

Add comment about custom client http header in Access-Control-Allow-Headers.

view details

push time in 7 days

push eventstreamr-dev/engine-and-editor

Tim Oxley

commit sha 03acfe34ad526d328ebfd20ffbb399b599ce9b26

Add existing headers to CORS allowed headers.

view details

push time in 7 days

pull request commentstreamr-dev/engine-and-editor

Add Access-Control-Allow-Headers=Streamr-Client to CORS responses.

Test failure seems unrelated.

timoxley

comment created time in 7 days

PR opened streamr-dev/engine-and-editor

Reviewers
Add Access-Control-Allow-Headers=Streamr-Client to CORS responses.

For CORE-1885, there's a new custom HTTP header sent along with client requests containing the streamr-client version:

image

This header needs to be whitelisted otherwise the browser will prevent CORS requests that contain this header:

image

Alternatively, this PR could be changed to allow all headers in CORS requests with 'Access-Control-Allow-Headers': '*'

Also possible this should be changed in CorsResourceMapper.groovy instead.

+2 -0

0 comment

1 changed file

pr created time in 7 days

pull request commentstreamr-dev/streamr-client-javascript

Add streamr-client info to User-Agent header.

Actually, that test was connecting to the production servers, so of course changes to nginx/engine-and-editor weren't being reflected. Sending a PR.

timoxley

comment created time in 7 days

push eventstreamr-dev/streamr-client-javascript

Tim Oxley

commit sha e8bb9bd9b431eebb44bc1b7296671fa955f8fb54

Use Streamr-Client http header instead of User-Agent. Changing User-Agent is not supported in Chrome. https://bugs.chromium.org/p/chromium/issues/detail?id=571722

view details

Tim Oxley

commit sha 54b39fb450df3d11907d3769dd03c726dcec993f

Add streamrClient=version to websocket query string.

view details

Tim Oxley

commit sha 4eaeef45c0808c6cfde03a9288531cca803160c4

Correctly reuse default headers after auth failure authFetch.

view details

push time in 7 days

push eventstreamr-dev/streamr-client-javascript

Tim Oxley

commit sha c9ea5a1f2870ce77c1bdaf38c250de342cb5dc93

Don't npm ci in example by default.

view details

Tim Oxley

commit sha af4d6313599a93e362c311314cd40295263f948e

Fix instantiation of shimmed node-webcrypto-ossl.

view details

push time in 7 days

pull request commentstreamr-dev/streamr-client-javascript

Add streamr-client info to User-Agent header.

heh, so looks like we might need to change nginx and/or engine-and-editor to whitelist the Streamr-Client header for CORS requests:

image

Access to fetch at 'https://streamr.network/api/v1/streams/7wa7APtlTq6EC5iTCBy6dw' from origin 'http://localhost:8080' has been blocked by CORS policy: Request header field streamr-client is not allowed by Access-Control-Allow-Headers in preflight response.

I tried adding the correct header to the OPTIONS response in engine-and-editor, but it doesn't seem to be used, instead the OPTIONS response comes back from nginx:

Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: origin, authorization, accept, content-type, x-requested-with
Access-Control-Allow-Methods: GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS
Access-Control-Allow-Origin: http://localhost:8080
Access-Control-Max-Age: 3600
Connection: keep-alive
Content-Length: 0
Date: Wed, 01 Apr 2020 15:38:05 GMT
Server: nginx/1.10.3

I don't see any cors-related config in streamr-docker-dev's nginx proxy so it's possible we'll need to add entirely new config in order to override the default behaviour.

timoxley

comment created time in 7 days

pull request commentstreamr-dev/streamr-client-javascript

Add streamr-client info to User-Agent header.

@hpihkala we can add the X- however it's no longer necessary and the Streamr- prefix ensures no possible collisions with other headers:

Custom proprietary headers have historically been used with an X- prefix, but this convention was deprecated in June 2012

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers

timoxley

comment created time in 7 days

push eventstreamr-dev/streamr-client-javascript

Tim Oxley

commit sha 663d1d8b90e60fdf30eb9557b77fda48d3b91b54

Fix instantiation of node-webcrypto-ossl.

view details

push time in 8 days

push eventstreamr-dev/streamr-client-javascript

Tim Oxley

commit sha 500207b98b5066948a86c426d97e197af102900f

Split example install & build steps.

view details

push time in 8 days

pull request commentstreamr-dev/streamr-client-javascript

Add streamr-client info to User-Agent header.

After doing some manual testing in browser, turns out you cannot change the user-agent header, at least not in Chrome. It was originally a "forbidden" header, but when it was made not forbidden in 2015, it seems Chrome never updated to fix this.

Related bug in Chrome: https://bugs.chromium.org/p/chromium/issues/detail?id=571722 Fixed bug in Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1188932

@hpihkala let's pick a different http header and use that e.g. Streamr-Version or perhaps the more restful approach would be to bake it into the client "Accepts" header e.g. Accepts: "application/streamr-client+json;version=3.2.1, application/json"

Also note there's no API for setting custom headers on the request for the WebSocket in the browser: https://stackoverflow.com/a/4361358/62851

timoxley

comment created time in 8 days

push eventstreamr-dev/streamr-client-javascript

Tim Oxley

commit sha e4a290e3bef18450a06fab34c9afa1f1b4e4937a

Use node-webcrypto-ossl directly instead of node-webcrypto-shim.

view details

Tim Oxley

commit sha 83d7fd2a3b2870558f2c65b2aab36c9136ae9cb9

Shim node-webcrypto-ossl in browser. Add browser main field to package.json, move aliases to webpack config.

view details

Tim Oxley

commit sha b697a81cf9f3becd59cac9aaae441e9b1addadc3

Verify webpack example builds with current client code in CI.

view details

push time in 8 days

push eventstreamr-dev/streamr-client-javascript

Tim Oxley

commit sha cb602752d4468a21186d98b3868bf53abc6b0130

Fix linting, add some comments.

view details

push time in 8 days

push eventstreamr-dev/streamr-client-javascript

Tim Oxley

commit sha fc627f7e9aca24db965f7a54fa8a27ee3be4d1d1

Shim WebCrypto APIs in node, test encryption works with WebCrypto APIs.

view details

push time in 9 days

pull request commentstreamr-dev/streamr-client-javascript

Make EncryptionUtil Browser Compatible

@mthambipillai

Plus it would be good to test that the generated keys are compatible. We should test that we can still use the same encrypt/decrypt methods with the keys generated in the browser.

Agreed. What do you think is the rough outline for how to test this?

Also we should test it in the e2e testing tool against the Java client.

I believe this will require booting a browser.

timoxley

comment created time in 9 days

Pull request review commentstreamr-dev/streamr-client-javascript

Make EncryptionUtil Browser Compatible

 export default class EncryptionUtil {         }     } +    async onReady() {+        if (this.isReady()) { return undefined }+        return this._generateKeyPair()+    }++    isReady() {+        return !!this.privateKey+    }+     // Returns a Buffer     decryptWithPrivateKey(ciphertext, isHexString = false) {+        if (!this.isReady()) { throw new Error('EncryptionUtil not ready.') }

Fixed.

timoxley

comment created time in 9 days

push eventstreamr-dev/streamr-client-javascript

Tim Oxley

commit sha 13150056052db602c666fb8066444485e3587173

Fix {Encryption,KeyExchange}Util unit tests.

view details

push time in 9 days

PR opened streamr-dev/streamr-client-javascript

Reviewers
Make EncryptionUtil Browser Compatible

WIP.

Current version of streamr-client (3.2.0) does not work in the browser because crypto-browserify, which is used by webpack to shim nodes crypto module in the browser, doesn't implement the generateKeyPairSync function, or even the async generateKeyPair.

I have added a possibly browser-compatible implementation of _generateKeyPair using https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/generateKey.

Until we set up a system for running in-browser tests, I am not sure this actually works yet.

The browser API does not provide a sync version, so I've made both versions async and added some handling to ensure it doesn't enqueue the same work twice. The async version should be used in node anyway since keygen is expensive and we don't want to block unnecessarily while it happens.

An alternative could be to use a JS implementation like https://www.npmjs.com/package/keypair, however:

Performance greatly depends on the bit size of the generated private key. With 1024 bits you get a key in 0.5s-2s, with 2048 bits it takes 8s-20s, on the same machine. As this will block the event loop while generating the key, make sure that's ok or to spawn a child process or run it inside a webworker.

We're using a 4096 bit key and on my machine that takes 26 seconds to generate. So a pure JS version is not a viable option for the browser without involving the complexity of adding web workers.

The browser crypto APIs have another caveat: they are only available in secure contexts (i.e. HTTPS). So the streamr-client won't be able to generate keys on any non-https page. Note it does appear to work with localhost or 127.0.0.1. We should probably fail gracefully when this situation is encountered e.g. toggle on window.isSecureContext.

+58 -2

0 comment

2 changed files

pr created time in 12 days

push eventstreamr-dev/streamr-client-javascript

Tim Oxley

commit sha 7c51cc6a2e6accc6521dba6bab0b196cec488800

Fix browser detection, fix promisify of missing function.

view details

Tim Oxley

commit sha 5c945bff6d36b520bb7dc17a27ce3c08f4aa5591

Fix crypto key export for browser.

view details

push time in 12 days

PR opened streamr-dev/streamr-client-javascript

Add streamr-client info to User-Agent header.

Adds header like so for server:

'User-Agent': 'Node v10.19.0 streamr-client-javascript/3.2.0dev'

dev only added if requests sent via non-npm-installed version of streamr-client.

Didn't append the node-fetch header that's currently sent because node-fetch doesn't expose it for extension, can only replace. This seems fine.

Client currently doesn't run in the browser (3.2.0), so haven't yet tested browser incantation, but intention is to append same streamr-client-javascript/3.2.0dev string to existing navigator.userAgent.

+58 -3

0 comment

3 changed files

pr created time in 13 days

push eventstreamr-dev/streamr-client-javascript

Tim Oxley

commit sha 12f4882962cc157639c675af915bf206d7f5705f

Add streamr-client info to User-Agent header.

view details

push time in 13 days

push eventstreamr-dev/data-union-server

Juuso Takalainen

commit sha c3a2b5ec3d91f5025bc958599ef01da0cbfce5d7

Merge remote-tracking branch 'origin/master' into add-dataunions-route

view details

Juuso Takalainen

commit sha 1f0ba1912b080f23cdd45c7d0d2164ca6f02a57a

Rename communityProduct -> dataunion TODO: variable names also: * inline deployTestCommunity because it was only used in one place * hack some things because CORE isn't renamed yet

view details

Jonathan Wolff

commit sha f551837b5c6b02892e7ca460bff2b4e7aaa4511b

initial commit (added unmodified state.js and member.js)

view details

Jonathan Wolff

commit sha cf3372a58e15daf0a9507537952f18e73f73ad4d

bugfix: active and name properly serialized

view details

Jonathan Wolff

commit sha 1dabfe827c7a605eee8233092879041ad13c6559

removed console line because lint doesnt permit

view details

Jonathan Wolff

commit sha d2fb25ec9874389f1c48d0d680d326d6db43f88b

WIP

view details

Tim Oxley

commit sha d65b4929d2e5d7b4e5d1751cd3595c21fd1dae44

Fix e&e intermittent system test failure in admin earnings check. Wait for member's withdrawable earnings by waiting for full amount, rather than any amount > 1.

view details

Tim Oxley

commit sha 2449befc9f3c1f8145190074269f7907b386d2be

Ensure community reports expected two members before proceeding with test.

view details

Tim Oxley

commit sha d1a046ac5fb98a12a604bc08a8c58e264641d49a

Fix linting issues.

view details

Tim Oxley

commit sha 95e7ebcda49c8d869533731e91f17c75384b4ba2

Migrate & integrate mock store from monoplasma.

view details

Tim Oxley

commit sha 2bab764256fde8fa62a773e14d4037f024cf503f

Add active flag in expected members for watcher test.

view details

Tim Oxley

commit sha 5652043ce52d45cb869354b2aaf2d5493094b3d8

Fix faulty server startup 'all failed' test, fix associated faulty check.

view details

Tim Oxley

commit sha 6ff1e55629a036814753fc856bae160bb4990c14

Migrate & integrate member and state tests from monoplasma.

view details

Tim Oxley

commit sha 995f3d6d83b6ed63aee92ca7a0f25573631acdd2

Use sync fs calls to work around fileStore timing issues.

view details

Tim Oxley

commit sha 5414f658bac744f26f995f132c048c524daaf0d1

Migrate & integrate fileStore unit tests from monoplasma.

view details

Tim Oxley

commit sha 5df9d27462b5885f6fb0c6a3d0fe3c35213c2a34

Replay operator changed events with concurrency 6.

view details

Tim Oxley

commit sha 17620be887a088cbedd4a995579af7ba928de903

Fail perf test early, check for timeout after each getProof.

view details

Tim Oxley

commit sha ad9cfad7b2c5c5a020f3907f04777d6d8c2e7713

Relax perf test so has hope of running on travis.

view details

Juuso Takalainen

commit sha 72b779d82190220c744cf3e99dbd0bb2e0b5af3a

speed up a slow test manually tested that busting the cache makes it "too slow", so it's caught

view details

Tim Oxley

commit sha b4c9721169d270ba960f9394344a9dac5f492b5a

Replace remaining references to code migrated from monoplasma.

view details

push time in 14 days

push eventstreamr-dev/streamr-platform

Tim Oxley

commit sha 7aaada5394314519fa3ae61e3f373b3035511263

[editor/canvas] Support new permission types.

view details

Tim Oxley

commit sha f08994b03616a37c1aec542c751f00b279c2d51d

[userpages ShareSidebar] Support new permission types, add preliminary shapes for permission groups.

view details

push time in 14 days

push eventstreamr-dev/streamr-platform

mthambipillai

commit sha c81c33343e4b41acde7a28024f2740dd1ce4f72a

init encryption doc

view details

mthambipillai

commit sha 79ca7a413c2cc9f45e62a319ebcfd1fef631d32c

fix AES size

view details

Juha Haavisto

commit sha 573d1959e600ebe22d7f14ca7fca47f66a74aac6

Replace edited product after saving image

view details

Mariusz Roliński

commit sha e55a922e0bba1d87dee0a6e177bf38e4bb5a35be

Hide “Made by” on the auth pages 0-effort solution.

view details

Mariusz Roliński

commit sha 32d28634d9d13750bb38d36dfeab38e41fb49cfc

Update font fams, weights and transformations

view details

Mariusz Roliński

commit sha 87c66ec76dcbe598ca9383d379bf9999ce325300

[share dialog] Swap user id and name “Streamr user” is now underneath the email address.

view details

Mariusz Roliński

commit sha 88db2f156c9363fd7638f6bc33e4d8d21a1e4e1f

Copy

view details

Mariusz Roliński

commit sha bb66ff1d11d1cc921705245be0e0ed56af4767a4

Remove translation for `footnote` key It’s unused.

view details

Mariusz Roliński

commit sha d3ed87db509ab290963eec359ff2317af3410a40

Merge pull request #851 from streamr-dev/PLATFORM-1232-update-auth-stuff [PLATFORM-1232] Update styling for the auth pages

view details

Juha Haavisto

commit sha 1bf6b4c39a96bd2010102277f9789e8378f0a045

Add custom text to status icon tooltip

view details

Tuomas Koponen

commit sha 0f9a8816252ff771ca64e6383de5214628fb8277

Add command for running cloc to count lines of code

view details

Juha Haavisto

commit sha aa0f8898100df6f011f912eff98ec562e0999c7c

Fetch members after removing

view details

juhah

commit sha 114b606b5d100daf29469113320b751db2df3cc0

Merge pull request #853 from streamr-dev/PLATFORM-1236-member-list-status-tooltip [PLATFORM-1236] Add custom text to status icon tooltip

view details

Mariusz Roliński

commit sha ea721e7b0f705f5bdfa4d2b0b31c26186242dfb4

Merge pull request #852 from streamr-dev/PLATFORM-647-swap-user-id-and-name [PLATFORM-647] Swap user id and name

view details

Juha Haavisto

commit sha 17ca91deb0418f5ddbd98805af735bd25b510d48

Add recent option to product sorting

view details

juhah

commit sha b1d1d63477a52072ae83c57af075e8910c34374d

Merge pull request #850 from streamr-dev/PLATFORM-1231-fix-cp-deploy-preview [PLATFORM-1231] Fix cover image not appearing in Community Products deploy process modal

view details

Tuomas Koponen

commit sha 807012d7d0c9c5ed9aa385724afd5c822c70fcfb

[PLATFORM-1235] Add smoke test for Docker builds (#849) * Add smoke test for dev builds

view details

juhah

commit sha 69fff48782e415ef7d4d61e9ba150bcb5bb68c57

Merge pull request #857 from streamr-dev/PLATFORM-1238-add-sort-by-recent-to-products-view [PLATFORM-1238] Add a "Recent" sort option to Core Products view

view details

Mariusz Roliński

commit sha 4cddd8c46f6f611938db9f9c7cfd28e572447529

Fix share dialog permission tests They started failing in ea721e7b0f705f5bdfa4d2b0b31c26186242dfb4.

view details

Mariusz Roliński

commit sha cb2d71a1841df8c7708399a84b95bafc8db7fbed

Text component The aim here is to make input tag extendable who unreadable mess of callbacks gathered in a single huge-ass file. I use “decorators” to enhance the basic <input /> with functionality like: - autocomplete detection - commit handler – unlike onChange it’s argument is the current value. - statefulness – the component is always controlled; keeps internal state and broadcasts it when needed Cheers!

view details

push time in 15 days

push eventstreamr-dev/data-union-server

jtakalai

commit sha 942312620f4d126a2ee5fc3bfece543a57cf8e9b

Merge pull request #39 from streamr-dev/add-dataunions-route Add /dataunions route, deprecate /communities

view details

Henri Pihkala

commit sha 1296e12b52280ed8a3c8bae43fb977111169cae9

fix travis, start everything except SUT

view details

Henri Pihkala

commit sha 9c67c193638379e1fa527840bf5c797362293f14

try adding sleep to reduce test flakiness

view details

Henri Pihkala

commit sha 6ccd4b1b7d9402b9ad9a66a114cf5938a44b37d0

debug travis

view details

Henri Pihkala

commit sha a3e54a20b8c3a22d1c450d0abdb4e83a9b322285

revert sleep

view details

Henri Pihkala

commit sha c267d02d6cae5386fa6b485f5b1d4e833b3f243c

Merge pull request #41 from streamr-dev/add-dataunions-route fix travis, start everything except SUT

view details

Jonathan Wolff

commit sha f551837b5c6b02892e7ca460bff2b4e7aaa4511b

initial commit (added unmodified state.js and member.js)

view details

Jonathan Wolff

commit sha cf3372a58e15daf0a9507537952f18e73f73ad4d

bugfix: active and name properly serialized

view details

Jonathan Wolff

commit sha 1dabfe827c7a605eee8233092879041ad13c6559

removed console line because lint doesnt permit

view details

Jonathan Wolff

commit sha d2fb25ec9874389f1c48d0d680d326d6db43f88b

WIP

view details

Tim Oxley

commit sha d65b4929d2e5d7b4e5d1751cd3595c21fd1dae44

Fix e&e intermittent system test failure in admin earnings check. Wait for member's withdrawable earnings by waiting for full amount, rather than any amount > 1.

view details

Tim Oxley

commit sha 2449befc9f3c1f8145190074269f7907b386d2be

Ensure community reports expected two members before proceeding with test.

view details

Tim Oxley

commit sha d1a046ac5fb98a12a604bc08a8c58e264641d49a

Fix linting issues.

view details

Tim Oxley

commit sha 95e7ebcda49c8d869533731e91f17c75384b4ba2

Migrate & integrate mock store from monoplasma.

view details

Tim Oxley

commit sha 2bab764256fde8fa62a773e14d4037f024cf503f

Add active flag in expected members for watcher test.

view details

Tim Oxley

commit sha 5652043ce52d45cb869354b2aaf2d5493094b3d8

Fix faulty server startup 'all failed' test, fix associated faulty check.

view details

Tim Oxley

commit sha 6ff1e55629a036814753fc856bae160bb4990c14

Migrate & integrate member and state tests from monoplasma.

view details

Tim Oxley

commit sha 995f3d6d83b6ed63aee92ca7a0f25573631acdd2

Use sync fs calls to work around fileStore timing issues.

view details

Tim Oxley

commit sha 5414f658bac744f26f995f132c048c524daaf0d1

Migrate & integrate fileStore unit tests from monoplasma.

view details

Tim Oxley

commit sha 5df9d27462b5885f6fb0c6a3d0fe3c35213c2a34

Replay operator changed events with concurrency 6.

view details

push time in 20 days

PR merged streamr-dev/streamr-client-javascript

Cps 35 community endpoints

"Version 0.2" of community / data union methods in StreamrClient

+366 -48

3 comments

17 changed files

jtakalai

pr closed time in 20 days

delete branch streamr-dev/streamr-client-javascript

delete branch : CPS-35-community-endpoints

delete time in 20 days

push eventstreamr-dev/streamr-client-javascript

jtakalai

commit sha 064881d657fee561dd30875d776ed47cc3df1f1b

Cps 35 community endpoints (#102) * delete accidental file it's under contracts * Refactor integration test options clientOptions were repeated, and with Ethereum, there's even more of them * add useful query function the endpoint exists, so why not use it... * Almost final version of CommunityEndPoints, also first version of tests One of the tests already passing (deployCommunity), woo! * weird typo fix websocketUrl doesn't exist in the structure, odd that this hasn't been caught before * remove options to joinCommunity with auth: apiKey also bunch of regrouping and fixing * update README * Member flow test working * eslint fixes * Tests for the common functions now pass * Added getBalance, using same EthereumOptions in deploy as in withdraw also other refactoring * fix integration test * package lock no idea what or why it changed but hey, it's good to keep it up to date * fixed error message * better error reporting if ganache is not available ...better yet, going to fix that condition in next commit! * Start CPS and ganache strangely they aren't started by streamr-docker-dev yet * lint fix * HTTP status code fix of course it returns 200 instead of 401 (what a curious way to check something works...) * Less waiting just checking cps answers something should be enough (it's not supposed to sync or anything silly like that) * fix promise bug * CPS-35: Put off fixing tests for now Of course they need to be fixed before the CommunityEndpoints can be developed further * Fixed tests let's try them again on Travis, too * increase timeouts now it seems to timeout in Travis (starting the community takes over 60s) * add a wait instead of increasing sleep maybe 1 sec sleep is still prudent * disconnect StreamrClient after test * try to fix test not terminating * try to fix test not terminating also "remove listeners" from ethers.js objects * ethers Contract.removeAllListeners seems broken * lint fixes * wait after transfer * try termination flag * Revert "try termination flag" This reverts commit 9c24aafb91005ce66c7d7f854d54bf881fdbd6af. * CPS-64: replaced generic logger with debug library * just create new getting is wrong here, at least with that kind of generated name * Add github workflow for integration test * fix github workflow * fix eslint warnings * remove .travis.yml * Improve code formatting PR fix * console.log -> debug, assert -> expect * Github actions debugging * Github actions debugging * Attempt fixing Resends tests. * Don't fail curl loops if server response is empty. * Print curl failure reason. * Ensure all created clients get disconnected when tests ends. Prevent crashes if no client. * Include response body in logged AuthFetchError. * Retry validateProof until proof validated, or run out of retries specifically what I fail to test now (because the block is validated on first try) is if waiting for next block actually works * Fix unit test assertion. Ensure space before printing auth error body in message. * added active flag to test * Ignore case of userId when checking permissions. * Update expected response shape for joinCommunity. Co-authored-by: Tim Oxley <secoif@gmail.com> Co-authored-by: Jonathan Wolff <jwolff@isentropy.com>

view details

push time in 20 days

pull request commentstreamr-dev/streamr-client-javascript

Cps 35 community endpoints

Ok this seems ready to go. Seems to pass reliably now.

jtakalai

comment created time in 20 days

push eventstreamr-dev/data-union-server

Tim Kevin Oxley

commit sha f6d680b242b061fbb016da6200a09b049e224621

Add timing tests. (#46) * Add utils/now * Update monoplasma to 0.2. * Fix references to monoplasma now util. * Port merkletree code from monoplasma. * Use npm-force-resolutions to fix references to scrypt, so install works on node 12. Manually made scrypt optional in package-lock.json. * Add missing web3 dependency. * Update travis/docker references to node/npm versions to use node 12. * Fix travis IMAGE_NAME for smoke_tests. * Ignore failure in npm-force-resolutions preinstall script, e.g. read-only lockfile in prod. * Replace web3 with ethers in code that was imported from monoplasma (old) * got rid of bn.js directly, turned all addresses into checksum-case now it comes through ethers.js, which ensures it works together with ethers.js code elsewhere ethers.js LOVES checksum-case * Remove web3 dependency. * Fix merkletree test case addresses to checksum-case. * Port merkletree code from monoplasma. * Give merkletree transitional async API. * Test false case for MerkleTree#includes. * Minimum viable merkletree worker. * Remove now unnecessary async wrapper from merkletree. * Guard against infinite loop in roundUpToPowerOfTwo. * Fix error wrapping. * Only set up process listeners if worker is actually a worker process. * Add test to ensure tree calculations don't block. * Ensure simultaneous duplicate merkletree requests don't create duplicate workers. * Add tests around merkletree update, ensure update doesn't interfere with in-progress calculations. * Comment merkletree update tests. * Stagger merkletree generation via sleeps, compare against worker perf. Prep for persistent tree worker. * Lint cleanup * Avoid unnecessary conversion from member objects to Member instances then back to objects. * Give a little more time to large number of members test. * Fix reference to BN.js -> bn.js. * Add utils/now * Calculate 'small' merkletrees (<100 item) in-process. * Add more jsdoc to merkletree worker classes, refactored a bit to be cleaner. * Update monoplasma to 0.2. * Fix references to monoplasma now util. * Use npm-force-resolutions to fix references to scrypt, so install works on node 12. Manually made scrypt optional in package-lock.json. * Add missing web3 dependency. * Update travis/docker references to node/npm versions to use node 12. * Implement merkletree concurrency on Node 12's worker_threads rather than child_process. * Fix travis IMAGE_NAME for smoke_tests. * Ignore failure in npm-force-resolutions preinstall script, e.g. read-only lockfile in prod. * Fix product creation type s/COMMUNITY/DATAUNION * Fix product creation type s/COMMUNITY/DATAUNION * fix merge hazard * fix another merge hazard * added TODO while reviewing * remove the scrypt.js hack * Update ganache-core this gets rid of some scrypt problems on Node 12 * Revert "Implement merkletree concurrency on Node 12's worker_threads rather than child_process." This reverts commit 3401a5d12081a84a92fb1ec0fb148a50ec9e5ed4. * remove stray file in this thread, the whole merkletree business is under src/merkletree directory * Ported Monoplasma 0.2 changes to merkletree mostly https://github.com/streamr-dev/monoplasma/pull/21 might have missed something for some reason the hashes are all wrong when you run the test * clear up useless methods from MonoplasmaMember TODO: clear up that whole class * Ethers BigNumber fixes it only has toString without radix or padding like bn.js Which is fine, there are other ways to do those in ethers.utils.BigNumber * "Unoptimized" MerkleTree now it's not using Node.js Buffers anymore, only ethers.js solidityKeccak256 function, which is faithful to Solidity's keccak256 function Hash come wrong from MerkleTree currently, but they're correct in the tests, see https://github.com/streamr-dev/monoplasma/blob/use-ethers-for-hashing/src/merkletree.js * Add scripts/fix_package_lock.js to patch out bad scrypt deps. Commit patched package-lock.json. * Fix missing salt merkletree RPC calls, hashes as strings instead of buffers, re-add perf tests. * Remove any references to Buffer from merkletree. * Disable linting for WIP script files. * Add timing tests. * start server runner with env vars * add logging * event.timestamp fix * changed test privateKey to something unique all private keys of form 0x100000000000000000000000000000000000000000000000000000000000xxxx where xxxx = 0000...9999 have ether in them, if using `streamr-docker-dev start ganache` * Add queue for publishing blocks to get rid of nonce complaints. * Fix block already published error message. * Add some logging around proof being correct. * Throw if already storing block and already have same or newer block. * Add utils/now * Trim logging * Actually wait for store to save state. * Fix nested debug output in timing tests. * Fix product creation type s/COMMUNITY/DATAUNION * Tidy up onTokensReceived catch handler. * Synchronously read/write values to blockTimestampCache. * Remove timing test. Co-authored-by: Juuso Takalainen <juuso.takalainen@streamr.com>

view details

push time in 21 days

delete branch streamr-dev/data-union-server

delete branch : timing-tests

delete time in 21 days

push eventstreamr-dev/streamr-client-javascript

Melchior Thambipillai

commit sha 314725ff60e8adbf7ff64a330734969c03c794d5

Key exchange (#83) * init createGroupKeyRequest * init inbox stream handler * add isStreamSubscriber endpoint * add isValidSubscriber * handle group key request * add handleGroupKeyResponse * make integration test pass * throw after second failed decryption * init key history * handle key range requests * key exchange for initial resends * option to store or not history of keys * update readme * fix error text * send key requests and handle responses * fix test * additional encryption/decryption unit tests * fix tests after merge * error handling on unable to decrypt * fix multiple publishers decryption * add check for invalid key added to history * error handling * fix integration tests * remove large timeout * fix passing group keys to sub * fix lower case publisher id and rsa key format * fix decryption order for multiple publishers * periodic group key request * apply pr review comments * fix tests * remove await not needed * Ignore case of userId when checking permissions. * apply changes from pr comments * remove unnecessary test file * fix eslint Co-authored-by: Tim Kevin Oxley <secoif@gmail.com>

view details

mthambipillai

commit sha a395d5d8f1b1995691da1afb10cfd7c928214701

3.2.0

view details

Tim Kevin Oxley

commit sha ebcafae0bb5ad2346031df48ee6dfc64d3bf1197

Merge branch 'master' into CPS-35-community-endpoints

view details

push time in 21 days

push eventstreamr-dev/data-union-server

Tim Oxley

commit sha 3a67d662c4d141e024112acae4641299506e2b80

Remove timing test.

view details

push time in 21 days

push eventstreamr-dev/data-union-server

Tim Oxley

commit sha aaf87158b4dabfe511fc741481d8977164869ec3

Synchronously read/write values to blockTimestampCache.

view details

push time in 21 days

push eventstreamr-dev/data-union-server

Tim Oxley

commit sha 7a29335c34a8238b7ee6c948af39fcee32a3c859

Tidy up onTokensReceived catch handler.

view details

push time in 21 days

push eventstreamr-dev/data-union-server

Tim Kevin Oxley

commit sha 9bcdd4dd825cd5269213648e7e6dfa0572c35853

Merkletree Worker (#42) * Add utils/now * Update monoplasma to 0.2. * Fix references to monoplasma now util. * Port merkletree code from monoplasma. * Use npm-force-resolutions to fix references to scrypt, so install works on node 12. Manually made scrypt optional in package-lock.json. * Add missing web3 dependency. * Update travis/docker references to node/npm versions to use node 12. * Fix travis IMAGE_NAME for smoke_tests. * Ignore failure in npm-force-resolutions preinstall script, e.g. read-only lockfile in prod. * Replace web3 with ethers in code that was imported from monoplasma (old) * got rid of bn.js directly, turned all addresses into checksum-case now it comes through ethers.js, which ensures it works together with ethers.js code elsewhere ethers.js LOVES checksum-case * Remove web3 dependency. * Fix merkletree test case addresses to checksum-case. * Port merkletree code from monoplasma. * Give merkletree transitional async API. * Test false case for MerkleTree#includes. * Minimum viable merkletree worker. * Remove now unnecessary async wrapper from merkletree. * Guard against infinite loop in roundUpToPowerOfTwo. * Fix error wrapping. * Only set up process listeners if worker is actually a worker process. * Add test to ensure tree calculations don't block. * Ensure simultaneous duplicate merkletree requests don't create duplicate workers. * Add tests around merkletree update, ensure update doesn't interfere with in-progress calculations. * Comment merkletree update tests. * Stagger merkletree generation via sleeps, compare against worker perf. Prep for persistent tree worker. * Lint cleanup * Avoid unnecessary conversion from member objects to Member instances then back to objects. * Give a little more time to large number of members test. * Fix reference to BN.js -> bn.js. * Add utils/now * Calculate 'small' merkletrees (<100 item) in-process. * Add more jsdoc to merkletree worker classes, refactored a bit to be cleaner. * Update monoplasma to 0.2. * Fix references to monoplasma now util. * Use npm-force-resolutions to fix references to scrypt, so install works on node 12. Manually made scrypt optional in package-lock.json. * Add missing web3 dependency. * Update travis/docker references to node/npm versions to use node 12. * Implement merkletree concurrency on Node 12's worker_threads rather than child_process. * Fix travis IMAGE_NAME for smoke_tests. * Ignore failure in npm-force-resolutions preinstall script, e.g. read-only lockfile in prod. * Fix product creation type s/COMMUNITY/DATAUNION * Fix product creation type s/COMMUNITY/DATAUNION * fix merge hazard * fix another merge hazard * added TODO while reviewing * remove the scrypt.js hack * Update ganache-core this gets rid of some scrypt problems on Node 12 * Revert "Implement merkletree concurrency on Node 12's worker_threads rather than child_process." This reverts commit 3401a5d12081a84a92fb1ec0fb148a50ec9e5ed4. * remove stray file in this thread, the whole merkletree business is under src/merkletree directory * Ported Monoplasma 0.2 changes to merkletree mostly https://github.com/streamr-dev/monoplasma/pull/21 might have missed something for some reason the hashes are all wrong when you run the test * clear up useless methods from MonoplasmaMember TODO: clear up that whole class * Ethers BigNumber fixes it only has toString without radix or padding like bn.js Which is fine, there are other ways to do those in ethers.utils.BigNumber * "Unoptimized" MerkleTree now it's not using Node.js Buffers anymore, only ethers.js solidityKeccak256 function, which is faithful to Solidity's keccak256 function Hash come wrong from MerkleTree currently, but they're correct in the tests, see https://github.com/streamr-dev/monoplasma/blob/use-ethers-for-hashing/src/merkletree.js * Add scripts/fix_package_lock.js to patch out bad scrypt deps. Commit patched package-lock.json. * Fix missing salt merkletree RPC calls, hashes as strings instead of buffers, re-add perf tests. * Remove any references to Buffer from merkletree. * Disable linting for WIP script files. * Move slow state unit tests to end, inside own describe so can be .skip'ed. * Ensure salt passed to initial tree. Test proofs are different if initial block different. * Ensure salt passed in getProofAt. * Ensure salt passed in getProofAt/getMemberAt. * Add TODO test for getProof. * Make members array immutable, test no proof if no revenue yet. * Fix reading from adminFee instead of adminFeeFraction. * Remove proof from getMember, remove getProof method. Proofs require a block number, which we don't know until storeBlock is called. Proofs for block in-progress likely not very useful anyway since they could change. * Use named parameters in state constructor. * Add debug logger to fileStore. * Capture dataunion state as-is before starting block publish. * Update dataunion-server contracts to solc 0.5.16. * Commit built contract data. * Clean up child process event handlers in test. * Install all deps in docker. Co-authored-by: Juuso Takalainen <juuso.takalainen@streamr.com>

view details

Tim Oxley

commit sha 897fa99ed1cf217f23786d8bec429163489bd52c

Merge branch 'master' into timing-tests * master: Merkletree Worker (#42)

view details

push time in 21 days

PullRequestEvent

delete branch streamr-dev/data-union-server

delete branch : node-12

delete time in 21 days

PR closed streamr-dev/data-union-server

Tidy Versions + Node 12

Extracted subset of changes from merkletree branch, and cherry-picked changes from production branch:

  • Fix install to work on node 12
  • Remove web3 dependency
  • Remove bn.js dependency
  • Update monoplasma 0.2 dependency
+24558 -50883

1 comment

16 changed files

timoxley

pr closed time in 21 days

pull request commentstreamr-dev/data-union-server

Tidy Versions + Node 12

Superseded by #42

timoxley

comment created time in 21 days

push eventstreamr-dev/data-union-server

Tim Oxley

commit sha d0c8d3717c547766330b2bbabea96d62eb749d3c

Clean up child process event handlers in test.

view details

Tim Oxley

commit sha 6813176a1307cf304aaf9d4c0da2941ae3e57c67

Install all deps in docker.

view details

push time in 21 days

push eventstreamr-dev/data-union-server

Tim Oxley

commit sha 609c4a4d83646d1823bac90c7e625c1aab566abf

Install all deps in docker.

view details

push time in 22 days

push eventstreamr-dev/data-union-server

Tim Oxley

commit sha 890c9811cff501d08c0fe3f589da41737de94c2d

Update dataunion-server contracts to solc 0.5.16.

view details

Tim Oxley

commit sha 2daf9df604b0750a6ddd65a7a929006c5cd2d2c5

Commit built contract data.

view details

Tim Oxley

commit sha c3d3c86e08d564e8ac1569dda603d848f1074498

Remove sleep before withdrawing tokens.

view details

Tim Oxley

commit sha cd3a429010e29a2d1e6c7ef525387828153522e5

Clean up child process event handlers in test.

view details

push time in 22 days

push eventstreamr-dev/data-union-server

Tim Oxley

commit sha fbf5ea2c9601cf681688f5a334ff498b6fcb493c

Update dataunion-server contracts to solc 0.5.16.

view details

Tim Oxley

commit sha ce722ea5a0272245710fb19bea98eac8ae242da1

Commit built contract data.

view details

push time in 22 days

push eventstreamr-dev/data-union-server

Tim Oxley

commit sha 86580c9ab92b1806acdc7652b5f872d2833d5a26

Add debug logger to fileStore.

view details

Tim Oxley

commit sha 1d962b06db39470c4da9b73f0a3c2e5740c19145

Capture dataunion state as-is before starting block publish.

view details

push time in 22 days

push eventstreamr-dev/data-union-server

Tim Oxley

commit sha 8fdffc3f0c89b489ba6dc954de0ac6247d270b85

Remove proof from getMember, remove getProof method. Proofs require a block number, which we don't know until storeBlock is called. Proofs for block in-progress likely not very useful anyway since they could change.

view details

Tim Oxley

commit sha 92852a14c60199f3246fede67926a8a2c9843a02

Use named parameters in state constructor.

view details

push time in 22 days

push eventstreamr-dev/data-union-server

Tim Oxley

commit sha 4e3ed9f0f4949c1ee6e163b2841c3f6484e2873d

Remove proof from getMember, remove getProof method. Proofs require a block number, which we don't know until storeBlock is called. Proofs for block in-progress likely not very useful anyway since they could change.

view details

push time in 22 days

push eventstreamr-dev/data-union-server

Tim Oxley

commit sha a17eb505a6fe2d6f52de73b923df3ed22eac91a3

Fix reading from adminFee instead of adminFeeFraction.

view details

push time in 22 days

push eventstreamr-dev/streamr-client-javascript

Tim Kevin Oxley

commit sha f0922a6853457899088beb97cb4ac6f6c7b6fbdc

Ignore case of userId when checking permissions. (#126) * Ignore case of userId when checking permissions. * Refactor hasPermission conditional. * Increase resend test timeouts. * Force userId in hasPermission to be string or nothing. * Don't crash on anonymous permissions. * Fix undefined comparison.

view details

dependabot[bot]

commit sha a5ef3755f7e2212b972bd2068369ecbe4882e416

Bump acorn from 6.4.0 to 6.4.1 in /examples/webpack (#127) Bumps [acorn](https://github.com/acornjs/acorn) from 6.4.0 to 6.4.1. - [Release notes](https://github.com/acornjs/acorn/releases) - [Commits](https://github.com/acornjs/acorn/compare/6.4.0...6.4.1) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

view details

dependabot[bot]

commit sha cd43119d3693e79efda1e16703af9053fee99e7f

Bump acorn from 5.7.3 to 5.7.4 (#128) Bumps [acorn](https://github.com/acornjs/acorn) from 5.7.3 to 5.7.4. - [Release notes](https://github.com/acornjs/acorn/releases) - [Commits](https://github.com/acornjs/acorn/compare/5.7.3...5.7.4) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

view details

Tim Kevin Oxley

commit sha d0e1e13a0a74b11c665587419bf167a742667aaf

Merge branch 'master' into key-exchange

view details

push time in 22 days

push eventstreamr-dev/streamr-client-javascript

Tim Kevin Oxley

commit sha f0922a6853457899088beb97cb4ac6f6c7b6fbdc

Ignore case of userId when checking permissions. (#126) * Ignore case of userId when checking permissions. * Refactor hasPermission conditional. * Increase resend test timeouts. * Force userId in hasPermission to be string or nothing. * Don't crash on anonymous permissions. * Fix undefined comparison.

view details

dependabot[bot]

commit sha a5ef3755f7e2212b972bd2068369ecbe4882e416

Bump acorn from 6.4.0 to 6.4.1 in /examples/webpack (#127) Bumps [acorn](https://github.com/acornjs/acorn) from 6.4.0 to 6.4.1. - [Release notes](https://github.com/acornjs/acorn/releases) - [Commits](https://github.com/acornjs/acorn/compare/6.4.0...6.4.1) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

view details

dependabot[bot]

commit sha cd43119d3693e79efda1e16703af9053fee99e7f

Bump acorn from 5.7.3 to 5.7.4 (#128) Bumps [acorn](https://github.com/acornjs/acorn) from 5.7.3 to 5.7.4. - [Release notes](https://github.com/acornjs/acorn/releases) - [Commits](https://github.com/acornjs/acorn/compare/5.7.3...5.7.4) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

view details

Tim Kevin Oxley

commit sha 461ab3165df3281fe106a091743515ea00fa44d5

Merge branch 'master' into CPS-35-community-endpoints

view details

push time in 22 days

delete branch streamr-dev/streamr-client-javascript

delete branch : dependabot/npm_and_yarn/acorn-5.7.4

delete time in 22 days

more