Skip to content

Commit

Permalink
Merge pull request #228 from Cyfrin/dev
Browse files Browse the repository at this point in the history
dev --> main
  • Loading branch information
solhosty authored Oct 3, 2024
2 parents cc853fe + 4bcc2f5 commit fe1f157
Show file tree
Hide file tree
Showing 235 changed files with 2,728 additions and 718 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ verify:

</details>

---

Now, by running `make anvil` (open a new terminal once your chain has started!) followed by `make deploy`...

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ Can you write the rest of the tests? Please include tests for:

</details>

---

> **NOTE**
> Your specific response will differ from mine, I encourage you to try using an AI tool like ChatGPT to generate a few tests of your own. I've included my AI response below, generated by GPT4o May 31, 2024.
Expand Down Expand Up @@ -360,7 +359,6 @@ contract OurTokenTest is StdCheats, Test {

</details>

---

I'll caution you against blindly copying and pasting AI responses and to use what's generated intelligently. Some things will make more sense for your situation that others.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ contract MoodNFTTest is Test {

</details>

---

With these adjustments, our tests should function identically to before.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ We can see this in Etherscan for any contract we've deployed. Here's an [**examp

</details>

---

The above may look like random numbers and letters to us, but to the `Ethereum Virtual Machine (EVM)`, this is effectively the alphabet it uses to perform computation. Every 2 bytes in the data above actually represents an op code. The website [**evm.codes**](https://www.evm.codes/) is an amazing resource for referencing these things.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ Originally we were referring to the human-readable ABI.

</details>

---

We can also accomplish our goals with the `bytecode` version directly. All you _really_ need to send a function call is the name of a function and the input types.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ contract CallAnything {

</details>

---

One last thing I want to point out is that we're not limited to this kind of interaction. Through this low-level calling method, two contracts are able to interact without possessing all the information associated with eachother. Consider this second contract `CallFunctionWithoutContract`.

Expand Down Expand Up @@ -291,7 +290,6 @@ contract CallFunctionWithoutContract {

</details>

---

By passing this contract the address of our `CallAnything.sol` deployment. We're able to use the functions it possesses to interact with `CallAnything.sol`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ flipMoodNft:

</details>

---

Assuming our `.env` is ready to go, we should be able to run the following...

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ contract MockV3Aggregator {

</details>

---

Once mocks are deployed, we can configure the anvilNetworkConfig with those deployed addresses, and return this struct.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ contract DSCEngine is ReentrancyGuard {

</details>

---

Welcome back! I'm excited to keep going. So far our DSCEngine.sol has quite a bit of functionality already. We've the ability to mint DSC, we can deposit collateral, check account information and more.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ contract DSCEngine is ReentrancyGuard {

</details>

---

### redeemCollateral

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,6 @@ contract DSCEngine is ReentrancyGuard {

</details>

---

### Liquidation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,6 @@ contract DSCEngine is ReentrancyGuard {

</details>

---

### Liquidation/Refactoring

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ function getHealthFactor(address user) external view returns (uint256) {

</details>

---

If you managed to improve your coverage, even if not to this extent, you should be proud of getting this far. This code base is hard to write tests for and a lot of it comes with experience, practice and familiarity.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ contract InvariantsTest is StdInvariant Test {

</details>

---

We can see this fails for the expected reasons below.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ Once more with feeling.

</details>

---

### Wrap Up

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -509,4 +509,3 @@ contract DSCEngine is ReentrancyGuard {

</details>

---
Original file line number Diff line number Diff line change
Expand Up @@ -491,4 +491,3 @@ contract DSCEngine is ReentrancyGuard {

</details>

---
Original file line number Diff line number Diff line change
Expand Up @@ -358,4 +358,3 @@ contract DSCEngine is ReentrancyGuard {

</details>

---
Original file line number Diff line number Diff line change
Expand Up @@ -291,4 +291,3 @@ contract DSCEngine is ReentrancyGuard {

</details>

---
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ In step 2 we will call the `getUserOpHash` on the `entryPoint` and pass in `user

</details>

---

Now that we have this imported, we need to be sure to add the following line to in our contract, just above the `run` function.

Expand Down Expand Up @@ -403,7 +402,6 @@ Just for the purpose of testing or working on a local chain, we are going to hav

</details>

---

<summary>2. Why is `using MessageHashUtils for bytes32` necessary? What does it do?</summary>

Expand All @@ -417,7 +415,6 @@ It allows the function to call `toEthSignedMessageHash` directly on a bytes32 va

</details>

---

<summary>3. What is the purpose of the generateSignedUserOperation function in the SendPackedUserOp script?</summary>

Expand All @@ -431,7 +428,6 @@ It generates a signed `PackedUserOperation` by creating an unsigned user operati

</details>

---

<summary>4. What is included in the `userOpHash` to prevent cross-chain replay attacks?</summary>

Expand All @@ -445,4 +441,3 @@ It generates a signed `PackedUserOperation` by creating an unsigned user operati

</details>

---
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ Now we know that we are getting the correct signatures and that our validation i

<summary>1. What is the main objective of the testValidationOfUserOps?</summary>

---
<details>

**<summary><span style="color:red">Click for Answers</span></summary>**
Expand All @@ -91,10 +90,8 @@ Now we know that we are getting the correct signatures and that our validation i
</details>

---
<summary>2. Why do we set missingAccountFunds to 1e18?</summary>

---
<details>

**<summary><span style="color:red">Click for Answers</span></summary>**
Expand All @@ -103,10 +100,8 @@ Now we know that we are getting the correct signatures and that our validation i

</details>

---
<summary>3. What does the assertEq(validationData, 0) statement check for?</summary>

---
<details>

**<summary><span style="color:red">Click for Answers</span></summary>**
Expand All @@ -115,5 +110,4 @@ Now we know that we are getting the correct signatures and that our validation i

</details>

---

Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ Before we move on, take a look at the review questions. Move on to the next less

</details>

---

<summary>2. What modification was made to the vm.getNonce function in the generateSignedUserOperation function?</summary>

Expand All @@ -168,4 +167,3 @@ It was modified to subtract 1 from the nonce value. This change ensures that the

</details>

---
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ Now we have our **ZK Minimal Account** set up. Things are starting to get exciti

</details>

---

<summary>2. How are EOAs different in zkSync compared to Ethereum?</summary>

Expand All @@ -135,7 +134,6 @@ In zkSync, EOAs are smart contracts.

</details>

---

<summary>3. What are the 4 functions of the IAccount interface?</summary>

Expand All @@ -152,4 +150,3 @@ In zkSync, EOAs are smart contracts.

</details>

---
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ struct Transaction {

</details>

---

When we send an Account Abstraction transaction through zkSync, the `Transaction` struct will essentially be populated. This will be our focus for now. The following parameters we won't worry about, for now. But here is the gist of what they do.

Expand Down Expand Up @@ -164,7 +163,6 @@ This lesson gave us a gist of what our IAccount interface will do. Take a moment

</details>

---

<summary>2. What is the role of the executeTransactionFromOutside function?</summary>

Expand All @@ -178,7 +176,6 @@ This lesson gave us a gist of what our IAccount interface will do. Take a moment

</details>

---

<summary>3. When is the prepareForPaymaster function called?</summary>

Expand All @@ -192,4 +189,3 @@ This lesson gave us a gist of what our IAccount interface will do. Take a moment

</details>

---
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ As always, Let's do some review. Move on to the next lesson when you are ready.
---
<summary>1. What are the two phases of sending an account abstraction transaction in zkSync?</summary>

---
<details>

**<summary><span style="color:red">Click for Answers</span></summary>**
Expand All @@ -79,11 +78,9 @@ As always, Let's do some review. Move on to the next lesson when you are ready.

</details>

---

<summary>2. What is the role of the ContractDeployer system contract in zkSync?</summary>

---
<details>

**<summary><span style="color:red">Click for Answers</span></summary>**
Expand All @@ -95,11 +92,9 @@ As always, Let's do some review. Move on to the next lesson when you are ready.

</details>

---

<summary>3. How does deploying a smart contract on zkSync differ from deploying on Ethereum?</summary>

---
<details>

**<summary><span style="color:red">Click for Answers</span></summary>**
Expand All @@ -108,7 +103,6 @@ As always, Let's do some review. Move on to the next lesson when you are ready.

</details>

---



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ This is essentially what will happen in our transaction lifecycle through the va

</details>

---

<summary>2. Who is the msg.sender when validateTransaction is called in zkSync?</summary>

Expand All @@ -112,7 +111,6 @@ This is essentially what will happen in our transaction lifecycle through the va

</details>

---

<summary>3. What happens if validateTransaction does not update the nonce?</summary>

Expand All @@ -126,7 +124,6 @@ This is essentially what will happen in our transaction lifecycle through the va

</details>

---

<summary>4. What is the role of the bootloader in zkSync?</summary>

Expand All @@ -140,4 +137,3 @@ This is essentially what will happen in our transaction lifecycle through the va

</details>

---
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ It makes a system call to the NonceHolder contract to conditionally increment th

</details>

---

<summary>2. Which function in NonceHolder.sol is called to increment the nonce?</summary>

Expand All @@ -258,7 +257,6 @@ It makes a system call to the NonceHolder contract to conditionally increment th

</details>

---

<summary>3. What library did we import to help with system contract calls?</summary>

Expand All @@ -272,4 +270,3 @@ It makes a system call to the NonceHolder contract to conditionally increment th

</details>

---
Loading

0 comments on commit fe1f157

Please sign in to comment.