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
54132ee4
Commit
54132ee4
authored
Mar 25, 2022
by
Andrey Petrov
Committed by
norswap
May 06, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demo: Change syntax of overrideable vars, add comments
parent
4e996386
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
12 deletions
+26
-12
challenge_simple.sh
demo/challenge_simple.sh
+21
-10
forked_node.sh
demo/forked_node.sh
+5
-2
No files found.
demo/challenge_simple.sh
View file @
54132ee4
#!/usr/bin/env bash
# The following variables can be overridden as environment variables:
# * BLOCK (block whose transition will be challenged)
# * WRONG_BLOCK (block number used by challenger)
# * SKIP_NODE (skip forking a node, useful if you've already forked a node)
#
# Example usage:
# SKIP_NODE=1 BLOCK=13284469 WRONG_BLOCK=13284491 ./demo/challenge_simple.sh
# --- DOC ----------------------------------------------------------------------
# In this example, the challenger will challenge the transition from a block
...
...
@@ -52,18 +60,20 @@ trap "exit_trap" SIGINT SIGTERM EXIT
# --- BOOT MAINNET FORK --------------------------------------------------------
NODE_LOG
=
"challenge_simple_node.log"
if
[[
!
"
$SKIP_NODE
"
]]
;
then
NODE_LOG
=
"challenge_simple_node.log"
shout
"BOOTING MAINNET FORK NODE IN BACKGROUND (LOG:
$NODE_LOG
)"
shout
"BOOTING MAINNET FORK NODE IN BACKGROUND (LOG:
$NODE_LOG
)"
# get directory containing this file
SCRIPT_DIR
=
$(
dirname
"
$(
readlink
-f
"
$0
"
)
"
)
# get directory containing this file
SCRIPT_DIR
=
$(
dirname
"
$(
readlink
-f
"
$0
"
)
"
)
# run a hardhat mainnet fork node
"
$SCRIPT_DIR
/forked_node.sh"
>
"
$NODE_LOG
"
2>&1 &
# run a hardhat mainnet fork node
"
$SCRIPT_DIR
/forked_node.sh"
>
"
$NODE_LOG
"
2>&1 &
# give the node some time to boot up
sleep
10
# give the node some time to boot up
sleep
10
fi
# --- CHALLENGE SETUP ----------------------------------------------------------
...
...
@@ -72,10 +82,11 @@ export ID=0
# block whose transition will be challenged
# this variable is read by challenge.js, respond.js and assert.js
export
BLOCK
=
13284469
BLOCK
=
${
BLOCK
:-
13284469
}
export
BLOCK
# block whose pre-state is used by the challenger instead of the challenged block's pre-state
WRONG_BLOCK
=
13284491
WRONG_BLOCK
=
${
WRONG_BLOCK
:-
13284491
}
# clear data from previous runs
mkdir
-p
/tmp/cannon /tmp/cannon_fault
&&
rm
-rf
/tmp/cannon/
*
/tmp/cannon_fault/
*
...
...
demo/forked_node.sh
View file @
54132ee4
...
...
@@ -3,15 +3,18 @@
# This runs a hardhat node forked from mainnet at the specified block.
# You need to run this in a separate terminal (or in the background)
# before running challenge_simple.sh or challenge_fault.sh.
#
# RPC_URL and FORK_BLOCK can be overwritten as environment variables. If not
# provided, defaults are used.
# Uncomment this line if you receive the error:
# Error HH604: Error running JSON-RPC server: error:0308010C:digital envelope routines::unsupported
# export NODE_OPTIONS=--openssl-legacy-provider
RPC_URL
=
https://mainnet.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161
RPC_URL
=
${
RPC_URL
:-
"https://mainnet.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161"
}
# block at which to fork mainnet
FORK_BLOCK
=
13284495
FORK_BLOCK
=
${
FORK_BLOCK
:-
13284495
}
# testing on hardhat (forked mainnet, a few blocks ahead of challenges in
# challenge_simple.sh and challenge_fault.sh)
...
...
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