Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ contract AuctionManager is AddressResolverUtil, Ownable, IAuctionManager, Initia
function expireBid(bytes32 asyncId_) external onlyWatcherPrecompile {
PayloadBatch memory batch = IDeliveryHelper(addressResolver__.deliveryHelper())
.payloadBatches(asyncId_);

// if executed, bid is not expired
if (batch.totalPayloadsRemaining == 0 || batch.isBatchCancelled) return;

Expand Down
2 changes: 1 addition & 1 deletion contracts/protocol/utils/common/Errors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ error InvalidPromise();
error InvalidIndex();
error InvalidTransmitter();
error FeesNotSet();
error InvalidTokenAddress();
error InvalidTokenAddress();
18 changes: 14 additions & 4 deletions contracts/protocol/watcherPrecompile/WatcherPrecompile.sol
Original file line number Diff line number Diff line change
Expand Up @@ -300,15 +300,20 @@ contract WatcherPrecompile is WatcherPrecompileConfig, Initializable {
/// @dev Only callable by the contract owner
/// @dev Watcher signs on following digest for validation on switchboard:
/// @dev keccak256(abi.encode(switchboard, root))
function finalized(bytes32 payloadId_, bytes calldata signature_) external onlyRole(WATCHER_ROLE) {
function finalized(
bytes32 payloadId_,
bytes calldata signature_
) external onlyRole(WATCHER_ROLE) {
watcherSignatures[payloadId_] = signature_;
emit Finalized(payloadId_, asyncRequests[payloadId_], signature_);
}

/// @notice Resolves multiple promises with their return data
/// @param resolvedPromises_ Array of resolved promises and their return data
/// @dev Only callable by the contract owner
function resolvePromises(ResolvedPromises[] calldata resolvedPromises_) external onlyRole(WATCHER_ROLE) {
function resolvePromises(
ResolvedPromises[] calldata resolvedPromises_
) external onlyRole(WATCHER_ROLE) {
for (uint256 i = 0; i < resolvedPromises_.length; i++) {
// Get the array of promise addresses for this payload
AsyncRequest memory asyncRequest_ = asyncRequests[resolvedPromises_[i].payloadId];
Expand All @@ -335,7 +340,10 @@ contract WatcherPrecompile is WatcherPrecompileConfig, Initializable {
}

// wait till expiry time to assign fees
function markRevert(bytes32 payloadId_, bool isRevertingOnchain_) external onlyRole(WATCHER_ROLE) {
function markRevert(
bytes32 payloadId_,
bool isRevertingOnchain_
) external onlyRole(WATCHER_ROLE) {
AsyncRequest memory asyncRequest_ = asyncRequests[payloadId_];
address[] memory next = asyncRequest_.next;

Expand Down Expand Up @@ -378,7 +386,9 @@ contract WatcherPrecompile is WatcherPrecompileConfig, Initializable {

// ================== On-Chain Inbox ==================

function callAppGateways(CallFromInboxParams[] calldata params_) external onlyRole(WATCHER_ROLE) {
function callAppGateways(
CallFromInboxParams[] calldata params_
) external onlyRole(WATCHER_ROLE) {
for (uint256 i = 0; i < params_.length; i++) {
if (appGatewayCalled[params_[i].callId]) revert AppGatewayAlreadyCalled();
if (!isValidInboxCaller[params_[i].appGateway][params_[i].chainSlug][params_[i].plug])
Expand Down
42 changes: 21 additions & 21 deletions hardhat-scripts/constants/relayers.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
export const relayerAddressList = [
"0x59D24CD3A0b2b646F980A62DCb0aA4115506FFc9",
"0x762783712FD12231601d6d8591F3a5718812D534",
"0x9f5C9941306E7B57583E99033BedB7eA7889EEA4",
"0xd35F262d6f2D3F6D610bAf6635dE57c349ca83A1",
"0xce6b9c352f864515d7E8BBEA67d80d18245937F2",
"0xE651eDb3F16D9e6b1145ae5eee388f0e48D2d44b",
"0xc176E88dE45747743699fAeA58814Ce98a2faC2D",
"0x88220692264EEc280Bd5AaF9278CdE0737Feb2D6",
"0x2d68551354226c7321130f122055F049F8F67791",
"0xA7C89619ceaC009a23c6C3bC5F74d41BBaC68fD1",
"0x7893D79718860DF30e5Fd21AAA6Be05edD22465D",
"0x6386c83e994331c6a41A4420294D130930AEDF9e",
"0xfF33A0afc88CbF48C9DB31Fc2D2EC2F36D598184",
"0xB756B6D986eE448433542A60A1f590EE3B0DFCda",
"0x76943F947D5622624444aeFF135a5121d6732299",
"0x049B750045fdE15F347aF9E86FB80dD879C848ea",
"0x9c653569C32473F40210495128BB5A40ef10c65B",
"0x0291a40beF28E3606b8208a665F900d141E9A8B3",
"0x2e498dFB44CC79D2ef80Afd7C4439BEC8822E216",
"0x049E701A690E885467E54A1B0595f90BDc8324B0"
]
"0x59D24CD3A0b2b646F980A62DCb0aA4115506FFc9",
"0x762783712FD12231601d6d8591F3a5718812D534",
"0x9f5C9941306E7B57583E99033BedB7eA7889EEA4",
"0xd35F262d6f2D3F6D610bAf6635dE57c349ca83A1",
"0xce6b9c352f864515d7E8BBEA67d80d18245937F2",
"0xE651eDb3F16D9e6b1145ae5eee388f0e48D2d44b",
"0xc176E88dE45747743699fAeA58814Ce98a2faC2D",
"0x88220692264EEc280Bd5AaF9278CdE0737Feb2D6",
"0x2d68551354226c7321130f122055F049F8F67791",
"0xA7C89619ceaC009a23c6C3bC5F74d41BBaC68fD1",
"0x7893D79718860DF30e5Fd21AAA6Be05edD22465D",
"0x6386c83e994331c6a41A4420294D130930AEDF9e",
"0xfF33A0afc88CbF48C9DB31Fc2D2EC2F36D598184",
"0xB756B6D986eE448433542A60A1f590EE3B0DFCda",
"0x76943F947D5622624444aeFF135a5121d6732299",
"0x049B750045fdE15F347aF9E86FB80dD879C848ea",
"0x9c653569C32473F40210495128BB5A40ef10c65B",
"0x0291a40beF28E3606b8208a665F900d141E9A8B3",
"0x2e498dFB44CC79D2ef80Afd7C4439BEC8822E216",
"0x049E701A690E885467E54A1B0595f90BDc8324B0",
];
23 changes: 15 additions & 8 deletions hardhat-scripts/deploy/2.roles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,28 +60,34 @@ async function setRoleForContract(
async function getSigner(chain: number, isWatcher: boolean = false) {
const providerInstance = getProviderFromChainSlug(chain);
const signer: Wallet = new ethers.Wallet(
isWatcher ? process.env.WATCHER_PRIVATE_KEY as string : process.env.SOCKET_SIGNER_KEY as string,
isWatcher
? (process.env.WATCHER_PRIVATE_KEY as string)
: (process.env.SOCKET_SIGNER_KEY as string),
providerInstance
);
return signer;
}


async function setRolesForOnChain(chain: number, addresses: DeploymentAddresses) {
const chainAddresses: ChainAddressesObj = (addresses[chain] ?? {}) as ChainAddressesObj;
async function setRolesForOnChain(
chain: number,
addresses: DeploymentAddresses
) {
const chainAddresses: ChainAddressesObj = (addresses[chain] ??
{}) as ChainAddressesObj;
const signer = await getSigner(chain);

for (const [contractName, roles] of Object.entries(REQUIRED_ROLES)) {
const contractAddress = chainAddresses[contractName as keyof ChainAddressesObj];
const contractAddress =
chainAddresses[contractName as keyof ChainAddressesObj];
if (!contractAddress) continue;

for (const roleName of roles) {
const targetAddress =
contractName === CORE_CONTRACTS.FastSwitchboard && roleName === ROLES.WATCHER_ROLE
contractName === CORE_CONTRACTS.FastSwitchboard &&
roleName === ROLES.WATCHER_ROLE
? watcher
: signer.address;


await setRoleForContract(
contractName as CORE_CONTRACTS,
contractAddress,
Expand All @@ -95,7 +101,8 @@ async function setRolesForOnChain(chain: number, addresses: DeploymentAddresses)
}

async function setRolesForEVMx(addresses: DeploymentAddresses) {
const chainAddresses: ChainAddressesObj = (addresses[EVMX_CHAIN_ID] ?? {}) as ChainAddressesObj;
const chainAddresses: ChainAddressesObj = (addresses[EVMX_CHAIN_ID] ??
{}) as ChainAddressesObj;
const signer = await getSigner(EVMX_CHAIN_ID, true);

const contractAddress = chainAddresses[EVMxCoreContracts.WatcherPrecompile];
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"publishConfig": {
"access": "public"
},
"version": "1.0.11",
"version": "1.0.12",
"description": "socket protocol",
"scripts": {
"build": "hardhat export-abi && tsc --project lib.tsconfig.json",
Expand Down
Loading