Skip to content
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

Alex/cheatcodes initial #523

Merged
merged 5 commits into from
Sep 28, 2023
Merged

Conversation

Alexangelj
Copy link
Contributor

Give an overview of the tasks completed
Closes #485 by creating the "Cheatcode" item of the Instruction enum and a "Cheatcodes" enum with the implemented cheatcodes. Adds a method apply_cheatcode to the client to send cheatcode instructions to the enviroment, very straightforward stuff!

Link to issue(s) that this PR closes
#485

Changes

  • Removes Instruction::Deal
  • Removes Outcome::DealCompleted
  • Removes Middleware::deal()
  • Adds Instruction::Cheatcode
  • Adds Cheatcodes enum
  • Adds Middleware::apply_cheatcode()
  • Implements the Store, Load, and Deal cheatcodes in the environment instruction processing switch
  • Adds a test for the store and load cheatcodes
  • Edits the deal tests to use the new apply_cheatcode method

@codecov
Copy link

codecov bot commented Sep 26, 2023

Codecov Report

❗ No coverage uploaded for pull request base (feat(arbiter-core)/v0.6.0@b16b6ef). Click here to learn what that means.
The diff coverage is n/a.

❗ Current head bba2029 differs from pull request most recent head ca20f32. Consider uploading reports for the commit ca20f32 to get more accurate results

@@                     Coverage Diff                      @@
##             feat(arbiter-core)/v0.6.0     #523   +/-   ##
============================================================
  Coverage                             ?   59.00%           
============================================================
  Files                                ?       11           
  Lines                                ?     3827           
  Branches                             ?        0           
============================================================
  Hits                                 ?     2258           
  Misses                               ?     1569           
  Partials                             ?        0           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@Alexangelj
Copy link
Contributor Author

It's not quite ready - Load cheatcode doesn't work because apply_cheatcode method does not return a value, which some cheatcodes might. Will need to think about how to handle this, since the return values could be non-existent or a certain type.

@kinrezC kinrezC changed the base branch from main to feat(arbiter-core)/v0.6.0 September 26, 2023 18:03
@0xJepsen
Copy link
Collaborator

0xJepsen commented Sep 27, 2023

It's not quite ready - Load cheatcode doesn't work because apply_cheatcode method does not return a value, which some cheatcodes might. Will need to think about how to handle this, since the return values could be non-existent or a certain type.

Could we have the apply_cheatcode return an option? Or does it need to have it's signature changed at all since it sends result to the outcomesender?

Copy link
Collaborator

@0xJepsen 0xJepsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Asked some questions

@Alexangelj
Copy link
Contributor Author

It's not quite ready - Load cheatcode doesn't work because apply_cheatcode method does not return a value, which some cheatcodes might. Will need to think about how to handle this, since the return values could be non-existent or a certain type.

Could we have the apply_cheatcode return an option? Or does it need to have it's signature changed at all since it sends result to the outcomesender?

Yeah I'm leaning towards not changing the signature and just using the outcome sender stuff to get the result - but trying to do that and running into some errors, so fixing that

@Alexangelj
Copy link
Contributor Author

Alexangelj commented Sep 27, 2023

Figured out the bug - since we are "catching" the results of applying a cheatcode, if we fail to catch one of the apply's we might get the return value of a different cheatcode, e.g.:

cheatcode::store -> dont catch
cheatcode::load -> catch

we catch the store result here, not the load result

edit: it's not the best developer experience to remind everyone they need to catch all the results

@0xJepsen
Copy link
Collaborator

if we fail to catch one of the apply's we might get the return value of a different cheatcode, e.g.:

Figured out the bug - since we are "catching" the results of applying a cheatcode, if we fail to catch one of the apply's we might get the return value of a different cheatcode, e.g.:

cheatcode::store -> dont catch cheatcode::load -> catch

we catch the store result here, not the load result

edit: it's not the best developer experience to remind everyone they need to catch all the results

Jus to clarify, are you saying that it's not a great devex to propagate the errors back with results? What do you mean by catch

@Alexangelj
Copy link
Contributor Author

if we fail to catch one of the apply's we might get the return value of a different cheatcode, e.g.:

Figured out the bug - since we are "catching" the results of applying a cheatcode, if we fail to catch one of the apply's we might get the return value of a different cheatcode, e.g.:
cheatcode::store -> dont catch cheatcode::load -> catch
we catch the store result here, not the load result
edit: it's not the best developer experience to remind everyone they need to catch all the results

Jus to clarify, are you saying that it's not a great devex to propagate the errors back with results? What do you mean by catch

Yeah I mean if you don't catch it, and you try to catch something else later, you might catch the result you didnt catch earlier in the outcome sender recv

@Alexangelj
Copy link
Contributor Author

I fixed it with my latest commit - for some reason the submodules also got pushed?

@Autoparallel
Copy link
Collaborator

I will review this once the merge conflicts are resolved if that is all that's left

@0xJepsen
Copy link
Collaborator

I fixed it with my latest commit - for some reason the submodules also got pushed?

Oh man yeah this is a pain, i think @kinrezC has a nice trick to remove them recursively so they don't get pushed? After that, and the merge conflicts it should be good to go

@Alexangelj Alexangelj force-pushed the alex/cheatcodes-initial branch from f8598a4 to 6b32c03 Compare September 27, 2023 17:01
@Alexangelj
Copy link
Contributor Author

Alright, good to review + merge!

Copy link
Collaborator

@0xJepsen 0xJepsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only thing i have a problem with is the gitsubmodules, can we get those removed?

@Alexangelj
Copy link
Contributor Author

Only thing i have a problem with is the gitsubmodules, can we get those removed?

Removed!

@0xJepsen 0xJepsen self-requested a review September 28, 2023 14:29
Copy link
Collaborator

@0xJepsen 0xJepsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! Are we still merging into this feature branch?

@kinrezC kinrezC merged commit bf013b2 into feat(arbiter-core)/v0.6.0 Sep 28, 2023
@Alexangelj Alexangelj deleted the alex/cheatcodes-initial branch September 28, 2023 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: use Foundry Environment based cheat codes
4 participants