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

Oasis-style encryption envelope #747

Merged
merged 11 commits into from
Sep 6, 2024
Merged

Oasis-style encryption envelope #747

merged 11 commits into from
Sep 6, 2024

Conversation

pro-wh
Copy link
Collaborator

@pro-wh pro-wh commented Aug 30, 2024

cross reference #407, getting the EVM-style encryption envelope

cross reference #704, confusion about why method is not known

sample output for the tx in #704, https://explorer.oasis.io/mainnet/sapphire/tx/7224d59e6b74d9b2caf55ab40dfe0757cef4f71c66d3a7aba3de1d267d2ea409

{
  "is_total_count_clipped": false,
  "total_count": 1,
  "transactions": [
    {
      "amount": "0",
      "charged_fee": "1238900000000000",
      "fee": "1238900000000000",
      "fee_symbol": "ROSE",
      "gas_limit": 12389,
      "gas_used": 12389,
      "hash": "7224d59e6b74d9b2caf55ab40dfe0757cef4f71c66d3a7aba3de1d267d2ea409",
      "index": 4,
      "method": "",
      "nonce_0": 27,
      "oasis_encryption_envelope": {
        "data": "M+EtPEsK0Jx6YBWovQqDc8Vfmwy86L0EE66kv1++2RYxbXYj2zQsPmHPJLhC1VELHKVJQ/WKF+lTYhV3XhPdjTl1CiY8HiY7BcbL+t4nHB77mrGAeDBZV3nAJt4=",
        "data_nonce": "p8fnoq24sBge89XBVnvG",
        "format": "encrypted/x25519-deoxysii",
        "public_key": "ZDSfM+5QCZez+7fEjVOGmY2UlF82Q/KKR7Void3UHUQ=",
        "result": "noRd8cBSdvefZ7LS+OtovFFkOKRz",
        "result_nonce": "AAAAAAA89jEAAAAEAAAA"
      },
      "round": 3995186,
      "sender_0": "oasis1qqugfeelqtp3qaxhdrwfv9nhpvwckjxr7yk369p7",
      "sender_0_eth": "0x4f1DAE99883E44c924Db37e4B537Da87A7459029",
      "size": 389,
      "timestamp": "2024-06-03T02:21:26-07:00"
    }
  ]
}

@pro-wh pro-wh added the analysis-layer Analysis layer-related issues. label Aug 30, 2024
@pro-wh pro-wh force-pushed the pro-wh/bugfix/unknownouter branch from 722a18c to 33dd673 Compare September 3, 2024 19:21
@pro-wh pro-wh force-pushed the pro-wh/feature/oasisenvelope branch from f06312e to 5c875b4 Compare September 3, 2024 21:30
@pro-wh pro-wh force-pushed the pro-wh/bugfix/unknownouter branch from 33dd673 to ba591d8 Compare September 3, 2024 21:30
Base automatically changed from pro-wh/bugfix/unknownouter to main September 3, 2024 22:14
@pro-wh pro-wh force-pushed the pro-wh/feature/oasisenvelope branch from 5c875b4 to ae7bace Compare September 3, 2024 22:15
@pro-wh pro-wh changed the base branch from main to pro-wh/feature/nullerror September 3, 2024 22:15
@pro-wh pro-wh force-pushed the pro-wh/feature/oasisenvelope branch from ae7bace to 5b0bd01 Compare September 3, 2024 22:58
@pro-wh pro-wh force-pushed the pro-wh/feature/nullerror branch 2 times, most recently from 159db20 to 7cfd53d Compare September 3, 2024 23:03
@pro-wh pro-wh force-pushed the pro-wh/feature/oasisenvelope branch from 5b0bd01 to 48698dd Compare September 3, 2024 23:03
Copy link
Collaborator

@Andrew7234 Andrew7234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for looking into this!

analyzer/runtime/oasis_encryption.go Outdated Show resolved Hide resolved
Base automatically changed from pro-wh/feature/nullerror to main September 4, 2024 19:12
@pro-wh
Copy link
Collaborator Author

pro-wh commented Sep 4, 2024

the logic for handling these uses these two sets of encrypted stuff differently, so it's fine and/or convenient to have these be separate tx properties. the logic is roughly this:

distinctions, btw:

  • tx Call vs evm data Call
  • outer Call vs inner Call
  • (and similarly for CallResult)
1. have outer tx Call
2. if outer tx Call format is encrypted
   i. parse encryption envelope <-- oasis_encrypted_*
   ii. display encryption envelope
   iii. if we can decrypt inner tx Call (i.e. the runtime does this with the runtime's key, explorer will maybe let a user provide the cleartext)
      a. parse inner tx Call
   iv. otherwise we have no further info, exit
3. otherwise outer tx Call is unencrypted, and inner tx Call is the same structure
4. have inner tx Call
5. display method name
6. if it's an evm method
   i. display to address (for calls), value, gas, etc.
   ii. if data parses as outer evm data Call:
      a. parse encryption envelope <-- evm_encrypted_*
      b. display encryption envelope
      c. if we can decrypt inner evm data Call
         (1) parse inner evm data Call
      d. otherwise we have no further info, exit
      e. have inner evm data Call
      f. extract data from inner evm data Call
   iii. otherwise data is the actual evm data
   iv. have evm data
   v. (further parsing or display of evm data)

Copy link
Collaborator

@Andrew7234 Andrew7234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanation! Lgtm

@pro-wh pro-wh force-pushed the pro-wh/feature/oasisenvelope branch 2 times, most recently from 754d589 to b0a8a14 Compare September 5, 2024 22:52
@pro-wh
Copy link
Collaborator Author

pro-wh commented Sep 5, 2024

unified the EncryptedData structure

@pro-wh pro-wh force-pushed the pro-wh/feature/oasisenvelope branch from 1533335 to fd19203 Compare September 6, 2024 00:09
@pro-wh pro-wh merged commit 9b877d5 into main Sep 6, 2024
16 checks passed
@pro-wh pro-wh deleted the pro-wh/feature/oasisenvelope branch September 6, 2024 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analysis-layer Analysis layer-related issues.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants