-
Notifications
You must be signed in to change notification settings - Fork 305
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4dbdd08
commit e9a0a08
Showing
18 changed files
with
725 additions
and
2 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
118 changes: 118 additions & 0 deletions
118
ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/DelegatingSpecConfigElectra.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,118 @@ | ||
/* | ||
* Copyright Consensys Software Inc., 2024 | ||
* | ||
* 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.config; | ||
|
||
import java.util.Optional; | ||
import tech.pegasys.teku.infrastructure.bytes.Bytes4; | ||
import tech.pegasys.teku.infrastructure.unsigned.UInt64; | ||
|
||
public class DelegatingSpecConfigElectra extends DelegatingSpecConfigDeneb | ||
implements SpecConfigElectra { | ||
private final SpecConfigElectra specConfigElectra; | ||
|
||
public DelegatingSpecConfigElectra(final SpecConfigElectra specConfig) { | ||
super(specConfig); | ||
this.specConfigElectra = SpecConfigElectra.required(specConfig); | ||
} | ||
|
||
@Override | ||
public Bytes4 getElectraForkVersion() { | ||
return specConfigElectra.getElectraForkVersion(); | ||
} | ||
|
||
@Override | ||
public UInt64 getElectraForkEpoch() { | ||
return specConfigElectra.getElectraForkEpoch(); | ||
} | ||
|
||
@Override | ||
public UInt64 getMinPerEpochChurnLimitElectra() { | ||
return specConfigElectra.getMinPerEpochChurnLimitElectra(); | ||
} | ||
|
||
@Override | ||
public UInt64 getMinActivationBalance() { | ||
return specConfigElectra.getMinActivationBalance(); | ||
} | ||
|
||
@Override | ||
public UInt64 getMaxEffectiveBalanceElectra() { | ||
return specConfigElectra.getMaxEffectiveBalanceElectra(); | ||
} | ||
|
||
@Override | ||
public int getPendingDepositsLimit() { | ||
return specConfigElectra.getPendingDepositsLimit(); | ||
} | ||
|
||
@Override | ||
public int getPendingPartialWithdrawalsLimit() { | ||
return specConfigElectra.getPendingPartialWithdrawalsLimit(); | ||
} | ||
|
||
@Override | ||
public int getPendingConsolidationsLimit() { | ||
return specConfigElectra.getPendingConsolidationsLimit(); | ||
} | ||
|
||
@Override | ||
public int getMinSlashingPenaltyQuotientElectra() { | ||
return specConfigElectra.getMinSlashingPenaltyQuotientElectra(); | ||
} | ||
|
||
@Override | ||
public int getWhistleblowerRewardQuotientElectra() { | ||
return specConfigElectra.getWhistleblowerRewardQuotientElectra(); | ||
} | ||
|
||
@Override | ||
public int getMaxAttesterSlashingsElectra() { | ||
return specConfigElectra.getMaxAttesterSlashingsElectra(); | ||
} | ||
|
||
@Override | ||
public int getMaxAttestationsElectra() { | ||
return specConfigElectra.getMaxAttestationsElectra(); | ||
} | ||
|
||
@Override | ||
public int getMaxConsolidationRequestsPerPayload() { | ||
return specConfigElectra.getMaxConsolidationRequestsPerPayload(); | ||
} | ||
|
||
@Override | ||
public int getMaxDepositRequestsPerPayload() { | ||
return specConfigElectra.getMaxDepositRequestsPerPayload(); | ||
} | ||
|
||
@Override | ||
public int getMaxWithdrawalRequestsPerPayload() { | ||
return specConfigElectra.getMaxWithdrawalRequestsPerPayload(); | ||
} | ||
|
||
@Override | ||
public int getMaxPendingPartialsPerWithdrawalsSweep() { | ||
return specConfigElectra.getMaxPendingPartialsPerWithdrawalsSweep(); | ||
} | ||
|
||
@Override | ||
public int getMaxPendingDepositsPerEpoch() { | ||
return specConfigElectra.getMaxPendingDepositsPerEpoch(); | ||
} | ||
|
||
@Override | ||
public Optional<SpecConfigElectra> toVersionElectra() { | ||
return Optional.of(this); | ||
} | ||
} |
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
42 changes: 42 additions & 0 deletions
42
ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigEip7805.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,42 @@ | ||
/* | ||
* Copyright Consensys Software Inc., 2024 | ||
* | ||
* 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.config; | ||
|
||
import java.util.Optional; | ||
import tech.pegasys.teku.infrastructure.bytes.Bytes4; | ||
import tech.pegasys.teku.infrastructure.unsigned.UInt64; | ||
|
||
public interface SpecConfigEip7805 extends SpecConfigElectra { | ||
|
||
static SpecConfigEip7805 required(final SpecConfig specConfig) { | ||
return specConfig | ||
.toVersionEip7805() | ||
.orElseThrow( | ||
() -> | ||
new IllegalArgumentException( | ||
"Expected Eip7805 spec config but got: " | ||
+ specConfig.getClass().getSimpleName())); | ||
} | ||
|
||
Bytes4 getEip7805ForkVersion(); | ||
|
||
UInt64 getEip7805ForkEpoch(); | ||
|
||
int getIlCommitteeSize(); | ||
|
||
int getMaxTransactionPerInclusionList(); | ||
|
||
@Override | ||
Optional<SpecConfigEip7805> toVersionEip7805(); | ||
} |
98 changes: 98 additions & 0 deletions
98
ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigEip7805Impl.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,98 @@ | ||
/* | ||
* Copyright Consensys Software Inc., 2024 | ||
* | ||
* 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.config; | ||
|
||
import java.util.Objects; | ||
import java.util.Optional; | ||
import tech.pegasys.teku.infrastructure.bytes.Bytes4; | ||
import tech.pegasys.teku.infrastructure.unsigned.UInt64; | ||
import tech.pegasys.teku.spec.SpecMilestone; | ||
|
||
public class SpecConfigEip7805Impl extends DelegatingSpecConfigElectra | ||
implements SpecConfigEip7805 { | ||
|
||
private final Bytes4 eip7805ForkVersion; | ||
private final UInt64 eip7805ForkEpoch; | ||
private final int ilCommitteeSize; | ||
private final int maxTransactionPerInclusionList; | ||
|
||
public SpecConfigEip7805Impl( | ||
final SpecConfigElectra specConfig, | ||
final Bytes4 eip7805ForkVersion, | ||
final UInt64 eip7805ForkEpoch, | ||
final int ilCommitteeSize, | ||
final int maxTransactionPerInclusionList) { | ||
super(specConfig); | ||
this.eip7805ForkVersion = eip7805ForkVersion; | ||
this.eip7805ForkEpoch = eip7805ForkEpoch; | ||
this.ilCommitteeSize = ilCommitteeSize; | ||
this.maxTransactionPerInclusionList = maxTransactionPerInclusionList; | ||
} | ||
|
||
@Override | ||
public Bytes4 getEip7805ForkVersion() { | ||
return eip7805ForkVersion; | ||
} | ||
|
||
@Override | ||
public UInt64 getEip7805ForkEpoch() { | ||
return eip7805ForkEpoch; | ||
} | ||
|
||
@Override | ||
public int getIlCommitteeSize() { | ||
return ilCommitteeSize; | ||
} | ||
|
||
@Override | ||
public int getMaxTransactionPerInclusionList() { | ||
return maxTransactionPerInclusionList; | ||
} | ||
|
||
@Override | ||
public Optional<SpecConfigEip7805> toVersionEip7805() { | ||
return Optional.of(this); | ||
} | ||
|
||
@Override | ||
public SpecMilestone getMilestone() { | ||
return SpecMilestone.EIP7805; | ||
} | ||
|
||
@Override | ||
public boolean equals(final Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
final SpecConfigEip7805Impl that = (SpecConfigEip7805Impl) o; | ||
return Objects.equals(specConfig, that.specConfig) | ||
&& Objects.equals(eip7805ForkVersion, that.eip7805ForkVersion) | ||
&& Objects.equals(eip7805ForkEpoch, that.eip7805ForkEpoch) | ||
&& ilCommitteeSize == that.ilCommitteeSize | ||
&& maxTransactionPerInclusionList == that.maxTransactionPerInclusionList; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash( | ||
specConfig, | ||
eip7805ForkVersion, | ||
eip7805ForkEpoch, | ||
ilCommitteeSize, | ||
maxTransactionPerInclusionList); | ||
} | ||
} |
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
Oops, something went wrong.