Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
c1d5edb4
Unverified
Commit
c1d5edb4
authored
Aug 29, 2023
by
Adrian Sutton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-challenger: Tidy up scripts based on review feedback.
parent
c73d7e1f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
17 deletions
+32
-17
init_game.sh
op-challenger/scripts/alphabet/init_game.sh
+2
-2
create_game.sh
op-challenger/scripts/create_game.sh
+0
-1
list_claims.sh
op-challenger/scripts/list_claims.sh
+20
-0
visualize.sh
op-challenger/scripts/visualize.sh
+10
-14
No files found.
op-challenger/scripts/alphabet/init_game.sh
View file @
c1d5edb4
...
...
@@ -15,7 +15,7 @@ make cannon-prestate
make devnet-up
DEVNET_SPONSOR
=
"ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
DISPUTE_GAME_
PROX
Y
=
$(
jq
-r
.DisputeGameFactoryProxy
$MONOREPO_DIR
/.devnet/addresses.json
)
DISPUTE_GAME_
FACTOR
Y
=
$(
jq
-r
.DisputeGameFactoryProxy
$MONOREPO_DIR
/.devnet/addresses.json
)
echo
"----------------------------------------------------------------"
echo
" Dispute Game Factory at
$DISPUTE_GAME_PROXY
"
...
...
@@ -63,4 +63,4 @@ done
# Alphabet game claim construction: keccak256(abi.encode(trace_index, trace[trace_index]))
ROOT_CLAIM
=
$(
cast keccak
$(
cast abi-encode
"f(uint256,uint256)"
15 122
))
GAME_TYPE
=
255
${
SOURCE_DIR
}
/../create_game.sh http://localhost:8545
"
${
DISPUTE_GAME_
PROX
Y
}
"
"
${
ROOT_CLAIM
}
"
--private-key
"
${
DEVNET_SPONSOR
}
"
GAME_TYPE
=
255
${
SOURCE_DIR
}
/../create_game.sh http://localhost:8545
"
${
DISPUTE_GAME_
FACTOR
Y
}
"
"
${
ROOT_CLAIM
}
"
--private-key
"
${
DEVNET_SPONSOR
}
"
op-challenger/scripts/create_game.sh
View file @
c1d5edb4
...
...
@@ -36,7 +36,6 @@ echo "L1 Checkpoint: $L1_CHECKPOINT"
# abi.encode(uint256(l2_block_number), uint256(l1 checkpoint))
EXTRA_DATA
=
$(
cast abi-encode
"f(uint256,uint256)"
"
${
L2_BLOCK_NUM
}
"
"
${
L1_CHECKPOINT
}
"
)
echo
"Initializing the game"
FAULT_GAME_DATA
=
$(
cast send
--rpc-url
"
${
RPC
}
"
${
SIGNER_ARGS
}
"
${
FACTORY_ADDR
}
"
"create(uint8,bytes32,bytes) returns(address)"
"
${
GAME_TYPE
}
"
"
${
ROOT_CLAIM
}
"
"
${
EXTRA_DATA
}
"
--json
)
FAULT_GAME_ADDRESS
=
$(
echo
"
${
FAULT_GAME_DATA
}
"
| jq
-r
'.logs[0].topics[1]'
| cast parse-bytes32-address
)
...
...
op-challenger/scripts/list_claims.sh
0 → 100755
View file @
c1d5edb4
#!/usr/bin/env bash
set
-euo
pipefail
RPC
=
${
1
:?Must
specify RPC address
}
GAME_ADDR
=
${
2
:?Must
specify fault dispute game address
}
COUNT
=
$(
cast call
--rpc-url
"
${
RPC
}
"
"
${
GAME_ADDR
}
"
'claimDataLen() returns(uint256)'
)
echo
"Claim count:
${
COUNT
}
"
((
COUNT
=
COUNT-1
))
for
i
in
$(
seq
0
"
${
COUNT
}
"
)
do
CLAIM
=
$(
cast call
--rpc-url
"
${
RPC
}
"
"
${
GAME_ADDR
}
"
'claimData(uint256) returns(uint32 parentIndex, bool countered, bytes32 claim, uint128 position, uint128 clock)'
"
${
i
}
"
)
SAVEIFS
=
$IFS
# Save current IFS (Internal Field Separator)
IFS
=
$'
\n
'
# Change IFS to newline char
CLAIM
=(
$CLAIM
)
# split the string into an array by the same name
IFS
=
$SAVEIFS
# Restore original IFS
echo
"
${
i
}
Parent:
${
CLAIM
[0]
}
Countered:
${
CLAIM
[1]
}
Claim:
${
CLAIM
[2]
}
Position:
${
CLAIM
[3]
}
Clock
${
CLAIM
[4]
}
"
done
op-challenger/scripts/visualize.sh
View file @
c1d5edb4
...
...
@@ -2,19 +2,15 @@
set
-euo
pipefail
RPC
=
${
1
:?Must
specify RPC address
}
GAME_ADDR
=
${
2
:?Must
specify fault dispute game address
}
RPC
=
"
${
1
:?Must
specify RPC address
}
"
FAULT_GAME_ADDRESS
=
"
${
2
:?Must
specify game address
}
"
COUNT
=
$(
cast call
--rpc-url
"
${
RPC
}
"
"
${
GAME_ADDR
}
"
'claimDataLen() returns(uint256)'
)
echo
"Claim count:
${
COUNT
}
"
((
COUNT
=
COUNT-1
))
for
i
in
$(
seq
0
"
${
COUNT
}
"
)
do
CLAIM
=
$(
cast call
--rpc-url
"
${
RPC
}
"
"
${
GAME_ADDR
}
"
'claimData(uint256) returns(uint32 parentIndex, bool countered, bytes32 claim, uint128 position, uint128 clock)'
"
${
i
}
"
)
SAVEIFS
=
$IFS
# Save current IFS (Internal Field Separator)
IFS
=
$'
\n
'
# Change IFS to newline char
CLAIM
=(
$CLAIM
)
# split the string into an array by the same name
IFS
=
$SAVEIFS
# Restore original IFS
DIR
=
$(
cd
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
&&
pwd
)
DIR
=
$(
echo
${
DIR
%/*/*
}
)
cd
$DIR
/packages/contracts-bedrock
echo
"
${
i
}
Parent:
${
CLAIM
[0]
}
Countered:
${
CLAIM
[1]
}
Claim:
${
CLAIM
[2]
}
Position:
${
CLAIM
[3]
}
Clock
${
CLAIM
[4]
}
"
done
forge script scripts/FaultDisputeGameViz.s.sol
\
--sig
"remote(address)"
$FAULT_GAME_ADDRESS
\
--fork-url
"
$RPC
"
mv
dispute_game.svg
"
$dir
"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment