Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

fix: do not republish self key twice #3634

Merged
merged 3 commits into from
Apr 28, 2021

Conversation

vasco-santos
Copy link
Member

IPNS Republish was republishing self private key twice, first as part of the root IPNS Record published when creating the IPFS Repo and then as part of keychain keys.

This was specially problematic when doing a flow such as:

node packages/ipfs/src/cli.js init
DEBUG=ipfs:i* node packages/ipfs/src/cli.js daemon --pass 12345678901234567890

As we provided a keychain password for the daemon, this password was going to be used for creating the keychain dek. However, self was created as part of the PeerId in the init command (without password).

@vasco-santos vasco-santos changed the base branch from master to chore/update-buffer-deps April 23, 2021 15:46
@vasco-santos vasco-santos force-pushed the fix/do-not-republish-self-key-twice branch from bc76ddf to 1f336ea Compare April 23, 2021 15:47
Base automatically changed from chore/update-buffer-deps to master April 27, 2021 07:46
@vasco-santos vasco-santos force-pushed the fix/do-not-republish-self-key-twice branch from 1f336ea to 26a46ec Compare April 27, 2021 14:45
@vasco-santos vasco-santos force-pushed the fix/do-not-republish-self-key-twice branch from 26a46ec to 1732fa8 Compare April 27, 2021 16:18
})
republisher._republishEntry = sinon.stub()

await republisher.start()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need stopping?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is stopped in the afterEach (line 29), like remaining tests

expect(republisher._republishEntry.calledOnce).to.equal(false)

// Initial republish should happen after ~500ms
await delay(750)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we configure a smaller delay to make the tests faster?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to 200 with initial broadcast of 100

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also decreased the other test timers

@achingbrain achingbrain merged commit 8545a76 into master Apr 28, 2021
@achingbrain achingbrain deleted the fix/do-not-republish-self-key-twice branch April 28, 2021 05:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants