Skip to content

feat: add slashing support to verifyAndUpdate signature#29

Open
RonTuretzky wants to merge 2 commits intomainfrom
slashing-support
Open

feat: add slashing support to verifyAndUpdate signature#29
RonTuretzky wants to merge 2 commits intomainfrom
slashing-support

Conversation

@RonTuretzky
Copy link
Contributor

Summary

This PR modifies the verifyAndUpdate function signature to enable on-chain slashing verification via SP1 zkVM proofs.

Breaking Change

The signed message format has changed:

// OLD (not slashable):
sha256(abi.encode(transitionIndex, address(this), targetFunction, storageUpdates))

// NEW (slashable):
sha256(abi.encode(transitionIndex, address(this), anchorHash, callerAddress, contractCalldata, storageUpdates))

New Parameters

Parameter Type Purpose
anchorHash bytes32 Block hash anchoring execution to specific Ethereum state
callerAddress address The msg.sender for the original call
contractCalldata bytes Full calldata with arguments (replaces 4-byte targetFunction)

Why This Enables Slashing

With the current signature (only targetFunction), a challenger cannot:

  • Reproduce the execution (no calldata arguments)
  • Verify against correct state (no block anchor)
  • Know who called (no caller address)

With the new signature, a challenger can:

  1. Generate an SP1 proof of correct execution using the signed inputs
  2. Verify the anchor hash via Helios light client or EIP-4788
  3. Compare proven storage updates with signed storage updates
  4. If they differ → submit slashing proof to EigenLayer

Anchor Block Clarification

If execution happens at block N:

  • anchorHash = hash of block N
  • State used = state root from block N (after all block N transactions)

Related Work

Migration Required

Operators must update their signing logic to:

  1. Include the block hash as anchorHash
  2. Include the caller address as callerAddress
  3. Sign full contractCalldata instead of just the 4-byte selector

Test plan

  • Update operator signing logic
  • Update tests to use new function signature
  • Integration test with SP1 slashing proof generation

RonTuretzky and others added 2 commits November 28, 2025 21:59
BREAKING CHANGE: Modified verifyAndUpdate function signature to enable on-chain slashing verification.

## Changes

The signed message now includes all values needed for slashing:

```solidity
// OLD (not slashable):
sha256(abi.encode(transitionIndex, address(this), targetFunction, storageUpdates))

// NEW (slashable):
sha256(abi.encode(transitionIndex, address(this), anchorHash, callerAddress, contractCalldata, storageUpdates))
```

### New Parameters

- `anchorHash` (bytes32): Block hash anchoring execution to specific Ethereum state
- `callerAddress` (address): The msg.sender for the original call
- `contractCalldata` (bytes): Full calldata with arguments (replaces `targetFunction`)

### Why This Enables Slashing

With these values, a challenger can:
1. Generate an SP1 proof of correct execution using the signed inputs
2. Compare proven storage updates with signed storage updates
3. If they differ, submit slashing proof to EigenLayer

### Migration

Operators must update their signing logic to include the new fields.
The `getMessageHash` function has been updated accordingly.
* @notice Base SDK for implementing Gas Killer functionality in contracts
* @dev Inherit from this contract to add Gas Killer capabilities to your contract
*
* ## Slashing Support
Copy link
Contributor

@bagelface bagelface Jan 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would rather see this in a README or not included at all in the contract comments at all.

* @param storageUpdates The storage updates to verify
* @param transitionIndex The transition index
* @param targetFunction The target function selector
* @param anchorHash The block hash anchoring the execution to a specific Ethereum state
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think "blockHash" would be clearer, personally

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think blockhash can be very confusing , as the ancor block can be any strictly smaller block than the current block hash and is the basis for the simulation

Copy link
Contributor

@bagelface bagelface Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then imo it should be anchorBlockHash. "Hash" is an ambiguous thing, "block hash" is a precise thing. The "anchor" descriptor is nice, but I don't think it's enough on it's own

* @param transitionIndex The transition index
* @param targetFunction The target function selector
* @param anchorHash The block hash anchoring the execution to a specific Ethereum state
* @param callerAddress The address that initiated the original call (msg.sender)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

am I understanding this correctly? This should just be msg.sender instead of a argument to this function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its not the msg.sender of this call ( some operatoir for the avs or the avs egress address) it is whoever signed the original tx data

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok in that case, i'd remove the msg.sender comment. It's confusing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants