Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[api] Add signature_type to AccountSignature #15926

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gregnazario
Copy link
Contributor

@gregnazario gregnazario commented Feb 10, 2025

Description

For a while, it's hard to tell what the underlying type of each signature is. Now, it adds a non-conflicting type to determine it.

Note that, this change currently breaks the existing OpenAPI spec documentation, but will still work with the old information.

How Has This Been Tested?

I tested this manually against many of the different types of transactions in the API, to see how they would show up in the explorer. Here are some examples:

Single key, with ed25519:

{
  "public_key":{
    "value":"0x4d7139da37bda01a68efd463fcafb67effb7c5ea0b5375d18a81439ee642d0b3"
    "type":"ed25519"
  }
  "signature":{
    "value":"0x5371902e6be7a747f6ef4e5c79e69a9c6ff9d4339df2823d115d2b28223f0887a562d0ee469538..."
    "type":"ed25519"
  }
  "type":"single_sender"
  "signature_type":"single_key_signature"
}

Single key, with secp256k1:

{
  "public_key": {
    "value": "0x044a10acd849690bccfa8a74e66de26a2bada930ba65ba795877e7b5c19f7cd91475d539dfd799...",
    "type": "secp256k1_ecdsa"
  },
  "signature": {
    "value": "0xe80937ecf14fb43097370d466121fec705a0399ada293eac544159a7bfb6214c368a6012722007...",
    "type": "secp256k1_ecdsa"
  },
  "signature_type": "single_key_signature",
  "type": "single_sender"
}

Abstraction:

{
  "function_info": "a7a28b48b320bcbce6bbf651b8df497dcdc28e132edb0eb043b7fa822d0d29f7::public_key_aut...",
  "auth_data": "0x0020d4298fcbed8db14395a3c43f85660ead880ed833b0680cea8441ab8ed9efc8d662203b04c6...",
  "signature_type": "abstraction_signature",
  "type": "single_sender"
}

Ed25519 (original):

{
  "public_key": "0x2f4847fee7c1612edd78cfbccdce7928e4925a61c1f752d8c893765aa3cc585d",
  "signature": "0x49fb5a47d34edf4854c028374c057f3d95d6d2aa7fba3d4eb7c89cda01b8ea28e54953b4e3976c...",
  "type": "ed25519_signature"
}

MultiKey:

{
  "public_keys": [
    {
      "value": "0x157f8119aa413789ff05ce0237c01b53c5d79e033700f27a5a98d6f25b061e15",
      "type": "ed25519"
    },
    {
      "value": "0xb6d55b87fc4b274f50ef50bf2dd953f00c56c2565d240155852c25f1c301c90e",
      "type": "ed25519"
    },
    {
      "value": "0x0477686a315555bf3fd2dfa1acc2e4338ab84e6f8f4bb93521a6d21209a6fb20f3e131d0e374f2...",
      "type": "secp256k1_ecdsa"
    }
  ],
  "signatures": [
    {
      "index": 0,
      "signature": {
        "value": "0x065e6588c8e3144d1411a0910f7a1a7876e5acb9a6e08d545e4d47b7af72eb01cfea20b04cdbcd...",
        "type": "ed25519"
      }
    },
    {
      "index": 1,
      "signature": {
        "value": "0x5c8050c6858b076093068c12e32c778bf8a1930310dd73f3efb525a57ab22e8a5b09c17102dc81...",
        "type": "ed25519"
      }
    },
    {
      "index": 2,
      "signature": {
        "value": "0xbf092cdc343d605c7c30c8216febb54a400fc87b43dcd5b2bbe53878409191e85e02e9b0b42912...",
        "type": "secp256k1_ecdsa"
      }
    }
  ],
  "signatures_required": 3,
  "type": "single_sender",
  "signature_type": "multi_key_signature"
}

Multiagent with single signers in it

{
  "sender": {
    "public_keys": [
      {
        "value": "0x3c4d4d1a7e39ce4be8d9eb21ca94588a8abbe7aab8085a5634f8ac8cc4772e62",
        "type": "ed25519"
      },
      {
        "value": "0x6ffe6c83b029dd0955b4c4204d7d6c2e33437efae90ea96137c46e7bdcb6b3af",
        "type": "ed25519"
      },
      {
        "value": "0x0474c524c42d9cb02b60ebfdf94709ff8cbbc1ea5793a66e402957e8f44341ea613c5e3799c014...",
        "type": "secp256k1_ecdsa"
      }
    ],
    "signatures": [
      {
        "index": 0,
        "signature": {
          "value": "0x4765e75e17ea7e27271f77a618144fcaf404160d540dd747f22c342261f2390a124e8cabea79dc...",
          "type": "ed25519"
        }
      },
      {
        "index": 1,
        "signature": {
          "value": "0xef594c12d3cd3973db327ef8a96df2281a449467061e59bca6973da8778ede288164b14701197a...",
          "type": "ed25519"
        }
      },
      {
        "index": 2,
        "signature": {
          "value": "0xb88f5d8c0dada4256b4bce904db28a764acae85b415eca6b4cac925102cb5d0c390cb068d9e1e2...",
          "type": "secp256k1_ecdsa"
        }
      }
    ],
    "signatures_required": 3,
    "type": "multi_key_signature",
    "signature_type": "multi_key_signature"
  },
  "secondary_signer_addresses": [
    "0x67ec75166b320d045a1bbe4570065212ba43ff23b247e54bdaec0f208d8af41c"
  ],
  "secondary_signers": [
    {
      "public_key": {
        "value": "0x04b267eac22b50ee5e9cd2dc12a9cc658564f51ac392366778f0e1a882db9a365a9e8e2d1d48e1...",
        "type": "secp256k1_ecdsa"
      },
      "signature": {
        "value": "0x4246458f6ec05d22bdd42af1ab62c0904b19da964e98dcd99111dde7d8a478c52d751b097e08ee...",
        "type": "secp256k1_ecdsa"
      },
      "type": "single_key_signature",
      "signature_type": "single_key_signature"
    }
  ],
  "type": "multi_agent_signature"
}

Fee payer

{
  "sender": {
    "public_key": "0xf3e5d0ab97b300e362c66c7b7e055885bf8ecc7bbef227b890fdd13dd04e7101",
    "signature": "0x1002c890edfd14f558d99a0ca1ecf53f3dbfcd9c08e13660bb3d8948439ebc47af5c8062962a62...",
    "type": "ed25519_signature",
    "signature_type": "ed25519_signature"
  },
  "secondary_signer_addresses": [],
  "secondary_signers": [],
  "fee_payer_address": "0x1783973c1d04ee8e4cb099f6c43e4896bf8ff868ee195509063d42223ebd7a08",
  "fee_payer_signer": {
    "public_key": "0xc897e48af8606340e8112ee095bf2884bb0bcf3ccdc52041c1792fa2102a4ee7",
    "signature": "0xa46157d8160b578449329c39f34c5c0a9c5fdf4bf67d51d876e0cb9f27e6d6128a036758f51215...",
    "type": "ed25519_signature",
    "signature_type": "ed25519_signature"
  },
  "type": "fee_payer_signature"
}

Key Areas to Review

Type of Change

  • New feature
  • Bug fix
  • Breaking change
  • Performance improvement
  • Refactoring
  • Dependency update
  • Documentation update
  • Tests

Which Components or Systems Does This Change Impact?

  • Validator Node
  • Full Node (API, Indexer, etc.)
  • Move/Aptos Virtual Machine
  • Aptos Framework
  • Aptos CLI/SDK
  • Developer Infrastructure
  • Move Compiler
  • Other (specify)

Checklist

  • I have read and followed the CONTRIBUTING doc
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I identified and added all stakeholders and component owners affected by this change as reviewers
  • I tested both happy and unhappy path of the functionality
  • I have made corresponding changes to the documentation

For a while, it's hard to tell what the underlying type of each
signature is.  Now, it adds a non-conflicting type to determine it.

Note that, this change currently breaks the existing OpenAPI spec
documentation, but will still work with the old information.
Copy link

trunk-io bot commented Feb 10, 2025

⏱️ 5m total CI duration on this PR
Job Cumulative Duration Recent Runs
rust-cargo-deny 2m 🟩
check-dynamic-deps 2m 🟩
general-lints 27s 🟩
semgrep/ci 22s 🟩
file_change_determinator 11s 🟩
permission-check 2s 🟩
permission-check 2s 🟩

settingsfeedbackdocs ⋅ learn more about trunk.io

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant