-
Notifications
You must be signed in to change notification settings - Fork 6
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
added e2e test #13
added e2e test #13
Changes from 3 commits
e102c9d
ce17f8b
e34c0b9
df46a1f
0bd9820
a4c4ec0
47fc6b9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,4 +53,44 @@ describe("SgETH.sol", () => { | |
.and.to.be.emit(sgEth, "RoleRevoked") | ||
.withArgs(ethers.constants.HashZero, deployer.address, deployer.address); | ||
}); | ||
|
||
it("e2e test", async () => { | ||
// deploy sgeth | ||
const WSGETH = await ethers.getContractFactory("WSGETH"); | ||
const wsgETH = await WSGETH.deploy(sgEth.address, 24 * 60 * 60); | ||
await wsgETH.deployed(); | ||
|
||
const feeCalc = ethers.constants.AddressZero; // not sure if it is right | ||
const numValidators = 1000; | ||
const adminFee = 0; | ||
|
||
const addresses = [ | ||
feeCalc, | ||
sgEth.address, | ||
wsgETH.address, | ||
ethers.constants.AddressZero, // using dummy address | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you comment in what these addresses are supposed to be? i think being able to deploy with a zero addr will annoy auditers, so we should
|
||
ethers.constants.AddressZero, // using dummy address | ||
]; | ||
|
||
// add secondary minter contract / eoa | ||
const Minter = await ethers.getContractFactory("SharedDepositMinterV2"); | ||
const minter = await Minter.deploy(numValidators, adminFee, addresses); | ||
await minter.deployed(); | ||
|
||
// revoke deployer minter rights | ||
// actually don't need to do this because deployer doesn't have minter role | ||
await sgEth.removeMinter(deployer.address); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm. good spot.
|
||
// add secondary owner | ||
// revoke deployer admin rights | ||
await expect(sgEth.transferOwnership(minter.address)) | ||
.to.be.emit(sgEth, "RoleGranted") | ||
.withArgs(ethers.constants.HashZero, minter.address, deployer.address) | ||
.and.to.be.emit(sgEth, "RoleRevoked") | ||
.withArgs(ethers.constants.HashZero, deployer.address, deployer.address); | ||
|
||
// check auth invariants are preserved. i.e ex owner and outsiders cannot interact with the contract | ||
await expect(sgEth.connect(deployer).transferOwnership(alice.address)).to.be.revertedWith( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we check deployer cant transfer to alice, but can we also make sure alice cant transfer to anyone? deployer + 0x00? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think alice can transfer ownership to another. do you want me to check this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yea? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. okay. got it |
||
`AccessControl: account ${deployer.address.toLowerCase()} is missing role ${ethers.constants.HashZero}`, | ||
); | ||
}); | ||
}); |
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.
iirc, theres 3 missing contracts here from the default deploy pipeline linked below:
https://github.com/chimera-defi/SharedDeposit/blob/main/deploy/v2/lib/onchain_actions.js#L102
daoFeeSplitter -> OpenZeppellin vanilla paymentsSplitter , pulled in here
SharedDeposit/deploy/v2/lib/opts.js
Line 57 in ae40f84
source:
OZ-3.3. - https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.3/contracts/payment/PaymentSplitter.sol
Note: - this is removed from OZ master, should check to make sure its still safe. Also need to rethink this build approach since it wasnt obvious to you what this contract should be?
Withdrawals -> https://github.com/chimera-defi/SharedDeposit/blob/main/contracts/v2/core/Withdrawals.sol
RewardsReceiver -> https://github.com/chimera-defi/SharedDeposit/blob/main/contracts/v2/core/RewardsReceiver.sol
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.
Could you let me know parameters of each contract constructor?
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.
you can see the constructor args here
https://github.com/chimera-defi/SharedDeposit/blob/main/deploy/v2/lib/onchain_actions.js#L102
they are defined here https://github.com/chimera-defi/SharedDeposit/blob/main/deploy/v2/lib/opts.js#L45
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.
What's the deposit contract? on args of minterv2?