From 1dcb546f30156cecbe7bbb71cbff71a4fecdd802 Mon Sep 17 00:00:00 2001 From: Dante Sanchez Date: Mon, 20 Nov 2023 11:30:46 -0500 Subject: [PATCH] add jq patch to sort coins --- cosmos_genesis_tinker.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cosmos_genesis_tinker.py b/cosmos_genesis_tinker.py index 1cc7732..102a569 100755 --- a/cosmos_genesis_tinker.py +++ b/cosmos_genesis_tinker.py @@ -389,6 +389,13 @@ def replace_validator(self, old_validator: Validator, new_validator: Validator): self.preprocessing_file], check=True) + # Sort coins in bank balances + self.log_step("Sorting balances coins") + subprocess.run(f"jq '.app_state.bank.balances |= map(.coins |= sort_by(.denom))' {self.preprocessing_file} > sorted.json", + check=True, shell=True) + subprocess.run(f"mv sorted.json {self.preprocessing_file}", + check=True, shell=True) + def load_file(self, path): """ Loads a genesis file from the given path