Skip to content

Commit

Permalink
refact: add payload hash as parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
henriquemarlon committed Feb 6, 2025
1 parent 79bd2c5 commit cdc0a31
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/CoprocessorAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ abstract contract CoprocessorAdapter is ICoprocessorCallback {
/// @notice Handles notices sent back from the coprocessor
/// @dev This function should be overridden by child contracts to define specific behavior
/// @param notice ABI-encoded notice data
function handleNotice(bytes memory notice) internal virtual {}
function handleNotice(bytes32 payloadHash, bytes memory notice) internal virtual {}

/// @notice Callback function invoked by the coprocessor with computation outputs
/// @param _machineHash The hash of the machine that processed the task
Expand Down Expand Up @@ -77,7 +77,7 @@ abstract contract CoprocessorAdapter is ICoprocessorCallback {
bytes calldata arguments = output[4:];

if (selector == ICoprocessorOutputs.Notice.selector) {
handleNotice(abi.decode(arguments, (bytes)));
handleNotice(_payloadHash, abi.decode(arguments, (bytes)));
} else if (selector == ICoprocessorOutputs.Voucher.selector) {
_executeVoucher(arguments);
} else {
Expand Down
2 changes: 1 addition & 1 deletion test/utils/CoprocessorAdapterSample.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ contract CoprocessorAdapterSample is CoprocessorAdapter {
CoprocessorAdapter(_coprocessorAddress, _machineHash)
{}

function handleNotice(bytes memory notice) internal override {
function handleNotice(bytes32 payloadHash, bytes memory notice) internal override {
address destination;
bytes memory decodedPayload;

Expand Down

0 comments on commit cdc0a31

Please sign in to comment.