-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(protocol): enhance nextTxId logics in DelegateOwner (#17718)
Co-authored-by: D <[email protected]>
- Loading branch information
Showing
10 changed files
with
342 additions
and
140 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ artifacts | |
cache | ||
coverage | ||
lib | ||
contracts/test/thirdparty/ | ||
contracts/automata-attestation/ |
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
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
This file was deleted.
Oops, something went wrong.
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,57 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.24; | ||
|
||
import "forge-std/src/Script.sol"; | ||
import "../contracts/L2/DelegateOwner.sol"; | ||
import "../contracts/bridge/IBridge.sol"; | ||
import "../test/thirdparty/muticall3/Multicall3.sol"; | ||
|
||
contract SendMessageToDelegateOwner is Script { | ||
address public delegateOwner = 0x5995941Df88F30Ac140515AA39832db963E2f863; | ||
address public delegateOwnerImpl = 0x1f0511cDae2fbfD93563469dA02b82dEd320C8Bd; | ||
address public multicall3 = 0xcA11bde05977b3631167028862bE2a173976CA11; | ||
address public l1Bridge = 0xd60247c6848B7Ca29eDdF63AA924E53dB6Ddd8EC; | ||
address public testAccount1 = 0x3c181965C5cFAE61a9010A283e5e0C1445649810; // owned by Daniel W | ||
|
||
modifier broadcast() { | ||
vm.startBroadcast(); | ||
_; | ||
vm.stopBroadcast(); | ||
} | ||
|
||
function run() external broadcast { | ||
Multicall3.Call3[] memory calls = new Multicall3.Call3[](2); | ||
calls[0].target = delegateOwner; | ||
calls[0].allowFailure = false; | ||
calls[0].callData = | ||
abi.encodeCall(DelegateOwner.setAdmin, (0x4757D97449acA795510b9f3152C6a9019A3545c3)); | ||
|
||
calls[1].target = delegateOwner; | ||
calls[1].allowFailure = false; | ||
calls[1].callData = abi.encodeCall(UUPSUpgradeable.upgradeTo, (delegateOwnerImpl)); | ||
|
||
DelegateOwner.Call memory dcall = DelegateOwner.Call({ | ||
txId: 1, // Has to match with DelegateOwner's nextTxId or 0 | ||
target: multicall3, | ||
isDelegateCall: true, | ||
txdata: abi.encodeCall(Multicall3.aggregate3, (calls)) | ||
}); | ||
|
||
// Use https://bridge.taiko.xyz/relayer to manually trigger the message if necessary. | ||
IBridge.Message memory message = IBridge.Message({ | ||
id: 0, | ||
fee: 0, | ||
gasLimit: 1_000_000, // cannot be zero | ||
from: msg.sender, | ||
srcChainId: 1, | ||
srcOwner: msg.sender, | ||
destChainId: 167_000, | ||
destOwner: delegateOwner, | ||
to: delegateOwner, | ||
value: 0, | ||
data: abi.encodeCall(DelegateOwner.onMessageInvocation, abi.encode(dcall)) | ||
}); | ||
|
||
IBridge(l1Bridge).sendMessage(message); | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.