-
Notifications
You must be signed in to change notification settings - Fork 64
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
feat: prototype localnet #202
Conversation
Co-authored-by: lumtis <lucas.bertrand.22@gmail.com>
Co-authored-by: lumtis <lucas.bertrand.22@gmail.com>
Co-authored-by: lumtis <lucas.bertrand.22@gmail.com>
WalkthroughThe changes involve refactoring Changes
Sequence Diagram(s)sequenceDiagram
participant Worker as worker.ts
participant EVM as EVM
participant ZEVM as ZEVM
participant GatewayEVM as GatewayEVM
participant GatewayZEVM as GatewayZEVM
Worker->>EVM: Deploy ReceiverEVM Contract
Worker->>ZEVM: Deploy SenderZEVM Contract
loop Management
note over Worker: Mint and Transfer Tokens
Worker->>EVM: Mint ERC-20
Worker->>ZEVM: Mint ZRC-20
end
loop Interactions
note over Worker: Calls, Withdrawals, Deposits through Gateways
Worker->>GatewayZEVM: Call ReceiverEVM
GatewayZEVM->>EVM: Execute Call
Worker->>GatewayEVM: Call SenderZEVM
GatewayEVM->>ZEVM: Execute Call
end
Poem
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 as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #202 +/- ##
=======================================
Coverage 59.25% 59.25%
=======================================
Files 31 31
Lines 1048 1048
Branches 262 217 -45
=======================================
Hits 621 621
Misses 427 427 ☔ View full report in Codecov by Sentry. |
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 (3)
scripts/readme.md (3)
9-9
: Possible missing article.Consider adding "the" before "hardhat local node and worker script" for clarity.
- This will run hardhat local node and worker script, which will deploy all contracts, and listen and react to events, facilitating communication between contracts. + This will run the hardhat local node and worker script, which will deploy all contracts, and listen and react to events, facilitating communication between contracts.Tools
LanguageTool
[uncategorized] ~9-~9: Possible missing article found.
Context: ...:yarn localnet
This will run hardhat local node and worker script, which wil...(AI_HYDRA_LEO_MISSING_THE)
10-10
: Possible missing article.Consider adding "the" before "same addresses" for clarity.
- To make use of default contract addresses on localnet, start localnet from scratch, so contracts are deployed on same addresses. Otherwise, provide custom addresses as tasks parameters. + To make use of the default contract addresses on localnet, start localnet from scratch, so contracts are deployed on the same addresses. Otherwise, provide custom addresses as tasks parameters.Tools
LanguageTool
[uncategorized] ~10-~10: Possible missing article found.
Context: ...m scratch, so contracts are deployed on same addresses. Otherwise, provide custom ad...(AI_HYDRA_LEO_MISSING_THE)
6-6
: Specify language for fenced code block.For better syntax highlighting, specify the language for the code block.
- ``` + ```bash
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (3)
- scripts/readme.md (1 hunks)
- scripts/worker.ts (1 hunks)
- tasks/localnet.ts (1 hunks)
Files skipped from review as they are similar to previous changes (2)
- scripts/worker.ts
- tasks/localnet.ts
Additional context used
Path-based instructions (1)
scripts/readme.md (1)
Pattern
scripts/**
: Review the Hardhat scripts for best practices.
LanguageTool
scripts/readme.md
[uncategorized] ~9-~9: Possible missing article found.
Context: ...:yarn localnet
This will run hardhat local node and worker script, which wil...(AI_HYDRA_LEO_MISSING_THE)
[uncategorized] ~10-~10: Possible missing article found.
Context: ...m scratch, so contracts are deployed on same addresses. Otherwise, provide custom ad...(AI_HYDRA_LEO_MISSING_THE)
Markdownlint
scripts/readme.md
5-5: null
Fenced code blocks should have a language specified(MD040, fenced-code-language)
I get this error when starting localnet:
As suggested on Internet, you can increase the memory for JS, just wondering why this is necessary? I'm gonna invetstigate further
|
@lumtis I was getting the same error, then switched to nodejs v20 it's gone. |
thanks for checking, i didnt have this error locally it could be that hardhat is spending a lot of resources, did you also try this https://hardhat.org/hardhat-runner/docs/troubleshooting/common-problems#out-of-memory-errors-when-compiling-large-projects using different node version might also help as @fadeev suggested |
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.
This looks good.
Not blocking for this PR, but I would see two improvement for the developer.
- Packaging the command to reduce the logs to what is essential to developer: showing account the two gateway addresses:
Local ZetaChain contracts environment deployed
Account 1: ...
...
Gateway EVM: 0x...
Gateway ZEVM: 0x...
Maybe could be done with some flags.
- Even further to simplify dev development, shipping a Hardhat plugin for devs to use to integrate the gateway contracts and worker in their own localnet.
import "zeta-contracts-localnet";
function deployScript{
// ...
// Deploy ZetaChain contracts environment, return gateway addresses and start the work process in the background
var gatewayZEVM, gatewayEVM = setupLocalZetaChain(...)
// dev do their own deployment here with their contracts using gateways
// ...
}
Not knowledgeable enough on hardhat to know if this is possible
These are not blocking for this PR, this is further work for devEx purposes
@fadeev I think this makes sense if you can review this one |
thanks for review, I fixed the comments, except hardhat plugin part, maybe we can discuss that and research options |
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: 6
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (2)
- scripts/worker.ts (1 hunks)
- tasks/localnet.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- tasks/localnet.ts
Additional context used
Path-based instructions (1)
scripts/worker.ts (1)
Pattern
scripts/**
: Review the Hardhat scripts for best practices.
GitHub Check: lint
scripts/worker.ts
[failure] 11-11:
Insert·
[failure] 40-40:
Expected object keys to be in ascending order. 'custody' should be before 'gatewayEVM'
[failure] 44-44:
Insert;
[failure] 46-46:
ReplacesystemContracts,·ownerEVM:·SignerWithAddress,·ownerZEVM:·SignerWithAddress,·fungibleModuleSigner:·SignerWithAddress
with⏎··systemContracts,⏎··ownerEVM:·SignerWithAddress,⏎··ownerZEVM:·SignerWithAddress,⏎··fungibleModuleSigner:·SignerWithAddress⏎
[failure] 96-96:
Expected object keys to be in ascending order. 'ZRC20Contract' should be before 'senderZEVM'
[failure] 172-172:
Replace[systemContracts.gatewayZEVM.address,·fungibleModuleSigner.address,·1],·asset,·parseEther("0"),·receiver,·payload
with⏎··········[systemContracts.gatewayZEVM.address,·fungibleModuleSigner.address,·1],⏎··········asset,⏎··········parseEther("0"),⏎··········receiver,⏎··········payload⏎········
Additional comments not posted (1)
scripts/worker.ts (1)
184-191
: LGTM!The initialization code looks good to me.
scripts/worker.ts
Outdated
gatewayZEVM, | ||
systemContract, | ||
}; | ||
} |
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.
Add missing semicolon.
Add a semicolon at the end of the function for better readability.
}
+};
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
} | |
} | |
; |
Tools
GitHub Check: lint
[failure] 44-44:
Insert;
scripts/worker.ts
Outdated
console.log("Worker: Calling TestZContract through GatewayZEVM..."); | ||
const executeTx = await systemContracts.gatewayZEVM | ||
.connect(fungibleModuleSigner) | ||
.execute([systemContracts.gatewayZEVM.address, fungibleModuleSigner.address, 1], asset, parseEther("0"), receiver, payload); |
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.
Reformat function parameters.
Reformat the function parameters for better readability.
const executeTx = await systemContracts.gatewayZEVM
.connect(fungibleModuleSigner)
.execute(
[systemContracts.gatewayZEVM.address, fungibleModuleSigner.address, 1],
asset,
parseEther("0"),
receiver,
payload
);
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
.execute([systemContracts.gatewayZEVM.address, fungibleModuleSigner.address, 1], asset, parseEther("0"), receiver, payload); | |
.execute( | |
[systemContracts.gatewayZEVM.address, fungibleModuleSigner.address, 1], | |
asset, | |
parseEther("0"), | |
receiver, | |
payload | |
); |
Tools
GitHub Check: lint
[failure] 172-172:
Replace[systemContracts.gatewayZEVM.address,·fungibleModuleSigner.address,·1],·asset,·parseEther("0"),·receiver,·payload
with⏎··········[systemContracts.gatewayZEVM.address,·fungibleModuleSigner.address,·1],⏎··········asset,⏎··········parseEther("0"),⏎··········receiver,⏎··········payload⏎········
scripts/worker.ts
Outdated
|
||
export const FUNGIBLE_MODULE_ADDRESS = "0x735b14BB79463307AAcBED86DAf3322B1e6226aB"; | ||
|
||
const deploySystemContracts = async(tss: SignerWithAddress) => { |
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.
Insert missing space.
Add a space after the import statement for better readability.
const deploySystemContracts = async(tss: SignerWithAddress) => {
+ const deploySystemContracts = async (tss: SignerWithAddress) => {
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
const deploySystemContracts = async(tss: SignerWithAddress) => { | |
const deploySystemContracts = async (tss: SignerWithAddress) => { |
Tools
GitHub Check: lint
[failure] 11-11:
Insert·
scripts/worker.ts
Outdated
return { | ||
receiverEVM, | ||
senderZEVM, | ||
ZRC20Contract, |
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.
Sort object keys.
Sort the object keys in ascending order for better readability.
return {
receiverEVM,
senderZEVM,
ZRC20Contract,
testZContract,
};
+return {
+ receiverEVM,
+ senderZEVM,
+ testZContract,
+ ZRC20Contract,
+};
Committable suggestion was skipped due to low confidence.
Tools
GitHub Check: lint
[failure] 96-96:
Expected object keys to be in ascending order. 'ZRC20Contract' should be before 'senderZEVM'
scripts/worker.ts
Outdated
}; | ||
} | ||
|
||
const deployTestContracts = async (systemContracts, ownerEVM: SignerWithAddress, ownerZEVM: SignerWithAddress, fungibleModuleSigner: SignerWithAddress) => { |
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.
Reformat function parameters.
Reformat the function parameters for better readability.
const deployTestContracts = async (
systemContracts,
ownerEVM: SignerWithAddress,
ownerZEVM: SignerWithAddress,
fungibleModuleSigner: SignerWithAddress
) => {
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
const deployTestContracts = async (systemContracts, ownerEVM: SignerWithAddress, ownerZEVM: SignerWithAddress, fungibleModuleSigner: SignerWithAddress) => { | |
const deployTestContracts = async ( | |
systemContracts, | |
ownerEVM: SignerWithAddress, | |
ownerZEVM: SignerWithAddress, | |
fungibleModuleSigner: SignerWithAddress | |
) => { |
Tools
GitHub Check: lint
[failure] 46-46:
ReplacesystemContracts,·ownerEVM:·SignerWithAddress,·ownerZEVM:·SignerWithAddress,·fungibleModuleSigner:·SignerWithAddress
with⏎··systemContracts,⏎··ownerEVM:·SignerWithAddress,⏎··ownerZEVM:·SignerWithAddress,⏎··fungibleModuleSigner:·SignerWithAddress⏎
scripts/worker.ts
Outdated
const deploySystemContracts = async(tss: SignerWithAddress) => { | ||
// Prepare EVM | ||
// Deploy system contracts (gateway and custody) | ||
const GatewayEVM = await ethers.getContractFactory("GatewayEVM"); | ||
const Custody = await ethers.getContractFactory("ERC20CustodyNew"); | ||
|
||
const gatewayEVM = await upgrades.deployProxy(GatewayEVM, [tss.address], { | ||
initializer: "initialize", | ||
kind: "uups", | ||
}); | ||
console.log("GatewayEVM:", gatewayEVM.address); | ||
|
||
const custody = await Custody.deploy(gatewayEVM.address); | ||
await gatewayEVM.setCustody(custody.address); | ||
|
||
// Prepare ZEVM | ||
// Deploy system contracts (gateway and system) | ||
const SystemContractFactory = await ethers.getContractFactory("SystemContractMock"); | ||
const systemContract = (await SystemContractFactory.deploy(AddressZero, AddressZero, AddressZero)) as SystemContract; | ||
|
||
const GatewayZEVM = await ethers.getContractFactory("GatewayZEVM"); | ||
const gatewayZEVM = await upgrades.deployProxy(GatewayZEVM, [], { | ||
initializer: "initialize", | ||
kind: "uups", | ||
}); | ||
console.log("GatewayZEVM:", gatewayZEVM.address); | ||
|
||
return { | ||
gatewayEVM, | ||
custody, | ||
gatewayZEVM, | ||
systemContract, | ||
}; | ||
} |
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.
Improve function structure and add comments.
Move deployment to a separate function and add comments to separate test contracts from system contracts.
// Separate deployment logic into a new function
const deploySystemContracts = async (tss: SignerWithAddress) => {
// Prepare EVM
// Deploy system contracts (gateway and custody)
const GatewayEVM = await ethers.getContractFactory("GatewayEVM");
const Custody = await ethers.getContractFactory("ERC20CustodyNew");
const gatewayEVM = await upgrades.deployProxy(GatewayEVM, [tss.address], {
initializer: "initialize",
kind: "uups",
});
console.log("GatewayEVM:", gatewayEVM.address);
const custody = await Custody.deploy(gatewayEVM.address);
await gatewayEVM.setCustody(custody.address);
// Prepare ZEVM
// Deploy system contracts (gateway and system)
const SystemContractFactory = await ethers.getContractFactory("SystemContractMock");
const systemContract = (await SystemContractFactory.deploy(AddressZero, AddressZero, AddressZero)) as SystemContract;
const GatewayZEVM = await ethers.getContractFactory("GatewayZEVM");
const gatewayZEVM = await upgrades.deployProxy(GatewayZEVM, [], {
initializer: "initialize",
kind: "uups",
});
console.log("GatewayZEVM:", gatewayZEVM.address);
return {
gatewayEVM,
custody,
gatewayZEVM,
systemContract,
};
};
// Add comments to separate test contracts from system contracts
const deployTestContracts = async (systemContracts, ownerEVM: SignerWithAddress, ownerZEVM: SignerWithAddress, fungibleModuleSigner: SignerWithAddress) => {
// Prepare EVM
// Deploy test contracts (erc20, receiver) and mint funds to test accounts
const TestERC20 = await ethers.getContractFactory("TestERC20");
const ReceiverEVM = await ethers.getContractFactory("ReceiverEVM");
const token = await TestERC20.deploy("Test Token", "TTK");
const receiverEVM = await ReceiverEVM.deploy();
await token.mint(ownerEVM.address, ethers.utils.parseEther("1000"));
// Transfer some tokens to the custody contract
await token.transfer(systemContracts.custody.address, ethers.utils.parseEther("500"));
// Prepare ZEVM
// Deploy test contracts (test zContract, zrc20, sender) and mint funds to test accounts
const TestZContract = await ethers.getContractFactory("TestZContract");
const testZContract = await TestZContract.deploy();
const ZRC20Factory = await ethers.getContractFactory("ZRC20New");
const ZRC20Contract = (await ZRC20Factory.connect(fungibleModuleSigner).deploy(
"TOKEN",
"TKN",
18,
1,
1,
0,
systemContracts.systemContract.address,
systemContracts.gatewayZEVM.address
)) as ZRC20;
await systemContracts.systemContract.setGasCoinZRC20(1, ZRC20Contract.address);
await systemContracts.systemContract.setGasPrice(1, ZRC20Contract.address);
await ZRC20Contract.connect(fungibleModuleSigner).deposit(ownerZEVM.address, parseEther("100"));
await ZRC20Contract.connect(ownerZEVM).approve(systemContracts.gatewayZEVM.address, parseEther("100"));
// Include abi of gatewayZEVM events, so hardhat can decode them automatically
const senderArtifact = await hre.artifacts.readArtifact("SenderZEVM");
const gatewayZEVMArtifact = await hre.artifacts.readArtifact("GatewayZEVM");
const senderABI = [
...senderArtifact.abi,
...gatewayZEVMArtifact.abi.filter((f: ethers.utils.Fragment) => f.type === "event"),
];
const SenderZEVM = new ethers.ContractFactory(senderABI, senderArtifact.bytecode, ownerZEVM);
const senderZEVM = await SenderZEVM.deploy(systemContracts.gatewayZEVM.address);
await ZRC20Contract.connect(fungibleModuleSigner).deposit(senderZEVM.address, parseEther("100"));
return {
receiverEVM,
senderZEVM,
ZRC20Contract,
testZContract,
};
};
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
const deploySystemContracts = async(tss: SignerWithAddress) => { | |
// Prepare EVM | |
// Deploy system contracts (gateway and custody) | |
const GatewayEVM = await ethers.getContractFactory("GatewayEVM"); | |
const Custody = await ethers.getContractFactory("ERC20CustodyNew"); | |
const gatewayEVM = await upgrades.deployProxy(GatewayEVM, [tss.address], { | |
initializer: "initialize", | |
kind: "uups", | |
}); | |
console.log("GatewayEVM:", gatewayEVM.address); | |
const custody = await Custody.deploy(gatewayEVM.address); | |
await gatewayEVM.setCustody(custody.address); | |
// Prepare ZEVM | |
// Deploy system contracts (gateway and system) | |
const SystemContractFactory = await ethers.getContractFactory("SystemContractMock"); | |
const systemContract = (await SystemContractFactory.deploy(AddressZero, AddressZero, AddressZero)) as SystemContract; | |
const GatewayZEVM = await ethers.getContractFactory("GatewayZEVM"); | |
const gatewayZEVM = await upgrades.deployProxy(GatewayZEVM, [], { | |
initializer: "initialize", | |
kind: "uups", | |
}); | |
console.log("GatewayZEVM:", gatewayZEVM.address); | |
return { | |
gatewayEVM, | |
custody, | |
gatewayZEVM, | |
systemContract, | |
}; | |
} | |
const deploySystemContracts = async (tss: SignerWithAddress) => { | |
// Prepare EVM | |
// Deploy system contracts (gateway and custody) | |
const GatewayEVM = await ethers.getContractFactory("GatewayEVM"); | |
const Custody = await ethers.getContractFactory("ERC20CustodyNew"); | |
const gatewayEVM = await upgrades.deployProxy(GatewayEVM, [tss.address], { | |
initializer: "initialize", | |
kind: "uups", | |
}); | |
console.log("GatewayEVM:", gatewayEVM.address); | |
const custody = await Custody.deploy(gatewayEVM.address); | |
await gatewayEVM.setCustody(custody.address); | |
// Prepare ZEVM | |
// Deploy system contracts (gateway and system) | |
const SystemContractFactory = await ethers.getContractFactory("SystemContractMock"); | |
const systemContract = (await SystemContractFactory.deploy(AddressZero, AddressZero, AddressZero)) as SystemContract; | |
const GatewayZEVM = await ethers.getContractFactory("GatewayZEVM"); | |
const gatewayZEVM = await upgrades.deployProxy(GatewayZEVM, [], { | |
initializer: "initialize", | |
kind: "uups", | |
}); | |
console.log("GatewayZEVM:", gatewayZEVM.address); | |
return { | |
gatewayEVM, | |
custody, | |
gatewayZEVM, | |
systemContract, | |
}; | |
}; | |
// Add comments to separate test contracts from system contracts | |
const deployTestContracts = async (systemContracts, ownerEVM: SignerWithAddress, ownerZEVM: SignerWithAddress, fungibleModuleSigner: SignerWithAddress) => { | |
// Prepare EVM | |
// Deploy test contracts (erc20, receiver) and mint funds to test accounts | |
const TestERC20 = await ethers.getContractFactory("TestERC20"); | |
const ReceiverEVM = await ethers.getContractFactory("ReceiverEVM"); | |
const token = await TestERC20.deploy("Test Token", "TTK"); | |
const receiverEVM = await ReceiverEVM.deploy(); | |
await token.mint(ownerEVM.address, ethers.utils.parseEther("1000")); | |
// Transfer some tokens to the custody contract | |
await token.transfer(systemContracts.custody.address, ethers.utils.parseEther("500")); | |
// Prepare ZEVM | |
// Deploy test contracts (test zContract, zrc20, sender) and mint funds to test accounts | |
const TestZContract = await ethers.getContractFactory("TestZContract"); | |
const testZContract = await TestZContract.deploy(); | |
const ZRC20Factory = await ethers.getContractFactory("ZRC20New"); | |
const ZRC20Contract = (await ZRC20Factory.connect(fungibleModuleSigner).deploy( | |
"TOKEN", | |
"TKN", | |
18, | |
1, | |
1, | |
0, | |
systemContracts.systemContract.address, | |
systemContracts.gatewayZEVM.address | |
)) as ZRC20; | |
await systemContracts.systemContract.setGasCoinZRC20(1, ZRC20Contract.address); | |
await systemContracts.systemContract.setGasPrice(1, ZRC20Contract.address); | |
await ZRC20Contract.connect(fungibleModuleSigner).deposit(ownerZEVM.address, parseEther("100")); | |
await ZRC20Contract.connect(ownerZEVM).approve(systemContracts.gatewayZEVM.address, parseEther("100")); | |
// Include abi of gatewayZEVM events, so hardhat can decode them automatically | |
const senderArtifact = await hre.artifacts.readArtifact("SenderZEVM"); | |
const gatewayZEVMArtifact = await hre.artifacts.readArtifact("GatewayZEVM"); | |
const senderABI = [ | |
...senderArtifact.abi, | |
...gatewayZEVMArtifact.abi.filter((f: ethers.utils.Fragment) => f.type === "event"), | |
]; | |
const SenderZEVM = new ethers.ContractFactory(senderABI, senderArtifact.bytecode, ownerZEVM); | |
const senderZEVM = await SenderZEVM.deploy(systemContracts.gatewayZEVM.address); | |
await ZRC20Contract.connect(fungibleModuleSigner).deposit(senderZEVM.address, parseEther("100")); | |
return { | |
receiverEVM, | |
senderZEVM, | |
ZRC20Contract, | |
testZContract, | |
}; | |
}; |
Tools
GitHub Check: lint
[failure] 11-11:
Insert·
[failure] 40-40:
Expected object keys to be in ascending order. 'custody' should be before 'gatewayEVM'
[failure] 44-44:
Insert;
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
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (1)
- scripts/worker.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- scripts/worker.ts
For the cleaned up log, is there maybe a solution, like a flag, to just show the WORKER logs? |
This is really cool! A few thoughts. Should this eventually move into a separate repo? Pros: we don't mix tools and protocol contracts, we don't have to explicitly exclude this code from the audit. Cons: slower iterations as protocol contracts live in one repo, localnet lives in a different repo. Package Should we find a different name for this? This feels more like a simulation rather than a local network. |
Would it make sense to start testing this with the examples we have in the |
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.
🔥🔥🔥
yes there is a way, i added to |
thanks for review - i would say currently this can help us speed up development as we work on v2 contracts so until its in development phase i would say it is beneficial to stay in same repo as it would evolve with contracts later we can discuss moving it and packaging it differently @lumtis what do you think? |
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 (7)
scripts/readme.md (7)
5-5
: Specify the language for the code block.Fenced code blocks should have a language specified for syntax highlighting.
-``` +yarn localnet +```shellTools
Markdownlint
5-5: null
Fenced code blocks should have a language specified(MD040, fenced-code-language)
9-9
: Add missing article.There is a missing article before "Hardhat local node."
-This will run hardhat local node and worker script, which will deploy all contracts, and listen and react to events, facilitating communication between contracts. +This will run the Hardhat local node and worker script, which will deploy all contracts, and listen and react to events, facilitating communication between contracts.Tools
LanguageTool
[uncategorized] ~9-~9: Possible missing article found.
Context: ...:yarn localnet
This will run hardhat local node and worker script, which wil...(AI_HYDRA_LEO_MISSING_THE)
10-10
: Add missing article.There is a missing article before "same addresses."
-Tasks to interact with localnet are located in `tasks/localnet`. To make use of default contract addresses on localnet, start localnet from scratch, so contracts are deployed on same addresses. Otherwise, provide custom addresses as tasks parameters. +Tasks to interact with localnet are located in `tasks/localnet`. To make use of default contract addresses on localnet, start localnet from scratch, so contracts are deployed on the same addresses. Otherwise, provide custom addresses as tasks parameters.Tools
LanguageTool
[uncategorized] ~10-~10: Possible missing article found.
Context: ...m scratch, so contracts are deployed on same addresses. Otherwise, provide custom ad...(AI_HYDRA_LEO_MISSING_THE)
12-12
: Correct grammatical number.The grammatical number of "tasks parameters" is incorrect.
-Otherwise, provide custom addresses as tasks parameters. +Otherwise, provide custom addresses as task parameters.Tools
LanguageTool
[uncategorized] ~12-~12: The grammatical number of this noun doesn’t look right. Consider replacing it.
Context: ...sks parameters. To only show logs from worker and hide hardhat node logs: ``` yarn lo...(AI_EN_LECTOR_REPLACEMENT_NOUN_NUMBER)
13-13
: Surround fenced code block with blank lines.Fenced code blocks should be surrounded by blank lines for better readability.
-To only show logs from worker and hide hardhat node logs: +To only show logs from the worker and hide Hardhat node logs: ```shell yarn localnet --hide="NODE"<details> <summary>Tools</summary> <details> <summary>Markdownlint</summary><blockquote> 13-13: null Fenced code blocks should be surrounded by blank lines (MD031, blanks-around-fences) --- 13-13: null Fenced code blocks should have a language specified (MD040, fenced-code-language) </blockquote></details> </details> --- `13-13`: **Specify the language for the code block.** Fenced code blocks should have a language specified for syntax highlighting. ```diff -``` +yarn localnet --hide="NODE" +```shell
Tools
Markdownlint
13-13: null
Fenced code blocks should be surrounded by blank lines(MD031, blanks-around-fences)
13-13: null
Fenced code blocks should have a language specified(MD040, fenced-code-language)
15-15
: Add a trailing newline.Files should end with a single newline character.
-``` +``` +Tools
Markdownlint
15-15: null
Files should end with a single newline character(MD047, single-trailing-newline)
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (1)
- scripts/readme.md (1 hunks)
Additional context used
Path-based instructions (1)
scripts/readme.md (1)
Pattern
scripts/**
: Review the Hardhat scripts for best practices.
LanguageTool
scripts/readme.md
[uncategorized] ~9-~9: Possible missing article found.
Context: ...:yarn localnet
This will run hardhat local node and worker script, which wil...(AI_HYDRA_LEO_MISSING_THE)
[uncategorized] ~10-~10: Possible missing article found.
Context: ...m scratch, so contracts are deployed on same addresses. Otherwise, provide custom ad...(AI_HYDRA_LEO_MISSING_THE)
[uncategorized] ~12-~12: The grammatical number of this noun doesn’t look right. Consider replacing it.
Context: ...sks parameters. To only show logs from worker and hide hardhat node logs: ``` yarn lo...(AI_EN_LECTOR_REPLACEMENT_NOUN_NUMBER)
Markdownlint
scripts/readme.md
13-13: null
Fenced code blocks should be surrounded by blank lines(MD031, blanks-around-fences)
5-5: null
Fenced code blocks should have a language specified(MD040, fenced-code-language)
13-13: null
Fenced code blocks should have a language specified(MD040, fenced-code-language)
15-15: null
Files should end with a single newline character(MD047, single-trailing-newline)
Yeah, I would tend toward keep the main command in this repo as being part of the development workflow and provide a packaged plugin or so reusable in a utility |
start local hardhat node and worker which deploys evm/zevm contracts and listen to Call/WithdrawAndCall/Deposit events
also, adding 4 hardhat tasks to interact with localnet (we can add more in follow up PRs if needed):
Summary by CodeRabbit
New Features
Documentation