forked from LayerZero-Labs/devtools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🗞️ Add --assert mode (LayerZero-Labs#627)
- Loading branch information
1 parent
d306a7c
commit 87ed6f5
Showing
6 changed files
with
175 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@layerzerolabs/ua-devtools-evm-hardhat-test": patch | ||
"@layerzerolabs/ua-devtools-evm-hardhat": patch | ||
"@layerzerolabs/toolbox-hardhat": patch | ||
--- | ||
|
||
Add --assert flag to lz:oapp:wire task |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
tests/ua-devtools-evm-hardhat-test/test/task/oapp/config.test.expectations/assert.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/usr/bin/expect -f | ||
# | ||
# This Expect script was generated by autoexpect on Mon Feb 12 16:57:18 2024 | ||
# Expect and autoexpect were both written by Don Libes, NIST. | ||
# | ||
# Note that autoexpect does not guarantee a working script. It | ||
# necessarily has to guess about certain things. Two reasons a script | ||
# might fail are: | ||
# | ||
# 1) timing - A surprising number of programs (rn, ksh, zsh, telnet, | ||
# etc.) and devices discard or ignore keystrokes that arrive "too | ||
# quickly" after prompts. If you find your new script hanging up at | ||
# one spot, try adding a short sleep just before the previous send. | ||
# Setting "force_conservative" to 1 (see below) makes Expect do this | ||
# automatically - pausing briefly before sending each character. This | ||
# pacifies every program I know of. The -c flag makes the script do | ||
# this in the first place. The -C flag allows you to define a | ||
# character to toggle this mode off and on. | ||
|
||
set force_conservative 0 | ||
if {$force_conservative} { | ||
set send_slow {1 .1} | ||
proc send {ignore arg} { | ||
sleep .1 | ||
exp_send -s -- $arg | ||
} | ||
} | ||
|
||
|
||
set timeout 60 | ||
|
||
match_max 100000 | ||
|
||
# Deploy everything first | ||
spawn npx hardhat lz:deploy --tags CustomOApp --ci | ||
|
||
# Wait for the deployment to finish | ||
expect "Deploying..." | ||
expect "Your contracts are now deployed" | ||
expect eof | ||
|
||
# Now run the custom configuration | ||
spawn npx hardhat lz:oapp:wire \ | ||
--oapp-config layerzero.config.with-custom-configuration.ts \ | ||
--assert | ||
|
||
# We check that we got an error message | ||
expect "The OApp is not fully wired, following transactions are necessary:" | ||
|
||
# We'll grab the exit code from wait | ||
# | ||
# wait returns a list of four integers when the spawned process terminates | ||
lassign [wait] pid spawn_id os_error wire_exit_code | ||
|
||
# And we check that the exit code we got is 1 | ||
if {$wire_exit_code != 1} { | ||
puts "Wiring script exited with code $wire_exit_code, expected exit code 1" | ||
|
||
exit 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters