Skip to content

huff-language/ctf-demo-repo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome Players!

Greetings, Huffoor! This document will guide you through the steps to solve this CTF challenge and register your solution.

Overview

This is an optimization challenge. Try and optimize the runtime gas for SimpleStore.huff contract found in PLAYER_SOLUTION.huff, The winner will be the submission with the lowest total gas.

*Ties will be decided by looking at bytecode length first, and then to submission time.

Getting Started

  1. Clone the Repo: Start by cloning this repository to your local machine.
git clone <REPO_URL>

If you're considering sharing your solution later or want to track your progress with commits, consider forking this repository. However, remember to keep your fork private initially to prevent others from seeing your solution.

  1. Solve the Puzzle: Dive into the PLAYER_SOLUTION.huff file and work your magic to solve the challenge.

  2. Testing: While solving, you can utilize the test suite Solution.t.sol to validate your solution. Feel free to make changes to this file; it won't affect the main challenge or your submission. It's just there to assist you.

Registering Your Solution

Once you're confident in your solution, register it with the HuffCTFRegistry on Optimism mainnet:

  1. Set Up Your Discord Handle: Before running the registration script, set up an environment variable with your Discord handle (without the '@' symbol):
export PLAYER_HANDLE=devtooligan
  1. Run the Registration Script: Use the following command to run the registration script:
forge script script/Solution.s.sol:Register --rpc-url <OPTIMISM RPC URL> --broadcast -vvvv

Note:

  • This command sends a live transaction on Optimism. Replace <OPTIMISM RPC URL> with a valid URL.
  • You'll need to use an actual wallet for the transaction. You can specify your wallet using the --wallet flag. Alternatively, you can input your private key in other ways, such as by using the --interactive flag. See Foundry documentation for more information.

Also note:

  • You can also interact directly with the Optimism block explorer. This is not the recommended way due to the danger of human error. If you want to see the exact input parameters you can run the Register script above and DO NOT use a private key. The arguments will be console.logged for you.

Wrapping Up

That's all there is to it! Once the CTF concludes, feel free to make your repository public. If your solution ranks among the top contenders, it will undergo a human review. Stay updated by keeping an eye on our Discord channel and Twitter feed.

Best of luck, and may the best coder win!

About

This is a demo repo created from the ctf-creator-template found at https://github.com/huff-language/ctf-creator-template

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published