Skip to content

Commit

Permalink
fix: add myth delivery fee (#3090)
Browse files Browse the repository at this point in the history
* fix: add myth delivery fee

* fix: count delivery fee
  • Loading branch information
stepanLav authored Oct 7, 2024
1 parent 6bac934 commit 1b44c32
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
33 changes: 33 additions & 0 deletions scripts/print_xcm_changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,42 @@ def compare_files(actual_json, new_json, chains_json):
compare_destinations(changed_values, prod_chain_dict,
new_chain_dict, chains_json_dict)

compare_network_delivery_fee(
changed_values,
actual_json.get('networkDeliveryFee', {}),
new_json.get('networkDeliveryFee', {}),
chains_json_dict
)

return changed_values


def compare_network_delivery_fee(object_accumulator, actual_network_delivery_fee, new_network_delivery_fee, chains_json_dict):
"""Compare network delivery fee between production and changed json
Args:
object_accumulator (dict): This object accumulate all changes
actual_network_delivery_fee (dict): Dictionary with actual network delivery fee
new_network_delivery_fee (dict): Dictionary with changed network delivery fee
chains_json_dict (dict): Dictionary with chains.json
"""
for chain_id, fee_data in new_network_delivery_fee.items():
chain_name = chains_json_dict[chain_id].get('name', chain_id)
if chain_id not in actual_network_delivery_fee:
object_accumulator['networkDeliveryFee'][chain_name] = 'Added'
else:
if fee_data != actual_network_delivery_fee[chain_id]:
object_accumulator['networkDeliveryFee'][chain_name] = {
'old_value': actual_network_delivery_fee[chain_id],
'new_value': fee_data
}

for chain_id in actual_network_delivery_fee:
chain_name = chains_json_dict[chain_id].get('name', chain_id)
if chain_id not in new_network_delivery_fee:
object_accumulator['networkDeliveryFee'][chain_name] = 'Removed'


def main(argv):
"""It will compare transfers.json from endpoint and local file, then print changes. Depends on parametrs it will print changes for dev or prod environment. Also it prepared as to run locally with default parameters, as to run in CI/CD pipeline with parameters from environment variables.
Expand Down
16 changes: 16 additions & 0 deletions xcm/v6/transfers_dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,22 @@
"sizeFactor": "100000",
"alwaysHoldingPays": false
}
},
"f6ee56e9c5277df5b4ce6ae9983ee88f3cbed27d31beeb98f9f84f997a1ab0b9": {
"toParent": {
"type": "exponential",
"factorPallet": "ParachainSystem",
"sizeBase": "300000000",
"sizeFactor": "100000",
"alwaysHoldingPays": false
},
"toParachain": {
"type": "exponential",
"factorPallet": "XcmpQueue",
"sizeBase": "300000000",
"sizeFactor": "100000",
"alwaysHoldingPays": false
}
}
},
"networkBaseWeight": {
Expand Down

0 comments on commit 1b44c32

Please sign in to comment.