Skip to content

Commit d4e0cb9

Browse files
committed
fixup: Exclude upstream files
1 parent 45dfd82 commit d4e0cb9

File tree

3 files changed

+31
-20
lines changed

3 files changed

+31
-20
lines changed

cmd/evm/transition-test.sh

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ticks="\`\`\`"
44
function showjson(){
55
echo "\`$1\`:"
66
echo "${ticks}json"
7-
cat "$1"
7+
cat $1
88
echo ""
99
echo "$ticks"
1010
}
@@ -256,7 +256,7 @@ echo ""
256256
echo "We can make them spit out the data to e.g. \`stdout\` like this:"
257257
cmd="./evm t8n --input.alloc=./testdata/1/alloc.json --input.txs=./testdata/1/txs.json --input.env=./testdata/1/env.json --output.result=stdout --output.alloc=stdout --state.fork=Berlin"
258258
tick;echo "$cmd"; tick
259-
output=$($cmd 2>/dev/null)
259+
output=`$cmd 2>/dev/null`
260260
echo "Output:"
261261
echo "${ticks}json"
262262
echo "$output"
@@ -294,7 +294,7 @@ showjson ./testdata/5/env.json
294294

295295
echo "When applying this, using a reward of \`0x08\`"
296296
cmd="./evm t8n --input.alloc=./testdata/5/alloc.json -input.txs=./testdata/5/txs.json --input.env=./testdata/5/env.json --output.alloc=stdout --state.reward=0x80 --state.fork=Berlin"
297-
output=$($cmd 2>/dev/null)
297+
output=`$cmd 2>/dev/null`
298298
echo "Output:"
299299
echo "${ticks}json"
300300
echo "$output"
@@ -314,16 +314,16 @@ echo "The \`BLOCKHASH\` opcode requires blockhashes to be provided by the caller
314314
echo "If a required blockhash is not provided, the exit code should be \`4\`:"
315315
echo "Example where blockhashes are provided: "
316316
demo "./evm t8n --input.alloc=./testdata/3/alloc.json --input.txs=./testdata/3/txs.json --input.env=./testdata/3/env.json --trace --state.fork=Berlin"
317-
cmd="grep BLOCKHASH -C2 < trace-0-0x72fadbef39cd251a437eea619cfeda752271a5faaaa2147df012e112159ffb81.jsonl"
318-
tick && echo "$cmd" && tick
317+
cmd="cat trace-0-0x72fadbef39cd251a437eea619cfeda752271a5faaaa2147df012e112159ffb81.jsonl | grep BLOCKHASH -C2"
318+
tick && echo $cmd && tick
319319
echo "$ticks"
320-
$cmd
320+
cat trace-0-0x72fadbef39cd251a437eea619cfeda752271a5faaaa2147df012e112159ffb81.jsonl | grep BLOCKHASH -C2
321321
echo "$ticks"
322322
echo ""
323323

324324
echo "In this example, the caller has not provided the required blockhash:"
325325
cmd="./evm t8n --input.alloc=./testdata/4/alloc.json --input.txs=./testdata/4/txs.json --input.env=./testdata/4/env.json --trace --state.fork=Berlin"
326-
tick && echo "$cmd" && "$cmd" 2>&1
326+
tick && echo $cmd && $cmd 2>&1
327327
errc=$?
328328
tick
329329
echo "Error code: $errc"
@@ -337,7 +337,7 @@ cmd2="./evm t8n --input.alloc=stdin --input.env=./testdata/1/env.json --input.tx
337337
echo "$ticks"
338338
echo "$cmd1 | $cmd2"
339339
output=$($cmd1 | $cmd2 )
340-
echo "$output"
340+
echo $output
341341
echo "$ticks"
342342
echo "What happened here, is that we first applied two identical transactions, so the second one was rejected. "
343343
echo "Then, taking the poststate alloc as the input for the next state, we tried again to include"
@@ -356,31 +356,28 @@ echo ""
356356
echo "The following command takes **json** the transactions in \`./testdata/13/txs.json\` and signs them. After execution, they are output to \`signed_txs.rlp\`.:"
357357
cmd="./evm t8n --state.fork=London --input.alloc=./testdata/13/alloc.json --input.txs=./testdata/13/txs.json --input.env=./testdata/13/env.json --output.result=alloc_jsontx.json --output.body=signed_txs.rlp"
358358
echo "$ticks"
359-
echo "$cmd"
359+
echo $cmd
360360
$cmd 2>&1
361361
echo "$ticks"
362362
echo ""
363363
echo "The \`output.body\` is the rlp-list of transactions, encoded in hex and placed in a string a'la \`json\` encoding rules:"
364364
demo "cat signed_txs.rlp"
365365
echo "We can use \`rlpdump\` to check what the contents are: "
366366
echo "$ticks"
367-
# TODO(marun) Maybe use a set -x in a subshell to ensure the command is printed e.g. (set -x; <cmd>)
368-
cmd="rlpdump -hex \$(jq -r < signed_txs.rlp)"
369-
echo "$cmd"
370-
$cmd
367+
echo "rlpdump -hex \$(cat signed_txs.rlp | jq -r )"
368+
rlpdump -hex $(cat signed_txs.rlp | jq -r )
371369
echo "$ticks"
372370
echo "Now, we can now use those (or any other already signed transactions), as input, like so: "
373371
cmd="./evm t8n --state.fork=London --input.alloc=./testdata/13/alloc.json --input.txs=./signed_txs.rlp --input.env=./testdata/13/env.json --output.result=alloc_rlptx.json"
374372
echo "$ticks"
375-
echo "$cmd"
373+
echo $cmd
376374
$cmd 2>&1
377375
echo "$ticks"
378376
echo "You might have noticed that the results from these two invocations were stored in two separate files. "
379377
echo "And we can now finally check that they match."
380378
echo "$ticks"
381-
cmd="jq .stateRoot < alloc_jsontx.json && jq .stateRoot < alloc_rlptx.json"
382-
echo "$cmd"
383-
$cmd
379+
echo "cat alloc_jsontx.json | jq .stateRoot && cat alloc_rlptx.json | jq .stateRoot"
380+
cat alloc_jsontx.json | jq .stateRoot && cat alloc_rlptx.json | jq .stateRoot
384381
echo "$ticks"
385382

386383
cat << "EOF"

metrics/validate.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
set -e
44

55
# check there are no formatting issues
6-
GOFMT_LINES=$(gofmt -l . | wc -l | xargs)
7-
test "$GOFMT_LINES" -eq 0 || echo "gofmt needs to be run, ${GOFMT_LINES} files have issues"
6+
GOFMT_LINES=`gofmt -l . | wc -l | xargs`
7+
test $GOFMT_LINES -eq 0 || echo "gofmt needs to be run, ${GOFMT_LINES} files have issues"
88

99
# run the tests for the root package
1010
go test -race .

scripts/shellcheck.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ set -euo pipefail
44

55
VERSION="v0.9.0"
66

7+
# Scripts that are sourced from upstream and not maintained in this repo will not be shellchecked.
8+
IGNORED_FILES="
9+
cmd/evm/transition-test.sh
10+
metrics/validate.sh
11+
"
12+
713
function get_version {
814
local target_path=$1
915
if command -v "${target_path}" > /dev/null; then
@@ -36,4 +42,12 @@ else
3642
fi
3743
fi
3844

39-
find "${REPO_ROOT}" -name "*.sh" -type f -print0 | xargs -0 "${SHELLCHECK}" "${@}"
45+
IGNORED_CONDITIONS=()
46+
for file in ${IGNORED_FILES}; do
47+
if [[ -n "${IGNORED_CONDITIONS-}" ]]; then
48+
IGNORED_CONDITIONS+=(-o)
49+
fi
50+
IGNORED_CONDITIONS+=(-path "${REPO_ROOT}/${file}" -prune)
51+
done
52+
53+
find "${REPO_ROOT}" \( "${IGNORED_CONDITIONS[@]}" \) -o -type f -name "*.sh" -print0 | xargs -0 "${SHELLCHECK}" "${@}"

0 commit comments

Comments
 (0)