@@ -4,7 +4,7 @@ ticks="\`\`\`"
4
4
function showjson(){
5
5
echo " \` $1 \` :"
6
6
echo " ${ticks} json"
7
- cat " $1 "
7
+ cat $1
8
8
echo " "
9
9
echo " $ticks "
10
10
}
@@ -256,7 +256,7 @@ echo ""
256
256
echo " We can make them spit out the data to e.g. \` stdout\` like this:"
257
257
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"
258
258
tick; echo " $cmd " ; tick
259
- output=$( $ cmd 2> /dev/null)
259
+ output=` $ cmd 2> /dev/null`
260
260
echo " Output:"
261
261
echo " ${ticks} json"
262
262
echo " $output "
@@ -294,7 +294,7 @@ showjson ./testdata/5/env.json
294
294
295
295
echo " When applying this, using a reward of \` 0x08\` "
296
296
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`
298
298
echo " Output:"
299
299
echo " ${ticks} json"
300
300
echo " $output "
@@ -314,16 +314,16 @@ echo "The \`BLOCKHASH\` opcode requires blockhashes to be provided by the caller
314
314
echo " If a required blockhash is not provided, the exit code should be \` 4\` :"
315
315
echo " Example where blockhashes are provided: "
316
316
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
319
319
echo " $ticks "
320
- $cmd
320
+ cat trace-0-0x72fadbef39cd251a437eea619cfeda752271a5faaaa2147df012e112159ffb81.jsonl | grep BLOCKHASH -C2
321
321
echo " $ticks "
322
322
echo " "
323
323
324
324
echo " In this example, the caller has not provided the required blockhash:"
325
325
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
327
327
errc=$?
328
328
tick
329
329
echo " Error code: $errc "
@@ -337,7 +337,7 @@ cmd2="./evm t8n --input.alloc=stdin --input.env=./testdata/1/env.json --input.tx
337
337
echo " $ticks "
338
338
echo " $cmd1 | $cmd2 "
339
339
output=$( $cmd1 | $cmd2 )
340
- echo " $output "
340
+ echo $output
341
341
echo " $ticks "
342
342
echo " What happened here, is that we first applied two identical transactions, so the second one was rejected. "
343
343
echo " Then, taking the poststate alloc as the input for the next state, we tried again to include"
@@ -356,31 +356,28 @@ echo ""
356
356
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\` .:"
357
357
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"
358
358
echo " $ticks "
359
- echo " $cmd "
359
+ echo $cmd
360
360
$cmd 2>&1
361
361
echo " $ticks "
362
362
echo " "
363
363
echo " The \` output.body\` is the rlp-list of transactions, encoded in hex and placed in a string a'la \` json\` encoding rules:"
364
364
demo " cat signed_txs.rlp"
365
365
echo " We can use \` rlpdump\` to check what the contents are: "
366
366
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 )
371
369
echo " $ticks "
372
370
echo " Now, we can now use those (or any other already signed transactions), as input, like so: "
373
371
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"
374
372
echo " $ticks "
375
- echo " $cmd "
373
+ echo $cmd
376
374
$cmd 2>&1
377
375
echo " $ticks "
378
376
echo " You might have noticed that the results from these two invocations were stored in two separate files. "
379
377
echo " And we can now finally check that they match."
380
378
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
384
381
echo " $ticks "
385
382
386
383
cat << "EOF "
0 commit comments