mirror of
https://github.com/ChainSafe/lodestar.git
synced 2026-01-09 23:58:12 -05:00
feat: add semi supernode flag (#8568)
**Motivation** Enable more efficient data availability with lower bandwidth and storage requirements compared to a supernode. **Description** Adds new `--semiSupernode` flag to subscribe to and custody half of the data column sidecar subnets to support blob reconstruction. This change in combination with https://github.com/ChainSafe/lodestar/pull/8567 will make it a lot less resource intensive to run a blob serving node. I went with the same flag name as Lighthouse currently uses for this https://github.com/sigp/lighthouse/issues/8218 to make it easier for users, even though I don't think this flag name is great. We can look into other ways to reconstruct blobs later, like fetching missing columns over req/resp, which will eventually become necessary if we want to support home operators that need blobs with higher max blob counts. **Note:** If the custody group count of the node was higher than 64 previously it will not be reduced. It is required to remove the ENR either manually or by setting `--persistNetworkIdentity false` to reset the custody requirements.
This commit is contained in:
@@ -225,6 +225,7 @@ stakers
|
|||||||
subnet
|
subnet
|
||||||
subnets
|
subnets
|
||||||
sudo
|
sudo
|
||||||
|
supernode
|
||||||
tcp
|
tcp
|
||||||
testnet
|
testnet
|
||||||
testnets
|
testnets
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ export async function beaconHandlerInit(args: BeaconArgs & GlobalArgs) {
|
|||||||
beaconNodeOptions.set({network: {discv5: {bootEnrs: [...new Set(bootnodes)]}}});
|
beaconNodeOptions.set({network: {discv5: {bootEnrs: [...new Set(bootnodes)]}}});
|
||||||
}
|
}
|
||||||
|
|
||||||
beaconNodeOptions.set({chain: {initialCustodyGroupCount: getInitialCustodyGroupCount(args, config, enr)}});
|
beaconNodeOptions.set({chain: {initialCustodyGroupCount: getInitialCustodyGroupCount(args, config, logger, enr)}});
|
||||||
|
|
||||||
if (args.disableLightClientServer) {
|
if (args.disableLightClientServer) {
|
||||||
beaconNodeOptions.set({chain: {disableLightClientServer: true}});
|
beaconNodeOptions.set({chain: {disableLightClientServer: true}});
|
||||||
@@ -255,7 +255,12 @@ export function initLogger(
|
|||||||
return logger;
|
return logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getInitialCustodyGroupCount(args: BeaconArgs & GlobalArgs, config: ChainForkConfig, enr: SignableENR): number {
|
function getInitialCustodyGroupCount(
|
||||||
|
args: BeaconArgs & GlobalArgs,
|
||||||
|
config: ChainForkConfig,
|
||||||
|
logger: LoggerNode,
|
||||||
|
enr: SignableENR
|
||||||
|
): number {
|
||||||
if (args.supernode) {
|
if (args.supernode) {
|
||||||
return config.NUMBER_OF_CUSTODY_GROUPS;
|
return config.NUMBER_OF_CUSTODY_GROUPS;
|
||||||
}
|
}
|
||||||
@@ -263,5 +268,15 @@ function getInitialCustodyGroupCount(args: BeaconArgs & GlobalArgs, config: Chai
|
|||||||
const enrCgcBytes = enr.kvs.get("cgc");
|
const enrCgcBytes = enr.kvs.get("cgc");
|
||||||
const enrCgc = enrCgcBytes != null ? bytesToInt(enrCgcBytes, "be") : 0;
|
const enrCgc = enrCgcBytes != null ? bytesToInt(enrCgcBytes, "be") : 0;
|
||||||
|
|
||||||
|
if (args.semiSupernode) {
|
||||||
|
const semiSupernodeCgc = Math.floor(config.NUMBER_OF_CUSTODY_GROUPS / 2);
|
||||||
|
if (enrCgc > semiSupernodeCgc) {
|
||||||
|
logger.warn(
|
||||||
|
`Reducing custody requirements is not supported, will continue to use custody group count of ${enrCgc}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Math.max(enrCgc, semiSupernodeCgc);
|
||||||
|
}
|
||||||
|
|
||||||
return Math.max(enrCgc, config.CUSTODY_REQUIREMENT);
|
return Math.max(enrCgc, config.CUSTODY_REQUIREMENT);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ type GlobalSingleArgs = {
|
|||||||
presetFile?: string;
|
presetFile?: string;
|
||||||
rcConfig?: string;
|
rcConfig?: string;
|
||||||
supernode?: boolean;
|
supernode?: boolean;
|
||||||
|
semiSupernode?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const defaultNetwork: NetworkName = "mainnet";
|
export const defaultNetwork: NetworkName = "mainnet";
|
||||||
@@ -55,6 +56,14 @@ const globalSingleOptions: CliCommandOptions<GlobalSingleArgs> = {
|
|||||||
supernode: {
|
supernode: {
|
||||||
description: "Subscribe to and custody all data column sidecar subnets",
|
description: "Subscribe to and custody all data column sidecar subnets",
|
||||||
type: "boolean",
|
type: "boolean",
|
||||||
|
conflicts: ["semiSupernode"],
|
||||||
|
},
|
||||||
|
|
||||||
|
semiSupernode: {
|
||||||
|
description:
|
||||||
|
"Subscribe to and custody half of the data column sidecar subnets to support blob reconstruction, enabling more efficient data availability with lower bandwidth and storage requirements compared to a supernode.",
|
||||||
|
type: "boolean",
|
||||||
|
conflicts: ["supernode"],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user