attestantio / dirk

Apache License 2.0
81 stars 23 forks source link

Dirk failed to obtain account available in ethdo #8

Closed fkbenjamin closed 3 years ago

fkbenjamin commented 3 years ago

After a new validator got activated on mainnet, Vouch tried to access the account on Dirk, which failed to obtain the account from ethdo. Listing all accounts in ethdo, the account that Dirk failed to obtain was visible there.

Here is the log from Dirk:

{"level":"trace","service":"fetcher","impl":"mem","path":"account-01/validators/007","time":"2021-02-26T08:59:59+01:00","message":"Fetching account"}
{"level":"trace","service":"fetcher","impl":"mem","path":"account-01/validators/007","time":"2021-02-26T08:59:59+01:00","message":"Fetching wallet"}
{"level":"trace","service":"fetcher","impl":"mem","path":"account-01/validators/007","time":"2021-02-26T08:59:59+01:00","message":"Wallet found in cache"}
{"level":"warn","service":"fetcher","impl":"mem","path":"account-01/validators/007","error":"no account with name \"validators/007\"","time":"2021-02-26T08:59:59+01:00","message":"Account not found"}
{"level":"warn","service":"signer","impl":"standard","error":"failed to obtain account by name: no account with name \"validators/007\"","result":"denied","time":"2021-02-26T08:59:59+01:00","message":"Did not obtain account; denied"}

After a simple restart of Dirk, it was able to find the account and sign messages with it.

mcdee commented 3 years ago

Dirk keeps a cache of known and unknown accounts, to speed up signing. In this situation an account was added, but after a request to Dirk had been made for the account. In this situation Dirk retains the negative cache entry, hence the mismatch.

Invalidating the cache here would be relatively expensive in terms of going back to the filesystem each time to look up potential negative entries, and so is not something that we would look to implement. As mentioned, a restart would clear the cache in this situation and allow Dirk to use the new account.