Closed Eikix closed 1 year ago
After a day of investigation, comment down here your findings and propose an architecture for integration tests.
shared findings below with monsier Kariy of dojo and they gracefully provided me this branch to experiment w/ https://github.com/dojoengine/dojo/tree/custom-steps
was able to deploy with a couple of changes, will share below for those interested and create a notion doc
Ok, here's my proposal:
I can start using this katana branch: https://github.com/dojoengine/dojo/compare/main...custom-steps.
We will pass an Environment
object with the necessary steps we need (2**18, per python -> 16777216) to the TestSequencer
https://github.com/dojoengine/dojo/blob/4e87bcb4437961537596debfcc49df134ef8ad5a/crates/katana/core/src/starknet/config.rs#L56, like so: https://github.com/dojoengine/dojo/blob/4e87bcb4437961537596debfcc49df134ef8ad5a/crates/katana/rpc/tests/starknet.rs#L23
I did an exploration today and have found it capable of deploying and interacting with kakaswap
.
First PR would probably be more calls on the opcodes contract and erc20 https://github.com/kkrt-labs/kakarot/blob/main/tests/integration/solidity_contracts/Solmate/test_erc20.py
Sensible?
Very sensible! I like it a lot.
I see you've been assigned to https://github.com/kkrt-labs/kakarot/issues/617, do you want to pause this issue and work on the integration tests?
In any case, this is a great idea, really. I guess the flow of a first PR could be:
Then in a subsequent PR -> same flow, but try to deploy a smart contract and call it?
yeah, the exploration here is to try to also use forge scripting to do the deploying/interacting from within a TestSequencer test. this configuration gives us
that issue that you mentioned is blocked a bit until i get more info about the error state that the issue is reporting. lmk if you feel differently and see another way forward with it 👂
I think that rn we want to focus only on tests using forge and drop ethers-rs because it's higher level (a regular devstack will probably have either forge or hardhat, but not ethers-rs)
Once we're ok with the foundry stack (probably not tomorrow indeed), then we'll add the hardhat one.
I see that we already defined a foundry deps in crates/core/Cargo.toml
, so I guess that we could invoke the forge script
programmatically as well, in a test using the TestSequencer as you suggest.
TL;DR for me is:
These tests will be run to make sure that we are compatible with the tooling, not to make sure that the EVM behaves correctly: the tests in Kakarot EVM insure that the EVM is sound, the tests in Kakarot RPC insure that we manage to communicate with the Kakarot EVM with the standard EVM tooling
tldr:
counter.inc()
in the PlainOpcodes.s.sol, I am getting a revert error. Here is an example that shows that this should be possible: https://book.getfoundry.sh/cheatcodes/start-broadcast(possible) next steps:
Open for feedback 👂
Thank you for submitting a detailed recollection of your findings! It really helps. My intuition is that even if we have hive tests (end-to-end tests) and ethereum/tests, It has some value to have eth-rpc tests that utilize test-sequencer, in order to have more granularity in tests,
Maybe this can wait a little for when we have more bandwidth
What is the status of this issue? I believe @ftupas already addressed this? Can close?
Feature Request
Describe the Feature Request
Currently, checking that we're moving towards our common goal -> working rpc for ethcc requires lots of manipulations.
It'd be easier to use a eth sdk plugged onto eth-rpc
Describe Preferred Solution
Investigate during one day a clean architecture to create integration tests for eth-rpc that can: