Skip to content

Commit 35dd88b

Browse files
authored
feat: cleanup cosmwasm deployer and cosmos types (#4029)
- clean up deployer - add migration functionality - start work on better cosmos types (tired of dealing with prost types) - various improvements to cosmos-client apis TODO: feature gate proto properly in unionlabs. likely this won't even be necessary as all of the proto types will be split out of this crate anyways. for now, "proto" is always enabled in unionlabs.
2 parents c5c951d + 6b71a47 commit 35dd88b

File tree

45 files changed

+1927
-731
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1927
-731
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ subset-of = { path = "lib/subset-of", default-features = false }
299299
subset-of-derive = { path = "lib/subset-of-derive", default-features = false }
300300

301301
token-factory-api = { path = "cosmwasm/token-factory-api", default-features = false }
302-
unionlabs = { path = "lib/unionlabs", default-features = false }
302+
unionlabs = { path = "lib/unionlabs", default-features = false, features = ["proto"] } # TODO: Properly feature gate proto in unionlabs
303303
unionlabs-primitives = { path = "lib/unionlabs-primitives", default-features = false }
304304
zktrie = { path = "lib/zktrie-rs", default-features = false }
305305

cosmwasm/cosmwasm.nix

Lines changed: 61 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@
1919
'';
2020
};
2121

22-
cosmwasm-deployer = crane.buildWorkspaceMember {
23-
crateDirFromRoot = "cosmwasm/deployer";
24-
};
22+
inherit
23+
((crane.buildWorkspaceMember {
24+
crateDirFromRoot = "cosmwasm/deployer";
25+
}).packages
26+
)
27+
cosmwasm-deployer
28+
;
2529

2630
networks = [
2731
{
@@ -31,14 +35,14 @@
3135
private_key = "0xaa820fa947beb242032a41b6dc9a8b9c37d8f5fbcda0966b1ec80335b10a7d6f";
3236
gas_config = {
3337
gas_denom = "muno";
34-
gas_multiplier = "1.1";
35-
gas_price = "1.0";
38+
gas_multiplier = "1.5";
39+
gas_price = "1.5";
3640
max_gas = 10000000;
3741
};
3842
ucs03_type = "cw20";
3943
bech32_prefix = "union";
4044
apps = {
41-
ucs03 = ucs03-configs.cw20;
45+
# ucs03 = ucs03-configs.cw20;
4246
};
4347
# lightclients = pkgs.lib.lists.remove "cometbls" (builtins.attrNames all-lightclients);
4448
lightclients = [ ];
@@ -287,7 +291,7 @@
287291
}:
288292
pkgs.writeShellApplication {
289293
name = "${name}-deploy-full";
290-
runtimeInputs = [ cosmwasm-deployer.packages.cosmwasm-deployer ];
294+
runtimeInputs = [ cosmwasm-deployer ];
291295
text = ''
292296
RUST_LOG=info \
293297
cosmwasm-deployer \
@@ -303,6 +307,44 @@
303307
'';
304308
};
305309

310+
# migrate the admin to the multisig address
311+
finalize-deployment =
312+
{
313+
name,
314+
rpc_url,
315+
gas_config,
316+
private_key,
317+
multisig_address,
318+
bech32_prefix,
319+
...
320+
}:
321+
pkgs.writeShellApplication {
322+
name = "${name}-deploy-full";
323+
runtimeInputs = [
324+
ibc-union-contract-addresses
325+
cosmwasm-deployer
326+
];
327+
text = ''
328+
DEPLOYER=$(cosmwasm-deployer address-of-private-key --private-key ${private_key} --bech32-prefix ${bech32_prefix})
329+
ADDRESSES=$(ibc-union-contract-addresses "$DEPLOYER")
330+
331+
echo "$DEPLOYER"
332+
echo "$ADDRESSES"
333+
334+
RUST_LOG=info \
335+
cosmwasm-deployer \
336+
migrate-admin \
337+
--private-key ${private_key} \
338+
--gas-price ${toString gas_config.gas_price} \
339+
--gas-denom ${toString gas_config.gas_denom} \
340+
--gas-multiplier ${toString gas_config.gas_multiplier} \
341+
--max-gas ${toString gas_config.max_gas} \
342+
--new-admin ${multisig_address} \
343+
--addresses <(echo "$ADDRESSES") \
344+
--rpc-url ${rpc_url}
345+
'';
346+
};
347+
306348
chain-deployments-json =
307349
{ lightclients, apps, ... }:
308350
pkgs.writeText "contracts.json" (
@@ -343,7 +385,7 @@
343385
inherit name;
344386
runtimeInputs = [
345387
ibc-union-contract-addresses
346-
cosmwasm-deployer.packages.cosmwasm-deployer
388+
cosmwasm-deployer
347389
];
348390
text = ''
349391
DEPLOYER=$(cosmwasm-deployer address-of-private-key --private-key ${private_key} --bech32-prefix ${bech32_prefix})
@@ -380,7 +422,7 @@
380422
inherit name;
381423
runtimeInputs = [
382424
ibc-union-contract-addresses
383-
cosmwasm-deployer.packages.cosmwasm-deployer
425+
cosmwasm-deployer
384426
];
385427
text = ''
386428
DEPLOYER=$(cosmwasm-deployer address-of-private-key --private-key ${private_key} --bech32-prefix ${bech32_prefix})
@@ -417,7 +459,7 @@
417459
inherit name;
418460
runtimeInputs = [
419461
ibc-union-contract-addresses
420-
cosmwasm-deployer.packages.cosmwasm-deployer
462+
cosmwasm-deployer
421463
];
422464
text = ''
423465
DEPLOYER=$(cosmwasm-deployer address-of-private-key --private-key ${private_key} --bech32-prefix ${bech32_prefix})
@@ -442,7 +484,7 @@
442484

443485
ibc-union-contract-addresses = pkgs.writeShellApplication {
444486
name = "ibc-union-contract-addresses";
445-
runtimeInputs = [ cosmwasm-deployer.packages.cosmwasm-deployer ];
487+
runtimeInputs = [ cosmwasm-deployer ];
446488
text = ''
447489
cosmwasm-deployer \
448490
addresses \
@@ -524,7 +566,7 @@
524566
pkgs.writeShellApplication {
525567
name = "${name}-deployments-json-entry";
526568
runtimeInputs = [
527-
cosmwasm-deployer.packages.cosmwasm-deployer
569+
cosmwasm-deployer
528570
pkgs.jq
529571
ibc-union-contract-addresses
530572
];
@@ -584,6 +626,7 @@
584626
bytecode-base
585627
cw721-base
586628
ucs03-zkgm
629+
cosmwasm-deployer
587630
# native-token-minter
588631
cw20-token-minter
589632
ibc-union
@@ -612,11 +655,16 @@
612655
value = deployments-json-entry args;
613656
}) networks
614657
))
658+
// (builtins.listToAttrs (
659+
map (args: {
660+
name = "finalize-deployment-${args.name}";
661+
value = finalize-deployment args;
662+
}) (builtins.filter (network: network ? multisig_address) networks)
663+
))
615664
)
616665
// (builtins.foldl' (a: b: a // b) { } (map chain-migration-scripts networks))
617666
// derivation { name = "cosmwasm-scripts"; };
618667
}
619-
// cosmwasm-deployer.packages
620668
//
621669
# all light clients
622670
(builtins.listToAttrs (

cosmwasm/deployer/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ repository = { workspace = true }
1212
workspace = true
1313

1414
[dependencies]
15-
anyhow = "1.0.95"
15+
anyhow = { version = "1.0.95", features = ["std"] }
1616
bip32 = { workspace = true }
1717
clap = { workspace = true, features = ["derive", "error-context", "help"] }
1818
cometbft-rpc = { workspace = true }
1919
cosmos-client = { workspace = true }
2020
cosmwasm-std = { workspace = true, features = ["std"] }
21+
futures = { workspace = true }
2122
hex-literal = { workspace = true }
2223
ibc-union-light-client = { workspace = true }
2324
ibc-union-msg = { workspace = true }
@@ -33,5 +34,5 @@ tracing = { workspace = true }
3334
tracing-subscriber = { workspace = true, features = ["env-filter", "fmt", "ansi"] }
3435
ucs03-zkgm = { workspace = true, features = ["library"] }
3536
ucs03-zkgm-token-minter-api = { workspace = true }
36-
unionlabs = { workspace = true }
37+
unionlabs = { workspace = true, features = ["proto"] }
3738
unionlabs-cosmwasm-upgradable = { workspace = true }

0 commit comments

Comments
 (0)