|
26 | 26 | },
|
27 | 27 | {
|
28 | 28 | "cell_type": "code",
|
29 |
| - "execution_count": 7, |
| 29 | + "execution_count": 2, |
30 | 30 | "id": "a7943f57-b9be-4168-a63e-cf3acf9ed41d",
|
31 | 31 | "metadata": {},
|
32 | 32 | "outputs": [],
|
|
42 | 42 | },
|
43 | 43 | {
|
44 | 44 | "cell_type": "code",
|
45 |
| - "execution_count": 12, |
| 45 | + "execution_count": 4, |
46 | 46 | "id": "b5bddad4-dbbe-47d0-8525-1d52ba9c7b58",
|
47 | 47 | "metadata": {},
|
48 | 48 | "outputs": [
|
49 | 49 | {
|
50 |
| - "name": "stdout", |
51 |
| - "output_type": "stream", |
52 |
| - "text": [ |
53 |
| - "4 defender\n", |
54 |
| - "<GameStatus.CHALLENGER_WINS: 1>\n", |
55 |
| - "defaultdict(<class 'game.ResolutionCheckpoint'>,\n", |
56 |
| - " {0: {'initial_checkpoint_complete': True, 'subgame_index': 1, 'leftmost_position': 2, 'countered_by': 'challenger'},\n", |
57 |
| - " 1: {'initial_checkpoint_complete': True, 'subgame_index': 1, 'leftmost_position': 340282366920938463463374607431768211455, 'countered_by': None},\n", |
58 |
| - " 2: {'initial_checkpoint_complete': True, 'subgame_index': 1, 'leftmost_position': 8, 'countered_by': 'challenger'},\n", |
59 |
| - " 3: {'initial_checkpoint_complete': True, 'subgame_index': 1, 'leftmost_position': 340282366920938463463374607431768211455, 'countered_by': None}})\n", |
60 |
| - "[{'parent_index': 4294967295, 'countered_by': 'challenger', 'claimant': 'defender', 'bond': 0, 'claim': '0xd6c66cad06fe14fdb6ce9297d80d32f24d7428996d0045cbf90cc345c677ba16', 'position': 1, 'clock': 0},\n", |
61 |
| - " {'parent_index': 0, 'countered_by': None, 'claimant': 'challenger', 'bond': 0, 'claim': '0x129d374684edc00de2e50d4cc4c5d89ef16c4127f5a20359339603d9e2a85e30', 'position': 2, 'clock': 18446744073709551617},\n", |
62 |
| - " {'parent_index': 1, 'countered_by': 'challenger', 'claimant': 'defender', 'bond': 0, 'claim': '0x4b68ed39e9144e18af8b167c14ebdceed81983f2598e1f1e1a3354c37e3472c7', 'position': 4, 'clock': 18446744073709551618},\n", |
63 |
| - " {'parent_index': 2, 'countered_by': None, 'claimant': 'challenger', 'bond': 0, 'claim': '0x01fdd07ee5e9f7ed3bdedc240a042a72ae2fc235840a49e6e46341dabca965ca', 'position': 8, 'clock': 36893488147419103235},\n", |
64 |
| - " {'parent_index': 3, 'countered_by': 'defender', 'claimant': 'defender', 'bond': 0, 'claim': '0x681f23a2934010b39501557ee6290d61059765df878ee56cb3b2a286565408c4', 'position': 16, 'clock': 36893488147419103236}]\n" |
| 50 | + "ename": "TypeError", |
| 51 | + "evalue": "exceptions must derive from BaseException", |
| 52 | + "output_type": "error", |
| 53 | + "traceback": [ |
| 54 | + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", |
| 55 | + "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", |
| 56 | + "Cell \u001b[0;32mIn[4], line 59\u001b[0m\n\u001b[1;32m 57\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m arg \u001b[38;5;129;01min\u001b[39;00m args:\n\u001b[1;32m 58\u001b[0m block\u001b[38;5;241m.\u001b[39minc()\n\u001b[0;32m---> 59\u001b[0m \u001b[43mgame\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmove\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 60\u001b[0m \u001b[43m \u001b[49m\u001b[43mdisputed\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[43marg\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mdisputed\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\n\u001b[1;32m 61\u001b[0m \u001b[43m \u001b[49m\u001b[43mchallenge_idx\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[43marg\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mchallenge_idx\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\n\u001b[1;32m 62\u001b[0m \u001b[43m \u001b[49m\u001b[43mclaim\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[43marg\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mclaim\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\n\u001b[1;32m 63\u001b[0m \u001b[43m \u001b[49m\u001b[43mis_attack\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[43marg\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mis_attack\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\n\u001b[1;32m 64\u001b[0m \u001b[43m \u001b[49m\u001b[43mmsg_value\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\n\u001b[1;32m 65\u001b[0m \u001b[43m \u001b[49m\u001b[43mblock_timestamp\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[43mblock\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mtimestamp\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 66\u001b[0m \u001b[43m \u001b[49m\u001b[43mmsg_sender\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[43marg\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mmsg_sender\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 67\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 69\u001b[0m block\u001b[38;5;241m.\u001b[39minc()\n\u001b[1;32m 70\u001b[0m game\u001b[38;5;241m.\u001b[39mstep(\n\u001b[1;32m 71\u001b[0m claim_idx \u001b[38;5;241m=\u001b[39m \u001b[38;5;241m4\u001b[39m, \n\u001b[1;32m 72\u001b[0m is_attack \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\u001b[39;00m, \n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 76\u001b[0m msg_sender \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mchallenger\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[1;32m 77\u001b[0m )\n", |
| 57 | + "File \u001b[0;32m~/bkp/dev/t4sk/notes/python/op/game.py:139\u001b[0m, in \u001b[0;36mFaultDisputeGame.move\u001b[0;34m(self, disputed, challenge_idx, claim, is_attack, **kwargs)\u001b[0m\n\u001b[1;32m 136\u001b[0m next_pos_depth \u001b[38;5;241m=\u001b[39m Position\u001b[38;5;241m.\u001b[39mdepth(next_pos)\n\u001b[1;32m 138\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m (challenge_idx \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m0\u001b[39m \u001b[38;5;129;01mor\u001b[39;00m next_pos_depth \u001b[38;5;241m==\u001b[39m SPLIT_DEPTH \u001b[38;5;241m+\u001b[39m \u001b[38;5;241m2\u001b[39m) \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m is_attack:\n\u001b[0;32m--> 139\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcannot defend root claim\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 141\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39ml2_block_num_challenged \u001b[38;5;129;01mand\u001b[39;00m challenge_idx \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m0\u001b[39m:\n\u001b[1;32m 142\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mL2 block num challenged\u001b[39m\u001b[38;5;124m\"\u001b[39m\n", |
| 58 | + "\u001b[0;31mTypeError\u001b[0m: exceptions must derive from BaseException" |
65 | 59 | ]
|
66 | 60 | }
|
67 | 61 | ],
|
|
132 | 126 | " msg_sender = arg[\"msg_sender\"],\n",
|
133 | 127 | " )\n",
|
134 | 128 | "\n",
|
135 |
| - "block.inc()\n", |
136 |
| - "game.step(\n", |
137 |
| - " claim_idx = 4, \n", |
138 |
| - " is_attack = True, \n", |
139 |
| - " state_data = \"0x00\", \n", |
140 |
| - " proof = \"\",\n", |
141 |
| - " block_timestamp = block.timestamp,\n", |
142 |
| - " msg_sender = \"defender\",\n", |
143 |
| - ")\n", |
| 129 | + "### Attack ###\n", |
| 130 | + "# block.inc()\n", |
| 131 | + "# game.step(\n", |
| 132 | + "# claim_idx = 4, \n", |
| 133 | + "# is_attack = True, \n", |
| 134 | + "# state_data = \"0x00\", \n", |
| 135 | + "# proof = \"\",\n", |
| 136 | + "# block_timestamp = block.timestamp,\n", |
| 137 | + "# msg_sender = \"challenger\",\n", |
| 138 | + "# )\n", |
| 139 | + "\n", |
| 140 | + "### Defend, parent post disagree ###\n", |
| 141 | + "# vm.set_post_state(write_8_bits(keccak256_str(\"8,0\"), VMStatus.INVALID.value))\n", |
| 142 | + "# block.inc()\n", |
| 143 | + "# game.step(\n", |
| 144 | + "# claim_idx = 4, \n", |
| 145 | + "# is_attack = False, \n", |
| 146 | + "# state_data = \"16,0\", \n", |
| 147 | + "# proof = \"\",\n", |
| 148 | + "# block_timestamp = block.timestamp,\n", |
| 149 | + "# msg_sender = \"challenger\",\n", |
| 150 | + "# )\n", |
144 | 151 | "\n",
|
145 | 152 | "block.warp(MAX_CLOCK_DURATION + 2)\n",
|
146 | 153 | "game.resolve_claim(4, 0, block_timestamp = block.timestamp)\n",
|
|
0 commit comments