-
Notifications
You must be signed in to change notification settings - Fork 3
Add replace-duration parameter for NearClient #14
Conversation
5c42e0f
to
65afa41
Compare
console.log( | ||
`Near2EthClient block is at ${clientBlockHeight.toString()} which is further than the needed block ${outcomeBlockHeight.toString()}` | ||
) | ||
if (clientBlockHeight > outcomeBlockHeight) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does JS int okay here? it's up to 2^52, bigger than that will become imprecise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that we won't reach block height of more than 253≅9·1015 any time soon.
watchdog/index.js
Outdated
try { | ||
result = await this.clientContract.methods.checkBlockProducerSignatureInHead(i).call() | ||
} catch (e) { | ||
console.log(`Error, continuing.`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to not attempt to call checkBlockProducerSignatureInHead
when signature is missing, because currently we cannot differentiate between transient errors, e.g. RPC-related stuff and error that occurs when we try to call checkBlockProducerSignatureInHead
on missing signature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current logic should work fine in both cases. Suppose that it will be possible to differentiate between those cases, will watchdog's behavior be different?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now sleeps timeDelta
before revalidating the block. Ideally this should be parameter (currently when I run on gcloud I patch this code for timeDelta
to be 300
because otherwise we would exceed infura quota). If user launches watchdog with timeDelta
that is comparable to challenge period then watchdog can accidentally skip invalid signature because of some RPC error and wait to retry for timeDelta
, which might be sufficient for bad header to be accepted. If we can differentiate between these two errors then we can retry signature check until RPC succeeds and only then sleep for timeDelta
.
Also, currently this will print lots of spam logs, because testnet headers have routinely skipped signatures. So right now watchdog
will be printing several Error, continuing
every timeDelta
seconds, which might be misinterpreted by the users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made the delay configurable, so this shouldn't be an issue anymore.
65afa41
to
a9ccb8b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving, assuming the comment is taken in consideration.
3351bc1
to
c198303
Compare
…rameter, various fixes
c198303
to
3bc5454
Compare
I have tested the change locally. I am now going to force merge it. |
No description provided.