forked from ethereum-optimism/superchain-ops
-
Notifications
You must be signed in to change notification settings - Fork 0
/
presigned-pause.just
158 lines (144 loc) · 4.44 KB
/
presigned-pause.just
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
set dotenv-load
export rpcUrl := env_var('ETH_RPC_URL')
export deputyGuardianModuleAddr := env_var('DEPUTY_GUARDIAN_MODULE_ADDR')
export presignerSafe := env_var('PRESIGNER_SAFE')
export taskPath := invocation_directory()
jsonFile := ''
######################################
# During the ceremony ...
######################################
install: install-presigner
install-presigner:
#!/usr/bin/env bash
REPO_ROOT=`git rev-parse --show-toplevel`
PATH="$REPO_ROOT/bin:$PATH"
cd $REPO_ROOT
mkdir -p bin || true
GOBIN="$REPO_ROOT/bin" go install github.com/ethereum-optimism/[email protected]
whoami hdPath='0':
#!/usr/bin/env bash
REPO_ROOT=`git rev-parse --show-toplevel`
PATH="$REPO_ROOT/bin:$PATH"
if [ -z "$SIMULATE_WITHOUT_LEDGER" ]; then
eip712sign --address --hd-paths "m/44'/60'/{{hdPath}}'/0/0" --ledger
else
eip712sign --address --mnemonic "test test test test test test test test test test test junk"
fi
sign hdPath='0':
#!/usr/bin/env bash
set -x
script=PresignPauseFromJson
if [ -n "$SCRIPT" ]; then
script=$SCRIPT
fi
echo "Using script ${script}"
REPO_ROOT=`git rev-parse --show-toplevel`
PATH="$REPO_ROOT/bin:$PATH"
export INPUT_JSON_PATH="${taskPath}/input.json"
for nonce in ${PRESIGN_NONCES[@]}; do
JSON_FILE="${taskPath}/tx/draft-${nonce}.json"
if [ -z "$SIMULATE_WITHOUT_LEDGER" ]; then
presigner \
--workdir ${taskPath} \
--script-name ${script} \
--rpc-url ${rpcUrl} \
--json-file $JSON_FILE \
--ledger \
--hd-paths "m/44'/60'/{{hdPath}}'/0/0" \
sign
else
TEST_MNEMONIC="test test test test test test test test test test test junk"
export FOUNDRY_SENDER=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
export TEST_SENDER=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
presigner \
--workdir ${taskPath} \
--script-name ${script} \
--rpc-url ${rpcUrl} \
--json-file $JSON_FILE \
--mnemonic "$TEST_MNEMONIC" \
--sender $TEST_SENDER \
sign
fi
done
######################################
# Before the ceremony ...
######################################
prepare:
#!/usr/bin/env bash
set -x
script=PresignPauseFromJson
if [ -n "$SCRIPT" ]; then
script=$SCRIPT
fi
echo "Using script ${script}"
REPO_ROOT=`git rev-parse --show-toplevel`
PATH="$REPO_ROOT/bin:$PATH"
echo Preparing transactions to sign...
echo
if [ -n "$SCRIPT" ]; then
script=$SCRIPT
fi
export INPUT_JSON_PATH="${taskPath}/input.json"
mkdir -p ${taskPath}/tmp
for nonce in ${PRESIGN_NONCES[@]}; do
presigner \
--workdir ${taskPath} \
--script-name ${script} \
--chain `cast chain-id` \
--rpc-url ${rpcUrl} \
--target-addr ${deputyGuardianModuleAddr} \
--safe-addr ${presignerSafe} \
--safe-nonce ${nonce} \
--json-file ${taskPath}/tmp/tmp-${nonce}.json \
create
cat ${taskPath}/tmp/tmp-${nonce}.json | jq . > ${taskPath}/tx/draft-${nonce}.json
done
######################################
# After the ceremony ...
######################################
merge:
#!/usr/bin/env bash
REPO_ROOT=`git rev-parse --show-toplevel`
PATH="$REPO_ROOT/bin:$PATH"
for nonce in ${PRESIGN_NONCES[@]}; do
presigner \
--rpc-url ${rpcUrl} \
--json-file ${taskPath}/tx/draft-${nonce}.json \
merge ${taskPath}/tx/draft-${nonce}.signer-*.json
done
verify:
#!/usr/bin/env bash
script=PresignPauseFromJson
if [ -n "$SCRIPT" ]; then
script=$SCRIPT
fi
echo "Using script ${script}"
REPO_ROOT=`git rev-parse --show-toplevel`
PATH="$REPO_ROOT/bin:$PATH"
export INPUT_JSON_PATH="${taskPath}/input.json"
for nonce in ${PRESIGN_NONCES[@]}; do
presigner \
--workdir ${taskPath} \
--script-name ${script} \
--rpc-url ${rpcUrl} \
--json-file ${taskPath}/tx/draft-${nonce}.json \
verify
done
simulate-all:
#!/usr/bin/env bash
script=PresignPauseFromJson
if [ -n "$SCRIPT" ]; then
script=$SCRIPT
fi
echo "Using script ${script}"
REPO_ROOT=`git rev-parse --show-toplevel`
PATH="$REPO_ROOT/bin:$PATH"
export INPUT_JSON_PATH="${taskPath}/input.json"
for nonce in ${PRESIGN_NONCES[@]}; do
presigner \
--workdir ${taskPath} \
--script-name ${script} \
--rpc-url ${rpcUrl} \
--json-file ${taskPath}/tx/draft-${nonce}.json \
simulate
done