Skip to content

Commit

Permalink
Merge pull request #392 from SocketDotTech/remaining-df-migration
Browse files Browse the repository at this point in the history
Remaining df migration
  • Loading branch information
arthcp authored Jul 25, 2024
2 parents 597fc88 + 2b5f825 commit 23b39b4
Show file tree
Hide file tree
Showing 14 changed files with 1,847 additions and 197 deletions.
291 changes: 170 additions & 121 deletions deployments/prod_addresses.json

Large diffs are not rendered by default.

1,666 changes: 1,608 additions & 58 deletions deployments/prod_verification.json

Large diffs are not rendered by default.

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.17.0",
"version": "2.19.0",
"description": "Smart contracts for socket data layer.",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
Expand Down
4 changes: 3 additions & 1 deletion scripts/admin/setFees.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ const main = async () => {
verificationOverheadFees
);

const nonce = await switchboard.nextNonce(switchboard.signer.getAddress());
const nonce = await switchboard.nextNonce(switchboard.signer.getAddress(), {
...overrides(chain),
});
const digest = keccak256(
defaultAbiCoder.encode(
[
Expand Down
14 changes: 10 additions & 4 deletions scripts/deploy/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ export const overrides = (
};
} else if (chain == ChainSlug.SEPOLIA) {
return {
// type: 1,
type: 1,
gasLimit: 2_000_000,
// gasPrice: 180_000_000_000,
gasPrice: 50_000_000_000,
};
} else if (chain == ChainSlug.AEVO_TESTNET) {
return {
Expand Down Expand Up @@ -242,7 +242,7 @@ export const overrides = (
return {
type: 1,
// gasLimit: 200000,
gasPrice: 0,
gasPrice: 100_000_000,
};
} else if (chain == ChainSlug.REYA) {
return {
Expand Down Expand Up @@ -295,9 +295,15 @@ export const overrides = (
} else if (chain == ChainSlug.MANTLE) {
return {
type: 1,
gasLimit: 10_000_000_000,
gasLimit: 100_000_000_000,
gasPrice: 30_000_000,
};
} else if (chain == ChainSlug.NEOX_TESTNET) {
return {
type: 1,
gasLimit: 1_000_000,
gasPrice: 212_000_000_000,
};
} else if (chainConfig[chain] && chainConfig[chain].overrides) {
return chainConfig[chain].overrides!;
} else return { type, gasLimit, gasPrice };
Expand Down
7 changes: 7 additions & 0 deletions scripts/deploy/em-migration/migrate-em.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { Wallet } from "ethers";
import { getProviderFromChainSlug } from "../../constants";
import { storeAllAddresses } from "../utils";
import { getSiblingsFromAddresses } from "../../common";
import { connectPlugs } from "../scripts/connect";

const emVersion = CORE_CONTRACTS.ExecutionManagerDF;

Expand Down Expand Up @@ -73,6 +74,10 @@ const deleteOldContracts = async (chains: ChainSlug[]) => {
if (chains.includes(parseInt(chain) as ChainSlug)) {
addresses[chain].Counter = "";
addresses[chain].SocketBatcher = "";
addresses[chain].SocketSimulator = "";
addresses[chain].SimulatorUtils = "";
addresses[chain].SwitchboardSimulator = "";
addresses[chain].CapacitorSimulator = "";
}
})
);
Expand Down Expand Up @@ -148,6 +153,8 @@ const configure = async (chains: ChainSlug[]) => {
emVersion
);

await connectPlugs(addresses, chains);

await configureExecutionManagers(chains, addresses);
} catch (error) {
console.log("Error:", error);
Expand Down
15 changes: 11 additions & 4 deletions scripts/deploy/scripts/configureSocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ export const setManagers = async (
).connect(socketSigner);

let tx;
const currentEM = await socket.executionManager__();
const currentEM = await socket.executionManager__({
...overrides(await socketSigner.getChainId()),
});
if (
currentEM.toLowerCase() !== addr[executionManagerVersion]?.toLowerCase()
) {
Expand All @@ -74,7 +76,9 @@ export const setManagers = async (
await tx.wait();
}

const currentTM = await socket.transmitManager__();
const currentTM = await socket.transmitManager__({
...overrides(await socketSigner.getChainId()),
});
if (currentTM.toLowerCase() !== addr.TransmitManager?.toLowerCase()) {
tx = await socket.setTransmitManager(addr.TransmitManager, {
...overrides(await socketSigner.getChainId()),
Expand All @@ -101,14 +105,17 @@ export const configureExecutionManager = async (
).connect(socketSigner);

let nextNonce = (
await executionManagerContract.nextNonce(socketSigner.address)
await executionManagerContract.nextNonce(socketSigner.address, {
...overrides(chain),
})
).toNumber();

let requests: any = [];
await Promise.all(
siblingSlugs.map(async (siblingSlug) => {
let currentValue = await executionManagerContract.msgValueMaxThreshold(
siblingSlug
siblingSlug,
{ ...overrides(chain) }
);

if (
Expand Down
4 changes: 3 additions & 1 deletion scripts/deploy/scripts/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ export const connectPlugs = async (
}
if (!switchboard) continue;

const configs = await socket.getPlugConfig(counter.address, sibling);
const configs = await socket.getPlugConfig(counter.address, sibling, {
...overrides(chain),
});
if (
configs["siblingPlug"].toLowerCase() ===
siblingCounter?.toLowerCase() &&
Expand Down
11 changes: 8 additions & 3 deletions scripts/deploy/scripts/roles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@ const checkNativeSwitchboardRoles = async ({
if (filterRoles.length > 0 && !filterRoles.includes(role)) return;
let hasRole = await instance.callStatic["hasRole(bytes32,address)"](
getRoleHash(role),
userAddress
userAddress,
{ ...overrides(chainSlug) }
);

if (!roleStatus[chainSlug][pseudoContractName]["global"])
Expand Down Expand Up @@ -353,7 +354,7 @@ export const checkAndUpdateRoles = async (
return;
let hasRole = await instance.callStatic[
"hasRole(bytes32,address)"
](getRoleHash(role), userAddress);
](getRoleHash(role), userAddress, { ...overrides(chainSlug) });
if (isRoleChanged(hasRole, newRoleStatus)) {
if (!roleStatus[chainSlug][contractName!]["global"]) {
roleStatus[chainSlug][contractName!]["global"] = [];
Expand Down Expand Up @@ -405,7 +406,11 @@ export const checkAndUpdateRoles = async (
return;
let hasRole = await instance.callStatic[
"hasRole(bytes32,address)"
](getChainRoleHash(role, Number(siblingSlug)), userAddress);
](
getChainRoleHash(role, Number(siblingSlug)),
userAddress,
{ ...overrides(chainSlug) }
);

if (isRoleChanged(hasRole, newRoleStatus)) {
if (
Expand Down
2 changes: 1 addition & 1 deletion scripts/rpcConfig/constants/batcherSupportedChainSlug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const batcherSupportedChainSlugs = [
// ChainSlug.MODE_TESTNET,
ChainSlug.BASE,
ChainSlug.MODE,
// ChainSlug.HOOK_TESTNET,
ChainSlug.HOOK_TESTNET,
ChainSlug.REYA_CRONOS,
ChainSlug.SYNDR_SEPOLIA_L3,
ChainSlug.POLYNOMIAL_TESTNET,
Expand Down
20 changes: 20 additions & 0 deletions scripts/rpcConfig/constants/disabledDFFeeChains.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { ChainSlug } from "../../../src";

export const disabledDFFeeChains = [
ChainSlug.AEVO,
ChainSlug.ARBITRUM,
ChainSlug.OPTIMISM,
ChainSlug.BSC,
ChainSlug.POLYGON_MAINNET,
ChainSlug.LYRA,
ChainSlug.MAINNET,
ChainSlug.MANTLE,
ChainSlug.HOOK,
ChainSlug.REYA,
ChainSlug.BASE,
ChainSlug.KINTO,
// ChainSlug.WINR,
ChainSlug.BLAST,
// ChainSlug.POLYNOMIAL,
ChainSlug.SYNDR,
];
1 change: 1 addition & 0 deletions scripts/rpcConfig/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ export * from "./icons";
export * from "./rpc";
export * from "./version";
export * from "./finality";
export * from "./disabledDFFeeChains";
2 changes: 1 addition & 1 deletion scripts/rpcConfig/constants/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import { DeploymentMode } from "../../../src";

export const version = {
[DeploymentMode.DEV]: "1.0.5",
[DeploymentMode.PROD]: "1.0.32",
[DeploymentMode.PROD]: "1.0.37",
};
5 changes: 3 additions & 2 deletions scripts/rpcConfig/rpcConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
getFinality,
getReSyncInterval,
getDefaultFinalityBucket,
disabledDFFeeChains,
} from "./constants";
import { feesUpdaterSupportedChainSlugs } from "./constants/feesUpdaterChainSlugs";
import { getChainTxData } from "./txdata-builder/generate-calldata";
Expand Down Expand Up @@ -133,7 +134,7 @@ export const generateDevConfig = async (txData: TxData): Promise<S3Config> => {
addresses,
chainSlugToId: ChainSlugToId,
oldEMVersionChainSlugs: getOldEMVersionChainSlugs(),
disabledDFFeeChains: [],
disabledDFFeeChains,
};
};

Expand Down Expand Up @@ -161,6 +162,6 @@ export const generateProdConfig = async (txData: TxData): Promise<S3Config> => {
addresses,
chainSlugToId: ChainSlugToId,
oldEMVersionChainSlugs: getOldEMVersionChainSlugs(),
disabledDFFeeChains: [],
disabledDFFeeChains,
};
};

0 comments on commit 23b39b4

Please sign in to comment.