-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Operator Forwarder Production Readiness (#12983)
* move oepratorforwarder out of dev/ and add more test cases * Update test locations * Update gas snapshot * Update solc compile * Changeset * Prettier linting + hardhat test updates * Interface naming and test updates * Update Deployer.sol => Deployer.t.sol * Rework OperatorForwarder tests * Update gas snapshot * prettier * Fix Hardhat tests * More style maintenance * Update constant variables in Deployer.t.sol * Update gas snapshot
- Loading branch information
1 parent
841fe61
commit 644f5f2
Showing
36 changed files
with
774 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@chainlink/contracts": patch | ||
--- | ||
|
||
Update operatorforwarder tests and pull out of dev/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,21 @@ | ||
Operator_cancelRequest:test_Success(uint96) (runs: 256, μ: 306103, ~: 306096) | ||
Operator_cancelRequest:test_afterSuccessfulRequestSucess(uint96) (runs: 256, μ: 384781, ~: 389554) | ||
FactoryTest:test_DeployNewForwarderAndTransferOwnership_Success() (gas: 1059722) | ||
FactoryTest:test_DeployNewForwarder_Success() (gas: 1048209) | ||
FactoryTest:test_DeployNewOperatorAndForwarder_Success() (gas: 4069305) | ||
FactoryTest:test_DeployNewOperator_Success() (gas: 3020464) | ||
ForwarderTest:test_Forward_Success(uint256) (runs: 256, μ: 226200, ~: 227289) | ||
ForwarderTest:test_MultiForward_Success(uint256,uint256) (runs: 256, μ: 257876, ~: 259120) | ||
ForwarderTest:test_OwnerForward_Success() (gas: 30118) | ||
ForwarderTest:test_SetAuthorizedSenders_Success() (gas: 160524) | ||
ForwarderTest:test_TransferOwnershipWithMessage_Success() (gas: 35123) | ||
OperatorTest:test_CancelOracleRequest_Success() (gas: 274436) | ||
OperatorTest:test_CancelOracleRequest_Success() (gas: 274436) | ||
OperatorTest:test_FulfillOracleRequest_Success() (gas: 330603) | ||
OperatorTest:test_FulfillOracleRequest_Success() (gas: 330603) | ||
OperatorTest:test_NotAuthorizedSender_Revert() (gas: 246716) | ||
OperatorTest:test_NotAuthorizedSender_Revert() (gas: 246716) | ||
OperatorTest:test_OracleRequest_Success() (gas: 250019) | ||
OperatorTest:test_OracleRequest_Success() (gas: 250019) | ||
OperatorTest:test_SendRequestAndCancelRequest_Success(uint96) (runs: 256, μ: 387120, ~: 387124) | ||
OperatorTest:test_SendRequestAndCancelRequest_Success(uint96) (runs: 256, μ: 387120, ~: 387124) | ||
OperatorTest:test_SendRequest_Success(uint96) (runs: 256, μ: 303611, ~: 303620) | ||
OperatorTest:test_SendRequest_Success(uint96) (runs: 256, μ: 303611, ~: 303620) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...atorforwarder/dev/AuthorizedForwarder.sol → ...operatorforwarder/AuthorizedForwarder.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ratorforwarder/dev/AuthorizedReceiver.sol → .../operatorforwarder/AuthorizedReceiver.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
100 changes: 0 additions & 100 deletions
100
contracts/src/v0.8/operatorforwarder/dev/test/operator.t.sol
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...nterfaces/AuthorizedReceiverInterface.sol → ...warder/interfaces/IAuthorizedReceiver.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...er/dev/interfaces/WithdrawalInterface.sol → ...ratorforwarder/interfaces/IWithdrawal.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.0; | ||
|
||
import {Deployer} from "./testhelpers/Deployer.t.sol"; | ||
import {AuthorizedForwarder} from "../AuthorizedForwarder.sol"; | ||
import {Operator} from "../Operator.sol"; | ||
|
||
contract FactoryTest is Deployer { | ||
function setUp() public { | ||
_setUp(); | ||
|
||
vm.startPrank(ALICE); | ||
} | ||
|
||
function test_DeployNewOperator_Success() public { | ||
// Deploy a new operator using the factory. | ||
address newOperator = s_factory.deployNewOperator(); | ||
// Assert that the new operator was indeed created by the factory. | ||
assertTrue(s_factory.created(newOperator)); | ||
// Ensure that Alice is the owner of the newly deployed operator. | ||
require(Operator(newOperator).owner() == ALICE); | ||
} | ||
|
||
function test_DeployNewOperatorAndForwarder_Success() public { | ||
// Deploy both a new operator and a new forwarder using the factory. | ||
(address newOperator, address newForwarder) = s_factory.deployNewOperatorAndForwarder(); | ||
|
||
// Assert that the new operator and the new forwarder were indeed created by the factory. | ||
assertTrue(s_factory.created(newOperator)); | ||
assertTrue(s_factory.created(newForwarder)); | ||
// Ensure that Alice is the owner of the newly deployed operator. | ||
require(Operator(newOperator).owner() == ALICE); | ||
|
||
//Operator to accept ownership | ||
vm.startPrank(newOperator); | ||
AuthorizedForwarder(newForwarder).acceptOwnership(); | ||
|
||
// Ensure that the newly deployed operator is the owner of the newly deployed forwarder. | ||
require(AuthorizedForwarder(newForwarder).owner() == newOperator, "operator is not the owner"); | ||
} | ||
|
||
function test_DeployNewForwarder_Success() public { | ||
// Deploy a new forwarder using the factory. | ||
address newForwarder = s_factory.deployNewForwarder(); | ||
// Assert that the new forwarder was indeed created by the factory. | ||
assertTrue(s_factory.created(newForwarder)); | ||
// Ensure that Alice is the owner of the newly deployed forwarder. | ||
require(AuthorizedForwarder(newForwarder).owner() == ALICE); | ||
} | ||
|
||
function test_DeployNewForwarderAndTransferOwnership_Success() public { | ||
// Deploy a new forwarder with a proposal to transfer its ownership to Bob. | ||
address newForwarder = s_factory.deployNewForwarderAndTransferOwnership(BOB, new bytes(0)); | ||
// Assert that the new forwarder was indeed created by the factory. | ||
assertTrue(s_factory.created(newForwarder)); | ||
// Ensure that Alice is still the current owner of the newly deployed forwarder. | ||
require(AuthorizedForwarder(newForwarder).owner() == ALICE); | ||
|
||
// Only proposed owner can call acceptOwnership() | ||
vm.expectRevert("Must be proposed owner"); | ||
AuthorizedForwarder(newForwarder).acceptOwnership(); | ||
|
||
vm.startPrank(BOB); | ||
// Let Bob accept the ownership. | ||
AuthorizedForwarder(newForwarder).acceptOwnership(); | ||
// Ensure that Bob is now the owner of the forwarder after the transfer. | ||
require(AuthorizedForwarder(newForwarder).owner() == BOB); | ||
} | ||
} |
Oops, something went wrong.