Solidity: Document or add Remix remappings when using upgradeable contracts
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- solidity
- Lĩnh vực
- blockchain, developer-experience
Hướng nghiên cứu
Bắt đầu bằng cách xác định điểm vào của Wizard UI để mở các project được tạo trong Remix và output của project Remix được tạo. So sánh hai ví dụ về xung đột import, sau đó xác định xem hành vi hoàn thiện có nên tự động thêm remappings.txt hay ghi lại remapping trước khi người dùng mở project trong Remix hay không.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 296
- Fork
- 188
- Merge trung bình
- 3 giờ 24 phút
- Pull request đã merge (30 ngày)
- 11
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của OpenZeppelin/contracts-wizard
-
Stellar: Generated test asserts against the contract identifier instead of the stored token nameĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
OpenZeppelin/contracts-wizard#805 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Document properly that yarn classic is required (v1.X)Có thể đã có người làm @0xMayurrr đã nhận 245 ngày trước. Đang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 68/100
OpenZeppelin/contracts-wizard#739 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Solidity: Governor absolute quorum values accepted by validation generate code that does not compileCó thể đã có người làm @RaphaelFakhri đã nhận 17 ngày trước. Đang mở
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 62/100
OpenZeppelin/contracts-wizard#895 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Solidity: Premint amounts below 1 with a leading fractional zero generate code that does not compileCó thể đã có người làm @RaphaelFakhri đã nhận 20 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 20/100
OpenZeppelin/contracts-wizard#893 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Follow-ups from the Chainlink CCIP and ACE integration (#880)Có thể đã có người làm @nahimterrazas đã nhận 25 ngày trước. Đang mở
OpenZeppelin/contracts-wizard#881 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của OpenZeppelin/contracts-wizard
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
jeanibarz/knowledge-base-mcp-server#1268 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
Koenkk/zigbee-herdsman-converters#13820 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[prefer-expect-resolves] autofix leaves a stray ")" when the awaited expression is parenthesizedĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
jest-community/eslint-plugin-jest#2052 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Wallet functions throws TypeError when the wallet has no account IDCó thể đã có người làm @Medhansh-741 đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
hiero-ledger/hiero-sdk-js#4781 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày