Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure we generate the keyfile for latest-set keys #138

Merged
merged 2 commits into from
May 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 17 additions & 36 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@ledgerhq/hw-app-eth": "^4.35.0",
"@ledgerhq/hw-transport-u2f": "^4.35.0",
"PaperCollateralRenderer": "github:urbit/PaperCollateralRenderer",
"azimuth-js": "^0.10.0",
"azimuth-js": "^0.13.2",
"azimuth-solidity": "1.0.2",
"babel-polyfill": "^6.26.0",
"bip32": "^1.0.2",
Expand Down
7 changes: 5 additions & 2 deletions src/bridge/Bridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,10 @@ class Bridge extends React.Component {
}
}

setNetworkSeedCache(networkSeed) {
setNetworkSeedCache(networkSeed, revision) {
this.setState({
networkSeedCache: networkSeed
networkSeedCache: networkSeed,
networkRevisionCache: revision
})
}

Expand Down Expand Up @@ -263,6 +264,7 @@ class Bridge extends React.Component {
urbitWallet,
authMnemonic,
networkSeedCache,
networkRevisionCache,
pointCursor,
pointCache,
txnHashCursor,
Expand Down Expand Up @@ -316,6 +318,7 @@ class Bridge extends React.Component {
pointCursor={ pointCursor }
pointCache={ pointCache }
networkSeedCache= { networkSeedCache }
networkRevisionCache={ networkRevisionCache }
setNetworkSeedCache= { this.setNetworkSeedCache }
// txn
setTxnHashCursor={ this.setTxnHashCursor }
Expand Down
5 changes: 3 additions & 2 deletions src/bridge/components/StatelessTransaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ class StatelessTransaction extends React.Component {
props.setTxnHashCursor(sent)
props.popRoute()

if (props.networkSeed) {
props.setNetworkSeedCache(props.networkSeed)
//TODO this special logic should live in a handler in SetKeys.
if (props.networkSeed && props.newRevision) {
props.setNetworkSeedCache(props.networkSeed, props.newRevision)
props.pushRoute(ROUTE_NAMES.SENT_TRANSACTION, {promptKeyfile: true})
} else {
props.pushRoute(ROUTE_NAMES.SENT_TRANSACTION)
Expand Down
5 changes: 4 additions & 1 deletion src/bridge/views/GenKeyfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ class GenKeyfile extends React.Component {
? pointCache[point]
: (() => { throw BRIDGE_ERROR.MISSING_POINT })()

const revision = parseInt(pointDetails.keyRevisionNumber)
// in case we did SetKeys earlier this session, make sure to generate the
// newer keyfile, rather than the one that will expire soon
const revision = (this.props.networkRevisionCache ||
parseInt(pointDetails.keyRevisionNumber));

return {
point,
Expand Down
1 change: 1 addition & 0 deletions src/bridge/views/SetKeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ class SetKeys extends React.Component {
canGenerate={ canGenerate }
createUnsignedTxn={this.createUnsignedTxn}
networkSeed={ state.networkSeed }
newRevision={ (parseInt(pointDetails.keyRevisionNumber) + 1) }
setNetworkSeedCache={ props.setNetworkSeedCache } />

</Col>
Expand Down