Skip to content

Update migrated imports from community to vanilla contracts #609

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

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
662 changes: 331 additions & 331 deletions packages/core/solidity/src/account.test.ts.md

Large diffs are not rendered by default.

Binary file modified packages/core/solidity/src/account.test.ts.snap
Binary file not shown.
16 changes: 8 additions & 8 deletions packages/core/solidity/src/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function addParents(c: ContractBuilder, opts: AccountOptions): void {
// Base
c.addParent({
name: 'Account',
path: `@openzeppelin/community-contracts/account/Account.sol`,
path: `@openzeppelin/contracts/account/Account.sol`,
});
c.addOverride({ name: 'Account' }, functions._validateUserOp);

Expand All @@ -97,7 +97,7 @@ function addSignatureValidation(c: ContractBuilder, opts: AccountOptions) {
case 'ERC7739':
c.addParent({
name: 'ERC7739',
path: '@openzeppelin/community-contracts/utils/cryptography/ERC7739.sol',
path: '@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol',
});
break;
case 'ERC1271':
Expand Down Expand Up @@ -139,7 +139,7 @@ function addBatchedExecution(c: ContractBuilder, opts: AccountOptions): void {
if (!opts.batchedExecution || !!opts.ERC7579Modules) return;
c.addParent({
name: 'ERC7821',
path: '@openzeppelin/community-contracts/account/extensions/ERC7821.sol',
path: '@openzeppelin/contracts/account/extensions/draft-ERC7821.sol',
});
c.addOverride({ name: 'ERC7821' }, functions._erc7821AuthorizedExecutor);
c.setFunctionBody(
Expand All @@ -152,12 +152,12 @@ function addERC7579Modules(c: ContractBuilder, opts: AccountOptions): void {
if (!opts.ERC7579Modules) return;
c.addParent({
name: opts.ERC7579Modules,
path: `@openzeppelin/community-contracts/account/extensions/${opts.ERC7579Modules}.sol`,
path: `@openzeppelin/contracts/account/extensions/draft-${opts.ERC7579Modules}.sol`,
});
if (opts.ERC7579Modules !== 'AccountERC7579') {
c.addImportOnly({
name: 'AccountERC7579',
path: `@openzeppelin/community-contracts/account/extensions/AccountERC7579.sol`,
path: `@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol`,
});
}
c.addOverride({ name: 'AccountERC7579' }, functions.isValidSignature);
Expand Down Expand Up @@ -224,7 +224,7 @@ function overrideRawSignatureValidation(c: ContractBuilder, opts: AccountOptions
if (opts.signer && opts.ERC7579Modules) {
c.addImportOnly({
name: 'AbstractSigner',
path: '@openzeppelin/community-contracts/utils/cryptography/AbstractSigner.sol',
path: '@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol',
});
c.addOverride({ name: 'AbstractSigner' }, signerFunctions._rawSignatureValidation);
c.addOverride({ name: 'AccountERC7579' }, signerFunctions._rawSignatureValidation);
Expand Down Expand Up @@ -283,13 +283,13 @@ const functions = {
},
setThreshold: {
kind: 'public' as const,
args: [{ name: 'threshold', type: 'uint256' }],
args: [{ name: 'threshold', type: 'uint64' }],
},
setSignerWeights: {
kind: 'public' as const,
args: [
{ name: 'signers', type: 'bytes[] memory' },
{ name: 'weights', type: 'uint256[] memory' },
{ name: 'weights', type: 'uint64[] memory' },
],
},
}),
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
"@nomicfoundation/hardhat-toolbox": "^6.1.0",
"hardhat": "^2.16.1"
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
"@nomicfoundation/hardhat-toolbox": "^6.1.0",
"hardhat": "^2.16.1"
}
}
}
6 changes: 3 additions & 3 deletions packages/core/solidity/src/generate/sources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,15 @@ function generateContractSubset(subset: Subset, kind?: Kind): GeneratedContract[
if (subset === 'all') {
return contracts;
} else {
const getParents = (c: GeneratedContract) => c.contract.parents.map(p => p.contract.path);
const getImports = (c: GeneratedContract) => c.contract.imports.map(importContract => importContract.path);
return [
...findCover(
contracts.filter(c => c.options.upgradeable),
getParents,
getImports,
),
...findCover(
contracts.filter(c => !c.options.upgradeable),
getParents,
getImports,
),
];
}
Expand Down
18 changes: 9 additions & 9 deletions packages/core/solidity/src/signer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,27 +49,27 @@ export function addSigner(c: ContractBuilder, signer: SignerOptions): void {
export const signers = {
ERC7702: {
name: 'SignerERC7702',
path: '@openzeppelin/community-contracts/utils/cryptography/SignerERC7702.sol',
path: '@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol',
},
ECDSA: {
name: 'SignerECDSA',
path: '@openzeppelin/community-contracts/utils/cryptography/SignerECDSA.sol',
path: '@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol',
},
P256: {
name: 'SignerP256',
path: '@openzeppelin/community-contracts/utils/cryptography/SignerP256.sol',
path: '@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol',
},
RSA: {
name: 'SignerRSA',
path: '@openzeppelin/community-contracts/utils/cryptography/SignerRSA.sol',
path: '@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol',
},
Multisig: {
name: 'MultiSignerERC7913',
path: '@openzeppelin/community-contracts/utils/cryptography/MultiSignerERC7913.sol',
path: '@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol',
},
MultisigWeighted: {
name: 'MultiSignerERC7913Weighted',
path: '@openzeppelin/community-contracts/utils/cryptography/MultiSignerERC7913Weighted.sol',
path: '@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol',
},
};

Expand All @@ -96,15 +96,15 @@ export const signerFunctions = defineFunctions({
kind: 'public' as const,
args: [
{ name: 'signers', type: 'bytes[] memory' },
{ name: 'threshold', type: 'uint256' },
{ name: 'threshold', type: 'uint64' },
],
},
initializeMultisigWeighted: {
kind: 'public' as const,
args: [
{ name: 'signers', type: 'bytes[] memory' },
{ name: 'weights', type: 'uint256[] memory' },
{ name: 'threshold', type: 'uint256' },
{ name: 'weights', type: 'uint64[] memory' },
{ name: 'threshold', type: 'uint64' },
],
},
_rawSignatureValidation: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ export const solidityAccountAIFunctionDefinition = {
],
description: solidityAccountDescriptions.ERC7579Modules,
},
// TODO: Only AccountERC7579Hooked is upgradeable, how to handle this?
upgradeable: {
type: 'boolean',
enum: [false],
Expand Down
14 changes: 7 additions & 7 deletions packages/ui/src/solidity/AccountControls.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
}}
/>
Signature Validation
<HelpTooltip link="https://docs.openzeppelin.com/community-contracts/accounts#signature_validation">
<HelpTooltip link="https://docs.openzeppelin.com/contracts/accounts#signature_validation">
Enables smart contracts to validate signatures through a standard <code>isValidSignature</code> method. Unlike EOAs
(regular accounts) that use private keys, this allows contracts to implement custom signature validation logic, making
them capable of acting as signing entities for operations like approvals, swaps, or any signed messages.
Expand All @@ -70,7 +70,7 @@
}}
/>
Account Bound
<HelpTooltip link="https://docs.openzeppelin.com/community-contracts/accounts#erc_7739_signatures">
<HelpTooltip link="https://docs.openzeppelin.com/contracts/accounts#erc_7739_signatures">
Enhances signature security by using a defensive rehashing scheme that prevents signature replay attacks across
multiple smart accounts owned by the same private key. This preserves the readability of signed contents while
ensuring each signature is uniquely bound to a specific account and chain.
Expand Down Expand Up @@ -112,7 +112,7 @@
}}
/>
Batched Execution
<HelpTooltip link="https://docs.openzeppelin.com/community-contracts/accounts#batched_execution">
<HelpTooltip link="https://docs.openzeppelin.com/contracts/accounts#batched_execution">
Enables atomic execution of multiple transactions in a single operation, reducing total transaction costs and
latency.
</HelpTooltip>
Expand Down Expand Up @@ -157,7 +157,7 @@
bind:value={opts.signer}
defaultValue="ECDSA"
helpContent="Defines the base signature validation mechanism for the account. This implementation will be used to validate user operations following ERC-4337 or by ERC-1271's <code>isValidSignature</code> to verify signatures on behalf of the account."
helpLink="https://docs.openzeppelin.com/community-contracts/accounts#selecting_a_signer"
helpLink="https://docs.openzeppelin.com/contracts/accounts#selecting_a_signer"
>
<div class="checkbox-group">
<label class:checked={opts.signer === 'ECDSA'}>
Expand All @@ -171,15 +171,15 @@
<label class:checked={opts.signer === 'ERC7702'}>
<input type="radio" bind:group={opts.signer} value="ERC7702" />
EOA Delegation
<HelpTooltip link="https://docs.openzeppelin.com/community-contracts/eoa-delegation">
<HelpTooltip link="https://docs.openzeppelin.com/contracts/eoa-delegation">
Special ECDSA validation that uses the account's own address as the signer. Enables EOAs to delegate execution
rights to the account while maintaining their native signature verification.
</HelpTooltip>
</label>
<label class:checked={opts.signer === 'Multisig'}>
<input type="radio" bind:group={opts.signer} value="Multisig" />
Multisig*
<HelpTooltip link="https://docs.openzeppelin.com/community-contracts/multisig">
<HelpTooltip link="https://docs.openzeppelin.com/contracts/multisig">
ERC-7913 multisignature validation requiring a minimum number of signatures to approve operations. The contract
maintains a set of authorized signers and validates that the number of valid signatures meets the threshold
requirement.
Expand All @@ -188,7 +188,7 @@
<label class:checked={opts.signer === 'MultisigWeighted'}>
<input type="radio" bind:group={opts.signer} value="MultisigWeighted" />
Multisig Weighted*
<HelpTooltip link="https://docs.openzeppelin.com/community-contracts/multisig#multisignererc7913weighted">
<HelpTooltip link="https://docs.openzeppelin.com/contracts/multisig#multisignererc7913weighted">
Weighted version of ERC-7913 multisignature validation. Signers have different voting weights, allowing for
flexible governance. The total weight of valid signatures must meet the threshold requirement.
</HelpTooltip>
Expand Down
Loading