-
Notifications
You must be signed in to change notification settings - Fork 299
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into check-network-on-start
- Loading branch information
Showing
72 changed files
with
2,126 additions
and
912 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
19 changes: 0 additions & 19 deletions
19
...n-test/resources/tech/pegasys/teku/beaconrestapi/beacon/schema/PendingBalanceDeposit.json
This file was deleted.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
...egration-test/resources/tech/pegasys/teku/beaconrestapi/beacon/schema/PendingDeposit.json
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,43 @@ | ||
{ | ||
"title": "PendingDeposit", | ||
"type": "object", | ||
"required": [ | ||
"pubkey", | ||
"withdrawal_credentials", | ||
"amount", | ||
"signature", | ||
"slot" | ||
], | ||
"properties": { | ||
"pubkey": { | ||
"type": "string", | ||
"pattern": "^0x[a-fA-F0-9]{2,}$", | ||
"description": "Bytes48 hexadecimal", | ||
"format": "bytes" | ||
}, | ||
"withdrawal_credentials": { | ||
"type": "string", | ||
"description": "Bytes32 hexadecimal", | ||
"example": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2", | ||
"format": "byte" | ||
}, | ||
"amount": { | ||
"type": "string", | ||
"description": "unsigned 64 bit integer", | ||
"example": "1", | ||
"format": "uint64" | ||
}, | ||
"signature": { | ||
"type": "string", | ||
"pattern": "^0x[a-fA-F0-9]{2,}$", | ||
"description": "SSZ hexadecimal", | ||
"format": "bytes" | ||
}, | ||
"slot": { | ||
"type": "string", | ||
"description": "unsigned 64 bit integer", | ||
"example": "1", | ||
"format": "uint64" | ||
} | ||
} | ||
} |
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
57 changes: 0 additions & 57 deletions
57
.../serializer/src/main/java/tech/pegasys/teku/api/schema/electra/PendingBalanceDeposit.java
This file was deleted.
Oops, something went wrong.
91 changes: 91 additions & 0 deletions
91
data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/PendingDeposit.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,91 @@ | ||
/* | ||
* 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.api.schema.electra; | ||
|
||
import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES96; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.util.Optional; | ||
import org.apache.tuweni.bytes.Bytes32; | ||
import tech.pegasys.teku.api.schema.BLSSignature; | ||
import tech.pegasys.teku.bls.BLSPublicKey; | ||
import tech.pegasys.teku.ethereum.execution.types.Eth1Address; | ||
import tech.pegasys.teku.infrastructure.ssz.primitive.SszBytes32; | ||
import tech.pegasys.teku.infrastructure.ssz.primitive.SszUInt64; | ||
import tech.pegasys.teku.infrastructure.unsigned.UInt64; | ||
import tech.pegasys.teku.spec.SpecVersion; | ||
import tech.pegasys.teku.spec.datastructures.type.SszPublicKey; | ||
import tech.pegasys.teku.spec.datastructures.type.SszSignature; | ||
import tech.pegasys.teku.spec.schemas.SchemaDefinitionsElectra; | ||
|
||
public class PendingDeposit { | ||
|
||
@JsonProperty("pubkey") | ||
private final BLSPublicKey publicKey; | ||
|
||
@JsonProperty("withdrawal_credentials") | ||
private final Eth1Address withdrawalCredentials; | ||
|
||
@JsonProperty("amount") | ||
public final UInt64 amount; | ||
|
||
@Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES96) | ||
public final BLSSignature signature; | ||
|
||
@JsonProperty("slot") | ||
public final UInt64 slot; | ||
|
||
public PendingDeposit( | ||
final @JsonProperty("pubkey") BLSPublicKey publicKey, | ||
final @JsonProperty("withdrawal_credentials") Eth1Address withdrawalCredentials, | ||
final @JsonProperty("amount") UInt64 amount, | ||
final @JsonProperty("signature") BLSSignature signature, | ||
final @JsonProperty("slot") UInt64 slot) { | ||
this.publicKey = publicKey; | ||
this.withdrawalCredentials = withdrawalCredentials; | ||
this.amount = amount; | ||
this.signature = signature; | ||
this.slot = slot; | ||
} | ||
|
||
public PendingDeposit( | ||
final tech.pegasys.teku.spec.datastructures.state.versions.electra.PendingDeposit | ||
internalPendingDeposit) { | ||
this.publicKey = internalPendingDeposit.getPublicKey(); | ||
this.withdrawalCredentials = | ||
Eth1Address.fromBytes(internalPendingDeposit.getWithdrawalCredentials()); | ||
this.amount = internalPendingDeposit.getAmount(); | ||
this.signature = new BLSSignature(internalPendingDeposit.getSignature()); | ||
this.slot = internalPendingDeposit.getSlot(); | ||
} | ||
|
||
public tech.pegasys.teku.spec.datastructures.state.versions.electra.PendingDeposit | ||
asInternalPendingDeposit(final SpecVersion spec) { | ||
final Optional<SchemaDefinitionsElectra> schemaDefinitionsElectra = | ||
spec.getSchemaDefinitions().toVersionElectra(); | ||
if (schemaDefinitionsElectra.isEmpty()) { | ||
throw new IllegalArgumentException("Could not create PendingDeposit for pre-electra spec"); | ||
} | ||
return schemaDefinitionsElectra | ||
.get() | ||
.getPendingDepositSchema() | ||
.create( | ||
new SszPublicKey(publicKey), | ||
SszBytes32.of(Bytes32.wrap(withdrawalCredentials.getWrappedBytes())), | ||
SszUInt64.of(amount), | ||
new SszSignature(signature.asInternalBLSSignature()), | ||
SszUInt64.of(slot)); | ||
} | ||
} |
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
Oops, something went wrong.