Skip to content

Commit

Permalink
Merge pull request #1917 from OffchainLabs/add-testnodestart-ci
Browse files Browse the repository at this point in the history
Add a CI step to start up a dev test node
  • Loading branch information
joshuacolvin0 authored Oct 13, 2023
2 parents ac85c0a + b9d8346 commit 5ae8502
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
11 changes: 11 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,17 @@ jobs:
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

- name: Start background nitro-testnode
shell: bash
run: |
cd nitro-testnode
./test-node.bash --init --dev &
- name: Wait for rpc to come up
shell: bash
run: |
${{ github.workspace }}/.github/workflows/waitForNitro.sh
- name: Print WAVM module root
id: module-root
run: |
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/waitForNitro.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# poll the nitro endpoint until we get a 0 return code
while true
do
curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":45678,"method":"eth_chainId","params":[]}' 'http://localhost:8547'
if [ "$?" -eq "0" ]; then
exit 0
else
sleep 20
fi
done
4 changes: 4 additions & 0 deletions execution/gethexec/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ func (c *Config) Validate() error {
func ConfigAddOptions(prefix string, f *flag.FlagSet) {
arbitrum.ConfigAddOptions(prefix+".rpc", f)
SequencerConfigAddOptions(prefix+".sequencer", f)
headerreader.AddOptions(prefix+".parent-chain-reader", f)
arbitrum.RecordingDatabaseConfigAddOptions(prefix+".recording-database", f)
f.String(prefix+".forwarding-target", ConfigDefault.ForwardingTarget, "transaction forwarding target URL, or \"null\" to disable forwarding (iff not sequencer)")
AddOptionsForNodeForwarderConfig(prefix+".forwarder", f)
Expand All @@ -86,6 +87,7 @@ func ConfigAddOptions(prefix string, f *flag.FlagSet) {
var ConfigDefault = Config{
RPC: arbitrum.DefaultConfig,
Sequencer: DefaultSequencerConfig,
ParentChainReader: headerreader.DefaultConfig,
RecordingDatabase: arbitrum.DefaultRecordingDatabaseConfig,
ForwardingTarget: "",
TxPreChecker: DefaultTxPreCheckerConfig,
Expand All @@ -97,6 +99,7 @@ var ConfigDefault = Config{

func ConfigDefaultNonSequencerTest() *Config {
config := ConfigDefault
config.ParentChainReader = headerreader.Config{}
config.Sequencer.Enable = false
config.Forwarder = DefaultTestForwarderConfig
config.ForwardingTarget = "null"
Expand All @@ -108,6 +111,7 @@ func ConfigDefaultNonSequencerTest() *Config {

func ConfigDefaultTest() *Config {
config := ConfigDefault
config.ParentChainReader = headerreader.Config{}
config.Sequencer = TestSequencerConfig
config.ForwardingTarget = "null"

Expand Down
2 changes: 1 addition & 1 deletion nitro-testnode

0 comments on commit 5ae8502

Please sign in to comment.