Skip to content

Conversation

@pcaversaccio
Copy link
Owner

@pcaversaccio pcaversaccio commented Sep 3, 2025

🕓 Changelog

This PR fixes a bug in the print_decoded_data function's nested transaction parser, making it more robust. Previously, the logic could fail on common transaction structures. The updated implementation now correctly handles the valueDecoded field whether it's a single object or an array, and reliably extracts method names across different data schemas, ensuring accurate parsing of nested calls.

Furthermore, this PR enhances print_decoded_data by adding support for detecting on-chain rejections. Previously, transactions with data == 0x were always displayed as ETH transfers, even when they were semantically rejections. The script now distinguishes between on-chain rejections (where the to address equals the multisig address and value is 0), ETH self-transfers (where the to address equals the multisig and value is non-zero), zero-value ETH transfers (where the to address is different but value is 0), and standard ETH transfers (where the to address is different and value is non-zero). This improves the clarity and accuracy of decoded transaction output.

Test Examples

./safe_hashes.sh --network ethereum --address 0xb35096b074fdb9bBac63E3AdaE0Bbde512B2E6b6 --nonce 559

returns:

===================================
= Selected Network Configurations =
===================================

Network: ethereum
Chain ID: 1

========================================
= Transaction Data and Computed Hashes =
========================================

> Transaction Data:
Multisig address: 0xb35096b074fdb9bBac63E3AdaE0Bbde512B2E6b6
To: 0xf85880FB009671fF716632a0a74df6deF003faF9
Value: 0
Data: 0x6a761202000000000000000000000000469788fe6e9e9681c6ebf3bf78e7fd26fc0154460000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000044bd86e5086d61696e6e65742e7373766e6574776f726b2e657468000000000000000000000000000000000000000000003ea44328b48a027a5e7ada15c193cbc388268786000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041000000000000000000000000b35096b074fdb9bbac63e3adae0bbde512b2e6b600000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000
Operation: Call
Safe Transaction Gas: 0
Base Gas: 0
Gas Price: 0
Gas Token: 0x0000000000000000000000000000000000000000
Refund Receiver: 0x0000000000000000000000000000000000000000
Nonce: 559
Encoded message: 0xbb8310d486368db6bd6f849402fdd73ad53d316b5a4b2644ad6efe0f941286d8000000000000000000000000f85880fb009671ff716632a0a74df6def003faf900000000000000000000000000000000000000000000000000000000000000001295f45093b8043c0ede7d462656df40525655019140c40d95377349024d1bee000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022f
Method: execTransaction
Parameters: [
  {
    "name": "to",
    "type": "address",
    "value": "0x469788fE6E9E9681C6ebF3bF78e7Fd26Fc015446"
  },
  {
    "name": "value",
    "type": "uint256",
    "value": "0"
  },
  {
    "name": "data",
    "type": "bytes",
    "value": "0xbd86e5086d61696e6e65742e7373766e6574776f726b2e657468000000000000000000000000000000000000000000003ea44328b48a027a5e7ada15c193cbc388268786",
    "valueDecoded": {
      "method": "setDelegate",
      "parameters": [
        {
          "name": "id",
          "type": "bytes32",
          "value": "0x6d61696e6e65742e7373766e6574776f726b2e65746800000000000000000000"
        },
        {
          "name": "delegate",
          "type": "address",
          "value": "0x3EA44328B48A027a5e7Ada15C193cBC388268786"
        }
      ]
    }
  },
  {
    "name": "operation",
    "type": "uint8",
    "value": "0"
  },
  {
    "name": "safeTxGas",
    "type": "uint256",
    "value": "0"
  },
  {
    "name": "baseGas",
    "type": "uint256",
    "value": "0"
  },
  {
    "name": "gasPrice",
    "type": "uint256",
    "value": "0"
  },
  {
    "name": "gasToken",
    "type": "address",
    "value": "0x0000000000000000000000000000000000000000"
  },
  {
    "name": "refundReceiver",
    "type": "address",
    "value": "0x0000000000000000000000000000000000000000"
  },
  {
    "name": "signatures",
    "type": "bytes",
    "value": "0x000000000000000000000000b35096b074fdb9bbac63e3adae0bbde512b2e6b6000000000000000000000000000000000000000000000000000000000000000001"
  }
]

> Hashes:
Domain hash: 0x24F6B6EE7F11B966587DEAEC7E1D9365E2971F19A29EC24C96653B1DAB684B2B
Message hash: 0x25DE7ECDB5BBA68EB6D410AF9DA5CB24F7AF58EFD64AC9D197631F8FFE8414BA
Safe transaction hash: 0xaf59d25206d7f4e061b1098096026787423258e411f475678f88b14e4a804f26
./safe_hashes.sh --network sepolia --address 0x657ff0D4eC65D82b2bC1247b0a558bcd2f80A0f1 --nonce 3

returns:

===================================
= Selected Network Configurations =
===================================

Network: sepolia
Chain ID: 11155111

========================================
= Transaction Data and Computed Hashes =
========================================

> Transaction Data:
Multisig address: 0x657ff0D4eC65D82b2bC1247b0a558bcd2f80A0f1
To: 0x657ff0D4eC65D82b2bC1247b0a558bcd2f80A0f1
Value: 0
Data: 0x
Operation: Call
Safe Transaction Gas: 0
Base Gas: 0
Gas Price: 0
Gas Token: 0x0000000000000000000000000000000000000000
Refund Receiver: 0x0000000000000000000000000000000000000000
Nonce: 3
Encoded message: 0xbb8310d486368db6bd6f849402fdd73ad53d316b5a4b2644ad6efe0f941286d8000000000000000000000000657ff0d4ec65d82b2bc1247b0a558bcd2f80a0f10000000000000000000000000000000000000000000000000000000000000000c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003
Method: 0x (On-Chain Rejection)
Parameters: []

> Hashes:
Domain hash: 0x611379C19940CAEE095CDB12BEBE6A9FA9ABB74CDB1FBD7377C49A1F198DC24F
Message hash: 0xAA79283593AA79638405E190428D1BAB99D63EA6D70AB4655C57224E1AB367AE
Safe transaction hash: 0x36d9bb09ffb8370745ff56790a28902e45e7fab8e8bfb35e736989738bcbc81a

Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
@pcaversaccio pcaversaccio self-assigned this Sep 3, 2025
@pcaversaccio pcaversaccio added bug 🐛 Something isn't working refactor/cleanup ♻️ Code refactorings and cleanups labels Sep 3, 2025
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
@pcaversaccio pcaversaccio added the feature 💥 New feature or request label Sep 3, 2025
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
@pcaversaccio pcaversaccio changed the title ♻️ Improve Parsing of ABI-Decoded Transaction Data ♻️ Improve Transaction Parsing and Identify On-Chain Rejections Sep 4, 2025
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
@pcaversaccio pcaversaccio merged commit 5e952b8 into main Sep 4, 2025
6 checks passed
@pcaversaccio pcaversaccio deleted the fix/print_decoded_data branch September 4, 2025 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🐛 Something isn't working feature 💥 New feature or request refactor/cleanup ♻️ Code refactorings and cleanups

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants