diff --git a/BIPs/4269-W69/unit_test/data_type_casting/more_tuples.json b/BIPs/4269-W69/unit_test/data_type_casting/more_tuples.json new file mode 100644 index 000000000..e651b4f58 --- /dev/null +++ b/BIPs/4269-W69/unit_test/data_type_casting/more_tuples.json @@ -0,0 +1,134 @@ +{ + "version": "1.0", + "chainId": "1", + "createdAt": 1729225805956, + "meta": { + "name": "Transactions Batch", + "description": "", + "txBuilderVersion": "1.17.0", + "createdFromSafeAddress": "0xc38c5f97B34E175FFd35407fc91a937300E33860", + "createdFromOwnerAddress": "", + "checksum": "0x4a6bbf44563a05b2da6cdb89c41788057421c21aa58e0724ef365c2f82dc7ae0" + }, + "transactions": [ + { + "to": "0x8f72fcf695523A6FC7DD97EafDd7A083c386b7b6", + "value": "0", + "data": null, + "contractMethod": { + "inputs": [ + { + "components": [ + { + "internalType": "string", + "name": "protocolName", + "type": "string" + }, + { + "components": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "contact", + "type": "string" + } + ], + "internalType": "struct Contact[]", + "name": "contactDetails", + "type": "tuple[]" + }, + { + "components": [ + { + "internalType": "address", + "name": "assetRecoveryAddress", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "accountAddress", + "type": "address" + }, + { + "internalType": "enum ChildContractScope", + "name": "childContractScope", + "type": "uint8" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "internalType": "struct Account[]", + "name": "accounts", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "internalType": "struct Chain[]", + "name": "chains", + "type": "tuple[]" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "bountyPercentage", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "bountyCapUSD", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "retainable", + "type": "bool" + }, + { + "internalType": "enum IdentityRequirements", + "name": "identity", + "type": "uint8" + }, + { + "internalType": "string", + "name": "diligenceRequirements", + "type": "string" + } + ], + "internalType": "struct BountyTerms", + "name": "bountyTerms", + "type": "tuple" + }, + { + "internalType": "string", + "name": "agreementURI", + "type": "string" + } + ], + "internalType": "struct AgreementDetailsV1", + "name": "details", + "type": "tuple" + } + ], + "name": "adoptSafeHarbor", + "payable": false + }, + "contractInputsValues": { + "details": "[\"Balancer\",[[\"Telegram: Mikeisballin\",\"Mike B - Strategy\"]],[[\"0x10A19e7eE7d7F8a52822f6817de8ea18204F2e4f\",[[\"0xBA12222222228d8Ba445958a75a0704d566BF2C8\",0,\"0x\"]],1],[\"0xaF23DC5983230E9eEAf93280e312e57539D098D0\",[[\"0xBA12222222228d8Ba445958a75a0704d566BF2C8\",0,\"0x\"]],42161],[\"0x17b11FF13e2d7bAb2648182dFD1f1cfa0E4C7cf3\",[[\"0xBA12222222228d8Ba445958a75a0704d566BF2C8\",0,\"0x\"]],43114],[\"0xC40DCFB13651e64C8551007aa57F9260827B6462\",[[\"0xBA12222222228d8Ba445958a75a0704d566BF2C8\",0,\"0x\"]],8453],[\"0x4f22C2784Cbd2B24a172566491Ee73fee1A63c2e\",[[\"0xBA12222222228d8Ba445958a75a0704d566BF2C8\",0,\"0x\"]],252],[\"0x2a5AEcE0bb9EfFD7608213AE1745873385515c18\",[[\"0xBA12222222228d8Ba445958a75a0704d566BF2C8\",0,\"0x\"]],100],[\"0x4f22C2784Cbd2B24a172566491Ee73fee1A63c2e\",[[\"0xBA12222222228d8Ba445958a75a0704d566BF2C8\",0,\"0x\"]],34443],[\"0x043f9687842771b3dF8852c1E9801DCAeED3f6bc\",[[\"0xBA12222222228d8Ba445958a75a0704d566BF2C8\",0,\"0x\"]],10],[\"0xeE071f4B516F69a1603dA393CdE8e76C40E5Be85\",[[\"0xBA12222222228d8Ba445958a75a0704d566BF2C8\",0,\"0x\"]],137],[\"0x2f237e7643a3bF6Ef265dd6FCBcd26a7Cc38dbAa\",[[\"0xBA12222222228d8Ba445958a75a0704d566BF2C8\",0,\"0x\"]],1101]],[10,1000000,false,2,\"KYC & Global Sanction Verification. Balancer requires all eligible whitehats to undergo Know Your Customer (KYC) verification and be screened against global sanctions lists, including OFAC, UK, and EU regulations. This process ensures that all bounty recipients are compliant with legal and regulatory standards before qualifying for payment.\"],\"https://bafybeiakxvysdvsvupqcibkpifugzwcnllzt2udjk3l4yhcix7dqxxqyp4.ipfs.w3s.link/agreement.pdf\"]" + } + } + ] +} diff --git a/BIPs/4269-W69/unit_test/data_type_casting/more_tuples.report.txt b/BIPs/4269-W69/unit_test/data_type_casting/more_tuples.report.txt new file mode 100644 index 000000000..ed7b8bb13 --- /dev/null +++ b/BIPs/4269-W69/unit_test/data_type_casting/more_tuples.report.txt @@ -0,0 +1,78 @@ +FILENAME: `BIPs/4269-W69/unit_test/data_type_casting/more_tuples.json` +MULTISIG: `multisigs/lm (mainnet:0xc38c5f97B34E175FFd35407fc91a937300E33860)` +COMMIT: `5764604a606bb54b5d243af62bcd6967e20766e3` +CHAIN(S): `mainnet` +TENDERLY: `🟪 SKIPPED (Web3ValidationError("\nCould not identify the intended function with name `adoptSafeHarbor`, positional arguments with type(s) `((str,str,str,str,str))` and keyword arguments with type(s) `{}`.\nFound 1 function(s) with the name `adoptSafeHarbor`: ['adoptSafeHarbor((string,(string,string)[],(address,(address,uint8,bytes)[],uint256)[],(uint256,uint256,bool,uint8,string),string))']\nFunction invocation failed due to no matching argument types."))` + +``` ++-----------------+-------------------------------------------------------------------+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+------------+----------+ +| fx_name | to | value | inputs | bip_number | tx_index | ++-----------------+-------------------------------------------------------------------+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+------------+----------+ +| adoptSafeHarbor | 0x8f72fcf695523A6FC7DD97EafDd7A083c386b7b6 (safe_harbor/registry) | 0 | { | N/A | N/A | +| | | | "details": [ | | | +| | | | "\"Balancer\"", | | | +| | | | "[[\"Telegram:Mikeisballin\"", | | | +| | | | "\"MikeB-Strategy\"]]", | | | +| | | | "[[\"0x10A19e7eE7d7F8a52822f6817de8ea18204F2e4f\"", | | | +| | | | "[[\"0xBA12222222228d8Ba445958a75a0704d566BF2C8\"", | | | +| | | | "0", | | | +| | | | "\"0x\"]]", | | | +| | | | "1]", | | | +| | | | "[\"0xaF23DC5983230E9eEAf93280e312e57539D098D0\"", | | | +| | | | "[[\"0xBA12222222228d8Ba445958a75a0704d566BF2C8\"", | | | +| | | | "0", | | | +| | | | "\"0x\"]]", | | | +| | | | "42161]", | | | +| | | | "[\"0x17b11FF13e2d7bAb2648182dFD1f1cfa0E4C7cf3\"", | | | +| | | | "[[\"0xBA12222222228d8Ba445958a75a0704d566BF2C8\"", | | | +| | | | "0", | | | +| | | | "\"0x\"]]", | | | +| | | | "43114]", | | | +| | | | "[\"0xC40DCFB13651e64C8551007aa57F9260827B6462\"", | | | +| | | | "[[\"0xBA12222222228d8Ba445958a75a0704d566BF2C8\"", | | | +| | | | "0", | | | +| | | | "\"0x\"]]", | | | +| | | | "8453]", | | | +| | | | "[\"0x4f22C2784Cbd2B24a172566491Ee73fee1A63c2e\"", | | | +| | | | "[[\"0xBA12222222228d8Ba445958a75a0704d566BF2C8\"", | | | +| | | | "0", | | | +| | | | "\"0x\"]]", | | | +| | | | "252]", | | | +| | | | "[\"0x2a5AEcE0bb9EfFD7608213AE1745873385515c18\"", | | | +| | | | "[[\"0xBA12222222228d8Ba445958a75a0704d566BF2C8\"", | | | +| | | | "0", | | | +| | | | "\"0x\"]]", | | | +| | | | "100]", | | | +| | | | "[\"0x4f22C2784Cbd2B24a172566491Ee73fee1A63c2e\"", | | | +| | | | "[[\"0xBA12222222228d8Ba445958a75a0704d566BF2C8\"", | | | +| | | | "0", | | | +| | | | "\"0x\"]]", | | | +| | | | "34443]", | | | +| | | | "[\"0x043f9687842771b3dF8852c1E9801DCAeED3f6bc\"", | | | +| | | | "[[\"0xBA12222222228d8Ba445958a75a0704d566BF2C8\"", | | | +| | | | "0", | | | +| | | | "\"0x\"]]", | | | +| | | | "10]", | | | +| | | | "[\"0xeE071f4B516F69a1603dA393CdE8e76C40E5Be85\"", | | | +| | | | "[[\"0xBA12222222228d8Ba445958a75a0704d566BF2C8\"", | | | +| | | | "0", | | | +| | | | "\"0x\"]]", | | | +| | | | "137]", | | | +| | | | "[\"0x2f237e7643a3bF6Ef265dd6FCBcd26a7Cc38dbAa\"", | | | +| | | | "[[\"0xBA12222222228d8Ba445958a75a0704d566BF2C8\"", | | | +| | | | "0", | | | +| | | | "\"0x\"]]", | | | +| | | | "1101]]", | | | +| | | | "[10", | | | +| | | | "1000000", | | | +| | | | "false", | | | +| | | | "2", | | | +| | | | "\"KYC&GlobalSanctionVerification.BalancerrequiresalleligiblewhitehatstoundergoKnowYourCustomer(KYC)verificationandbescreenedagainstglobalsanctionslists", | | | +| | | | "includingOFAC", | | | +| | | | "UK", | | | +| | | | "andEUregulations.Thisprocessensuresthatallbountyrecipientsarecompliantwithlegalandregulatorystandardsbeforequalifyingforpayment.\"]", | | | +| | | | "\"https://bafybeiakxvysdvsvupqcibkpifugzwcnllzt2udjk3l4yhcix7dqxxqyp4.ipfs.w3s.link/agreement.pdf\"" | | | +| | | | ] | | | +| | | | } | | | ++-----------------+-------------------------------------------------------------------+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+------------+----------+ +``` diff --git a/BIPs/4269-W69/unit_test/data_type_casting/simple_tuple.json b/BIPs/4269-W69/unit_test/data_type_casting/simple_tuple.json new file mode 100644 index 000000000..bb9c5e730 --- /dev/null +++ b/BIPs/4269-W69/unit_test/data_type_casting/simple_tuple.json @@ -0,0 +1,44 @@ +{ + "version": "1.0", + "chainId": "34443", + "createdAt": 1730139390525, + "meta": { + "name": "Transactions Batch", + "description": "", + "txBuilderVersion": "1.16.5", + "createdFromSafeAddress": "0x9ff471F9f98F42E5151C7855fD1b5aa906b1AF7e", + "createdFromOwnerAddress": "", + "checksum": "0x53531d16f59ade450f97769d73da6668e00604c1b5430f89f2a0ed5f590a20cd" + }, + "transactions": [ + { + "to": "0x2aA8A5C1Af4EA11A1f1F10f3b73cfB30419F77Fb", + "value": "0", + "data": null, + "contractMethod": { + "inputs": [ + { "internalType": "uint256", "name": "_tokenId", "type": "uint256" }, + { + "components": [ + { + "internalType": "uint256", + "name": "weight", + "type": "uint256" + }, + { "internalType": "address", "name": "gauge", "type": "address" } + ], + "internalType": "struct IGaugeVote.GaugeVote[]", + "name": "_votes", + "type": "tuple[]" + } + ], + "name": "vote", + "payable": false + }, + "contractInputsValues": { + "_tokenId": "98", + "_votes": "[[1,\"0x9ff471F9f98F42E5151C7855fD1b5aa906b1AF7e\"]]" + } + } + ] +} diff --git a/BIPs/4269-W69/unit_test/data_type_casting/simple_tuple.report.txt b/BIPs/4269-W69/unit_test/data_type_casting/simple_tuple.report.txt new file mode 100644 index 000000000..cb44bd86c --- /dev/null +++ b/BIPs/4269-W69/unit_test/data_type_casting/simple_tuple.report.txt @@ -0,0 +1,21 @@ +FILENAME: `BIPs/4269-W69/unit_test/data_type_casting/simple_tuple.json` +MULTISIG: `multisigs/lm (mode:0x9ff471F9f98F42E5151C7855fD1b5aa906b1AF7e)` +COMMIT: `5764604a606bb54b5d243af62bcd6967e20766e3` +CHAIN(S): `mode` +TENDERLY: [`🟩 SUCCESS`](https://www.tdly.co/shared/simulation/a04f1e83-2b77-465d-87f3-71d9bb2d8d24) + +``` ++---------+---------------------------------------------------------------------------------------+-------+------------------------------------------------------+------------+----------+ +| fx_name | to | value | inputs | bip_number | tx_index | ++---------+---------------------------------------------------------------------------------------+-------+------------------------------------------------------+------------+----------+ +| vote | 0x2aA8A5C1Af4EA11A1f1F10f3b73cfB30419F77Fb (modeGovernance/mode8020BPTVotingContract) | 0 | { | N/A | N/A | +| | | | "_tokenId": [ | | | +| | | | "98" | | | +| | | | ], | | | +| | | | "_votes": [ | | | +| | | | "1", | | | +| | | | "\"0x9ff471F9f98F42E5151C7855fD1b5aa906b1AF7e\"" | | | +| | | | ] | | | +| | | | } | | | ++---------+---------------------------------------------------------------------------------------+-------+------------------------------------------------------+------------+----------+ +``` diff --git a/action-scripts/brownie/scripts/script_utils.py b/action-scripts/brownie/scripts/script_utils.py index 2a37ab5e1..de7eac603 100644 --- a/action-scripts/brownie/scripts/script_utils.py +++ b/action-scripts/brownie/scripts/script_utils.py @@ -258,6 +258,37 @@ def run_tenderly_sim(network_id: str, safe_addr: str, transactions: list[dict]): ] = to_checksum_address( tx["contractInputsValues"][input["name"]] ) + # tuple + elif "tuple" in input["type"]: + casted_tuple = [] + for idx, tuple_item in enumerate( + tx["contractInputsValues"][input["name"]] + .strip("[]") + .split(",") + ): + try: + if "bool" in input["components"][idx]["type"]: + casted_tuple.append( + True + if tuple_item.strip('"') == "true" + else False + ) + elif re.search( + r"int[0-9]+", input["components"][idx]["type"] + ): + casted_tuple.append(int(tuple_item.strip('"'))) + elif "address" in input["components"][idx]["type"]: + casted_tuple.append( + to_checksum_address(tuple_item.strip('"')) + ) + else: + casted_tuple.append(str(tuple_item.strip('"'))) + tx["contractInputsValues"][input["name"]] = [ + tuple(casted_tuple) + ] + except IndexError: + # payload contains nested tuples; no support yet + continue # catchall; cast to str else: if "[]" in input["type"]: