-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
238 additions
and
235 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
## Back-end | ||
|
||
### Set up | ||
|
||
First, you need to install the Cartesi CLI with `pnpm`. | ||
|
||
```sh | ||
pnpm i | ||
``` | ||
|
||
### Building the Cartesi Machine image | ||
|
||
#### From source | ||
|
||
```sh | ||
make machine | ||
``` | ||
|
||
#### From a tagged image | ||
|
||
Every release, the machine image is built and published to GitHub Container Registry. | ||
You can retrieve any given version using the `docker pull` command. | ||
|
||
```sh | ||
docker pull --platform linux/riscv64 ghcr.io/crypto-bug-hunters/bug-buster-machine:$VERSION | ||
``` | ||
|
||
Then, you can build the Cartesi Machine image like so. | ||
|
||
```sh | ||
pnpm exec cartesi build --from-image ghcr.io/crypto-bug-hunters/bug-buster-machine:$VERSION | ||
``` | ||
|
||
### Running the Cartesi Node | ||
|
||
``` | ||
pnpm start | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
## CLI | ||
|
||
To interact with the contract, you may use the Bug Buster CLI. | ||
For all the options, run the command below. | ||
|
||
```sh | ||
go run ./cli help | ||
``` | ||
|
||
### Showing the current state | ||
|
||
```sh | ||
go run ./cli state | ||
``` | ||
|
||
### Sending dapp address | ||
|
||
```sh | ||
go run ./cli send dapp-address | ||
``` | ||
|
||
### Sending bounty | ||
|
||
```sh | ||
go run ./cli send bounty \ | ||
-n "Lua Bounty" \ | ||
-d "Description of Lua bounty" \ | ||
-c ./tests/bounties/dist/lua-5.4.3-bounty.tar.xz \ | ||
-t 0x92C6bcA388E99d6B304f1Af3c3Cd749Ff0b591e2 | ||
``` | ||
|
||
### Sending sponsor | ||
|
||
```sh | ||
go run ./cli send sponsor \ | ||
-b 0 \ | ||
-n "Sponsor Name" \ | ||
-t 0x92C6bcA388E99d6B304f1Af3c3Cd749Ff0b591e2 \ | ||
-v 5000000 | ||
``` | ||
|
||
### Sending exploit | ||
|
||
```sh | ||
go run ./cli send exploit \ | ||
-b 0 \ | ||
-n "Hacker Name" \ | ||
-e ./tests/bounties/src/lua/exploit-lua-5.4.3.lua | ||
``` | ||
|
||
### Withdraw bounty | ||
|
||
```sh | ||
go run ./cli send withdraw -b 0 | ||
``` | ||
|
||
### Testing exploit | ||
|
||
```sh | ||
go run ./cli test \ | ||
-b 0 \ | ||
-e ./tests/bounties/src/lua/exploit-lua-5.4.3.lua | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
## Debugging | ||
|
||
When running Bug Buster locally, you might want to perform some operations that would otherwise be impossible in a production environment. | ||
To this end, we advise you to install the [Foundry](https://book.getfoundry.sh/getting-started/installation) toolkit. | ||
|
||
### Shell | ||
|
||
If you want to run the machine locally through a shell interface, you can do so through the following command. | ||
Please make sure you have built the machine beforehand. | ||
|
||
```sh | ||
make shell | ||
``` | ||
|
||
### Time travel | ||
|
||
When testing sponsor withdrawals, it's handy to be able to instantly advance time past the expiry date of some bounty. | ||
The following command advances time in 30 days, expressed in seconds. | ||
|
||
```sh | ||
cast rpc evm_increaseTime $((60*60*24*30)) | ||
``` | ||
|
||
### Funding a wallet | ||
|
||
In order to publish transactions, you need some Ether. | ||
The following command sets the balance of address `0xf39Fd...92266` to 1 Ether, expressed in Wei. | ||
|
||
```sh | ||
cast rpc anvil_setBalance 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 $(cast to-wei 1 ether) | ||
``` |
Oops, something went wrong.