-
Notifications
You must be signed in to change notification settings - Fork 295
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
chore: make canary uniswap test similar to e2e #2767
Conversation
a43c633
to
d4fd732
Compare
const wethL1BeforeBalance = await wethContract.read.balanceOf([ownerEthAddress.toString()]); | ||
// 1. Approve weth to be bridged | ||
await wethContract.write.approve([wethTokenPortalAddress.toString(), wethAmountToBridge], {} as any); | ||
it('should uniswap trade on L1 from L2 funds privately (swaps WETH -> DAI)', 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.
everything from this line onwards is an exact copy-paste of end-to-end/uniswap_trade_on_l1_from_l2.test.ts
!
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.
Similar to my comment later. There should be a way such that we can simply rerun the same ones instead of needing to copy them around like this.
yarn-project/canary/src/utils.ts
Outdated
* shared between cross chain tests. | ||
*/ | ||
export class CrossChainTestHarness { | ||
static async new( |
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.
had to modify the CrossChainTestHarness.new()
a bit to make it workable on sandbox. Otherwise it is mostly a copy paste!
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.
Cannot we alter the CrossChainTestHarness
such that the same can be used both places without having these two that are almost just copied.
The cheatcodes
are not used for example, there is probably other stuff that could also be purged such that it can be used both places.
d4fd732
to
5f00639
Compare
createDebugLogger, | ||
createPXEClient, | ||
getL1ContractAddresses, | ||
sleep as delay, |
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?
const wethAmountToBridge = parseEther('1'); | ||
const uniswapFeeTier = 3000n; | ||
const minimumOutputAmount = 0n; | ||
const deadlineForDepositingSwappedDai = BigInt(2 ** 32 - 1); // max uint32 - 1 |
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 is just max uint32
not - 1
, recall that max uint32 = 2**32 -1
.
yarn-project/canary/src/utils.ts
Outdated
* shared between cross chain tests. | ||
*/ | ||
export class CrossChainTestHarness { | ||
static async new( |
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.
Cannot we alter the CrossChainTestHarness
such that the same can be used both places without having these two that are almost just copied.
The cheatcodes
are not used for example, there is probably other stuff that could also be purged such that it can be used both places.
const wethL1BeforeBalance = await wethContract.read.balanceOf([ownerEthAddress.toString()]); | ||
// 1. Approve weth to be bridged | ||
await wethContract.write.approve([wethTokenPortalAddress.toString(), wethAmountToBridge], {} as any); | ||
it('should uniswap trade on L1 from L2 funds privately (swaps WETH -> DAI)', 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.
Similar to my comment later. There should be a way such that we can simply rerun the same ones instead of needing to copy them around like this.
0cd6197
to
4af81f3
Compare
b90038c
to
e4a649d
Compare
New dependencies detected. Learn more about Socket for GitHub ↗︎
|
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.
Minor nits. Really nice stuff 👍
logger('DAI balance after swap : ' + daiL2BalanceAfterSwap.toString()); | ||
}, 140_000); | ||
}); | ||
uniswapL1L2TestSuite(setupRPC, () => Promise.resolve(), EXPECTED_FORKED_BLOCK); |
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.
👑💩
@@ -356,11 +322,4 @@ export class CrossChainTestHarness { | |||
const unshieldReceipt = await unshieldTx.wait(); | |||
expect(unshieldReceipt.status).toBe(TxStatus.MINED); | |||
} | |||
|
|||
async stop() { |
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.
Should you not still keep the stop, just without the aztecNode now?
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 teardown()
from e2e setup is enough! teardown()
has access to the node and kills it
@@ -71,7 +72,7 @@ export function getConfigEnvVars(): ArchiverConfig { | |||
rollupAddress: ROLLUP_CONTRACT_ADDRESS ? EthAddress.fromString(ROLLUP_CONTRACT_ADDRESS) : EthAddress.ZERO, | |||
registryAddress: REGISTRY_CONTRACT_ADDRESS ? EthAddress.fromString(REGISTRY_CONTRACT_ADDRESS) : EthAddress.ZERO, | |||
inboxAddress: INBOX_CONTRACT_ADDRESS ? EthAddress.fromString(INBOX_CONTRACT_ADDRESS) : EthAddress.ZERO, | |||
outboxAddress: EthAddress.ZERO, | |||
outboxAddress: OUTBOX_CONTRACT_ADDRESS ? EthAddress.fromString(OUTBOX_CONTRACT_ADDRESS) : EthAddress.ZERO, |
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.
Good spot
@@ -26,9 +26,9 @@ export class CrossChainTestHarness { | |||
const ethAccount = EthAddress.fromString((await walletClient.getAddresses())[0]); | |||
const owner = wallet.getCompleteAddress(); | |||
const l1ContractAddresses = (await pxeService.getNodeInfo()).l1ContractAddresses; | |||
|
|||
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.
Prettier?
d7e06bf
to
72a3e52
Compare
Benchmark resultsAll benchmarks are run on txs on the L2 block published to L1Each column represents the number of txs on an L2 block published to L1.
L2 chain processingEach column represents the number of blocks on the L2 chain where each block has 16 txs.
Circuits statsStats on running time and I/O sizes collected for every circuit run across all benchmarks.
|
added the cross-chain test harness in Canary as well, so that e2e tests and Canary tests look the same. This has some advantages:
#include_code
with minimal copy-paste. Without the canary version of the cross-chain test harness, I would have to hardcode a lot in the docs. This makes it easily maintainable.