-
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.
Showing
7 changed files
with
257 additions
and
1 deletion.
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
...um/spec/src/main/java/tech/pegasys/teku/spec/datastructures/operations/InclusionList.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., 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.datastructures.operations; | ||
|
||
import java.util.List; | ||
import org.apache.tuweni.bytes.Bytes32; | ||
import tech.pegasys.teku.infrastructure.ssz.SszList; | ||
import tech.pegasys.teku.infrastructure.ssz.containers.Container4; | ||
import tech.pegasys.teku.infrastructure.ssz.primitive.SszBytes32; | ||
import tech.pegasys.teku.infrastructure.ssz.primitive.SszUInt64; | ||
import tech.pegasys.teku.infrastructure.ssz.tree.TreeNode; | ||
import tech.pegasys.teku.infrastructure.unsigned.UInt64; | ||
import tech.pegasys.teku.spec.datastructures.execution.Transaction; | ||
|
||
public class InclusionList | ||
extends Container4<InclusionList, SszUInt64, SszUInt64, SszBytes32, SszList<Transaction>> { | ||
protected InclusionList( | ||
final InclusionListSchema schema, | ||
final SszUInt64 slot, | ||
final SszUInt64 validatorIndex, | ||
final SszBytes32 inclusionListCommitteeRoot, | ||
final SszList<Transaction> transactions) { | ||
super(schema, slot, validatorIndex, inclusionListCommitteeRoot, transactions); | ||
} | ||
|
||
InclusionList(final InclusionListSchema type, final TreeNode backingNode) { | ||
super(type, backingNode); | ||
} | ||
|
||
public UInt64 getSlot() { | ||
return getField0().get(); | ||
} | ||
|
||
public UInt64 getValidatorIndex() { | ||
return getField1().get(); | ||
} | ||
|
||
public Bytes32 getInclusionListCommitteeRoot() { | ||
return getField2().get(); | ||
} | ||
|
||
public List<Transaction> getTransactions() { | ||
return getField3().asList(); | ||
} | ||
|
||
@Override | ||
public InclusionListSchema getSchema() { | ||
return (InclusionListSchema) super.getSchema(); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
...c/src/main/java/tech/pegasys/teku/spec/datastructures/operations/InclusionListSchema.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,48 @@ | ||
/* | ||
* 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.datastructures.operations; | ||
|
||
import tech.pegasys.teku.infrastructure.ssz.SszList; | ||
import tech.pegasys.teku.infrastructure.ssz.containers.ContainerSchema4; | ||
import tech.pegasys.teku.infrastructure.ssz.primitive.SszBytes32; | ||
import tech.pegasys.teku.infrastructure.ssz.primitive.SszUInt64; | ||
import tech.pegasys.teku.infrastructure.ssz.schema.SszListSchema; | ||
import tech.pegasys.teku.infrastructure.ssz.schema.SszPrimitiveSchemas; | ||
import tech.pegasys.teku.infrastructure.ssz.tree.TreeNode; | ||
import tech.pegasys.teku.spec.config.SpecConfigEip7805; | ||
import tech.pegasys.teku.spec.datastructures.execution.Transaction; | ||
import tech.pegasys.teku.spec.datastructures.execution.TransactionSchema; | ||
|
||
public class InclusionListSchema | ||
extends ContainerSchema4< | ||
InclusionList, SszUInt64, SszUInt64, SszBytes32, SszList<Transaction>> { | ||
|
||
public InclusionListSchema(final SpecConfigEip7805 specConfigEip7805) { | ||
super( | ||
"InclusionList", | ||
namedSchema("slot", SszPrimitiveSchemas.UINT64_SCHEMA), | ||
namedSchema("validator_index", SszPrimitiveSchemas.UINT64_SCHEMA), | ||
namedSchema("inclusion_list_committee_root", SszPrimitiveSchemas.BYTES32_SCHEMA), | ||
namedSchema( | ||
"transactions", | ||
SszListSchema.create( | ||
new TransactionSchema(specConfigEip7805), | ||
specConfigEip7805.getMaxTransactionsPerInclusionList()))); | ||
} | ||
|
||
@Override | ||
public InclusionList createFromBackingNode(final TreeNode node) { | ||
return new InclusionList(this, node); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...c/src/main/java/tech/pegasys/teku/spec/datastructures/operations/SignedInclusionList.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,47 @@ | ||
/* | ||
* 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.datastructures.operations; | ||
|
||
import tech.pegasys.teku.bls.BLSSignature; | ||
import tech.pegasys.teku.infrastructure.ssz.containers.Container2; | ||
import tech.pegasys.teku.infrastructure.ssz.tree.TreeNode; | ||
import tech.pegasys.teku.spec.datastructures.type.SszSignature; | ||
|
||
public class SignedInclusionList | ||
extends Container2<SignedInclusionList, InclusionList, SszSignature> { | ||
|
||
public SignedInclusionList(final SignedInclusionListSchema type, final TreeNode backingNode) { | ||
super(type, backingNode); | ||
} | ||
|
||
public SignedInclusionList( | ||
final SignedInclusionListSchema schema, | ||
final InclusionList message, | ||
final BLSSignature signature) { | ||
super(schema, message, new SszSignature(signature)); | ||
} | ||
|
||
@Override | ||
public SignedInclusionListSchema getSchema() { | ||
return (SignedInclusionListSchema) super.getSchema(); | ||
} | ||
|
||
public InclusionList getMessage() { | ||
return getField0(); | ||
} | ||
|
||
public BLSSignature getSignature() { | ||
return getField1().getSignature(); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
...main/java/tech/pegasys/teku/spec/datastructures/operations/SignedInclusionListSchema.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,48 @@ | ||
/* | ||
* 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.datastructures.operations; | ||
|
||
import static tech.pegasys.teku.spec.schemas.registry.SchemaTypes.INCLUSION_LIST_SCHEMA; | ||
|
||
import tech.pegasys.teku.bls.BLSSignature; | ||
import tech.pegasys.teku.infrastructure.ssz.containers.ContainerSchema2; | ||
import tech.pegasys.teku.infrastructure.ssz.tree.TreeNode; | ||
import tech.pegasys.teku.spec.datastructures.type.SszSignature; | ||
import tech.pegasys.teku.spec.datastructures.type.SszSignatureSchema; | ||
import tech.pegasys.teku.spec.schemas.registry.SchemaRegistry; | ||
|
||
public class SignedInclusionListSchema | ||
extends ContainerSchema2<SignedInclusionList, InclusionList, SszSignature> { | ||
|
||
public SignedInclusionListSchema( | ||
final String containerName, final SchemaRegistry schemaRegistry) { | ||
super( | ||
containerName, | ||
namedSchema("message", schemaRegistry.get(INCLUSION_LIST_SCHEMA)), | ||
namedSchema("signature", SszSignatureSchema.INSTANCE)); | ||
} | ||
|
||
public InclusionListSchema getInclusionListSchema() { | ||
return (InclusionListSchema) getFieldSchema0(); | ||
} | ||
|
||
@Override | ||
public SignedInclusionList createFromBackingNode(final TreeNode node) { | ||
return new SignedInclusionList(this, node); | ||
} | ||
|
||
public SignedInclusionList create(final InclusionList message, final BLSSignature signature) { | ||
return new SignedInclusionList(this, message, signature); | ||
} | ||
} |
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