Skip to content

Commit

Permalink
Merge pull request #36 from SocketDotTech/native-bridge-fixes
Browse files Browse the repository at this point in the history
Native bridge fixes and deployments
  • Loading branch information
arthcp authored Dec 16, 2022
2 parents bd0454d + ed800ba commit e8a7d28
Show file tree
Hide file tree
Showing 14 changed files with 793 additions and 212 deletions.
9 changes: 2 additions & 7 deletions contracts/notaries/native-bridge/PolygonL1Notary.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,8 @@ contract PolygonL1Notary is NativeBridgeNotary, FxBaseRootTunnel {
function _processMessageFromChild(
bytes memory message
) internal override onlyRemoteAccumulator {
(, , bytes memory data) = abi.decode(
message,
(uint256, bytes32, bytes)
);
(uint256 packetId, bytes32 root, ) = abi.decode(
data,
message,
(uint256, bytes32, bytes)
);
_attest(packetId, root);
Expand All @@ -46,8 +42,7 @@ contract PolygonL1Notary is NativeBridgeNotary, FxBaseRootTunnel {
bytes32 root
) internal override {
bytes memory data = abi.encode(packetId, root, bytes(""));
bytes memory fxData = abi.encode(address(this), remoteNotary, data);
_sendMessageToChild(fxData);
_sendMessageToChild(data);
}

// set fxChildTunnel if not set already
Expand Down
11 changes: 6 additions & 5 deletions contracts/notaries/native-bridge/PolygonL2Notary.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,17 @@ contract PolygonL2Notary is NativeBridgeNotary, FxBaseChildTunnel {
bytes32 root
) internal override {
bytes memory data = abi.encode(packetId, root, bytes(""));
bytes memory fxData = abi.encode(address(this), remoteNotary, data);
_sendMessageToRoot(fxData);
_sendMessageToRoot(data);
}

/**
* validate sender verifies if `rootMessageSender` is the root contract (notary) on L1.
*/
function _processMessageFromRoot(
uint256,
address rootMessageSender,
bytes calldata data
) internal override {
if (rootMessageSender != remoteNotary) revert InvalidAttester();
bytes memory data
) internal override validateSender(rootMessageSender) {
(uint256 packetId, bytes32 root, ) = abi.decode(
data,
(uint256, bytes32, bytes)
Expand Down
Loading

0 comments on commit e8a7d28

Please sign in to comment.