-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Store nonce in local file system and recover it when starting gateway #4505
Conversation
@martinkou It mentions that you shouldn't need to run I have not seen any errors while running gateway by itself and making curl calls to it. Also running Here are some errors I see:
|
@@ -56,6 +55,17 @@ export class Ethereum extends EthereumBase { | |||
return Ethereum._instance; | |||
} | |||
|
|||
async init(): Promise<void> { |
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.
Now init from nonceManager is async, so we need to override init from ethereum-base.
|
||
export class EVMNonceManager { | ||
private static _instance: EVMNonceManager; | ||
private _addressToNonce: Record<string, [number, Date]> = {}; | ||
private _delay: number | null = null; | ||
private _initialized: boolean = false; | ||
private _chainId: number = 0; |
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.
This isn't great, but making it null | number
was also annoying, though it is probably more correct.
if (!this._provider || !this._delay) { | ||
this._provider = provider; | ||
this._delay = delay; | ||
} | ||
|
||
if (!this._initialized) { |
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.
Load the nonces from the local storage file if it exists. This is async so it make init async.
private _ready: boolean = false; | ||
private _initializing: boolean = false; | ||
private _initPromise: Promise<void> = Promise.resolve(); | ||
protected _ready: boolean = false; |
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.
expose these as protected so the Ethereum class can override init
@martinkou |
@willyPat Thanks for finding the solution. |
┆Issue is synchronized with this Clickup task by Unito