Skip to content

Commit

Permalink
Merge pull request #1468 from dappnode/pablo/relocate-writeondb
Browse files Browse the repository at this point in the history
Skip possible returns when writting on db
  • Loading branch information
pablomendezroyo authored May 4, 2023
2 parents e5f577e + 9381778 commit 38304ab
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions packages/dappmanager/src/modules/stakerConfig/setStakerConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,14 @@ export async function setStakerConfig<T extends Network>({

// EXECUTION CLIENT
await setExecutionClientConfig<T>({
network: stakerConfig.network,
currentExecClient,
targetExecutionClient: stakerConfig.executionClient,
currentExecClientPkg
});
await setExecutionOnDb(
stakerConfig.network,
stakerConfig.executionClient?.dnpName
);

// CONSENSUS CLIENT (+ Fee recipient address + Graffiti + Checkpointsync)
await setConsensusClientConfig<T>({
Expand All @@ -162,6 +165,10 @@ export async function setStakerConfig<T extends Network>({
targetConsensusClient: stakerConfig.consensusClient,
currentConsClientPkg
});
await setConsensusOnDb(
stakerConfig.network,
stakerConfig.consensusClient?.dnpName
);

// WEB3SIGNER
if (stakerConfig.enableWeb3signer !== undefined)
Expand All @@ -173,20 +180,18 @@ export async function setStakerConfig<T extends Network>({

// MEV BOOST
await setMevBoostConfig({
network: stakerConfig.network,
mevBoost,
targetMevBoost: stakerConfig.mevBoost,
currentMevBoostPkg: pkgs.find(pkg => pkg.dnpName === mevBoost)
});
await setMevBoostOnDb(stakerConfig.network, stakerConfig.mevBoost?.dnpName);
}

async function setExecutionClientConfig<T extends Network>({
network,
currentExecClient,
targetExecutionClient,
currentExecClientPkg
}: {
network: T;
currentExecClient?: T extends "mainnet"
? ExecutionClientMainnet
: T extends "gnosis"
Expand Down Expand Up @@ -260,8 +265,6 @@ async function setExecutionClientConfig<T extends Network>({
await stopAllPkgContainers(currentExecClientPkg);
}
}

await setExecutionOnDb(network, targetExecutionClient?.dnpName);
}

async function setConsensusClientConfig<T extends Network>({
Expand Down Expand Up @@ -380,8 +383,6 @@ async function setConsensusClientConfig<T extends Network>({
await stopAllPkgContainers(currentConsClientPkg);
}
}

await setConsensusOnDb(network, targetConsensusClient.dnpName);
}

async function setWeb3signerConfig(
Expand Down Expand Up @@ -409,12 +410,10 @@ async function setWeb3signerConfig(
}

async function setMevBoostConfig<T extends Network>({
network,
mevBoost,
targetMevBoost,
currentMevBoostPkg
}: {
network: T;
mevBoost: T extends "mainnet"
? MevBoostMainnet
: T extends "gnosis"
Expand Down Expand Up @@ -464,8 +463,6 @@ async function setMevBoostConfig<T extends Network>({
logs.info("Installing MevBoost");
await packageInstall({ name: mevBoost, userSettings });
}

await setMevBoostOnDb(network, targetMevBoost.dnpName);
}

/**
Expand Down

0 comments on commit 38304ab

Please sign in to comment.