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.
6778 blob sidecars by range (Consensys#6835)
* Add BlobSidecarsByRange RPC method
- Loading branch information
1 parent
fbf6e11
commit 164a68b
Showing
33 changed files
with
1,060 additions
and
31 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
72 changes: 72 additions & 0 deletions
72
...sys/teku/spec/datastructures/networking/libp2p/rpc/BlobSidecarsByRangeRequestMessage.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,72 @@ | ||
/* | ||
* Copyright ConsenSys Software Inc., 2023 | ||
* | ||
* 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.networking.libp2p.rpc; | ||
|
||
import tech.pegasys.teku.infrastructure.ssz.containers.Container2; | ||
import tech.pegasys.teku.infrastructure.ssz.containers.ContainerSchema2; | ||
import tech.pegasys.teku.infrastructure.ssz.primitive.SszUInt64; | ||
import tech.pegasys.teku.infrastructure.ssz.schema.SszPrimitiveSchemas; | ||
import tech.pegasys.teku.infrastructure.ssz.tree.TreeNode; | ||
import tech.pegasys.teku.infrastructure.unsigned.UInt64; | ||
|
||
public class BlobSidecarsByRangeRequestMessage | ||
extends Container2<BlobSidecarsByRangeRequestMessage, SszUInt64, SszUInt64> | ||
implements RpcRequest { | ||
|
||
public static class BlobSidecarsByRangeRequestMessageSchema | ||
extends ContainerSchema2<BlobSidecarsByRangeRequestMessage, SszUInt64, SszUInt64> { | ||
|
||
public BlobSidecarsByRangeRequestMessageSchema() { | ||
super( | ||
"BlobSidecarsByRangeRequestMessage", | ||
namedSchema("start_slot", SszPrimitiveSchemas.UINT64_SCHEMA), | ||
namedSchema("count", SszPrimitiveSchemas.UINT64_SCHEMA)); | ||
} | ||
|
||
@Override | ||
public BlobSidecarsByRangeRequestMessage createFromBackingNode(final TreeNode node) { | ||
return new BlobSidecarsByRangeRequestMessage(this, node); | ||
} | ||
} | ||
|
||
public static final BlobSidecarsByRangeRequestMessage.BlobSidecarsByRangeRequestMessageSchema | ||
SSZ_SCHEMA = new BlobSidecarsByRangeRequestMessage.BlobSidecarsByRangeRequestMessageSchema(); | ||
|
||
private BlobSidecarsByRangeRequestMessage( | ||
final BlobSidecarsByRangeRequestMessage.BlobSidecarsByRangeRequestMessageSchema type, | ||
final TreeNode backingNode) { | ||
super(type, backingNode); | ||
} | ||
|
||
public BlobSidecarsByRangeRequestMessage(final UInt64 startSlot, final UInt64 count) { | ||
super(SSZ_SCHEMA, SszUInt64.of(startSlot), SszUInt64.of(count)); | ||
} | ||
|
||
public UInt64 getStartSlot() { | ||
return getField0().get(); | ||
} | ||
|
||
public UInt64 getCount() { | ||
return getField1().get(); | ||
} | ||
|
||
public UInt64 getMaxSlot() { | ||
return getStartSlot().plus(getCount()).minusMinZero(1); | ||
} | ||
|
||
@Override | ||
public int getMaximumResponseChunks() { | ||
return getCount().intValue(); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,5 +17,5 @@ | |
|
||
public interface RpcRequest extends SszData { | ||
|
||
int getMaximumRequestChunks(); | ||
int getMaximumResponseChunks(); | ||
} |
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.