Add Crosschain Batcher contract#747
Conversation
src/core/hub/Hub.sol
Outdated
|
|
||
| if (what == "gateway") gateway = IGateway(data); | ||
| else if (what == "feeHook") feeHook = IFeeHook(data); | ||
| if (what == "feeHook") feeHook = IFeeHook(data); |
There was a problem hiding this comment.
Why don't we allow to set the batcher?
| function withBatch(bytes memory data, uint256 value, address refund) public payable { | ||
| require(value <= msg.value, NotEnoughValueForCallback()); | ||
|
|
||
| gateway.startBatching(); |
There was a problem hiding this comment.
The previous isBatching was there to be able to nest batches, which I think it's something cool to allow integrators to have integrators on top, so I would keep it.
| } | ||
|
|
||
| /// @inheritdoc ICrosschainBatcher | ||
| function file(bytes32 what, address data) external auth { |
There was a problem hiding this comment.
We need to add root to the deployer, and also allow crosschainBatcher to modify gateway stuff through rely
| isBatching = true; | ||
|
|
||
| function startBatching() external auth { | ||
| _batcher = msg.sender; |
There was a problem hiding this comment.
Batcher not needed here, right?
| //---------------------------------------------------------------------------------------------- | ||
| // View methods | ||
| //---------------------------------------------------------------------------------------------- | ||
|
|
There was a problem hiding this comment.
Can be removed because there are no view methods?
| using MathLib for *; | ||
| using CastLib for bytes32; | ||
|
|
||
| IGateway public gateway; |
There was a problem hiding this comment.
I think this is not needed, or is it there for integrators?
|
|
||
| spoke.crosschainTransferShares{ | ||
| value: gateway.isBatching() ? 0 : msg.value | ||
| value: msgValue() |
| contract MockGateway { | ||
| address internal transient _batcher; | ||
|
|
||
| function startBatching() external { | ||
| _batcher = msg.sender; | ||
| } | ||
|
|
||
| function endBatching(address) external payable { | ||
| _batcher = address(0); | ||
| } | ||
|
|
||
| function batcher() external view returns (address) { | ||
| return _batcher; | ||
| } | ||
| } |
There was a problem hiding this comment.
I think you don't need this here right? Only multicall calls withBatch, and it's already tested under BatchedMulticall
test/core/unit/Gateway.t.sol
Outdated
| @@ -912,24 +905,30 @@ contract AttackerIntegrationMock is Test { | |||
| } | |||
|
|
|||
| contract GatewayTestWithBatch is GatewayTest { | |||
There was a problem hiding this comment.
This test should be moved to CrosschainBatcher.t.sol
|
Coverage after merging crosschain-batcher into electisec-v31-fixes will be
Coverage Report
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
No description provided.