Skip to content

Commit 60d9999

Browse files
authored
Merge pull request #16 from rainshowerLabs/0.4.0
0.4.0 release
2 parents 4ee2d0f + 2cffca0 commit 60d9999

File tree

13 files changed

+406
-180
lines changed

13 files changed

+406
-180
lines changed

Cargo.lock

Lines changed: 1 addition & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "sothis"
3-
version = "0.3.2"
3+
version = "0.4.0"
44
edition = "2021"
55
authors = ["makemake <vukasin@gostovic.me>"]
66
license = "GPL-3.0-or-later"
@@ -15,11 +15,8 @@ categories = ["command-line-utilities"]
1515
[dependencies]
1616
clap = "4.3.0"
1717
ctrlc = "3.4.0"
18-
env = "0.0.0"
1918
ethers = {version = "2.0.7", features = ["legacy"]}
20-
lazy_static = "1.4.0"
2119
reqwest = { version = "0.11.18", features = ["blocking", "json"] }
22-
rlp = "0.5.2"
2320
serde = { version = "1.0.163", features = ["derive"] }
2421
serde_json = "1.0.96"
2522
tokio = { version = "1.28.1", features = ["full"] }

README.md

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
Sothis is a tool for replaying historical state on a local ***anvil/hardhat*** testnet node.
66

7+
**For detailed instructions, read the [wiki.](https://github.com/rainshowerLabs/sothis/wiki)**
8+
79
## Support and discussion
810

911
Join the [Rainshower Labs discord server](https://discord.gg/Cs3h397gkz) to discuss sothis and get help.
@@ -18,12 +20,12 @@ Usage: sothis [OPTIONS] --source_rpc <source_rpc>...
1820
Options:
1921
-s, --source_rpc <source_rpc>...
2022
HTTP JSON-RPC of the node we're querying data from
21-
-b, --terminal_block <terminal_block>...
22-
Block we're replaying until
2323
-r, --replay_rpc <replay_rpc>...
2424
HTTP JSON-RPC of the node we're replaying data to
2525
-m, --mode <mode>...
26-
Choose between live, historic replay, or tracking [default: historic]
26+
Choose between live, historic, track, or fast_track [default: historic]
27+
-b, --terminal_block <terminal_block>...
28+
Block we're replaying until
2729
--exit_on_tx_fail [<exit_on_tx_fail>...]
2830
Exit the program if a transaction fails
2931
-t, --block_listen_time <block_listen_time>...
@@ -32,12 +34,16 @@ Options:
3234
Set the percentage of failed transactions to trigger a warning [default: 0.07]
3335
-d, --replay_delay <replay_delay>...
3436
Default delay for block replay in ms [default: 0]
35-
--send_as_raw [<send_as_raw>...]
37+
--send_as_unsigned [<send_as_unsigned>...]
3638
Exit the program if a transaction fails
39+
--no_setup [<no_setup>...]
40+
Start replaying immediately.
3741
-c, --contract_address <contract_address>...
3842
Address of the contract we're tracking storage.
3943
-l, --storage_slot <storage_slot>...
4044
Storage slot for the variable we're tracking
45+
-0, --origin_block <origin_block>...
46+
First block sothis will look at.
4147
-p, --path <path>...
4248
Path to file we're writing to [default: .]
4349
-f, --filename <filename>...
@@ -48,22 +54,20 @@ Options:
4854
Print version
4955
```
5056

51-
Sothis currently has 3 modes. Live, historic and track.
52-
53-
***IMPORTANT:*** Hardhat support is currently experimental. If you are using Hardhat, add the `--send_as_raw` argument.
57+
Sothis currently has 4 modes. Live, historic, track, and fast track.
5458

5559
### Historic
5660

5761
Historic mode is the default way to use sothis. Its used to replay state to a local node forked to a deep historical block.
5862

5963
#### Usage
6064

61-
- `-m historic`(optional): Used to denote we are replaying in live mode.
65+
- `-m historic`(optinal): Used to denote we are replaying in live mode.
6266
- `--source_rpc`: RPC of the node we are getting blocks from.
6367
- `--replay_rpc`: RPC of the node were sending blocks to.
6468
- `--terminal_block`: Final block sothis will replay.
6569

66-
To stop replaying, terminate the process via Ctrl+C or however else you prefer.
70+
To stop replaying, terminate the process via Ctrl+C or however else you preffer.
6771

6872
```
6973
sothis --source_rpc {ARCHIVE_NODE} --replay_rpc http://localhost:8545 -m historic --terminal_block 9000022
@@ -79,15 +83,15 @@ Live mode is designed to be used with a forked local node, with its tip near the
7983
- `--source_rpc`: RPC of the node we are getting blocks from.
8084
- `--replay_rpc`: RPC of the node were sending blocks to.
8185

82-
To stop replaying, terminate the process via Ctrl+C or however else you prefer.
86+
To stop replaying, terminate the process via Ctrl+C or however else you preffer.
8387

8488
```
8589
sothis --source_rpc {ARCHIVE_NODE} --replay_rpc http://localhost:8545 -m live
8690
```
8791

8892
### Track
8993

90-
The tracking mode is used to track the change in value of a storage slot for a contract. It can be used on a live production network, as well as in conjunction with sothis (keep in mind that you can use the `--block_listen_time`!) . If you are testing on a local network, you can launch another instance of sothis to track the change of a slot on a replay node.
94+
The tracking mode is used to track the change in value of a storage slot for a contract, that needs to be updated live. It can be used on a live production network, as well as in conjuntion with sothis (keep in mind that you can use the `--block_listen_time` so tracking doesn't lag behind!) . If you are testing on a local network, you can launch another instance of sothis to track the change of a slot on a replay node.
9195

9296
The result is saved to a JSON file that looks like this:
9397
```json
@@ -115,6 +119,26 @@ Once you are done tracking the slot, terminate the process via a `SIGTERM` or a
115119
`sothis --mode track --source_rpc http://localhost:8545 --contract_address 0x1c479675ad559DC151F6Ec7ed3FbF8ceE79582B6 --storage_slot 0 --filename siuuu.json --path ~/Desktop
116120
`
117121

122+
### Fast track
123+
124+
The fast track mode is used to track the change for a *historic* storage slot. It cannot be used to get a live view of it. The source_rpc must be an archive node for this mode to perform optimally. This results in a speedup of as much as ~10000% compared to the regular tracking mode. This is the recommended mode to use if you do not have a local node.
125+
126+
#### Usage
127+
128+
- `--mode fast_track`: Used to denote we are using the tracking mode.
129+
- `--source_rpc`: RPC of the node we are getting data from.
130+
- `--contract_address`: Address of the contract we are reading storage from.
131+
- `--storage_slot`: The storage slot of the contract.
132+
- `--origin_block`: The block from which we start tracking.
133+
- `--terminal_block`(optional): Final block sothis will track. If not specified, sothis will track until terminated.
134+
- `--filename`(optional): Name of our output file. The default filename is formatted as: `address-{}-slot-{}-timestamp-{}.json`.
135+
- `--path`(optional): Path to our output file. The default path is the current directory.
136+
137+
Once you are done tracking the slot, terminate the process via a `SIGTERM` or a `SIGINT` (ctrl-c), which will terminate execution and write the file. Keep in mind that sothis will check once per new block if you tried to terminate it. If no new block are produced on the source_rpc, sothis will not terminate and nothing will be written if you force close it.
138+
<!-- easter egg contract -->
139+
`sothis --mode track --source_rpc http://localhost:8545 --contract_address 0x910cbd523d972eb0a6f4cae4618ad62622b39dbf --storage_slot 3 --filename siuuu.json --path ~/Desktop
140+
`
141+
118142
## Installation
119143

120144
Sothis is a rust crate. You can install it with cargo:
@@ -124,17 +148,13 @@ Sothis is a rust crate. You can install it with cargo:
124148

125149
### Why is sothis so slow?
126150

127-
Sothis uses a lot of JSON-RPC calls. This may cause your RPC provider to throttle you. One indication the throttling is happening is when the `evm_mine` action takes a long time. If `anvil` is frozen on `evm_mine`, it may take 3-4 minutes to mine a single block but it will eventually finish. It's recommended to use your own local node.
128-
If using `anvil` make sure you add the `--cups {REALLY_HIGH_VALUE}` arg so anvil doesn't throttle itself.
151+
Sothis uses a lot of JSON-RPC calls. This may cause your RPC provider to throttle you. It's recommended to use your own local node.
152+
If using `anvil` make sure you add the `--cups {REALL_HIGH_VALUE}` arg so anvil doesn't throttle itself.
129153

130154
### I have a problem with sothis. Can devs do something?
131155

132156
Yes! Make a github issue detailing your problem.
133157

134158
### Why the name?
135159

136-
Sothis is known as the creator and God of Fódlan in Fire Emblem: Three Houses. She has the ability to rewind time at will.
137-
138-
## todo
139-
140-
- ??????
160+
Sothis is known as the creator and God of Fódlan in Fire Emblem: Thee Houses. She has the ability to rewind time at will.

0 commit comments

Comments
 (0)