-
Notifications
You must be signed in to change notification settings - Fork 76
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
chore: rename single request proxy #1488
Conversation
WalkthroughThis pull request introduces a comprehensive renaming and refactoring of the Changes
Possibly related PRs
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 10
🧹 Outside diff range and nitpick comments (8)
packages/smart-contracts/scripts-create2/contract-setup/setupSingleRequestProxyFactory.ts (1)
Line range hint
57-61
: Update success and error messages to use new terminology.The console messages still reference "SingleRequestProxyFactory". Update them to maintain consistency.
- console.log(`Setup of SingleRequestProxyFactory successful on ${network}`); + console.log(`Setup of SingleRequestForwarderFactory successful on ${network}`); } catch (err) { console.warn( - `An error occurred during the setup of SingleRequestProxyFactory on ${network}`, + `An error occurred during the setup of SingleRequestForwarderFactory on ${network}`, );packages/smart-contracts/src/lib/artifacts/SingleRequestProxyFactory/index.ts (1)
Incomplete Directory Structure Update
The directory
SingleRequestProxyFactory
still has references in multiple files, indicating that the renaming toSingleRequestForwarderFactory
was not fully completed.
- packages/smart-contracts/test/contracts/EthereumSingleRequestProxy.test.ts
- packages/smart-contracts/scripts-create2/transfer-ownership.ts
- packages/smart-contracts/scripts-create2/utils.ts
- packages/smart-contracts/scripts-create2/verify.ts
- packages/smart-contracts/scripts/test-deploy-single-request-proxy.ts
- packages/smart-contracts/test/contracts/SingleRequestProxyFactory.test.ts
- packages/smart-contracts/scripts-create2/contract-setup/setupSingleRequestProxyFactory.ts
- packages/smart-contracts/scripts-create2/contract-setup/setups.ts
- packages/smart-contracts/src/lib/artifacts/index.ts
- packages/smart-contracts/scripts-create2/contract-setup/adminTasks.ts
- packages/smart-contracts/src/lib/artifacts/SingleRequestProxyFactory/index.ts
- packages/smart-contracts/scripts-create2/constructor-args.ts
- packages/smart-contracts/scripts-create2/compute-one-address.ts
- packages/smart-contracts/scripts/test-deploy-all.ts
- packages/smart-contracts/deploy/deploy-zk-single-request-proxy.ts
🔗 Analysis chain
Line range hint
1-1
: Update file and directory structureThe file is still located in the
SingleRequestProxyFactory
directory. The directory should be renamed toSingleRequestForwarderFactory
to maintain consistency with the new terminology.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check if there are any remaining references to the old directory name rg -l "SingleRequestProxyFactory" --type tsLength of output: 1024
packages/smart-contracts/scripts-create2/utils.ts (1)
Line range hint
13-13
: Update contract name in deployment listThe contract name in
create2ContractDeploymentList
still uses the old name "SingleRequestProxyFactory" while the artifact reference has been updated to use "Forwarder". This inconsistency should be fixed.Apply this diff to maintain consistency:
- 'SingleRequestProxyFactory', + 'SingleRequestForwarderFactory',packages/payment-processor/src/payment/single-request-forwarder.ts (2)
Line range hint
76-89
: Update factory method names to use new terminologyThe factory method names still use the old "proxy" terminology.
- tx = await singleRequestForwarderFactory.createERC20SingleRequestProxy( + tx = await singleRequestForwarderFactory.createERC20SingleRequestForwarder( - tx = await singleRequestForwarderFactory.createEthereumSingleRequestProxy( + tx = await singleRequestForwarderFactory.createEthereumSingleRequestForwarder(
Line range hint
113-118
: Update documentation to use new terminologyThe documentation comment still references "SingleRequestProxy".
- * Validates that a contract is a SingleRequestProxy by checking required methods + * Validates that a contract is a SingleRequestForwarder by checking required methodspackages/payment-processor/test/payment/single-request-forwarder.test.ts (3)
Line range hint
1-1
: Update artifact import to match new naming conventionWhile the functions have been renamed to use "Forwarder", the artifact import still uses the old "Proxy" naming convention. This should be updated for consistency.
-import { singleRequestProxyFactoryArtifact } from '@requestnetwork/smart-contracts'; +import { singleRequestForwarderFactoryArtifact } from '@requestnetwork/smart-contracts';Also applies to: 12-16
Line range hint
98-98
: Update test suite description to use new namingThe describe block still uses the old "deploySingleRequestProxy" name.
-describe('deploySingleRequestProxy', () => { +describe('deploySingleRequestForwarder', () => {
Update Remaining "SingleRequestProxy" References for Consistency
Several files still reference "SingleRequestProxy" and should be updated to "SingleRequestForwarder" to maintain consistency across the codebase:
- packages/smart-contracts/scripts/test-deploy-single-request-proxy.ts
- packages/smart-contracts/test/contracts/EthereumSingleRequestProxy.test.ts
- packages/smart-contracts/src/lib/artifacts/SingleRequestProxyFactory/index.ts
- packages/payment-processor/test/payment/single-request-forwarder.test.ts
- ... (additional files as listed in the shell script output)
🔗 Analysis chain
Line range hint
1-355
: Verify consistent renaming across the codebaseLet's verify that all references to "Single Request Proxy" have been updated to "Single Request Forwarder" across the codebase.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for any remaining references to the old naming echo "Searching for remaining 'SingleRequestProxy' references..." rg -i "SingleRequestProxy" --type ts echo "Searching for remaining 'Request Proxy' references..." rg -i "Request Proxy" --type ts echo "Searching for remaining 'RequestProxy' references..." rg -i "RequestProxy" --type tsLength of output: 50757
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (6)
packages/payment-processor/src/index.ts
(1 hunks)packages/payment-processor/src/payment/single-request-forwarder.ts
(7 hunks)packages/payment-processor/test/payment/single-request-forwarder.test.ts
(9 hunks)packages/smart-contracts/scripts-create2/contract-setup/setupSingleRequestProxyFactory.ts
(3 hunks)packages/smart-contracts/scripts-create2/utils.ts
(1 hunks)packages/smart-contracts/src/lib/artifacts/SingleRequestProxyFactory/index.ts
(1 hunks)
🧰 Additional context used
📓 Learnings (3)
packages/payment-processor/test/payment/single-request-forwarder.test.ts (3)
Learnt from: MantisClone
PR: RequestNetwork/requestNetwork#1474
File: packages/payment-processor/test/payment/single-request-proxy.test.ts:251-270
Timestamp: 2024-11-10T17:21:26.660Z
Learning: When testing the payment-processor module, specifically in `packages/payment-processor/test/payment/single-request-proxy.test.ts`, it's acceptable to omit tests for partial payments if they have already been covered at the smart-contract level.
Learnt from: MantisClone
PR: RequestNetwork/requestNetwork#1487
File: packages/payment-processor/test/payment/single-request-proxy.test.ts:237-246
Timestamp: 2024-11-10T17:21:20.340Z
Learning: In `packages/payment-processor/test/payment/single-request-proxy.test.ts`, when asserting the `feeProxyUsed` in emitted events from `SingleRequestProxyFactory`, retrieve the `erc20FeeProxy` (or `ethereumFeeProxy`) public variable from the `SingleRequestProxyFactory` contract instead of using `wallet.address`.
Learnt from: MantisClone
PR: RequestNetwork/requestNetwork#1487
File: packages/payment-processor/test/payment/single-request-proxy.test.ts:198-206
Timestamp: 2024-11-10T17:21:20.340Z
Learning: In tests for `SingleRequestProxyFactory`, the `feeProxyUsed` in events should be verified by retrieving the `ethereumFeeProxy` public variable from the `SingleRequestProxyFactory` contract, not `wallet.address`.
packages/smart-contracts/scripts-create2/contract-setup/setupSingleRequestProxyFactory.ts (4)
Learnt from: MantisClone
PR: RequestNetwork/requestNetwork#1478
File: packages/smart-contracts/scripts-create2/contract-setup/setupSingleRequestProxyFactory.ts:38-43
Timestamp: 2024-11-10T17:21:20.340Z
Learning: In the RequestNetwork codebase, setup scripts such as `setupSingleRequestProxyFactory.ts` do not include contract existence checks before interacting with contracts, even though scripts like `check-deployer.ts` do include such checks.
Learnt from: MantisClone
PR: RequestNetwork/requestNetwork#1478
File: packages/smart-contracts/scripts-create2/contract-setup/setupSingleRequestProxyFactory.ts:30-36
Timestamp: 2024-11-10T17:21:20.340Z
Learning: In the RequestNetwork project, admin scripts like `setupSingleRequestProxyFactory.ts` in `packages/smart-contracts/scripts-create2/contract-setup/` do not require extensive error checking.
Learnt from: MantisClone
PR: RequestNetwork/requestNetwork#1478
File: packages/smart-contracts/scripts-create2/contract-setup/setupSingleRequestProxyFactory.ts:26-28
Timestamp: 2024-11-10T17:21:20.340Z
Learning: In the `requestNetwork` project's TypeScript setup scripts located in `packages/smart-contracts/scripts-create2/contract-setup`, `Promise.all` is used for asynchronous network setup tasks to maintain consistency across scripts.
Learnt from: MantisClone
PR: RequestNetwork/requestNetwork#1478
File: packages/smart-contracts/scripts-create2/contract-setup/adminTasks.ts:423-483
Timestamp: 2024-11-10T17:21:26.660Z
Learning: When creating or naming functions related to the SingleRequestProxyFactory, include 'SingleRequestProxyFactory' or 'SRPF' in the function names for clarity.
packages/smart-contracts/scripts-create2/utils.ts (1)
Learnt from: MantisClone
PR: RequestNetwork/requestNetwork#1453
File: packages/smart-contracts/scripts-create2/utils.ts:23-23
Timestamp: 2024-11-10T17:21:20.340Z
Learning: When a contract has not been deployed yet and thus has no artifact, the `getArtifact` function will be updated after deployment.
🔇 Additional comments (6)
packages/payment-processor/src/index.ts (1)
30-30
: LGTM! Export path updated to reflect new module name.
The change aligns with the PR objective of renaming "Single Request Proxy" to "Single Request Forwarder".
packages/smart-contracts/src/lib/artifacts/SingleRequestProxyFactory/index.ts (1)
7-69
: LGTM! Artifact configuration preserved correctly
The constant has been properly renamed while maintaining all deployment configurations across different networks. The preservation of addresses and block numbers ensures no functional changes.
packages/smart-contracts/scripts-create2/utils.ts (1)
61-61
: Verify the new artifact exists
The artifact reference has been updated to singleRequestForwarderFactoryArtifact
. Let's verify this artifact exists to prevent potential runtime errors.
packages/payment-processor/src/payment/single-request-forwarder.ts (3)
11-22
: LGTM! Documentation is clear and comprehensive.
The documentation has been properly updated to reflect the new terminology and accurately describes the functionality.
214-214
:
Update error message to use new terminology
The error message still uses "Proxy" terminology.
- throw new Error('Contract is not an EthereumSingleRequestProxy');
+ throw new Error('Contract is not an EthereumSingleRequestForwarder');
Likely invalid or redundant comment.
Line range hint 1-277
: Verify consistent renaming across the codebase
Let's ensure all references to "proxy" have been updated to "forwarder" across the codebase.
✅ Verification successful
Mixed terminology is expected and intentional
The mixed use of "proxy" and "forwarder" terminology is correct. The new file introduces "forwarder" terminology while necessarily maintaining compatibility with the existing smart contract names, events, and interfaces that use "proxy". This pattern is common when introducing new terminology while preserving backward compatibility with deployed contracts and existing integrations.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for any remaining instances of "proxy" terminology that might need updating
rg -i "proxy" --type ts --type sol
# Search for any inconsistent usage of "forwarder" terminology
rg -i "forwarder" --type ts --type sol
Length of output: 129
Script:
#!/bin/bash
# Search for any remaining instances of "proxy" terminology that might need updating in .ts and .sol files
rg -i "proxy" -g "*.ts" -g "*.sol"
# Search for any inconsistent usage of "forwarder" terminology in .ts and .sol files
rg -i "forwarder" -g "*.ts" -g "*.sol"
Length of output: 406783
packages/smart-contracts/scripts-create2/contract-setup/setupSingleRequestProxyFactory.ts
Show resolved
Hide resolved
packages/smart-contracts/scripts-create2/contract-setup/setupSingleRequestProxyFactory.ts
Outdated
Show resolved
Hide resolved
packages/smart-contracts/src/lib/artifacts/SingleRequestProxyFactory/index.ts
Show resolved
Hide resolved
packages/payment-processor/src/payment/single-request-forwarder.ts
Outdated
Show resolved
Hide resolved
packages/payment-processor/src/payment/single-request-forwarder.ts
Outdated
Show resolved
Hide resolved
packages/payment-processor/test/payment/single-request-forwarder.test.ts
Outdated
Show resolved
Hide resolved
packages/payment-processor/test/payment/single-request-forwarder.test.ts
Outdated
Show resolved
Hide resolved
packages/payment-processor/test/payment/single-request-forwarder.test.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
packages/payment-processor/src/payment/single-request-forwarder.ts (1)
Line range hint
76-89
: Update factory method names to use new terminologyThe factory method calls still use the old "Proxy" terminology while the rest of the code uses "Forwarder".
- tx = await singleRequestForwarderFactory.createERC20SingleRequestProxy( + tx = await singleRequestForwarderFactory.createERC20SingleRequestForwarder( paymentRecipient, tokenAddress, paymentReference, feeAddress, feeAmount, ); } else { - tx = await singleRequestForwarderFactory.createEthereumSingleRequestProxy( + tx = await singleRequestForwarderFactory.createEthereumSingleRequestForwarder( paymentRecipient, paymentReference, feeAddress, feeAmount, );
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
packages/payment-processor/src/payment/single-request-forwarder.ts
(5 hunks)
🔇 Additional comments (4)
packages/payment-processor/src/payment/single-request-forwarder.ts (4)
211-220
: Well-implemented error handling and contract type validation
The error handling logic for contract type validation is robust and properly implemented. It correctly distinguishes between ERC20 and Ethereum forwarders while maintaining clear error messages.
104-104
:
Update event argument name to match new terminology
The event argument still uses the old "proxyAddress" terminology, while the rest of the code has been updated to use "forwarder".
- const forwarderAddress = event.args?.proxyAddress || event.args?.[0];
+ const forwarderAddress = event.args?.forwarderAddress || event.args?.[0];
242-246
:
Update documentation to use new terminology
The documentation still contains references to "proxy" instead of "forwarder".
- * For Ethereum payments, it directly sends the Ether to the proxy contract.
- * The function automatically detects whether the proxy is for ERC20 or Ethereum based on the contract interface.
+ * For Ethereum payments, it directly sends the Ether to the forwarder contract.
+ * The function automatically detects whether the forwarder is for ERC20 or Ethereum based on the contract interface.
45-51
: Verify contract factory address security
Please ensure that the factory contract addresses are properly secured and verified on all supported chains.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (1)
packages/payment-processor/src/payment/single-request-forwarder.ts (1)
114-122
: Update parameter name in documentationThe documentation still uses "proxyAddress" while the function signature uses "forwarderAddress".
/** - * @param proxyAddress - The address of the contract to validate + * @param forwarderAddress - The address of the contract to validate * @param signer - The Ethereum signer used to interact with the contract */
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
packages/payment-processor/src/payment/single-request-forwarder.ts
(5 hunks)packages/payment-processor/test/payment/single-request-forwarder.test.ts
(10 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/payment-processor/test/payment/single-request-forwarder.test.ts
🔇 Additional comments (2)
packages/payment-processor/src/payment/single-request-forwarder.ts (2)
7-7
: LGTM! Import and documentation updates are consistent
The import statement and documentation have been properly updated to use the new "Forwarder" terminology.
Also applies to: 11-22
45-51
:
Update remaining instances of "Proxy" terminology
Several instances of the old "Proxy" terminology remain in the code:
- Factory method names still use "Proxy":
createERC20SingleRequestProxy
createEthereumSingleRequestProxy
- Event argument name still uses "proxyAddress"
Apply these changes:
- tx = await singleRequestForwarderFactory.createERC20SingleRequestProxy(
+ tx = await singleRequestForwarderFactory.createERC20SingleRequestForwarder(
- tx = await singleRequestForwarderFactory.createEthereumSingleRequestProxy(
+ tx = await singleRequestForwarderFactory.createEthereumSingleRequestForwarder(
- const forwarderAddress = event.args?.proxyAddress || event.args?.[0];
+ const forwarderAddress = event.args?.forwarderAddress || event.args?.[0];
Also applies to: 76-77, 84-85, 104-104
packages/payment-processor/test/payment/single-request-forwarder.test.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
packages/payment-processor/src/payment/single-request-forwarder.ts
(5 hunks)packages/payment-processor/test/payment/single-request-forwarder.test.ts
(10 hunks)packages/smart-contracts/scripts-create2/contract-setup/setupSingleRequestProxyFactory.ts
(3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- packages/payment-processor/test/payment/single-request-forwarder.test.ts
- packages/smart-contracts/scripts-create2/contract-setup/setupSingleRequestProxyFactory.ts
🧰 Additional context used
📓 Learnings (1)
packages/payment-processor/src/payment/single-request-forwarder.ts (1)
Learnt from: aimensahnoun
PR: RequestNetwork/requestNetwork#1488
File: packages/payment-processor/src/payment/single-request-forwarder.ts:104-104
Timestamp: 2024-11-12T16:54:02.703Z
Learning: In `packages/payment-processor/src/payment/single-request-forwarder.ts`, when the smart contract has not changed, event argument names such as `proxyAddress` remain the same, even if variable names in the code are updated to use new terminology like `forwarderAddress`.
🔇 Additional comments (3)
packages/payment-processor/src/payment/single-request-forwarder.ts (3)
76-84
: Confirm usage of unchanged smart contract methods
The methods createERC20SingleRequestProxy
and createEthereumSingleRequestProxy
are still using the "Proxy" terminology.
Given that the smart contracts were not renamed, this might be intentional. However, please verify that these method names are correct and align with the updated terminology in the codebase.
95-95
: Verify event names correspond to updated terminology
The event names ERC20SingleRequestProxyCreated
and EthereumSingleRequestProxyCreated
still use "Proxy" instead of "Forwarder".
Since the contracts were not changed, this might be appropriate. Please confirm that these event names are correct and consistent with the deployed contracts.
104-104
: Ensure consistency in event argument names
The event argument proxyAddress
is used to retrieve the forwarder address:
const forwarderAddress = event.args?.proxyAddress || event.args?.[0];
As per previous discussions, if the smart contract has not changed, retaining proxyAddress
is acceptable. Just ensure that this is intentional and documented accordingly.
Description of the changes
Single Request Proxy
toSingle Request Forwarder
This PR does not rename the smart contracts since they are already deployed, it only effects the SDK methods that help make interactions with SRF easier for the builder.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Tests
Chores
singleRequestProxy
tosingleRequestForwarder
, ensuring consistency across the codebase.