Skip to content

Commit

Permalink
Merge pull request #328 from SocketDotTech/feat/prod-xai
Browse files Browse the repository at this point in the history
Prod deployments for xai testnet
  • Loading branch information
ameeshaagrawal authored Nov 1, 2023
2 parents f9508aa + 2c915d2 commit bc06f17
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 227 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ scripts/deploy/gasEstimate.ts

# coverage
lcov.info

dev_switchboards.json
prod_switchboards.json
switchboards.json
83 changes: 11 additions & 72 deletions contracts/socket/SocketBatcher.sol
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,10 @@ contract SocketBatcher is AccessControl {
* @param socketAddress_ address of socket
* @param sealRequests_ the list of requests with packets to be sealed on sourceChain
*/
function _sealBatch(
function sealBatch(
address socketAddress_,
SealRequest[] calldata sealRequests_
) internal {
) external {
uint256 sealRequestLength = sealRequests_.length;
for (uint256 index = 0; index < sealRequestLength; ) {
ISocket(socketAddress_).seal(
Expand All @@ -282,27 +282,15 @@ contract SocketBatcher is AccessControl {
}
}

/**
* @notice seal a batch of packets from capacitor on sourceChain mentioned in sealRequests
* @param socketAddress_ address of socket
* @param sealRequests_ the list of requests with packets to be sealed on sourceChain
*/
function sealBatch(
address socketAddress_,
SealRequest[] calldata sealRequests_
) external {
_sealBatch(socketAddress_, sealRequests_);
}

/**
* @notice propose a batch of packets sequentially by socketDestination
* @param socketAddress_ address of socket
* @param proposeRequests_ the list of requests with packets to be proposed by socketDestination
*/
function _proposeBatch(
function proposeBatch(
address socketAddress_,
ProposeRequest[] calldata proposeRequests_
) internal {
) external {
uint256 proposeRequestLength = proposeRequests_.length;
for (uint256 index = 0; index < proposeRequestLength; ) {
ISocket(socketAddress_).proposeForSwitchboard(
Expand All @@ -317,26 +305,17 @@ contract SocketBatcher is AccessControl {
}
}

/**
* @notice propose a batch of packets sequentially by socketDestination
* @param socketAddress_ address of socket
* @param proposeRequests_ the list of requests with packets to be proposed by socketDestination
*/
function proposeBatch(
address socketAddress_,
ProposeRequest[] calldata proposeRequests_
) external {
_proposeBatch(socketAddress_, proposeRequests_);
}

/**
* @notice attests a batch of Packets
* @param attestRequests_ the list of requests with packets to be attested by switchboard in sequence
*/
function _attestBatch(AttestRequest[] calldata attestRequests_) internal {
function attestBatch(
address switchboardAddress_,
AttestRequest[] calldata attestRequests_
) external {
uint256 attestRequestLength = attestRequests_.length;
for (uint256 index = 0; index < attestRequestLength; ) {
FastSwitchboard(attestRequests_[index].switchboard).attest(
FastSwitchboard(switchboardAddress_).attest(
attestRequests_[index].packetId,
attestRequests_[index].proposalCount,
attestRequests_[index].root,
Expand All @@ -348,34 +327,6 @@ contract SocketBatcher is AccessControl {
}
}

/**
* @notice attests a batch of Packets
* @param attestRequests_ the list of requests with packets to be attested by switchboard in sequence
*/
function attestBatch(AttestRequest[] calldata attestRequests_) external {
_attestBatch(attestRequests_);
}

/**
* @notice send a batch of propose, attest and execute transactions
* @param socketAddress_ address of socket
* @param proposeRequests_ the list of requests with packets to be proposed
* @param attestRequests_ the list of requests with packets to be attested by switchboard
* @param executeRequests_ the list of requests with messages to be executed
*/
function sendBatch(
address socketAddress_,
SealRequest[] calldata sealRequests_,
ProposeRequest[] calldata proposeRequests_,
AttestRequest[] calldata attestRequests_,
ExecuteRequest[] calldata executeRequests_
) external payable {
_sealBatch(socketAddress_, sealRequests_);
_proposeBatch(socketAddress_, proposeRequests_);
_attestBatch(attestRequests_);
_executeBatch(socketAddress_, executeRequests_);
}

/**
* @notice trip a batch of Proposals
* @param proposalTripRequests_ the list of requests for tripping proposals
Expand Down Expand Up @@ -412,10 +363,10 @@ contract SocketBatcher is AccessControl {
* @param socketAddress_ address of socket
* @param executeRequests_ the list of requests with messages to be executed in sequence
*/
function _executeBatch(
function executeBatch(
address socketAddress_,
ExecuteRequest[] calldata executeRequests_
) internal {
) external payable {
uint256 executeRequestLength = executeRequests_.length;
uint256 totalMsgValue = msg.value;
for (uint256 index = 0; index < executeRequestLength; ) {
Expand Down Expand Up @@ -443,18 +394,6 @@ contract SocketBatcher is AccessControl {
}
}

/**
* @notice executes a batch of messages
* @param socketAddress_ address of socket
* @param executeRequests_ the list of requests with messages to be executed in sequence
*/
function executeBatch(
address socketAddress_,
ExecuteRequest[] calldata executeRequests_
) external payable {
_executeBatch(socketAddress_, executeRequests_);
}

/**
* @notice invoke receive Message on PolygonRootReceiver for a batch of messages in loop
* @param polygonRootReceiverAddress_ address of polygonRootReceiver
Expand Down
20 changes: 10 additions & 10 deletions deployments/prod_addresses.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"FastSwitchboard2": "0x6B5b7402e5bA4732D8A231552144384FC369Ce5e",
"OptimisticSwitchboard": "0x3DFDc6DFa41FA64aa3a879254B41517e5ba50c56",
"Counter": "0xEA33a8f11A719d728A42Ff5A860eBd7620683433",
"SocketBatcher": "0xB5f289a6Af87A65fddF1a7068F556E7d669c0D4b"
"SocketBatcher": "0x5a23e41c1ff969244eE2A5D563519b170F143AcD"
},
"10": {
"SignatureVerifier": "0xbb1f202095BE99000038D8d207C7E6f0F85a3925",
Expand Down Expand Up @@ -448,7 +448,7 @@
"FastSwitchboard2": "0x7bFeb0bf17Da2eCFD3d897f11f87e0b80b3e5303",
"OptimisticSwitchboard": "0xDFbf47607FBA3707E69B16576F653154a92d9B96",
"Counter": "0x9d10C5D68C0878Ba255E62b3f2051f22E43A9b2f",
"SocketBatcher": "0xb80d97657277e24d70caee6dEF92BFaa7D884A7f"
"SocketBatcher": "0xE0DD154111D407Db671eAeC703CF472d3a2c5333"
},
"901": {
"SignatureVerifier": "0x19791877C020f7Cd5Ca1c97bdd5D268a52dbB0ff",
Expand Down Expand Up @@ -534,7 +534,7 @@
"FastSwitchboard2": "0xB39Cb89dfD708115616fdA1a2735613931B14181",
"OptimisticSwitchboard": "0x1d6E46fd4DFdfe063f9096Dc2C0862D36A25b1aD",
"Counter": "0xfCa282147D5E9b14c208D09dbEbC7Eb5C3814dC5",
"SocketBatcher": "0xb2dA552c9Baa0e15b13302aBBF7B555aBc8eE4E8"
"SocketBatcher": "0xe54f19dCD6f855296F57BC26a899f278E369464e"
},
"2999": {
"SignatureVerifier": "0x6D290609b3F5F02D52F28d97C75a443ED8564cBf",
Expand Down Expand Up @@ -796,7 +796,7 @@
"FastSwitchboard2": "0xedAC223C3Fe694A6d4c8407b4f6e95c299d6Eba6",
"OptimisticSwitchboard": "0x6977afB0d9F041327D2C7d1E9d412685C1B202ea",
"Counter": "0xAf8FcDA8536eBA1dDf2e6F8E405ADAd5C44b8568",
"SocketBatcher": "0x4941AE128a3d0d276d5ABA751B596f1173b2b762"
"SocketBatcher": "0x60dB9641eFee65c437aD8a44D3CEc7fB7934eD9c"
},
"421613": {
"SignatureVerifier": "0x52e987409522F2abeaD9A66B87B8914Dc5A071D9",
Expand Down Expand Up @@ -887,7 +887,7 @@
"FastSwitchboard2": "0xB73f329E38265E6a619eeC198A8eC4DB0b9ebe21",
"OptimisticSwitchboard": "0xb56e8417755685E6d01A11598f6a1229F11Cc9b5",
"Counter": "0x07680Ca88B8Df538A5aB564BBBD3E4F3aBbF97eE",
"SocketBatcher": "0x3F8cdB2F8F61c31855cA6314FFA480F4dEe9574f"
"SocketBatcher": "0x762769E24b61800682B7a66C83835f9C23FB9955"
},
"11155111": {
"SignatureVerifier": "0x10d9DA6AE85eff6D582A91829f78bde2a3EC2dCC",
Expand All @@ -899,8 +899,8 @@
"integrations": {},
"FastSwitchboard2": "0x501fCBa3e6F92b2D1d89038FeD56EdacaaF5f7c2",
"OptimisticSwitchboard": "0xd84fabe06806270Fb2dDFC2255102206e3B36865",
"SocketBatcher": "0xBc3Ff3923b36F1590C16363b09c4759654d7B6d4",
"Counter": "0xE593288228d17a6D057D9a61a35F32166A6B4191"
"Counter": "0xE593288228d17a6D057D9a61a35F32166A6B4191",
"SocketBatcher": "0x6ba1161bbBC353F4173eB9f785E3A0513264769d"
},
"11155112": {
"SignatureVerifier": "0x7E3D0FAC82b9d5a67906f7028Aa4a70d582011b2",
Expand Down Expand Up @@ -986,7 +986,7 @@
"FastSwitchboard2": "0x61438D1E9C9127F4996E2f74bb7BF62CC7f9B32F",
"OptimisticSwitchboard": "0xFCd8ebA25c0e0973Fd131b6bF77fd8dAEcCaC75B",
"Counter": "0x21abD53f1150b6DFA1111E4F2b7536F6eaA48538",
"SocketBatcher": "0xd17A64B37b432Bc344420D12eD086c5E6BEC1a30"
"SocketBatcher": "0xaE966C37eAb996B2bA55f0b3caD61564EBD691Fa"
},
"1399904803": {
"SignatureVerifier": "0x03D51955216a7E6F301e0613515fA86A6f3d59A9",
Expand All @@ -997,7 +997,6 @@
"TransmitManager": "0x0777Ab388f065FC3CdB96008C701751827Ee171B",
"FastSwitchboard2": "0x2735d5B15066049a709e680b2D400155aA5A91BE",
"OptimisticSwitchboard": "0x59AcE34e5c47aEe3ec8feF2A89DcF14Ac98538C9",
"SocketBatcher": "0x0B35F40f13C3641bDed7654C9a7620cFa312aA7a",
"Counter": "0x91C27Cad374246314E756f8Aa2f62F433d6F102C",
"integrations": {
"5": {
Expand Down Expand Up @@ -1072,6 +1071,7 @@
"switchboard": "0x59AcE34e5c47aEe3ec8feF2A89DcF14Ac98538C9"
}
}
}
},
"SocketBatcher": "0xaa95869960B4f783b17410a7E9e4b91DA3b371C4"
}
}
48 changes: 48 additions & 0 deletions deployments/prod_verification.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
{
"5": [
[
"0x5a23e41c1ff969244eE2A5D563519b170F143AcD",
"SocketBatcher",
"contracts/socket/SocketBatcher.sol",
["0x752B38FA38F53dF7fa60e6113CFd9094b7e040Aa"]
],
[
"0xB5f289a6Af87A65fddF1a7068F556E7d669c0D4b",
"SocketBatcher",
Expand Down Expand Up @@ -479,6 +485,12 @@
]
],
"420": [
[
"0xE0DD154111D407Db671eAeC703CF472d3a2c5333",
"SocketBatcher",
"contracts/socket/SocketBatcher.sol",
["0x752B38FA38F53dF7fa60e6113CFd9094b7e040Aa"]
],
[
"0xb80d97657277e24d70caee6dEF92BFaa7D884A7f",
"SocketBatcher",
Expand Down Expand Up @@ -600,6 +612,12 @@
]
],
"901": [
[
"0xe54f19dCD6f855296F57BC26a899f278E369464e",
"SocketBatcher",
"contracts/socket/SocketBatcher.sol",
["0x752B38FA38F53dF7fa60e6113CFd9094b7e040Aa"]
],
[
"0xb2dA552c9Baa0e15b13302aBBF7B555aBc8eE4E8",
"SocketBatcher",
Expand Down Expand Up @@ -923,6 +941,12 @@
]
],
"80001": [
[
"0x60dB9641eFee65c437aD8a44D3CEc7fB7934eD9c",
"SocketBatcher",
"contracts/socket/SocketBatcher.sol",
["0x752B38FA38F53dF7fa60e6113CFd9094b7e040Aa"]
],
[
"0x4941AE128a3d0d276d5ABA751B596f1173b2b762",
"SocketBatcher",
Expand Down Expand Up @@ -1043,6 +1067,12 @@
]
],
"421613": [
[
"0x762769E24b61800682B7a66C83835f9C23FB9955",
"SocketBatcher",
"contracts/socket/SocketBatcher.sol",
["0x752B38FA38F53dF7fa60e6113CFd9094b7e040Aa"]
],
[
"0x3F8cdB2F8F61c31855cA6314FFA480F4dEe9574f",
"SocketBatcher",
Expand Down Expand Up @@ -1162,6 +1192,12 @@
]
],
"11155111": [
[
"0x6ba1161bbBC353F4173eB9f785E3A0513264769d",
"SocketBatcher",
"contracts/socket/SocketBatcher.sol",
["0x752B38FA38F53dF7fa60e6113CFd9094b7e040Aa"]
],
[
"0xE593288228d17a6D057D9a61a35F32166A6B4191",
"Counter",
Expand Down Expand Up @@ -1264,6 +1300,12 @@
]
],
"11155112": [
[
"0xaE966C37eAb996B2bA55f0b3caD61564EBD691Fa",
"SocketBatcher",
"contracts/socket/SocketBatcher.sol",
["0x752B38FA38F53dF7fa60e6113CFd9094b7e040Aa"]
],
[
"0xd17A64B37b432Bc344420D12eD086c5E6BEC1a30",
"SocketBatcher",
Expand Down Expand Up @@ -1372,6 +1414,12 @@
]
],
"1399904803": [
[
"0xaa95869960B4f783b17410a7E9e4b91DA3b371C4",
"SocketBatcher",
"contracts/socket/SocketBatcher.sol",
["0x752B38FA38F53dF7fa60e6113CFd9094b7e040Aa"]
],
[
"0x91C27Cad374246314E756f8Aa2f62F433d6F102C",
"Counter",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@socket.tech/dl-core",
"license": "UNLICENSED",
"version": "2.4.8",
"version": "2.4.9",
"description": "Smart contracts for socket data layer.",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
Expand Down
5 changes: 1 addition & 4 deletions scripts/deploy/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ export const main = async () => {

const siblingIntegrationtype: IntegrationTypes[] = siblingSlugs.map(
(chainSlug) => {
return getDefaultIntegrationType(
ChainSlugToKey[chain],
ChainSlugToKey[chainSlug]
);
return getDefaultIntegrationType(chain, chainSlug);
}
);

Expand Down
2 changes: 1 addition & 1 deletion scripts/deploy/scripts/switchboardData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export const getSwitchboardData = async () => {
);
console.log("total switchboards: ", switchboards.length);
fs.writeFileSync(
"./switchboards.json",
`./${mode}_switchboards.json`,
JSON.stringify(switchboards, null, 2)
);
};
Expand Down
Loading

0 comments on commit bc06f17

Please sign in to comment.