-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add CCIPEncodingUtils contract and gethwrapper (#1429)
## Motivation I encountered a scenario w/ RMN where offchain needs to abi.encode a [struct](https://github.com/smartcontractkit/ccip/blob/fc50683640bcfd73f0074d791fbaf7cdb6b29c71/contracts/src/v0.8/ccip/rmn/RMNRemote.sol#L90:L97) that is not included in any public contract functions (as input param or return value) and so it is not a part of the ABI or the go wrapper. Offchain is currently doing a manual encoding by re-defining the type, which I usually try to avoid at all costs. In the past, we've used a Utils contract ([ex here](https://github.com/smartcontractkit/chainlink/blob/develop/contracts/src/v0.8/automation/AutomationCompatibleUtils.sol) from automation) to expose all private structs in public functions so that offchain components can use E2E type safety when encoding / decoding. ## Solution Create a `CCIPEncodingUtils` contract and accompanying gethwrapper
- Loading branch information
Showing
5 changed files
with
235 additions
and
0 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,18 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity 0.8.24; | ||
|
||
import {RMNRemote} from "./rmn/RMNRemote.sol"; | ||
|
||
/// @dev this file exposes structs that are otherwise internal to the CCIP codebase | ||
/// doing this allows those structs to be encoded and decoded with type safety in offchain code | ||
/// and tests because generated wrappers are available | ||
contract CCIPEncodingUtils { | ||
error DoNotDeploy(); | ||
|
||
constructor() { | ||
revert DoNotDeploy(); | ||
} | ||
|
||
/// @dev the RMN Report struct is used in integration / E2E tests | ||
function _rmnReport(bytes32 rmnReportVersion, RMNRemote.Report memory rmnReport) external {} | ||
} |
209 changes: 209 additions & 0 deletions
209
core/gethwrappers/ccip/generated/ccip_encoding_utils/ccip_encoding_utils.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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