Skip to content

Commit 7e2f107

Browse files
authored
Add VersionedHash DB logic only (Consensys#9931)
* Safer interface for VersionedHashDBSource
1 parent cd9f1ab commit 7e2f107

File tree

43 files changed

+929
-72
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+929
-72
lines changed

ethereum/pow/api/build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,9 @@ dependencies {
77

88
testImplementation testFixtures(project(':ethereum:spec'))
99
}
10+
11+
publishing {
12+
publications {
13+
mavenJava(MavenPublication) { artifactId 'ethereum-pow-api' }
14+
}
15+
}

ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/deneb/types/VersionedHash.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
public class VersionedHash {
2323

2424
public static final int SIZE = 32;
25+
public static final VersionedHash EMPTY = new VersionedHash(Bytes32.ZERO);
2526

2627
final Bytes version;
2728
final Bytes value;
@@ -53,6 +54,10 @@ public Bytes getValue() {
5354
return value;
5455
}
5556

57+
public Bytes32 get() {
58+
return Bytes32.wrap(Bytes.concatenate(version, value));
59+
}
60+
5661
public String toHexString() {
5762
return Bytes.wrap(version, value).toHexString();
5863
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
dependencies {
2+
implementation project(':infrastructure:events')
3+
}
4+
5+
publishing {
6+
publications {
7+
mavenJava(MavenPublication) { artifactId 'ethereum-statetransition-api' }
8+
}
9+
}

ethereum/statetransition/src/main/java/tech/pegasys/teku/statetransition/CustodyGroupCountChannel.java renamed to ethereum/statetransition/api/src/main/java/tech/pegasys/teku/statetransition/api/CustodyGroupCountChannel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* specific language governing permissions and limitations under the License.
1212
*/
1313

14-
package tech.pegasys.teku.statetransition;
14+
package tech.pegasys.teku.statetransition.api;
1515

1616
import java.util.function.Consumer;
1717
import tech.pegasys.teku.infrastructure.events.VoidReturningChannelInterface;

ethereum/statetransition/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ idea {
66

77
dependencies {
88
api project(':ethereum:events')
9+
api project(':ethereum:statetransition:api')
910

1011
implementation project(':ethereum:performance-trackers')
1112
implementation project(':ethereum:execution-types')

ethereum/statetransition/src/main/java/tech/pegasys/teku/statetransition/datacolumns/CustodyGroupCountManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import tech.pegasys.teku.spec.SpecMilestone;
3232
import tech.pegasys.teku.spec.config.SpecConfigFulu;
3333
import tech.pegasys.teku.spec.logic.versions.fulu.helpers.MiscHelpersFulu;
34-
import tech.pegasys.teku.statetransition.CustodyGroupCountChannel;
34+
import tech.pegasys.teku.statetransition.api.CustodyGroupCountChannel;
3535
import tech.pegasys.teku.statetransition.forkchoice.PreparedProposerInfo;
3636
import tech.pegasys.teku.statetransition.forkchoice.ProposersDataManager;
3737
import tech.pegasys.teku.storage.client.CombinedChainDataClient;

ethereum/statetransition/src/test/java/tech/pegasys/teku/statetransition/datacolumns/CustodyGroupCountManagerImplTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
import tech.pegasys.teku.spec.config.SpecConfigFulu;
4040
import tech.pegasys.teku.spec.logic.versions.fulu.helpers.MiscHelpersFulu;
4141
import tech.pegasys.teku.spec.util.DataStructureUtil;
42-
import tech.pegasys.teku.statetransition.CustodyGroupCountChannel;
42+
import tech.pegasys.teku.statetransition.api.CustodyGroupCountChannel;
4343
import tech.pegasys.teku.statetransition.forkchoice.PreparedProposerInfo;
4444
import tech.pegasys.teku.statetransition.forkchoice.ProposersDataManager;
4545
import tech.pegasys.teku.storage.client.CombinedChainDataClient;

ethereum/statetransition/src/test/java/tech/pegasys/teku/statetransition/datacolumns/DasSamplerBasicTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState;
4545
import tech.pegasys.teku.spec.datastructures.util.DataColumnSlotAndIdentifier;
4646
import tech.pegasys.teku.spec.util.DataStructureUtil;
47-
import tech.pegasys.teku.statetransition.CustodyGroupCountChannel;
47+
import tech.pegasys.teku.statetransition.api.CustodyGroupCountChannel;
4848
import tech.pegasys.teku.statetransition.datacolumns.db.DataColumnSidecarDbAccessor;
4949
import tech.pegasys.teku.statetransition.datacolumns.retriever.DataColumnSidecarRetriever;
5050
import tech.pegasys.teku.statetransition.forkchoice.PreparedProposerInfo;

networking/eth2/src/main/java/tech/pegasys/teku/networking/eth2/gossip/subnets/DataColumnSidecarSubnetBackboneSubscriber.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import tech.pegasys.teku.infrastructure.unsigned.UInt64;
2424
import tech.pegasys.teku.networking.eth2.Eth2P2PNetwork;
2525
import tech.pegasys.teku.spec.Spec;
26-
import tech.pegasys.teku.statetransition.CustodyGroupCountChannel;
26+
import tech.pegasys.teku.statetransition.api.CustodyGroupCountChannel;
2727

2828
public class DataColumnSidecarSubnetBackboneSubscriber
2929
implements SlotEventsChannel, CustodyGroupCountChannel {

networking/eth2/src/main/java/tech/pegasys/teku/networking/eth2/rpc/beaconchain/methods/MetadataMessagesFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.PingMessage;
2323
import tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.metadata.MetadataMessage;
2424
import tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.metadata.MetadataMessageSchema;
25-
import tech.pegasys.teku.statetransition.CustodyGroupCountChannel;
25+
import tech.pegasys.teku.statetransition.api.CustodyGroupCountChannel;
2626

2727
public class MetadataMessagesFactory implements CustodyGroupCountChannel {
2828
private static final Logger LOG = LogManager.getLogger();

0 commit comments

Comments
 (0)