-
Notifications
You must be signed in to change notification settings - Fork 304
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add inclusion list signature verification (#8999)
- Loading branch information
1 parent
381b07d
commit f011b0b
Showing
7 changed files
with
159 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
.../main/java/tech/pegasys/teku/spec/logic/versions/eip7805/block/BlockProcessorEip7805.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
* Copyright Consensys Software Inc., 2025 | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
*/ | ||
|
||
package tech.pegasys.teku.spec.logic.versions.eip7805.block; | ||
|
||
import org.apache.tuweni.bytes.Bytes; | ||
import tech.pegasys.teku.bls.BLS; | ||
import tech.pegasys.teku.bls.BLSPublicKey; | ||
import tech.pegasys.teku.infrastructure.unsigned.UInt64; | ||
import tech.pegasys.teku.spec.config.SpecConfigElectra; | ||
import tech.pegasys.teku.spec.constants.Domain; | ||
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ExecutionRequestsDataCodec; | ||
import tech.pegasys.teku.spec.datastructures.operations.InclusionList; | ||
import tech.pegasys.teku.spec.datastructures.operations.SignedInclusionList; | ||
import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState; | ||
import tech.pegasys.teku.spec.logic.common.helpers.Predicates; | ||
import tech.pegasys.teku.spec.logic.common.operations.OperationSignatureVerifier; | ||
import tech.pegasys.teku.spec.logic.common.operations.validation.OperationValidator; | ||
import tech.pegasys.teku.spec.logic.common.util.AttestationUtil; | ||
import tech.pegasys.teku.spec.logic.common.util.BeaconStateUtil; | ||
import tech.pegasys.teku.spec.logic.common.util.SyncCommitteeUtil; | ||
import tech.pegasys.teku.spec.logic.common.util.ValidatorsUtil; | ||
import tech.pegasys.teku.spec.logic.versions.eip7805.helpers.MiscHelpersEip7805; | ||
import tech.pegasys.teku.spec.logic.versions.electra.block.BlockProcessorElectra; | ||
import tech.pegasys.teku.spec.logic.versions.electra.helpers.BeaconStateAccessorsElectra; | ||
import tech.pegasys.teku.spec.logic.versions.electra.helpers.BeaconStateMutatorsElectra; | ||
import tech.pegasys.teku.spec.schemas.SchemaDefinitionsElectra; | ||
|
||
public class BlockProcessorEip7805 extends BlockProcessorElectra { | ||
|
||
public BlockProcessorEip7805( | ||
final SpecConfigElectra specConfig, | ||
final Predicates predicates, | ||
final MiscHelpersEip7805 miscHelpers, | ||
final SyncCommitteeUtil syncCommitteeUtil, | ||
final BeaconStateAccessorsElectra beaconStateAccessors, | ||
final BeaconStateMutatorsElectra beaconStateMutators, | ||
final OperationSignatureVerifier operationSignatureVerifier, | ||
final BeaconStateUtil beaconStateUtil, | ||
final AttestationUtil attestationUtil, | ||
final ValidatorsUtil validatorsUtil, | ||
final OperationValidator operationValidator, | ||
final SchemaDefinitionsElectra schemaDefinitions, | ||
final ExecutionRequestsDataCodec executionRequestsDataCodec) { | ||
super( | ||
specConfig, | ||
predicates, | ||
miscHelpers, | ||
syncCommitteeUtil, | ||
beaconStateAccessors, | ||
beaconStateMutators, | ||
operationSignatureVerifier, | ||
beaconStateUtil, | ||
attestationUtil, | ||
validatorsUtil, | ||
operationValidator, | ||
schemaDefinitions, | ||
executionRequestsDataCodec); | ||
} | ||
|
||
/** Check if ``signed_inclusion_list`` has a valid signature. */ | ||
public boolean isValidInclusionListSignature( | ||
final BeaconState state, final SignedInclusionList signedInclusionList) { | ||
final InclusionList message = signedInclusionList.getMessage(); | ||
final UInt64 index = message.getValidatorIndex(); | ||
final BLSPublicKey pubkey = state.getValidators().get(index.intValue()).getPublicKey(); | ||
final Bytes signingRoot = | ||
miscHelpers.computeSigningRoot( | ||
message, | ||
beaconStateAccessors.getDomain( | ||
state.getForkInfo(), | ||
Domain.DOMAIN_INCLUSION_LIST_COMMITTEE, | ||
miscHelpers.computeEpochAtSlot(state.getSlot()))); | ||
return BLS.verify(pubkey, signingRoot, signedInclusionList.getSignature()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...c/main/java/tech/pegasys/teku/spec/logic/versions/eip7805/helpers/MiscHelpersEip7805.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Copyright Consensys Software Inc., 2025 | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
*/ | ||
|
||
package tech.pegasys.teku.spec.logic.versions.eip7805.helpers; | ||
|
||
import java.util.Optional; | ||
import tech.pegasys.teku.spec.config.SpecConfigEip7805; | ||
import tech.pegasys.teku.spec.config.SpecConfigElectra; | ||
import tech.pegasys.teku.spec.logic.common.helpers.MiscHelpers; | ||
import tech.pegasys.teku.spec.logic.versions.electra.helpers.MiscHelpersElectra; | ||
import tech.pegasys.teku.spec.logic.versions.electra.helpers.PredicatesElectra; | ||
import tech.pegasys.teku.spec.schemas.SchemaDefinitionsEip7805; | ||
import tech.pegasys.teku.spec.schemas.SchemaDefinitionsElectra; | ||
|
||
public class MiscHelpersEip7805 extends MiscHelpersElectra { | ||
|
||
public MiscHelpersEip7805( | ||
final SpecConfigEip7805 specConfig, | ||
final PredicatesElectra predicates, | ||
final SchemaDefinitionsEip7805 schemaDefinitions) { | ||
super( | ||
SpecConfigElectra.required(specConfig), | ||
predicates, | ||
SchemaDefinitionsElectra.required(schemaDefinitions)); | ||
} | ||
|
||
public static MiscHelpersEip7805 required(final MiscHelpers miscHelpers) { | ||
return miscHelpers | ||
.toVersionEip7805() | ||
.orElseThrow( | ||
() -> | ||
new IllegalArgumentException( | ||
"Expected Eip7805 misc helpers but got: " | ||
+ miscHelpers.getClass().getSimpleName())); | ||
} | ||
|
||
@Override | ||
public Optional<MiscHelpersEip7805> toVersionEip7805() { | ||
return Optional.of(this); | ||
} | ||
} |