forked from Consensys/teku
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
32 changed files
with
696 additions
and
97 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
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
61 changes: 61 additions & 0 deletions
61
ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/DelegatingSpecConfigFulu.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,61 @@ | ||
/* | ||
* 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; | ||
|
||
public class DelegatingSpecConfigFulu extends DelegatingSpecConfigElectra | ||
implements SpecConfigFulu { | ||
private final SpecConfigFulu specConfigFulu; | ||
|
||
public DelegatingSpecConfigFulu(final SpecConfigFulu specConfig) { | ||
super(specConfig); | ||
this.specConfigFulu = SpecConfigFulu.required(specConfig); | ||
} | ||
|
||
@Override | ||
public Optional<SpecConfigFulu> toVersionFulu() { | ||
return Optional.of(this); | ||
} | ||
|
||
@Override | ||
public Bytes4 getFuluForkVersion() { | ||
return specConfigFulu.getFuluForkVersion(); | ||
} | ||
|
||
@Override | ||
public UInt64 getFuluForkEpoch() { | ||
return specConfigFulu.getFuluForkEpoch(); | ||
} | ||
|
||
@Override | ||
public boolean equals(final Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
final DelegatingSpecConfigFulu that = (DelegatingSpecConfigFulu) o; | ||
return Objects.equals(specConfigFulu, that.specConfigFulu); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(specConfigFulu); | ||
} | ||
} |
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
37 changes: 37 additions & 0 deletions
37
ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigFulu.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,37 @@ | ||
/* | ||
* 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 SpecConfigFulu extends SpecConfigElectra { | ||
|
||
static SpecConfigFulu required(final SpecConfig specConfig) { | ||
return specConfig | ||
.toVersionFulu() | ||
.orElseThrow( | ||
() -> | ||
new IllegalArgumentException( | ||
"Expected Fulu spec config but got: " + specConfig.getClass().getSimpleName())); | ||
} | ||
|
||
Bytes4 getFuluForkVersion(); | ||
|
||
UInt64 getFuluForkEpoch(); | ||
|
||
@Override | ||
Optional<SpecConfigFulu> toVersionFulu(); | ||
} |
68 changes: 68 additions & 0 deletions
68
ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigFuluImpl.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,68 @@ | ||
/* | ||
* 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; | ||
|
||
public class SpecConfigFuluImpl extends DelegatingSpecConfigElectra implements SpecConfigFulu { | ||
|
||
private final Bytes4 fuluForkVersion; | ||
private final UInt64 fuluForkEpoch; | ||
|
||
public SpecConfigFuluImpl( | ||
final SpecConfigElectra specConfig, | ||
final Bytes4 fuluForkVersion, | ||
final UInt64 fuluForkEpoch) { | ||
super(specConfig); | ||
this.fuluForkVersion = fuluForkVersion; | ||
this.fuluForkEpoch = fuluForkEpoch; | ||
} | ||
|
||
@Override | ||
public Bytes4 getFuluForkVersion() { | ||
return fuluForkVersion; | ||
} | ||
|
||
@Override | ||
public UInt64 getFuluForkEpoch() { | ||
return fuluForkEpoch; | ||
} | ||
|
||
@Override | ||
public Optional<SpecConfigFulu> toVersionFulu() { | ||
return Optional.of(this); | ||
} | ||
|
||
@Override | ||
public boolean equals(final Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
final SpecConfigFuluImpl that = (SpecConfigFuluImpl) o; | ||
return Objects.equals(specConfig, that.specConfig) | ||
&& Objects.equals(fuluForkVersion, that.fuluForkVersion) | ||
&& Objects.equals(fuluForkEpoch, that.fuluForkEpoch); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(specConfig, fuluForkVersion, fuluForkEpoch); | ||
} | ||
} |
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.