Skip to content

Commit

Permalink
make hint functions view
Browse files Browse the repository at this point in the history
  • Loading branch information
1kresh committed Jul 30, 2024
1 parent f330537 commit 656b58f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/contracts/hints/SlasherHints.sol
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ contract SlasherHints is Hints, Slasher {
address operator,
uint256 amount,
uint48 captureTimestamp
) external returns (bytes memory) {
) external view returns (bytes memory) {
bytes memory slashableStakeHints =
BaseSlasherHints(BASE_SLASHER_HINTS).slashableStakeHints(slasher, subnetwork, operator, captureTimestamp);

Expand Down Expand Up @@ -122,7 +122,7 @@ contract VetoSlasherHints is Hints, VetoSlasher {
(exists,,, hint) = _resolver[subnetwork].upperLookupRecentCheckpoint(timestamp);
}

function resolverHint(address slasher, bytes32 subnetwork, uint48 timestamp) public returns (bytes memory) {
function resolverHint(address slasher, bytes32 subnetwork, uint48 timestamp) public view returns (bytes memory) {
(bool exists, uint32 hint_) = abi.decode(
_selfStaticDelegateCall(
slasher, abi.encodeWithSelector(VetoSlasherHints.resolverHintInternal.selector, subnetwork, timestamp)
Expand All @@ -142,7 +142,7 @@ contract VetoSlasherHints is Hints, VetoSlasher {
address operator,
uint256 amount,
uint48 captureTimestamp
) external returns (bytes memory) {
) external view returns (bytes memory) {
bytes memory slashableStakeHints =
BaseSlasherHints(BASE_SLASHER_HINTS).slashableStakeHints(slasher, subnetwork, operator, captureTimestamp);

Expand All @@ -156,7 +156,7 @@ contract VetoSlasherHints is Hints, VetoSlasher {
bytes32 subnetwork,
address operator,
uint48 captureTimestamp
) external returns (bytes memory) {
) external view returns (bytes memory) {
bytes memory resolverHint = resolverHint(slasher, subnetwork, captureTimestamp);
bytes memory slashableStakeHints =
BaseSlasherHints(BASE_SLASHER_HINTS).slashableStakeHints(slasher, subnetwork, operator, captureTimestamp);
Expand All @@ -170,15 +170,19 @@ contract VetoSlasherHints is Hints, VetoSlasher {
address slasher,
bytes32 subnetwork,
uint48 captureTimestamp
) external returns (bytes memory) {
) external view returns (bytes memory) {
bytes memory resolverHint_ = resolverHint(slasher, subnetwork, captureTimestamp);

if (resolverHint_.length > 0) {
return abi.encode(VetoSlashHints({resolverHint: resolverHint_}));
}
}

function setResolverHints(address slasher, bytes32 subnetwork, uint48 timestamp) external returns (bytes memory) {
function setResolverHints(
address slasher,
bytes32 subnetwork,
uint48 timestamp
) external view returns (bytes memory) {
bytes memory resolverHint_ = resolverHint(slasher, subnetwork, timestamp);

if (resolverHint_.length > 0) {
Expand Down

0 comments on commit 656b58f

Please sign in to comment.