Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permissionless deployment #332

Closed
wants to merge 22 commits into from
Closed
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
48 changes: 48 additions & 0 deletions chainConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
export type ChainConfig = {
chainSlug: number;
chainName: string;
timeout: number;
rpc: string;
transmitterAddress: string;
executorAddress: string;
watcherAddress: string;
feeUpdaterAddress: string;
ownerAddress: string;
msgValueMaxThreshold?: string | number;
overrides?: {
type?: number;
gasLimit?: string | number;
gasPrice?: string | number;
};
};

export const chainConfig: { [chain: string]: ChainConfig } = {
"31337": {
chainSlug: 31337,
chainName: "hardhat",
timeout: 7200,
rpc: "http://127.0.0.1:8545/",
transmitterAddress: "0xdE7f7a699F8504641eceF544B0fbc0740C37E69B",
executorAddress: "0xdE7f7a699F8504641eceF544B0fbc0740C37E69B",
watcherAddress: "0xdE7f7a699F8504641eceF544B0fbc0740C37E69B",
feeUpdaterAddress: "0xdE7f7a699F8504641eceF544B0fbc0740C37E69B",
ownerAddress: "0xdE7f7a699F8504641eceF544B0fbc0740C37E69B",
msgValueMaxThreshold: 10000000000000000,
overrides: {
type: 1,
gasLimit: 20000000,
gasPrice: 1000000000000,
},
},
"647": {
chainSlug: 647,
chainName: "sxn_testnet",
timeout: 7200,
rpc: "https://rpc.toronto.sx.technology/",
transmitterAddress: "0xdE7f7a699F8504641eceF544B0fbc0740C37E69B",
executorAddress: "0xdE7f7a699F8504641eceF544B0fbc0740C37E69B",
watcherAddress: "0xdE7f7a699F8504641eceF544B0fbc0740C37E69B",
feeUpdaterAddress: "0xdE7f7a699F8504641eceF544B0fbc0740C37E69B",
ownerAddress: "0xdE7f7a699F8504641eceF544B0fbc0740C37E69B",
},
};
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
10 changes: 5 additions & 5 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
npx hardhat run scripts/deploy/index.ts &&
npx ts-node scripts/deploy/checkRoles.ts --no-compile &&
npx hardhat run scripts/deploy/configure.ts --no-compile &&
npx hardhat run scripts/deploy/connect.ts --no-compile &&
npx hardhat run scripts/deploy/verify.ts --no-compile
npx hardhat run scripts/deploy/1-deploy.ts &&
npx ts-node scripts/deploy/2-check-roles.ts --no-compile &&
npx hardhat run scripts/deploy/3-configure.ts --no-compile &&
npx hardhat run scripts/deploy/4-connect.ts --no-compile &&
npx hardhat run scripts/deploy/5-verify.ts --no-compile
56 changes: 56 additions & 0 deletions deployments/dev_addresses.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@
"switchboard": "0xD2F16F574c7B4022192C53af9570b4b3C9B42f73"
}
},
"647": {
"FAST2": {
"capacitor": "0xDaB21eD920cCf2E7277430aFAb19Cb6Dce1AA912",
"decapacitor": "0xF9F8c72E7027B37b8f5a56c0b3331F7497032Aa9",
"switchboard": "0xD2F16F574c7B4022192C53af9570b4b3C9B42f73"
}
},
"901": {
"FAST": {
"capacitor": "0xE23Ed3328c2ab5AE41eCE04EB13472276c88E292",
Expand Down Expand Up @@ -267,6 +274,41 @@
"FastSwitchboard2": "0x7E7735e77574228C4F55d4B2F96Fe586dF10104e",
"SocketBatcher": "0xc07216D0e55044572d6E3C08d8a8a86BD3D909e3"
},
"647": {
"SignatureVerifier": "0xE19cC72ad60d0aE127E2c8d7C016cf67e15c5493",
"Hasher": "0x08f47Af4FB9Ab119e6Dd2C43994B9131E2AA91e2",
"CapacitorFactory": "0xF4E477308ab2f30330cD3233e9b71Dc5d636EEe0",
"Socket": "0x78E9EcA8889A6b6016CE5b56cD872bfB6F1Ba41f",
"ExecutionManager": "0xFAE13FC12a111CD31Ea02Ae554A59Fb18fD45127",
"TransmitManager": "0x255f9F9aB7eE46cb59a2Ed57a852304faD701C8d",
"FastSwitchboard2": "0xd7D1dc1B8aB82E14b896fF980a0fd3B035E0c9E3",
"OptimisticSwitchboard": "0xF6bc9bC110464f7544507B574bEC357403171156",
"SocketBatcher": "0xf47103263296eFebc7B8DD4d5410e15d7B59FceF",
"Counter": "0x2a754670Ed76F892568EE6Ff690fc56ee38a2DC9",
"integrations": {
"5": {
"FAST2": {
"capacitor": "0x08C4805744B45C708a26d762594d5481c9dde885",
"decapacitor": "0x6e873C240896Bd96C2061C9Bed5489FB248608FC",
"switchboard": "0xd7D1dc1B8aB82E14b896fF980a0fd3B035E0c9E3"
}
},
"80001": {
"FAST2": {
"capacitor": "0x024E195D5751Ae3D79e40F3aEdE742BF6E311BC1",
"decapacitor": "0xaE0EB47AFB854124EAe3cDe713592de90Dd56339",
"switchboard": "0xd7D1dc1B8aB82E14b896fF980a0fd3B035E0c9E3"
}
},
"421613": {
"FAST2": {
"capacitor": "0xc416F0D400dFCBE5dA672BFC2f88b7b9AB218C82",
"decapacitor": "0xd5175A72b98eE7C86bBa76F0095Da683dB7C190e",
"switchboard": "0xd7D1dc1B8aB82E14b896fF980a0fd3B035E0c9E3"
}
}
}
},
"901": {
"SignatureVerifier": "0x47140353947Bc127c9cf36fabd61112C8Fb8db2A",
"Hasher": "0x9814d1E6751ADAE2D60fF16f987ae02a25C87224",
Expand Down Expand Up @@ -438,6 +480,13 @@
"switchboard": "0x0dD648cdF51b7f7AdA68F84BB245D52172199F0d"
}
},
"647": {
"FAST2": {
"capacitor": "0xABbcD246a79129A9850ae6bA8E862FD9f550afc5",
"decapacitor": "0x9F9E77c4B94fC244Eb58a005DbFDE07Ff1007E3d",
"switchboard": "0x0dD648cdF51b7f7AdA68F84BB245D52172199F0d"
}
},
"901": {
"FAST": {
"capacitor": "0xe75e3AdAac425b69e6aA8Be1502b1e0FcD9Eb529",
Expand Down Expand Up @@ -567,6 +616,13 @@
"switchboard": "0xFD468fc7d23dA3e7466EE78327D4db5FcA232B2d"
}
},
"647": {
"FAST2": {
"capacitor": "0x6d84ee5B59125cB4b608f50747de4E31CC4Cd7d9",
"decapacitor": "0xE981C76FC7D6252A46f94aee7CA97d7617f82489",
"switchboard": "0xFD468fc7d23dA3e7466EE78327D4db5FcA232B2d"
}
},
"901": {
"FAST": {
"capacitor": "0xc9f5FcEbb5414b4065d8E74C203aCfcF166E1Cda",
Expand Down
Loading
Loading