Solidity: Document or add Remix remappings when using upgradeable contracts
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- solidity
調査の方向性
まず、Remix で生成されたプロジェクトを開くための Wizard UI のエントリーポイントと、生成された Remix プロジェクトの出力を特定します。2 つの import 競合の例を比較し、ユーザーが Remix でプロジェクトを開く前に、完了した動作で remappings.txt を自動的に追加するべきか、remapping をドキュメント化するべきかを判断します。
索引モデルが issue の本文から書いたものです。
説明
Background
When opening a Solidity contract in Remix, the Contracts library version is appended to the import paths to ensure Remix uses a specific pinned version of the library, for example:
import {GovernorUpgradeable} from "@openzeppelin/[email protected]/governance/GovernorUpgradeable.sol";
Problem
In some cases when the contract directly references a contract or interface, and if the same contract/interface is referenced transitively through a different import, the transitive version is using the original path which causes a conflict.
This particularly occurs between upgradeable and vanilla Contracts dependencies, because the upgradeable variants import vanilla contracts using full paths rather than relative paths. The actual conflict itself occurs in vanilla dependencies, and is due to the inclusion/exclusion of version in its path.
Example 1
For example, when using Governor with ERC20Votes and Upgradeability, the following are in the direct imports:
import {GovernorVotesUpgradeable} from "@openzeppelin/[email protected]/governance/extensions/GovernorVotesUpgradeable.sol";
import {IVotes} from "@openzeppelin/[email protected]/governance/utils/IVotes.sol";
but GovernorVotesUpgradeable.sol itself has (note this is without @5.4.0)
import {IVotes} from "@openzeppelin/contracts/governance/utils/IVotes.sol";
This causes a compile error:
TypeError: Invalid type for argument in function call. Invalid implicit conversion from contract IVotes to contract IVotes requested.
--> contract-3b3900f8c2.sol:22:30:
|
22 | __GovernorVotes_init(_token);
| ^^^^^^
Example 2
A similar issue occurs for Account with Modules and Upgradeability since https://github.com/OpenZeppelin/contracts-wizard/pull/609, with the following imports:
import {Account} from "@openzeppelin/[email protected]/account/Account.sol";
import {AccountERC7579Upgradeable} from "@openzeppelin/[email protected]/account/extensions/draft-AccountERC7579Upgradeable.sol";
where draft-AccountERC7579Upgradeable.sol has
import {Account} from "@openzeppelin/contracts/account/Account.sol";
This causes a compile error:
DeclarationError: Identifier already declared.
--> @openzeppelin/[email protected]/account/Account.sol:30:5:
|
30 | error AccountUnauthorized(address sender);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Note: The previous declaration is here:
--> @openzeppelin/contracts/account/Account.sol:30:5:
|
30 | error AccountUnauthorized(address sender);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Solution
Remappings should be defined to remap the unversioned library path @openzeppelin/contracts/ to the versioned one. This will ensure compilation of all imports uses the same specified version.
This can be done by adding remappings.txt with the content:
@openzeppelin/contracts/=@openzeppelin/[email protected]/
We should either document the above (somewhere in the Wizard UI before the users opens in Remix), or if possible automatically add this into the generated Remix project.
- 主要言語
- TypeScript
- スター
- 296
- フォーク
- 188
- 平均マージ
- 3時間 24分
- マージ済み PR(30日)
- 11
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
OpenZeppelin/contracts-wizard のほかの issue
-
Stellar: Generated test asserts against the contract identifier instead of the stored token nameオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
OpenZeppelin/contracts-wizard#805 ·
メンテナーはふだん 1 日以内に返信
-
Document properly that yarn classic is required (v1.X)対応中かも @0xMayurrr が 245 日前に担当しました。 オープン
難易度 1/5 1〜3時間 初心者へのやさしさ 68/100
OpenZeppelin/contracts-wizard#739 ·
メンテナーはふだん 1 日以内に返信
-
Solidity: Governor absolute quorum values accepted by validation generate code that does not compile対応中かも @RaphaelFakhri が 17 日前に担当しました。 オープン
難易度 3/5 半日 初心者へのやさしさ 62/100
OpenZeppelin/contracts-wizard#895 ·
メンテナーはふだん 1 日以内に返信
-
Solidity: Premint amounts below 1 with a leading fractional zero generate code that does not compile対応中かも @RaphaelFakhri が 20 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 20/100
OpenZeppelin/contracts-wizard#893 ·
メンテナーはふだん 1 日以内に返信
-
Follow-ups from the Chainlink CCIP and ACE integration (#880)対応中かも @nahimterrazas が 25 日前に担当しました。 オープン
OpenZeppelin/contracts-wizard#881 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
OpenZeppelin/contracts-wizard の issue をすべて見る
似ている issue
-
Wallet functions throws TypeError when the wallet has no account ID対応中かも @Medhansh-741 が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
hiero-ledger/hiero-sdk-js#4781 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
dataforgoodfr/mediterranean-rescue#91 ·
メンテナーはふだん 1 日以内に返信
-
transformer-directives: `@apply` drops a utility whose CSS is a substring of an earlier one's対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
Add: KRT TVオープンapproved check:passed streams:add
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
iptv-org/iptv#58647 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
milind-soni/OpenMausBot#5829 ·
メンテナーはふだん 1 日以内に返信