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

feat: Add Foundry toolkit that enables Sapphire precompile and decryption #484

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

ZigaMr
Copy link
Contributor

@ZigaMr ZigaMr commented Jan 20, 2025

This PR:

  • Adds boilerplate Foundry contracts that simulate Sapphire precompiles and decryption
  • Implements Foundry tests
  • Contains Rust FFI bindings
  • Added Makefile with build, test, clean options
  • Readme with instructions

Enables local testing of Sapphire-compatible contracts without using forks.

Copy link

netlify bot commented Jan 20, 2025

Deploy Preview for oasisprotocol-sapphire-paratime canceled.

Name Link
🔨 Latest commit d0bf982
🔍 Latest deploy log https://app.netlify.com/sites/oasisprotocol-sapphire-paratime/deploys/67b8902f6eda1d0008195d04

@ZigaMr ZigaMr requested a review from matevz January 21, 2025 14:06
@ZigaMr ZigaMr requested a review from matevz February 10, 2025 13:35
Copy link
Member

@matevz matevz left a comment

Choose a reason for hiding this comment

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

Looks good!

Copy link
Member

Choose a reason for hiding this comment

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

I wonder is dependencies/ still the right folder naming? I think forge now only prefers lib/, e.g. when you run forge install

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think both are still supported, soldeer uses dependencies

- `DeoxysiiOpen`: Decrypt data using Deoxys-II
- `Curve25519ComputePublic`: Compute public keys
- `DECODE`: decode cbor encoded data and decrypt the calldata.
<span style="color:red">Warning</span>: This precompile is not part of
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<span style="color:red">Warning</span>: This precompile is not part of
**Warning:** This precompile is not part of

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

Copy link
Member

@matevz matevz left a comment

Choose a reason for hiding this comment

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

Some naming suggestions/questions.


build:
forge install foundry-rs/forge-std --no-commit --no-git
forge soldeer install @oasisprotocol-sapphire-contracts~0.2.11 --config-location foundry
Copy link
Member

Choose a reason for hiding this comment

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

Could we simply put a dependencies/oasisprotocol-sapphire-contracts symlink pointing to ../../../contracts folder instead? This way we could always test whether sapphire contracts broke any foundry example specifics.

Copy link
Member

Choose a reason for hiding this comment

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

integrations-foundry folder should probably be named oasisprotocol-sapphire-foundry to match the soldeer package, no (without the leading @)?

Comment on lines +24 to +29






Copy link
Member

Choose a reason for hiding this comment

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

remove

Comment on lines +38 to +40
- Delegations
- Undelegations
- Receipt tracking
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- Delegations
- Undelegations
- Receipt tracking
- Delegations
- Undelegations
- Receipt tracking


## List of precompiles

### Cryptographic Operations
Copy link
Member

Choose a reason for hiding this comment

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

The line after the title should always be empty.

Suggested change
### Cryptographic Operations
### Cryptographic Operations

Comment on lines +24 to +29






Copy link
Member

Choose a reason for hiding this comment

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

remove

Copy link
Member

Choose a reason for hiding this comment

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

Rename to oasisprotocol-sapphire-foundry ?

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.

2 participants