paradigmxyz / paradigm-ctf-2021

Official repository for Paradigm CTF 2021
https://ctf.paradigm.xyz
530 stars 90 forks source link

`eth_sandbox` from paradigm-ctf-infrastructure not compatible with CTF 2021 #23

Open 0xYYY opened 2 years ago

0xYYY commented 2 years ago

Issue

Run the babyrev challenge, nc babyrev 31337 31338, then connecting to it with nc localhost 31337 will encounter the following error:

Traceback (most recent call last):
  File "/home/ctf/chal.py", line 5, in <module>
    eth_sandbox.new_launch_instance_action(deploy_value=Web3.toWei(50, 'ether')),
TypeError: new_launch_instance_action() got an unexpected keyword argument

Cause

I believe the commit 46974f891c84c7b4b473f35b19394674f1d20c2b updated the infra to build images with the code from https://github.com/paradigmxyz/paradigm-ctf-infrastructure, but the eth_sandbox package there is not compatible with 2021 CTF.

chal.py in babyrev: https://github.com/paradigmxyz/paradigm-ctf-2021/blob/eedc32d5e3367cbfd2a45601e026572ea39ddedb/babyrev/public/deploy/chal.py#L4-L7

Signature of eth_sandbox.new_launch_instance_action in paradigm-ctf-infrastructure

def new_launch_instance_action(
    do_deploy: Callable[[Web3, str], str],
):
popelev commented 2 years ago

same issue for "bank"

Traceback (most recent call last):
  File "/home/ctf/chal.py", line 5, in <module>
    eth_sandbox.new_launch_instance_action(deploy_value=Web3.toWei(50, 'ether')),
TypeError: new_launch_instance_action() got an unexpected keyword argument 'deploy_value'
M52111 commented 4 days ago

import eth_sandbox from web3 import Web3

eth_sandbox.run_launcher([ eth_sandbox.new_launch_instance_action(do_deploy=lambda w3, addr: w3.toWei(50, 'ether')), eth_sandbox.new_get_flag_action() ]) this is ok