Skip to content

Commit

Permalink
chore: specify contract function overrides (#314)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattstam authored Jan 9, 2024
1 parent 8a763bd commit 9360fb8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
9 changes: 7 additions & 2 deletions contracts/src/FunctionRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import {IFunctionRegistry} from "./interfaces/IFunctionRegistry.sol";

abstract contract FunctionRegistry is IFunctionRegistry {
/// @notice Maps function IDs to their corresponding verifiers.
mapping(bytes32 => address) public verifiers;
mapping(bytes32 => address) public override verifiers;

/// @notice Maps function IDs to their corresponding owners.
mapping(bytes32 => address) public verifierOwners;
mapping(bytes32 => address) public override verifierOwners;

/// @notice Registers a function, using a pre-deployed verifier.
/// @dev The _owner can be set to address 0 to remove any update capabilities.
Expand All @@ -17,6 +17,7 @@ abstract contract FunctionRegistry is IFunctionRegistry {
/// @param _salt The salt to use for calculating the function ID.
function registerFunction(address _owner, address _verifier, bytes32 _salt)
external
override
returns (bytes32 functionId)
{
functionId = getFunctionId(_owner, _salt);
Expand All @@ -39,6 +40,7 @@ abstract contract FunctionRegistry is IFunctionRegistry {
/// @param _salt The salt to use for calculating the function ID.
function deployAndRegisterFunction(address _owner, bytes memory _bytecode, bytes32 _salt)
external
override
returns (bytes32 functionId, address verifier)
{
functionId = getFunctionId(_owner, _salt);
Expand All @@ -59,6 +61,7 @@ abstract contract FunctionRegistry is IFunctionRegistry {
/// @param _salt The salt that was used when registering this function ID.
function updateFunction(address _verifier, bytes32 _salt)
external
override
returns (bytes32 functionId)
{
functionId = getFunctionId(msg.sender, _salt);
Expand All @@ -82,6 +85,7 @@ abstract contract FunctionRegistry is IFunctionRegistry {
/// @param _salt The salt that was used when registering this function ID.
function deployAndUpdateFunction(bytes memory _bytecode, bytes32 _salt)
external
override
returns (bytes32 functionId, address verifier)
{
functionId = getFunctionId(msg.sender, _salt);
Expand All @@ -100,6 +104,7 @@ abstract contract FunctionRegistry is IFunctionRegistry {
function getFunctionId(address _owner, bytes32 _salt)
public
pure
override
returns (bytes32 functionId)
{
functionId = keccak256(abi.encode(_owner, _salt));
Expand Down
7 changes: 4 additions & 3 deletions contracts/src/SuccinctGateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ contract SuccinctGateway is ISuccinctGateway, FunctionRegistry, TimelockedUpgrad
bytes public verifiedOutput;

/// @notice A flag that indicates whether the contract is currently making a callback.
bool public isCallback;
bool public override isCallback;

mapping(bytes32 => WhitelistStatus) public whitelistStatus;

Expand Down Expand Up @@ -92,7 +92,7 @@ contract SuccinctGateway is ISuccinctGateway, FunctionRegistry, TimelockedUpgrad
bytes memory _context,
bytes4 _callbackSelector,
uint32 _callbackGasLimit
) external payable returns (bytes32) {
) external payable override returns (bytes32) {
// Compute the callback hash uniquely associated with this request.
bytes32 inputHash = sha256(_input);
bytes32 contextHash = keccak256(_context);
Expand Down Expand Up @@ -144,7 +144,7 @@ contract SuccinctGateway is ISuccinctGateway, FunctionRegistry, TimelockedUpgrad
address _entryAddress,
bytes memory _entryCalldata,
uint32 _entryGasLimit
) external payable {
) external payable override {
// Emit event.
emit RequestCall(
_functionId,
Expand All @@ -169,6 +169,7 @@ contract SuccinctGateway is ISuccinctGateway, FunctionRegistry, TimelockedUpgrad
function verifiedCall(bytes32 _functionId, bytes memory _input)
external
view
override
returns (bytes memory)
{
bytes32 inputHash = sha256(_input);
Expand Down
6 changes: 3 additions & 3 deletions contracts/src/payments/SuccinctFeeVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ contract SuccinctFeeVault is IFeeVault, TimelockedUpgradeable {
/// @notice Tracks the amount of active balance that an account has for Succinct services.
/// @dev balances[token][account] returns the amount of balance for token the account has. To
/// check native currency balance, use address(0) as the token address.
mapping(address => mapping(address => uint256)) public balances;
mapping(address => mapping(address => uint256)) public override balances;
/// @notice The allowed senders for the deduct functions.
mapping(address => bool) public allowedDeductors;

Expand Down Expand Up @@ -62,7 +62,7 @@ contract SuccinctFeeVault is IFeeVault, TimelockedUpgradeable {
/// @notice Deposit the specified amount of native currency from the caller.
/// @dev The native currency is represented by address(0) in balances.
/// @param _account The account to deposit the native currency for.
function depositNative(address _account) external payable {
function depositNative(address _account) external payable override {
if (_account == address(0)) {
revert InvalidAccount(_account);
}
Expand All @@ -77,7 +77,7 @@ contract SuccinctFeeVault is IFeeVault, TimelockedUpgradeable {
/// @param _account The account to deposit the tokens to.
/// @param _token The address of the token to deposit.
/// @param _amount The amount of the token to deposit.
function deposit(address _account, address _token, uint256 _amount) external {
function deposit(address _account, address _token, uint256 _amount) external override {
if (_account == address(0)) {
revert InvalidAccount(_account);
}
Expand Down

0 comments on commit 9360fb8

Please sign in to comment.