-
Notifications
You must be signed in to change notification settings - Fork 223
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
test(e2e): sendAnywhere contract #9898
Conversation
Deploying agoric-sdk with
|
Latest commit: |
c3c11be
|
Status: | ✅ Deploy successful! |
Preview URL: | https://f162d01e.agoric-sdk.pages.dev |
Branch Preview URL: | https://pc-send-anywhere-e2e.agoric-sdk.pages.dev |
6c311db
to
e3fbbd8
Compare
- allows us to use brands from vstroage.query(published.agoricNames.brand) with walletDriver (provisionSmartWallet)
e3fbbd8
to
71a2a94
Compare
Logs from local runs, ci logs can be found here: https://github.com/Agoric/agoric-sdk/actions/runs/10393409141/job/28780860582?pr=9898#step:12:1889 first run (unsuccessful) - Error: 0uist is smaller than 10uist: insufficient funds
second run (successful)
|
801d00e
to
b07211b
Compare
const makeRandomValue = (min: number, max: number) => | ||
BigInt(Math.floor(Math.random() * (max - min + 1)) + min); | ||
// send 3 offers from each account | ||
const scenarios = [ | ||
makeRandomValue(1, 33), | ||
makeRandomValue(34, 66), | ||
makeRandomValue(67, 100), | ||
]; | ||
console.log('Scenarios', scenarios); |
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 was to force different amounts to surface something like:
Error: 98uist is smaller than 100uist: insufficient funds'
as mentioned #9901 (comment)
It may no longer make sense to keep around if it reads confusingly
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 didn't think much of it but someone might. Consider a comment about how the change in values prevents mistaking one result for another
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.
Behavior looks right to me. Please consider the code legibility suggestions.
const chains = ['osmosis', 'cosmoshub']; | ||
const scenarios = Array(2) | ||
.fill(undefined) | ||
.flatMap((_, i) => chains.map(c => [c, i])) as [string, number][]; | ||
const accounts = scenarios.map(args => args.join('')); |
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 took me some minutes to make sense of this (the logic and where the values are used). Consider:
const chains = ['osmosis', 'cosmoshub']; | |
const scenarios = Array(2) | |
.fill(undefined) | |
.flatMap((_, i) => chains.map(c => [c, i])) as [string, number][]; | |
const accounts = scenarios.map(args => args.join('')); | |
const accounts = ['osmosis', 'cosmoshub'].map((name, i) => `${name}${i}`); |
And rather than data-driving with scenarios
, just explicitly call each one.
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.
We're testing with 4 accounts, so I explicitly wrote them out. (the above would just return 2). Acknowledge the readability feedback and implemented your suggestions 🙏
for (const [chainName, accountIdx] of scenarios) { | ||
test.serial(sendAnywhereScenario, chainName, accountIdx); | ||
} |
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 is more flexible but since it's a test sometimes it's better to be explicit:
for (const [chainName, accountIdx] of scenarios) { | |
test.serial(sendAnywhereScenario, chainName, accountIdx); | |
} | |
test.serial(sendAnywhereScenario, 'osmosis', 1); | |
test.serial(sendAnywhereScenario, 'cosmoshub', 2); |
Though I'd also suggest dropping the index number and having a lookup for the test account for each named chain.
const makeRandomValue = (min: number, max: number) => | ||
BigInt(Math.floor(Math.random() * (max - min + 1)) + min); | ||
// send 3 offers from each account | ||
const scenarios = [ |
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.
confusing that this whole function executes one scenario, then within it there are three other "scenarios"
maybe "offerAmounts"?
proposal: { give: { Send: amount } }, | ||
}); | ||
|
||
// TODO confirm offerResult = undefined |
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.
in this PR ?
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
b07211b
to
7d4800c
Compare
until it works on top of new (upgrade-16)
refs: #9193
closes: #9901
Description
Adds an e2e test for
sendAnywhere.contract.js
, ensuringzoeTools.localTransfer()
andlocalOrchestrationAccount.transfer()
are working as expected.Fixes a bug in
zoeTools.transfer()
where a vow chain was broken (we usedPromise.all()
on an array of vows instead ofvowTools.allVows()
.Also satisfies this requirement in #9193:
Security Considerations
n/a
Scaling Considerations
n/a
Documentation Considerations
n/a
Testing Considerations
Includes tests for paths where bugs were discovered.
Upgrade Considerations
n/a