Skip to content

Commit 2f9c95b

Browse files
authored
Merge branch 'main' into jade/ton-support-testcontainers-go
2 parents a5b7776 + 3db6234 commit 2f9c95b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+28226
-393
lines changed

.github/workflows/test.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
test:
16+
- path: framework
17+
vm: ubuntu-latest
18+
regex: TestStorageMutations
1619
- path: framework
1720
vm: ubuntu-latest
1821
regex: TestSmoke
@@ -78,6 +81,10 @@ jobs:
7881
restore-keys: |
7982
go-modules-${{ matrix.test.path }}-${{ runner.os }}-test
8083
go-modules-${{ matrix.test.path }}-${{ runner.os }}
84+
- name: Install Foundry
85+
uses: foundry-rs/foundry-toolchain@82dee4ba654bd2146511f85f0d013af94670c4de # v1.4.0
86+
with:
87+
version: stable
8188
- uses: extractions/setup-just@dd310ad5a97d8e7b41793f8ef055398d51ad4de6 # v2.0.0
8289
with:
8390
github-token: ${{ secrets.GITHUB_TOKEN }}

book/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
- [Performance]()
6363
- [Chaos](./framework/chaos/chaos.md)
6464
- [Fork Testing](./framework/fork.md)
65+
- [Fork Testing (Mutating Storage)](./framework/fork_storage.md)
6566
- [Libraries](./libraries.md)
6667
- [Seth](./libs/seth.md)
6768
- [WASP](./libs/wasp/overview.md)

book/src/framework/fork_storage.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Fork Testing (Mutating Storage)
2+
3+
We provide API to use `anvil_setStorageAt` more easily so in case you can't edit EVM smart contracts code you can still mutate your contract values.
4+
5+
You need to build your contract layout first
6+
```
7+
forge build || forge inspect Counter storageLayout --json > layout.json
8+
```
9+
10+
And then you can use `AnvilSetStorageAt` to override contract's storage data
11+
```
12+
r := rpc.New(rpcURL, nil)
13+
err = r.AnvilSetStorageAt([]interface{}{contractAddr, slot, data})
14+
```
15+
See [examples](https://github.com/smartcontractkit/chainlink-testing-framework/blob/main/framework/evm_storage/layout_api_test.go) of how you can use API to encode/mutate different values.
16+
17+
Keep in mind that values <32 bytes are packed together, see `encodeCustomStructFunc` example and `offset` example to understnad how to change them properly.
18+
19+
```
20+
cd framework/evm_storage
21+
./setup.sh
22+
go test -v -run TestLayoutAPI
23+
./teardown.sh
24+
```
25+
26+
Read more about Solidity storage layout [here](https://docs.soliditylang.org/en/latest/internals/layout_in_storage.html#)

devbox.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
77
"git@latest",
8-
"go@latest",
8+
"go@1.24.0",
99
"goreleaser@latest",
1010
"postgresql@15",
1111
"python@latest",

0 commit comments

Comments
 (0)