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

Document Sapphire and Remix #866

Open
matevz opened this issue Jul 4, 2024 · 3 comments
Open

Document Sapphire and Remix #866

matevz opened this issue Jul 4, 2024 · 3 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@matevz
Copy link
Member

matevz commented Jul 4, 2024

See what is needed for Remix to work seamlessly with Sapphire. Currently, it only works via "universal" metamask connector. A section on this was written years ago for Emerald. Revamp it for Sapphire and move it out of Emerald into a separate chapter under https://docs.oasis.io/dapp/tools/ ➝ Remix.

OFC you won't be able to debug in Remix much against Sapphire because it won't reveal confidential information.

Don't forget to mention the transactions and queries are unencrypted and unsigned.

Don't forget to pinpoint solc version up to 0.8.24 (see rust-ethereum/evm#277).

Also consider, if the Explorer➝Sourcify➝Remix flow is feasible to interact with a smart contract and worth describing it in this chapter how a (non-tech) user could communicate with the smart contract, e.g. if the maintainer decides to shut down the dApp frontend and the user is stuck with the contract and wants to withdraw his assets back. FYI @lukaw3d built a simpler alternative https://abi-playground.oasis.io/ for this.

@matevz matevz added the documentation Improvements or additions to documentation label Jul 4, 2024
@matevz matevz assigned matevz and unassigned matevz Jul 4, 2024
@lukaw3d
Copy link
Member

lukaw3d commented Sep 27, 2024

Maybe we can edit remix to allow sapphire in walletconnect
image

@lukaw3d
Copy link
Member

lukaw3d commented Oct 2, 2024

Reproducing an already verified contract annoyances:
https://explorer.oasis.io/mainnet/sapphire/address/0x8Bc2B030b299964eEfb5e1e0b36991352E56D2D3

  • Open in Sourcify
  • View in Remix
  • https://remix.ethereum.org/?#activate=sourcify&call=sourcify//fetchAndSave//0x8Bc2B030b299964eEfb5e1e0b36991352E56D2D3//23294
  • UI shows Solidity Compiler: 0.8.26 (probably kept selection from before)
    even though cloned metadata.json specified "version": "0.8.16+commit.07a7930e"
  • Open WrappedROSE at path verified-sources/0x8Bc2B030b299964eEfb5e1e0b36991352E56D2D3/sources/contracts/WrappedROSE.sol
  • Click compile. The resulting bytecode is different!
  • WrappedROSE imports @openzeppelin/contracts/token/ERC20/ERC20.sol, and verified correct version of this dependency was cloned into verified-sources/0x8Bc2B030b299964eEfb5e1e0b36991352E56D2D3/sources/@openzeppelin/contracts/token/ERC20/ERC20.sol
    file starts with

    // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)

  • But Remix automatically downloaded latest dependency into .deps/npm/@openzeppelin/contracts/token/ERC20/ERC20.sol

    // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)
    and compiled using this instead

  • To reproduce the original bytecode, manually switch compiler version 0.8.16. Adjust advanced config to match metadata.json "optimizer": { "enabled": true, "runs": 0 }
  • Remix now marks modern ERC20.sol as incompatible with compiler. Delete .deps/npm/@openzeppelin/contracts and move verified-sources/0x8Bc2B030b299964eEfb5e1e0b36991352E56D2D3/sources/@openzeppelin/contracts there.
  • Recompile
  • still "The deployed and recompiled bytecode don't match."

🤷

@rube-de rube-de self-assigned this Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants