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

/eth/v1/config/spec does not return Altair constants #2638

Closed
mcdee opened this issue Sep 27, 2021 · 2 comments
Closed

/eth/v1/config/spec does not return Altair constants #2638

mcdee opened this issue Sep 27, 2021 · 2 comments
Assignees
Labels

Comments

@mcdee
Copy link
Contributor

mcdee commented Sep 27, 2021

Description

The /eth/v1/config/spec endpoint does not return all Altair constants.

Version

1.5.2

Present Behaviour

Not all Altair constants not returned (although some are, for example SYNC_COMMITTEE_SIZE).

Expected Behaviour

Altair constants should be returned:

  • DOMAIN_CONTRIBUTION_AND_PROOF
  • DOMAIN_SYNC_COMMITTEE
  • DOMAIN_SYNC_COMMITTEE_SELECTION_PROOF
  • SYNC_COMMITTEE_SUBNET_COUNT
  • TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE

Steps to resolve

Query /eth/v1/config/spec and examine output.

@michaelsproul
Copy link
Member

Ah, I wasn't aware that a decision had been made to include constants in the spec endpoint. As in, I hadn't seen this paragraph before:

Retrieve specification configuration used on this node. The configuration should include:

Constants for all hard forks known by the beacon node, for example the phase 0 and altair values
Presets for all hard forks supplied to the beacon node, for example the phase 0 and altair values
Configuration for the beacon node, for example the mainnet values

Lighthouse's current behaviour is to return the preset + configs, and some constants from phase0 for backwards compatibility that we were hoping to eventually remove.

IMO including constants in the endpoint is kind of clunky because the set of constants is expansive and defined over multiple spec documents (there's no straightforward single source of truth). I had hoped the preset/config distinction would simplify and clearly define the configuration parameters, yet adding constants back in to the mix seems to work against that. You've listed a few constants that you want access to, but there are many more, e.g.

pub mod altair {
pub const TIMELY_SOURCE_FLAG_INDEX: usize = 0;
pub const TIMELY_TARGET_FLAG_INDEX: usize = 1;
pub const TIMELY_HEAD_FLAG_INDEX: usize = 2;
pub const TIMELY_SOURCE_WEIGHT: u64 = 14;
pub const TIMELY_TARGET_WEIGHT: u64 = 26;
pub const TIMELY_HEAD_WEIGHT: u64 = 14;
pub const SYNC_REWARD_WEIGHT: u64 = 2;
pub const PROPOSER_WEIGHT: u64 = 8;
pub const WEIGHT_DENOMINATOR: u64 = 64;
pub const SYNC_COMMITTEE_SUBNET_COUNT: u64 = 4;
pub const TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE: u64 = 16;
pub const PARTICIPATION_FLAG_WEIGHTS: [u64; NUM_FLAG_INDICES] = [
TIMELY_SOURCE_WEIGHT,
TIMELY_TARGET_WEIGHT,
TIMELY_HEAD_WEIGHT,
];
pub const NUM_FLAG_INDICES: usize = 3;
}

Does Vouch not hard-code the constants from the specification? If it's a matter of wanting to avoid hard-coding values, maybe we need to address the root issue which is the lack of a canonical list of constants in the spec.

Of course, we're also pragmatic, and we want to follow the spec, so if this is something you really need we can kick the can down the road on adding all constants and just add the ones you mentioned

@mcdee
Copy link
Contributor Author

mcdee commented Sep 28, 2021

Vouch does use the beacon node information for all of its constants (I've never trusted constants; they're shifty). I can see the other constants being useful as well (e.g. externally calculating rewards for a given epoch) but up to you if you want to add them as well.

@michaelsproul michaelsproul changed the title /eth/v1/config/spec does not return altair info /eth/v1/config/spec does not return Altair constants Oct 22, 2021
@michaelsproul michaelsproul added the good first issue Good for newcomers label Jan 11, 2022
@michaelsproul michaelsproul self-assigned this Aug 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants