• Juan C's avatar
    Add Kontrol proof `prove_relayMessage_paused` (#9156) · 34592a1e
    Juan C authored
    * `KontrolDeployment`: deploy `L1CrossDomainMessenger`
    
    * KontrolInterfaces: add `IL1CrossDomainMessenger`
    
    * Add deployment summary tests for `L1CrossDomainMessenger`
    
    * Add `prove_relayMessage_paused`
    
    * `run-kontrol.sh`: add `prove_relayMessage_paused`
    
    * `run-kontrol.sh`: correct help message to install right kontrol version
    
    * Bump Kontrol version from `0.1.121` to `0.1.127`
    
    * `forge fmt`
    
    * Update `Kontrol-Deploy.json`
    
    * `README.md`: Add `L1CrossDomainMessenger.k.sol` documentation
    
    * Fix typos
    
    * Make autogenerated address names start with lowercase
    34592a1e
reverse_key_values.py 1.54 KB
"""
Description:
    Reverses the key-value pairs of a given JSON
    The use case for this script within the project is to reverse the key-value
    pairs of the auto generated file contracts-bedrock/deployments/hardhat/.deployment
    so that it can be fed as the `--contract-names` argument to `kontrol summary`
    This script is used in ../make-summary-deployment.sh

Usage:
    To reverse the order of an $input_file and save it to an $output_file run
    `python3 reverse_key_values.py $input_file $output_file`
"""

import sys
import json

def reverse_json(input_file, output_file):
    try:
        with open(input_file, 'r') as file:
            json_data = json.load(file)

        reversed_json = {str(value): key[0].lower() + key[1:] for key, value in json_data.items()}

        with open(output_file, 'w') as file:
            json.dump(reversed_json, file, indent=2)

        print(f"Reversed JSON saved to {output_file}")

    except FileNotFoundError:
        print(f"Error: File not found: {input_file}")
        sys.exit(1)
    except json.JSONDecodeError:
        print(f"Error: Invalid JSON format in file: {input_file}")
        sys.exit(1)

if __name__ == "__main__":
    # Check if both input and output file paths are provided
    if len(sys.argv) != 3:
        print("Usage: reverse_key_values.py <input_file_path> <output_file_path>")
        sys.exit(1)

    input_file_path = sys.argv[1]
    output_file_path = sys.argv[2]

    # Execute the function to reverse JSON and save to the output file
    reverse_json(input_file_path, output_file_path)