forked from jl777/SuperNET
-
Notifications
You must be signed in to change notification settings - Fork 118
feat(ARRR): dockerize zombie/pirate tests #2374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
d789c36
save dev state
borngraced 3050594
save dev state
borngraced c6e8100
save dev state
borngraced f68cd01
save dev state - docker image working!
borngraced bf9312b
reduce timeout, add log
borngraced ea42ae7
uncomment tendermint docker and cleanups
borngraced da82da1
fix tx_streaming_tests mod
borngraced 0377162
use multiarch for zombie docker
borngraced 83133de
fix post rebase
borngraced 588ee43
Merge branch 'dev' into dockerize_pirate
borngraced 6d423a6
nits
borngraced 9950305
remove mm2_test_helpers lock file
borngraced 46d59ea
rename zombie to pirate
borngraced 2c662ce
add internal Lockfile to gitignore
borngraced d2e09d0
revert z_coin save change output and fix docker image init arrangement
borngraced ec4845c
fix zcoin cache update test, improve z docker, and nits
borngraced 300943e
fix clippy
borngraced 6e6d37c
move fund shield to docker start script
borngraced 5344fa6
fix clippy
borngraced f36a3a1
remove z_shieldcoinbase rpc
borngraced 5d6bc86
revert all changes not related to dockerizing zombie tests
borngraced 8184e29
fix clippy and remove unused
borngraced 0c8f297
update avg_blocktiime for ZOMBIE
borngraced 6bb1f65
Merge branch 'dev' into dockerize_pirate
borngraced 42dcd42
ignore z_coin docker tests
borngraced 281fe81
fix nits
borngraced 06858a9
Merge branch 'dev' into dockerize_pirate
borngraced 427a653
Merge branch 'dev' into dockerize_pirate
borngraced a4736ad
fix review notes
borngraced 642f493
add zombie_conf_for_docker with 10 avg blocktime and use in z_coin_do…
borngraced 1d57ad4
make sapling check fn compile for test, docker-test only
borngraced File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| use coins::z_coin::ZCoin; | ||
| pub use common::{block_on, block_on_f01, now_ms, now_sec, wait_until_ms, wait_until_sec, DEX_FEE_ADDR_RAW_PUBKEY}; | ||
| pub use mm2_number::MmNumber; | ||
| use mm2_rpc::data::legacy::BalanceResponse; | ||
|
|
@@ -8,6 +9,7 @@ pub use mm2_test_helpers::for_tests::{check_my_swap_status, check_recent_swaps, | |
| TAKER_SUCCESS_EVENTS}; | ||
|
|
||
| use super::eth_docker_tests::{erc20_contract_checksum, fill_eth, fill_eth_erc20_with_private_key, swap_contract}; | ||
| use super::z_coin_docker_tests::z_coin_from_spending_key; | ||
| use bitcrypto::{dhash160, ChecksumType}; | ||
| use chain::TransactionOutput; | ||
| use coins::eth::addr_from_raw_pubkey; | ||
|
|
@@ -57,6 +59,7 @@ lazy_static! { | |
| static ref MY_COIN1_LOCK: Mutex<()> = Mutex::new(()); | ||
| static ref QTUM_LOCK: Mutex<()> = Mutex::new(()); | ||
| static ref FOR_SLP_LOCK: Mutex<()> = Mutex::new(()); | ||
| static ref ZOMBIE_LOCK: Mutex<()> = Mutex::new(()); | ||
| pub static ref SLP_TOKEN_ID: Mutex<H256> = Mutex::new(H256::default()); | ||
| // Private keys supplied with 1000 SLP tokens on tests initialization. | ||
| // Due to the SLP protocol limitations only 19 outputs (18 + change) can be sent in one transaction, which is sufficient for now though. | ||
|
|
@@ -126,6 +129,9 @@ pub const UTXO_ASSET_DOCKER_IMAGE: &str = "docker.io/artempikulin/testblockchain | |
| pub const UTXO_ASSET_DOCKER_IMAGE_WITH_TAG: &str = "docker.io/artempikulin/testblockchain:multiarch"; | ||
| pub const GETH_DOCKER_IMAGE: &str = "docker.io/ethereum/client-go"; | ||
| pub const GETH_DOCKER_IMAGE_WITH_TAG: &str = "docker.io/ethereum/client-go:stable"; | ||
| pub const ZOMBIE_ASSET_DOCKER_IMAGE: &str = "docker.io/borngraced/zombietestrunner"; | ||
| pub const ZOMBIE_ASSET_DOCKER_IMAGE_WITH_TAG: &str = "docker.io/borngraced/zombietestrunner:multiarch"; | ||
|
Comment on lines
+132
to
+133
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should move these to komodo platform in docker.io. This is not a blocker for merge as this is for testing but we should open a PR once moved. |
||
|
|
||
| #[allow(dead_code)] | ||
| pub const SIA_DOCKER_IMAGE: &str = "docker.io/alrighttt/walletd-komodo"; | ||
| #[allow(dead_code)] | ||
|
|
@@ -221,6 +227,24 @@ impl UtxoAssetDockerOps { | |
| } | ||
| } | ||
|
|
||
| pub struct ZCoinAssetDockerOps { | ||
| #[allow(dead_code)] | ||
| ctx: MmArc, | ||
| coin: ZCoin, | ||
| } | ||
|
|
||
| impl CoinDockerOps for ZCoinAssetDockerOps { | ||
| fn rpc_client(&self) -> &UtxoRpcClientEnum { &self.coin.as_ref().rpc_client } | ||
| } | ||
|
|
||
| impl ZCoinAssetDockerOps { | ||
| pub fn new() -> ZCoinAssetDockerOps { | ||
| let (ctx, coin) = block_on(z_coin_from_spending_key("secret-extended-key-main1q0k2ga2cqqqqpq8m8j6yl0say83cagrqp53zqz54w38ezs8ly9ly5ptamqwfpq85u87w0df4k8t2lwyde3n9v0gcr69nu4ryv60t0kfcsvkr8h83skwqex2nf0vr32794fmzk89cpmjptzc22lgu5wfhhp8lgf3f5vn2l3sge0udvxnm95k6dtxj2jwlfyccnum7nz297ecyhmd5ph526pxndww0rqq0qly84l635mec0x4yedf95hzn6kcgq8yxts26k98j9g32kjc8y83fe")); | ||
|
|
||
| ZCoinAssetDockerOps { ctx, coin } | ||
| } | ||
| } | ||
|
|
||
| pub struct BchDockerOps { | ||
| #[allow(dead_code)] | ||
| ctx: MmArc, | ||
|
|
@@ -463,6 +487,38 @@ pub fn ibc_relayer_node(docker: &'_ Cli, runtime_dir: PathBuf) -> DockerNode<'_> | |
| } | ||
| } | ||
|
|
||
| pub fn zombie_asset_docker_node(docker: &Cli, port: u16) -> DockerNode<'_> { | ||
| let image = GenericImage::new(ZOMBIE_ASSET_DOCKER_IMAGE, "multiarch") | ||
| .with_volume(zcash_params_path().display().to_string(), "/root/.zcash-params") | ||
| .with_env_var("COIN_RPC_PORT", port.to_string()) | ||
| .with_wait_for(WaitFor::message_on_stdout("config is ready")); | ||
|
|
||
| let image = RunnableImage::from(image).with_mapped_port((port, port)); | ||
| let container = docker.run(image); | ||
| let config_ticker = "ZOMBIE"; | ||
| let mut conf_path = coin_daemon_data_dir(config_ticker, true); | ||
|
|
||
| std::fs::create_dir_all(&conf_path).unwrap(); | ||
| conf_path.push(format!("{}.conf", config_ticker)); | ||
| Command::new("docker") | ||
| .arg("cp") | ||
| .arg(format!("{}:/data/node_0/{}.conf", container.id(), config_ticker)) | ||
| .arg(&conf_path) | ||
| .status() | ||
| .expect("Failed to execute docker command"); | ||
|
|
||
| let timeout = wait_until_ms(3000); | ||
| while !conf_path.exists() { | ||
| assert!(now_ms() < timeout, "Test timed out"); | ||
| } | ||
|
|
||
| DockerNode { | ||
| container, | ||
| ticker: config_ticker.into(), | ||
| port, | ||
| } | ||
| } | ||
|
|
||
| pub fn rmd160_from_priv(privkey: Secp256k1Secret) -> H160 { | ||
| let secret = SecretKey::from_slice(privkey.as_slice()).unwrap(); | ||
| let public = PublicKey::from_secret_key(&Secp256k1::new(), &secret); | ||
|
|
||
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.