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

Nonce tracking #155

Closed
roderik opened this issue May 14, 2020 · 4 comments
Closed

Nonce tracking #155

roderik opened this issue May 14, 2020 · 4 comments
Labels
wontfix This will not be worked on

Comments

@roderik
Copy link
Contributor

roderik commented May 14, 2020

When running a test suite of a flow I want to execute, I run into 'nonce too low' errors.

2020-05-14T20:11:37.000Z daf:key-store Saving key 04b202a46acca5a9dfbad36eaee845ec50874d5da57bd8863d5c6179153424fd23fa1c8506c43c3e2954a6d1c35d927c1d1f741dd2ce39d2e010453264b5c74bb1
2020-05-14T20:11:37.007Z daf:sodium:kms Created key Secp256k1 04b202a46acca5a9dfbad36eaee845ec50874d5da57bd8863d5c6179153424fd23fa1c8506c43c3e2954a6d1c35d927c1d1f741dd2ce39d2e010453264b5c74bb1
2020-05-14T20:11:37.015Z daf:identity-store Saving did:ethr:yellow-daf-poc:0x2c00ca2fb63a440b91b6f2298e074bd1c11e62ac
2020-05-14T20:11:37.015Z daf:ethr-did:identity-provider Created did:ethr:yellow-daf-poc:0x2c00ca2fb63a440b91b6f2298e074bd1c11e62ac
2020-05-14T20:11:37.025Z daf:key-store Saving key a3a3b62ef9fd0b4c1816920403379f3b82e3038ab0ddd128773a87be35512be1
2020-05-14T20:11:37.027Z daf:sodium:kms Created key Ed25519 a3a3b62ef9fd0b4c1816920403379f3b82e3038ab0ddd128773a87be35512be1
2020-05-14T20:11:37.028Z daf:ethr-did:identity-controller ethrDid.setAttribute {
  attribute: 'did/pub/Ed25519/veriKey/hex',
  value: '0xa3a3b62ef9fd0b4c1816920403379f3b82e3038ab0ddd128773a87be35512be1',
  ttl: 31104001,
  gas: 100000
}
2020-05-14T20:11:37.550Z daf:ethr-did:identity-controller {
  txHash: '0x572b2340d5b007176ef450a90508e6505f296c39cc7e1ee5bdb836f4fd6472a5'
}
2020-05-14T20:11:37.555Z daf:identity-store Saving did:ethr:yellow-daf-poc:0x2c00ca2fb63a440b91b6f2298e074bd1c11e62ac
2020-05-14T20:11:37.561Z daf:ethr-did:identity-controller ethrDid.setAttribute {
  attribute: 'did/svc/Messaging',
  value: 'http://settlemint.com',
  ttl: 31104001,
  gas: 100000
}
2020-05-14T20:11:38.272Z daf:ethr-did:identity-controller [ethjs-query] while formatting outputs from RPC '{"value":{"code":-32001,"message":"Nonce too low"}}'

Option a:

  • IdentityController.addService returns a txHash I could use to poll for a receipt
  • IdentityController.addPublicKey returns true, so no way I can handle it because the txHash is not stored
  • The return type can be improved by Promise<boolean|string> or even Promise<false|string>

Option b:

Option c:

What approach do you think is best?

@mirceanis
Copy link
Member

We're exploring using a different provider API.
Likely it will be ethers since it is a bit smaller, is about to get separated into even smaller modules, it has the concept of FallbackProvider which would allow some composition as well as providing transaction inputs as Promises (including a promise to obtain the correct nonce).

I haven't tested this yet but I think it would also be composable with a metamask provider if required.

Also, in any case there should be some extension possible on the controller methods (and any other methods that can lead to transactions) to be able to override some TX parameters.
The easiest is an options parameter that can be used by the ethr-did-controller to override TX inputs

@roderik
Copy link
Contributor Author

roderik commented May 28, 2020

As far as I know (not sure if they added it in v5 beta), ethers also does not track nonces. Some workarounds: ethers-io/ethers.js#319

I think you would need to track this in memory in either ethr-did or daf-ethr-did. Or expose the txHash (I have a pr open for that) so you can poll for the receipt outside of daf.

@mirceanis
Copy link
Member

relates to #205 #224

@stale
Copy link

stale bot commented Dec 19, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Dec 19, 2020
@stale stale bot closed this as completed Dec 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants