diff --git a/public/content/developers/tutorials/all-you-can-cache/index.md b/public/content/developers/tutorials/all-you-can-cache/index.md index a6218cfcf24..ae557c7aeb8 100644 --- a/public/content/developers/tutorials/all-you-can-cache/index.md +++ b/public/content/developers/tutorials/all-you-can-cache/index.md @@ -12,7 +12,7 @@ When using rollups the cost of a byte in the transaction is a lot more expensive In this article you learn how to create and use a caching contract in such a way that any parameter value that is likely to be used multiple times will be cached and available for use (after the first time) with a much smaller number of bytes, and how to write offchain code that uses this cache. -If you want to skip the article and just see the source code, [it is here](https://github.com/qbzzt/20220915-all-you-can-cache). The development stack is [Foundry](https://book.getfoundry.sh/getting-started/installation). +If you want to skip the article and just see the source code, [it is here](https://github.com/qbzzt/20220915-all-you-can-cache). The development stack is [Foundry](https://getfoundry.sh/introduction/installation/). ## Overall design {#overall-design} @@ -53,7 +53,7 @@ These constants are used to interpret the special cases where we provide all the mapping(uint => uint) public val2key; ``` -A [mapping](https://www.geeksforgeeks.org/solidity-mappings/) between the values and their keys. This information is necessary to encode values before you send out the transaction. +A [mapping](https://www.geeksforgeeks.org/solidity/solidity-mappings/) between the values and their keys. This information is necessary to encode values before you send out the transaction. ```solidity // Location n has the value for key n+1, because we need to preserve @@ -305,7 +305,7 @@ If we get here it means we got a key that's not less than 16\*25615. ### Testing the cache {#testing-the-cache} -One of the advantages of Foundry is that [it lets you write tests in Solidity](https://book.getfoundry.sh/forge/tests), which makes it easier to write unit tests. The tests for the `Cache` class are [here](https://github.com/qbzzt/20220915-all-you-can-cache/blob/main/test/Cache.t.sol). Because the testing code is repetitive, as tests tend to be, this article only explains the interesting parts. +One of the advantages of Foundry is that [it lets you write tests in Solidity](https://getfoundry.sh/forge/tests/overview/), which makes it easier to write unit tests. The tests for the `Cache` class are [here](https://github.com/qbzzt/20220915-all-you-can-cache/blob/main/test/Cache.t.sol). Because the testing code is repetitive, as tests tend to be, this article only explains the interesting parts. ```solidity // SPDX-License-Identifier: UNLICENSED @@ -352,7 +352,7 @@ Tests are functions whose names start with `test`. This function checks the basi assertEq(cache.cacheRead(i), i*i); ``` -This is how you do the actual testing, using [`assert...` functions](https://book.getfoundry.sh/reference/forge-std/std-assertions). In this case, we check that the value we wrote is the one we read. We can discard the result of `cache.cacheWrite` because we know that cache keys are assigned linearly. +This is how you do the actual testing, using [`assert...` functions](https://getfoundry.sh/reference/forge-std/std-assertions/). In this case, we check that the value we wrote is the one we read. We can discard the result of `cache.cacheWrite` because we know that cache keys are assigned linearly. ```solidity } @@ -753,7 +753,7 @@ Since we use the low level `
.call()` function, we can't use `vm.expectR (_success,) = address(worm).call(_callInput); ``` -This is the way we verify that code [emits an event correctly](https://book.getfoundry.sh/cheatcodes/expect-emit) in Foundry. +This is the way we verify that code [emits an event correctly](https://getfoundry.sh/reference/cheatcodes/expect-emit/) in Foundry. ### The client {#the-client} One thing you don't get with Solidity tests is JavaScript code you can cut and paste into your own application. To write that code I deployed WORM to [Optimism Goerli](https://community.optimism.io/docs/useful-tools/networks/#optimism-goerli), [Optimism's](https://www.optimism.io/) new testnet. It is at address [`0xd34335b1d818cee54e3323d3246bd31d94e6a78a`](https://goerli-optimism.etherscan.io/address/0xd34335b1d818cee54e3323d3246bd31d94e6a78a).