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

contracts: calldata encryption function (Solidity) #449

Merged
merged 2 commits into from
Nov 4, 2024

Conversation

CedarMist
Copy link
Member

@CedarMist CedarMist commented Oct 31, 2024

Closes: #436

Implements calldata encryption to create encrypted transactions from contracts on Sapphire.

This also updates Cipher TS to accept an optional nonce parameter, this means we can do easier deterministic tests to verify the Solidity implementation matches the Typescript implementation.

@CedarMist CedarMist added the contracts Pull requests that update sapphire-contracts label Oct 31, 2024
@CedarMist CedarMist added this to the contracts-0.3.0 milestone Oct 31, 2024
@CedarMist CedarMist self-assigned this Oct 31, 2024
Copy link

netlify bot commented Oct 31, 2024

Deploy Preview for oasisprotocol-sapphire-paratime canceled.

Name Link
🔨 Latest commit d4c083f
🔍 Latest deploy log https://app.netlify.com/sites/oasisprotocol-sapphire-paratime/deploys/6728ef07a6e49300080d5999

@CedarMist CedarMist force-pushed the CedarMist/calldataencryption-v2 branch from 4a32e74 to c4f36d3 Compare October 31, 2024 10:23
@CedarMist CedarMist marked this pull request as draft October 31, 2024 10:23
@CedarMist CedarMist marked this pull request as ready for review October 31, 2024 11:42
@rube-de
Copy link
Contributor

rube-de commented Nov 4, 2024

Running the test against localnet fails for me

  1) CalldataEncryption
       testEncryptCallData:

      AssertionError: expected '0xa264626f6479a462706b58204a0269de680…' to equal '0xa264626f6479a462706b58204a0269de680…'
      + expected - actual

      -0xa264626f6479a462706b58204a0269de680edc05553943543d70c5df9e23f6af53381eded9641b5d08df7b2d646461746158184bf966b9e87a715c26b2428996c85589e1ba7e2c060487206565706f636800656e6f6e63654fb9cb3f82f8a608902dcb321ae611a766666f726d617401
      +0xa264626f6479a462706b58204a0269de680edc05553943543d70c5df9e23f6af53381eded9641b5d08df7b2d64646174615818cbca0d4444a619c839a845d2b045ccf4437a861047e59b5f6565706f636800656e6f6e63654f0d0922c9861097bab82a5a77b15d8666666f726d617401
      
       at Context.<anonymous> (test/calldata.spec.ts:50:22)

@CedarMist
Copy link
Member Author

That could happen if you don't build the clients/js package, the solidity tests require repeatability so I had to modify the client to pass a custom nonce.

If the clients/js package isn't rebuilt, the solidity tests will use the last build you did which will generate a nonce every time and ignore the one passed in.

clients/js/src/cipher.ts Outdated Show resolved Hide resolved
clients/js/src/cipher.ts Outdated Show resolved Hide resolved
contracts/test/calldata.spec.ts Outdated Show resolved Hide resolved
@CedarMist CedarMist force-pushed the CedarMist/calldataencryption-v2 branch from 8311dc9 to d4c083f Compare November 4, 2024 15:57
@CedarMist CedarMist merged commit ef8c480 into main Nov 4, 2024
11 checks passed
@CedarMist CedarMist deleted the CedarMist/calldataencryption-v2 branch November 4, 2024 16:10
github-actions bot added a commit that referenced this pull request Nov 4, 2024
…edarMist/calldataencryption-v2

contracts: calldata encryption function (Solidity) ef8c480
github-actions bot added a commit that referenced this pull request Nov 4, 2024
…darMist/calldataencryption-v2

contracts: calldata encryption function (Solidity) ef8c480
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contracts Pull requests that update sapphire-contracts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants