-
Notifications
You must be signed in to change notification settings - Fork 107
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
feat: allow test utils to use builds from outside the RPC repo root #543
feat: allow test utils to use builds from outside the RPC repo root #543
Conversation
2279d16
to
bc75858
Compare
bc75858
to
4efddee
Compare
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.
one remark
@@ -98,12 +98,29 @@ pub fn get_contract(filename: &str) -> CompactContractBytecode { | |||
let dot_sol = format!("{filename}.sol"); | |||
let dot_json = format!("{filename}.json"); | |||
|
|||
let foundry_default_out = load_config().out; |
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.
can we keep the load config and use your method if there is not config? It makes more sense imo to use to config if you find 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.
So, I think we should avoid this, because:
- we would then need more logic, i.e checking whether
FOUNDRY_OUTPUT_PATH
exists or not, there are scenarious where someone might have forget to provide this variable, but RPC will still take the builds from local builds, this can create confusion, as they might not be suspecting that they have forgot to provide this variable. { TLDR; I think it will make it more automagical which we don't seem to need as of now, this is used in just one place, if complexity increases, might we can do this. }
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's not completely clear to me what we're doing in this PR
Is this because we'll run this repo in the Kakarot v0 context, so it's nonsensical to expect Kakarot to point to Kakarot-RPC that points as submodule Kakarot?
Could you add more comments to explain what relative and absolute mean in your context of this PR / CI Epic and maybe with more concrete context or examples.
That way when we read it back in a month we understand
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #543 +/- ##
===========================================
+ Coverage 23.17% 72.47% +49.29%
===========================================
Files 9 44 +35
Lines 1247 4014 +2767
===========================================
+ Hits 289 2909 +2620
- Misses 958 1105 +147
☔ View full report in Codecov by Sentry. |
@Eikix so, the scenarios is:
One option is to put builds inside Kakarot RPC, but when you do that, then you realize it is better to make this logic more generic on Kakarot RPC itself! Does this helps in understanding the use case? Concrete example
Since the RPC will look for this folder relative to its root, the solution the only solution that can work as of now is to move ~/kakarot/build to ~/kakarot-rpc, this should not be the behaviour. Also, since as of now to load solidity contracts, we use the This PR is keeping all that used to work before this alongwith also adding the functionality of making this more generic. |
I think this might be overkill and cause more complexity in the already tangled up deploy helpers. Could we maybe untangle the deploy helpers a bit and check if there isn't a cleaner way to do this? We can make a code smell issue to clean the config loading. I see for example a As discussed with @ClementWalter we might want to pause rolling out anything new a little and work on cleaning knots/smells. I think having ef-tests in Kakarot CI is important but this might be a little rushed. Just my opinion. |
@greged93 I agree with you here, but I was thinking might be we can for now proceed with this as ef-tests on Kakarot CI are important and this is doesn't change much in terms of DX we already have. We can later fix this as a code smell issue, and once that is done we can make a small change to the CI file as well! Lemme know what you think, if you still think we should do a different refactor first, then I am fine with that as well. |
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.
some comments about clarity of the two different cases
`./scripts/make_with_env.sh test`", | ||
); | ||
|
||
// We search firstly for existence for absolute path |
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 comment isn't so clear, absolute path for what, could we provide an example of path, and in which case it's used?
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.
Ah, so by comments you mean comments on the code, lemme make this better!
`./scripts/make_with_env.sh test`", | ||
); | ||
|
||
// We search firstly for existence for absolute path |
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.
same remark as above
if compiled_kakarot_path_absolute.try_exists().unwrap() { | ||
compiled_kakarot_path_absolute | ||
} else { | ||
// If the absolute path is not found, then we search for a path relative to the project root |
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.
same remark
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, lemme know if this works.
if foundry_output_path_absolute.try_exists().unwrap() { | ||
foundry_output_path_absolute | ||
} else { | ||
// If the absolute path is not found, then we search for a path relative to the project root |
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.
same remark
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, lemme know if this works.
@bajpai244 I agree that they are important but we didn't have them for 8 months, I would rather delayed them for 10 more days and integrate them nicely then increase the knots in the deploy helper. |
Looking at the big picture, I'd ask for us to at least sit down for a second and look at the Kakarot cairo0 repo, and think how can we make the CI run smoothly:
This requires a smooth dump management as you pointed out Harsh and maybe some refactors to be able to more freely handle build paths etc. But i'd argue we need to think in terms of architecture first |
@@ -24,6 +24,7 @@ PROXY_ACCOUNT_CLASS_HASH=0xba8f3f34eb92f56498fdf14ecac1f19d507dcc6859fa6d85eb854 | |||
|
|||
## configurations for testing | |||
COMPILED_KAKAROT_PATH=lib/kakarot/build | |||
FOUNDRY_OUTPUT_PATH=./lib/kakarot/tests/integration/solidity_contracts/build |
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.
do we need ./
or not? see it's not put for COMPILED_KAKAROT_PATH
; when adding similar context into a file, make sure that you stay consistent
@@ -423,14 +443,31 @@ pub fn compute_kakarot_contracts_class_hash() -> Vec<(String, FieldElement)> { | |||
.collect() | |||
} | |||
|
|||
fn compiled_kakarot_path() -> PathBuf { |
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.
so this is kakarot build dir right? when the path is a directory, it's more explicit to use directory
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 the beginning I thought it was the full path like kakarot/build/kakarot.json
let paths = fs::read_dir(&compiled_kakarot_path) | ||
let compiled_kakarot_path = &compiled_kakarot_path(); | ||
|
||
let paths = fs::read_dir(compiled_kakarot_path) |
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.
so these paths
are build artifacts?
Should this be closed? |
@Eikix this can be closed, with the new refactors we are doing this PR shouldn't be much needed anymore. |
<!--- Please provide a general summary of your changes in the title above --> Adds transfer of value when executing `CALLCODE`. <!-- Give an estimate of the time you spent on this PR in terms of work days. Did you spend 0.5 days on this PR or rather 2 days? --> Time spent on this PR: 0.2 days ## Pull request type <!-- Please try to limit your pull request to one type, submit multiple pull requests if needed. --> Please check the type of change your PR introduces: - [ ] Bugfix - [x] Feature - [ ] Code style update (formatting, renaming) - [ ] Refactoring (no functional changes, no api changes) - [ ] Build related changes - [ ] Documentation content changes - [ ] Other (please describe): ## What is the current behavior? <!-- Please describe the current behavior that you are modifying, or link to a relevant issue. --> Executing `CALLCODE` does not transfer any value to the target `account`. Resolves kkrt-labs#543 ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - `CALLCODE` transfers `value` to `account`. - Additional unit testing for `CALLCODE` opcode value transfer.
Time spent on this PR:
Resolves: #542
Pull Request type
Please check the type of change your PR introduces:
What is the new behavior?
The current change will allow the RPC to consume builds outside from the project root of Kakarot RPC { as of now we need this to simplify CI flow for running ef-tests on kakarot main }, we still get all good DX features we used to have, the flow now is:
A new environment variable
FOUNDRY_OUTPUT_PATH
has been added so that we can point to solidity builds outside from this repo, this will add no extra complexity as of now, the default value here will work out of the box with the current flow until a change is needed.Does this introduce a breaking change?