-
Notifications
You must be signed in to change notification settings - Fork 14
clean and migrate callback erc1154 UT file part 1 #145
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #145 +/- ##
========================================
Coverage 84.58% 84.58%
========================================
Files 35 35
Lines 1077 1077
Branches 221 221
========================================
Hits 911 911
Misses 166 166 ☔ View full report in Codecov by Sentry. |
const task = await iexecPoco.viewTask(taskId); | ||
await time.setNextBlockTimestamp(task.revealDeadline); |
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.
const task = await iexecPoco.viewTask(taskId); | |
await time.setNextBlockTimestamp(task.revealDeadline); | |
const task = await iexecPoco.viewTask(taskId); | |
expect(task.status).to.equal(TaskStatusEnum.REVEALING); | |
expect(task.revealCounter).to.equal(1); | |
// caller is scheduler, task status is revealing, before final deadline, | |
// reveal counter is reached | |
// but resultsCallback is bad |
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.
Done here
const { resultsCallback } = buildResultCallbackAndDigest(567); | ||
await expect( | ||
iexecPocoAsScheduler.finalize(taskId, results, resultsCallback), | ||
).to.be.revertedWithoutReason(); |
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.
).to.be.revertedWithoutReason(); | |
).to.be.revertedWithoutReason(); // require#4 (part 2) |
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.
Done here
).to.be.revertedWithoutReason(); | ||
}); | ||
|
||
it('Should finalize task when result callback is invalid', async () => { |
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.
Why do you say result callback is invalid?
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.
Here the invalid callback is because callback: appAddress,
and should have been callback: oracleConsumerInstance.address,
It's to mimic the test incallback.js
=> describe('invalid callback', async () => {
https://github.com/iExecBlockchainComputing/PoCo/blob/feature/migrate-erc1154-UT/test/ERC1154/callback.js.skip#L501
.to.not.emit(oracleConsumerInstance, 'GotResult'); | ||
}); | ||
|
||
it('Should finalize task when callback is EOA', async () => { |
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 would move this closer to "should tests" maybe below "Should finalize task of deal payed by requester (no callback, no dataset)" (?)
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.
Updated here
.reveal(taskId, callbackResultDigest) | ||
.then((tx) => tx.wait()); | ||
const task = await iexecPoco.viewTask(taskId); | ||
await time.setNextBlockTimestamp(task.revealDeadline); |
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.
Why do you fly to reveal deadline?
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.
removed here
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.
Thank you :)
Co-authored-by: Jérémy James Toussaint <33313130+jeremyjams@users.noreply.github.com>
assets: ordersAssets, | ||
requester: requester.address, | ||
prices: ordersPrices, | ||
callback: appAddress, // Non-EIP1154 contract |
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.
Maybe use another random address to avoid confusion.
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.
here the appAddress was to meant to have a smart contract address and not a EOA without code in it
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.
How about that
PoCo/test/byContract/IexecPoco/IexecPoco1.test.ts
Lines 121 to 124 in 4821374
randomContract = await new OwnableMock__factory() | |
.connect(anyone) | |
.deploy() | |
.then((contract) => contract.deployed()); |
Or at least add a comment to explain than it's a random contract.
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.
✔️
No description provided.