Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
pablomendezroyo committed Apr 8, 2024
2 parents e4bf74d + a633036 commit 9c3f542
Show file tree
Hide file tree
Showing 15 changed files with 99 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default function EnableEthicalMetrics({
const [tgChannelIdError, setTgChannelIdError] = useState(false);
const [validationMessage, setValidationMessage] = useState("");
const [tgAccordionOpen, setTgAccordionOpen] = useState(false);
const [ethicalLoading, setEthicalLoading] = useState(false);

// useEffect to populate email field when data is available
useEffect(() => {
Expand Down Expand Up @@ -56,6 +57,7 @@ export default function EnableEthicalMetrics({
}, [mail, tgChannelId]);

async function enableEthicalMetricsSync() {
setEthicalLoading(true);
try {
setValidationMessage("Enabling ethical metrics...");
await api.enableEthicalMetrics({
Expand All @@ -70,6 +72,7 @@ export default function EnableEthicalMetrics({
setValidationMessage("Error enabling ethical metrics.");
console.error("Error enabling ethical metrics:", error);
}
setEthicalLoading(false);
}

// clear the success message after 5 seconds
Expand Down Expand Up @@ -262,7 +265,8 @@ export default function EnableEthicalMetrics({
(tgChannelId === "" && mail === "") ||
(tgChannelIdError && mailError) ||
(tgChannelIdError && mail === "") ||
(tgChannelId === "" && mailError)
(tgChannelId === "" && mailError) ||
ethicalLoading
}
checked={ethicalMetricsOn}
onChange={toggleEthicalSwitch}
Expand All @@ -280,4 +284,3 @@ export default function EnableEthicalMetrics({
</div>
);
}

Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ export default function StakerNetwork<T extends Network>({
isSelected={newEnableWeb3signer}
/>
</Col>
{(network === "prater" || network === "mainnet") && (
{["prater", "mainnet", "holesky"].includes(network) && (
<Col>
<SubTitle>Mev Boost</SubTitle>
<MevBoost
Expand All @@ -242,18 +242,13 @@ export default function StakerNetwork<T extends Network>({
newMevBoost={newMevBoost}
setNewMevBoost={setNewMevBoost}
isSelected={
currentStakerConfigReq.data.mevBoost.dnpName ===
newMevBoost?.dnpName
? true
: false
currentStakerConfigReq.data.mevBoost.dnpName === newMevBoost?.dnpName
}
/>
</Col>
)}
</Row>

<hr />

<div>
<div className="staker-buttons">
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ function Relay<T extends Network>({
{relay.ofacCompliant === undefined
? "-"
: relay.ofacCompliant
? "Yes"
: "No"}
? "Yes"
: "No"}
</td>
<td>
<Form.Check
Expand Down Expand Up @@ -288,6 +288,27 @@ const getDefaultRelays = <T extends Network>(network: T): RelayIface[] => {
"https://0x8a72a5ec3e2909fff931c8b42c9e0e6c6e660ac48a98016777fc63a73316b3ffb5c622495106277f8dbcc17a06e92ca3@goerli-relay.securerpc.com/"
}
];
case "holesky":
return [
{
operator: "Flashbots",
docs: "https://www.flashbots.net/",
url:
"https://0xafa4c6985aa049fb79dd37010438cfebeb0f2bd42b115b89dd678dab0670c1de38da0c4e9138c9290a398ecd9a0b3110@boost-relay-holesky.flashbots.net"
},
{
operator: "Aestus",
docs: "https://flashbots.notion.site/Relay-API-Documentation-5fb0819366954962bc02e81cb33840f5#417abe417dde45caaff3dc15aaae65dd",
url:
"https://0xab78bf8c781c58078c3beb5710c57940874dd96aef2835e7742c866b4c7c0406754376c2c8285a36c630346aa5c5f833@holesky.aestus.live"
},
{
operator: "Ultrasound",
docs: "https://github.com/ultrasoundmoney/frontend",
url:
"https://0xb1559beef7b5ba3127485bbbb090362d9f497ba64e177ee2c8e7db74746306efad687f2cf8574e38d70067d40ef136dc@relay-stag.ultrasound.money"
}
];
default:
return [];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default function EthicalMetrics() {

const ethicalMetricsConfig = useApi.getEthicalMetricsConfig();
const [ethicalMetricsOn, setEthicalMetricsOn] = useState(false);
const [ethicalLoading, setEthicalLoading] = useState(false);

const [mail, setMail] = useState("");
const [mailError, setMailError] = useState(false);
Expand Down Expand Up @@ -66,6 +67,7 @@ export default function EthicalMetrics() {
mailValue = ethicalMetricsConfig.data?.mail,
tgChannelIdValue = ethicalMetricsConfig.data?.tgChannelId
}) {
setEthicalLoading(true);
try {
setReqStatusEnable({ loading: true });

Expand All @@ -77,12 +79,13 @@ export default function EthicalMetrics() {
sync: true
}),
{
message: `Enabling ethical metrics via ${mailValue && tgChannelIdValue
? "telegram channel and email"
: mailValue
message: `Enabling ethical metrics via ${
mailValue && tgChannelIdValue
? "telegram channel and email"
: mailValue
? "email"
: tgChannelId && "telegram channel"
}`,
}`,
onSuccess: `Enabled ethical metrics`
}
);
Expand All @@ -94,6 +97,7 @@ export default function EthicalMetrics() {
console.error("Error on enableEthicalMetrics", e);
setEthicalMetricsOn(false);
}
setEthicalLoading(false);
}

function disableConfirmation() {
Expand All @@ -106,6 +110,7 @@ export default function EthicalMetrics() {
}

async function disableEthicalMetrics() {
setEthicalLoading(true);
try {
setReqStatusDisable({ loading: true });
await withToast(() => api.disableEthicalMetrics(), {
Expand All @@ -119,15 +124,17 @@ export default function EthicalMetrics() {
setReqStatusDisable({ error: e });
console.error("Error on registerEthicalMetrics", e);
}
setEthicalLoading(false);
}

return (
<Card spacing>
<div>
<p>
Receive notifications if your <strong>dappnode remains offline</strong>{" "}
for at least 3 hours, sent to either your Telegram or email. Telemetry
is collected anonymously to ensure no personal data is retained.
Receive notifications if your{" "}
<strong>dappnode remains offline</strong> for at least 3 hours, sent
to either your Telegram or email. Telemetry is collected anonymously
to ensure no personal data is retained.
</p>
</div>
<div>
Expand All @@ -151,20 +158,21 @@ export default function EthicalMetrics() {
<div style={{ display: "inline-block" }}>
<SwitchBig
disabled={
(tgChannelId === "" && mail === "") ||
(tgChannelId === "" && mail === "" && !ethicalMetricsOn) ||
mailError ||
tgChannelIdError
tgChannelIdError ||
ethicalLoading
}
checked={ethicalMetricsOn}
onChange={
ethicalMetricsOn
? disableConfirmation
: () =>
enableEthicalMetricsSync({
mailValue: mail && !mailError ? mail : null,
tgChannelIdValue:
tgChannelId && !tgChannelIdError ? tgChannelId : null
})
enableEthicalMetricsSync({
mailValue: mail && !mailError ? mail : null,
tgChannelIdValue:
tgChannelId && !tgChannelIdError ? tgChannelId : null
})
}
label={""}
id="enable-ethical-metrics"
Expand Down Expand Up @@ -357,4 +365,3 @@ export default function EthicalMetrics() {
</Card>
);
}

2 changes: 2 additions & 0 deletions packages/db/src/globalEnvs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
mevBoostLukso,
mevBoostMainnet,
mevBoostPrater,
mevBoostHolesky,
consensusClientHolesky,
executionClientHolesky,
} from "./stakerConfig.js";
Expand Down Expand Up @@ -55,6 +56,7 @@ export function computeGlobalEnvsFromDb<B extends boolean>(
[`${prefix}MEVBOOST_PRATER`]: mevBoostPrater.get(),
[`${prefix}CONSENSUS_CLIENT_HOLESKY`]: consensusClientHolesky.get(),
[`${prefix}EXECUTION_CLIENT_HOLESKY`]: executionClientHolesky.get(),
[`${prefix}MEVBOOST_HOLESKY`]: mevBoostHolesky.get(),
[`${prefix}CONSENSUS_CLIENT_LUKSO`]: consensusClientLukso.get(),
[`${prefix}EXECUTION_CLIENT_LUKSO`]: executionClientLukso.get(),
[`${prefix}MEVBOOST_LUKSO`]: mevBoostLukso.get(),
Expand Down
6 changes: 6 additions & 0 deletions packages/db/src/stakerConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export const mevBoostPrater = interceptGlobalEnvOnSet(

const CONSENSUS_CLIENT_HOLESKY = "consensus-client-holesky";
const EXECUTION_CLIENT_HOLESKY = "execution-client-holesky";
const MEVBOOST_HOLESKY = "mevboost-holesky";

// Null means not set
// Undefined means its set but the user has not selected any value
Expand All @@ -135,6 +136,11 @@ export const executionClientHolesky = interceptGlobalEnvOnSet(
Object.keys({ EXECUTION_CLIENT_HOLESKY })[0]
);

export const mevBoostHolesky = interceptGlobalEnvOnSet(
dbMain.staticKey<boolean>(MEVBOOST_HOLESKY, false),
Object.keys({ MEVBOOST_HOLESKY })[0]
);

// LUKSO

const CONSENSUS_CLIENT_LUKSO = "consensus-client-lukso";
Expand Down
14 changes: 10 additions & 4 deletions packages/hostScriptsServices/hostScripts/docker_upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,20 @@ function getIsDockerInstalledThroughApt() {
fi
}

# Check if Docker is in unattended upgrades
# Check if unnatended upgrades is installed and Docker is in unattended upgrades
function getIsDockerInUnattendedUpgrades() {
# Check if Docker is in unattended upgrades
if ! grep -q "${DOCKER_DOWNLOAD_ORIGINS}" "${UNATTENDED_UPGRADES_FILE}"; then
# Check if unattended-upgrades is installed
if [ ! -f "${UNATTENDED_UPGRADES_FILE}" ]; then
isDockerInUnattendedUpgrades=false
else
isDockerInUnattendedUpgrades=true
# Check if Docker is in unattended upgrades
if ! grep -q "${DOCKER_DOWNLOAD_ORIGINS}" "${UNATTENDED_UPGRADES_FILE}"; then
isDockerInUnattendedUpgrades=false
else
isDockerInUnattendedUpgrades=true
fi
fi

}

# check if docker-compose is installed and create an alias for docker compose if not
Expand Down
5 changes: 4 additions & 1 deletion packages/installer/src/calls/packageRemove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
} from "@dappnode/dockerapi";
import { httpsPortal } from "@dappnode/httpsportal";
import * as db from "@dappnode/db";
import { mevBoostMainnet, mevBoostPrater, stakerPkgs } from "@dappnode/types";
import { mevBoostMainnet, mevBoostPrater, mevBoostHolesky, stakerPkgs } from "@dappnode/types";
import { ethicalMetricsDnpName, unregister } from "@dappnode/ethicalmetrics";

/**
Expand Down Expand Up @@ -161,6 +161,9 @@ async function removeStakerPkgFromDbIfSelected({
case mevBoostPrater:
await db.mevBoostPrater.set(false);
break;
case mevBoostHolesky:
await db.mevBoostHolesky.set(false);
break;
default:
return;
}
Expand Down
6 changes: 6 additions & 0 deletions packages/params/src/params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,12 @@ export const params = {
signatureProtocol: "ECDSA_256" as const,
key: "0x7305356ad936A06c4ea5DF45AD5E5C3ff9Db818E",
},
{
name: "Gnosis Team",
dnpNameSuffix: ".dnp.dappnode.eth",
signatureProtocol: "ECDSA_256" as const,
key: "0x2BdB9b9b477268C1e7C04459F79DCc22401BBcd1",
},
],
};

Expand Down
3 changes: 2 additions & 1 deletion packages/stakers/src/get/getStakerDnpNamesByNetwork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
executionClientsLukso,
mevBoostMainnet,
mevBoostPrater,
mevBoostHolesky,
signerGnosis,
signerMainnet,
signerPrater,
Expand Down Expand Up @@ -49,7 +50,7 @@ export function getStakerDnpNamesByNetwork(
executionClients: executionClientsHolesky,
consensusClients: consensusClientsHolesky,
signer: signerHolesky,
mevBoost: "",
mevBoost: mevBoostHolesky,
};
case "gnosis":
return {
Expand Down
10 changes: 5 additions & 5 deletions packages/stakers/src/set/getStakerCompatibleVersionsByNetwork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,23 +179,23 @@ export function getStakerCompatibleVersionsByNetwork<T extends Network>(
{
dnpName:
"lighthouse-holesky.dnp.dappnode.eth" as ConsensusClient<T>,
minVersion: "0.1.0",
minVersion: "0.1.2",
},
{
dnpName: "prysm-holesky.dnp.dappnode.eth" as ConsensusClient<T>,
minVersion: "0.1.0",
minVersion: "0.1.3",
},
{
dnpName: "teku-holesky.dnp.dappnode.eth" as ConsensusClient<T>,
minVersion: "0.1.0",
minVersion: "0.1.2",
},
{
dnpName: "nimbus-holesky.dnp.dappnode.eth" as ConsensusClient<T>,
minVersion: "0.1.0",
minVersion: "0.1.2",
},
{
dnpName: "lodestar-holesky.dnp.dappnode.eth" as ConsensusClient<T>,
minVersion: "0.1.0",
minVersion: "0.1.3",
},
],
compatibleSigner: {
Expand Down
3 changes: 2 additions & 1 deletion packages/stakers/src/set/setMevBoost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
InstalledPackageData,
MevBoostMainnet,
MevBoostPrater,
MevBoostHolesky,
Network,
} from "@dappnode/types";
import {
Expand All @@ -22,7 +23,7 @@ export async function setMevBoost<T extends Network>({
currentMevBoostPkg,
}: {
dappnodeInstaller: DappnodeInstaller;
mevBoost: T extends "mainnet" ? MevBoostMainnet : MevBoostPrater;
mevBoost: T extends "mainnet" ? MevBoostMainnet : (T extends "prater" ? MevBoostPrater : MevBoostHolesky);
targetMevBoost?: StakerItemOk<T, "mev-boost">;
currentMevBoostPkg?: InstalledPackageData;
}): Promise<void> {
Expand Down
2 changes: 2 additions & 0 deletions packages/stakers/src/set/setStakerConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ async function setStakerConfigOnDb<T extends Network>(
await db.consensusClientHolesky.set(
consensusClient as ConsensusClientHolesky
);
if (db.mevBoostHolesky.get() !== Boolean(mevBoost))
await db.mevBoostHolesky.set(mevBoost ? true : false);
break;

case "lukso":
Expand Down
2 changes: 1 addition & 1 deletion packages/stakers/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function getStakerConfigByNetwork<T extends Network>(
return {
executionClient: db.executionClientHolesky.get() as ExecutionClient<T>,
consensusClient: db.consensusClientHolesky.get() as ConsensusClient<T>,
isMevBoostSelected: false, // holesky doesn't support mevBoost
isMevBoostSelected: db.mevBoostHolesky.get(),
};
case "lukso":
return {
Expand Down
Loading

0 comments on commit 9c3f542

Please sign in to comment.