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

update block lists to use new electra preset #19

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,49 +26,61 @@

public class BeaconBlockBodyLists {

public static BeaconBlockBodyLists ofSpec(Spec spec) {
public static BeaconBlockBodyLists ofSpec(final Spec spec) {
return new BeaconBlockBodyLists(spec);
}

private final Spec spec;
private final BeaconBlockBodySchema<?> blockBodySchema;

public BeaconBlockBodyLists(Spec spec) {
public BeaconBlockBodyLists(final Spec spec) {
this.spec = spec;
blockBodySchema = spec.getGenesisSpec().getSchemaDefinitions().getBeaconBlockBodySchema();
}

public SszList<ProposerSlashing> createProposerSlashings(ProposerSlashing... proposerSlashings) {
public SszList<ProposerSlashing> createProposerSlashings(
final ProposerSlashing... proposerSlashings) {
return blockBodySchema.getProposerSlashingsSchema().of(proposerSlashings);
}

public SszList<AttesterSlashing> createAttesterSlashings(AttesterSlashing... attesterSlashings) {
public SszList<AttesterSlashing> createAttesterSlashings(
final AttesterSlashing... attesterSlashings) {
return blockBodySchema.getAttesterSlashingsSchema().of(attesterSlashings);
}

public SszList<AttesterSlashing> createAttesterSlashings(
UInt64 slot, AttesterSlashing... attesterSlashings) {
final UInt64 slot, final AttesterSlashing... attesterSlashings) {
return spec.atSlot(slot)
.getSchemaDefinitions()
.getBeaconBlockBodySchema()
.getAttesterSlashingsSchema()
.of(attesterSlashings);
}

public SszList<Attestation> createAttestations(Attestation... attestations) {
public SszList<Attestation> createAttestations(final Attestation... attestations) {
return blockBodySchema.getAttestationsSchema().of(attestations);
}

public SszList<Deposit> createDeposits(Deposit... deposits) {
public SszList<Attestation> createAttestations(
final UInt64 slot, final Attestation... attestations) {
return spec.atSlot(slot)
.getSchemaDefinitions()
.getBeaconBlockBodySchema()
.getAttestationsSchema()
.of(attestations);
}

public SszList<Deposit> createDeposits(final Deposit... deposits) {
return blockBodySchema.getDepositsSchema().of(deposits);
}

public SszList<SignedVoluntaryExit> createVoluntaryExits(SignedVoluntaryExit... voluntaryExits) {
public SszList<SignedVoluntaryExit> createVoluntaryExits(
final SignedVoluntaryExit... voluntaryExits) {
return blockBodySchema.getVoluntaryExitsSchema().of(voluntaryExits);
}

public SszList<SignedBlsToExecutionChange> createBlsToExecutionChanges(
SignedBlsToExecutionChange... blsToExecutionChanges) {
final SignedBlsToExecutionChange... blsToExecutionChanges) {
return blockBodySchema
.toVersionCapella()
.map(schema -> schema.getBlsToExecutionChangesSchema().of(blsToExecutionChanges))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ private SignedBlockAndState appendNewBlockToChain(final UInt64 slot, final Block
try {
SszList<Attestation> attestations =
BeaconBlockBodyLists.ofSpec(spec)
.createAttestations(options.getAttestations().toArray(new Attestation[0]));
.createAttestations(slot, options.getAttestations().toArray(new Attestation[0]));
SszList<AttesterSlashing> attesterSlashings =
BeaconBlockBodyLists.ofSpec(spec)
.createAttesterSlashings(
Expand Down