-
Notifications
You must be signed in to change notification settings - Fork 7
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
Local testnet simulator implementation #4
Conversation
const simulations = [...Array(numberOfSimulatedNodeExecutions)].map(() => | ||
simulateScript({ | ||
source: requestData.source, | ||
secrets: simulationConfig.secrets, // Secrets are taken from simulationConfig, not request data included in transaction |
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.
Seems a bit odd that the secrets that accompany a request would be in the sim's config?
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 this will be more clear shortly when I get this integrated into the HH starter kit. If it still doesn't make sense then, maybe we can revisit. I will have the starter kit PR up later today.
|
||
const req = await reqTx.wait(1) | ||
const requestId = req.events[0].topics[1] | ||
const response = await functionsListener.listenForResponse(requestId) |
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.
is it possible for the request response to be fulfilled before the listener gets mounted?
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.
It shouldn't because it takes 1 block for the response transaction to be mined on the testnet, which is plenty of time to initialize the response listener. Also, we need to initiate the request transaction so we can get the requestId (however, maybe I could switch reqTx.wait(1)
-> reqTx.wait(0)
to further eliminate any chance of a race condition.
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.
LGTM. Few comments for you to consider.
* implemented SubscriptionManager class and createSubscription method * regenerated package-lock.json * added recompilation in separate command * regenerated package-lock.json * added env var during hardhat compilation * ran prettier * fixed corrupted package-lock.json
TODO: