Skip to content

Commit

Permalink
Merge branch 'master' into detach-block-and-blobs-publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
tbenr authored Oct 31, 2024
2 parents cb269c5 + 4910514 commit ad0ff80
Show file tree
Hide file tree
Showing 63 changed files with 16,125 additions and 2,004 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
### Additions and Improvements

### Bug Fixes
- Added a startup script for unix systems to ensure that when jemalloc is installed the script sets the LD_PRELOAD environment variable to the use the jemalloc library
8 changes: 5 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -574,11 +574,11 @@ task autocomplete(type: JavaExec) {
}

installDist {
dependsOn checkLicense, autocomplete
dependsOn checkLicense, startScripts, autocomplete
}

distTar {
dependsOn checkLicense, autocomplete
dependsOn checkLicense, startScripts, autocomplete
doFirst {
delete fileTree(dir: 'build/distributions', include: '*.tar.gz')
}
Expand All @@ -591,7 +591,7 @@ distTar {
}

distZip {
dependsOn checkLicense, autocomplete
dependsOn checkLicense, startScripts, autocomplete
doFirst {
delete fileTree(dir: 'build/distributions', include: '*.zip')
}
Expand All @@ -603,6 +603,8 @@ distZip {

startScripts {

unixStartScriptGenerator.template = resources.text.fromFile("${projectDir}/teku/src/main/scripts/unixStartScript.txt")

def shortenWindowsClasspath = { line ->
line = line.replaceAll(/^set CLASSPATH=.*$/, "set CLASSPATH=%APP_HOME%/lib/*")
}
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@
import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.io.Resources;
import java.io.IOException;
import java.util.List;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import tech.pegasys.teku.api.migrated.AllBlocksAtSlotData;
import tech.pegasys.teku.beaconrestapi.AbstractMigratedBeaconHandlerTest;
import tech.pegasys.teku.infrastructure.async.SafeFuture;
import tech.pegasys.teku.infrastructure.json.JsonTestUtil;
import tech.pegasys.teku.infrastructure.unsigned.UInt64;
import tech.pegasys.teku.spec.SpecMilestone;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
Expand Down Expand Up @@ -88,12 +89,14 @@ void metadata_shouldHandle503() throws JsonProcessingException {
}

@Test
void metadata_shouldHandle200() throws IOException {
void metadata_shouldHandle200() throws Exception {
final String data = getResponseStringFromMetadata(handler, SC_OK, responseData);
final JsonNode responseDataAsJsonNode = JsonTestUtil.parseAsJsonNode(data);
final String expected =
Resources.toString(
Resources.getResource(GetAllBlocksAtSlotTest.class, "getAllBlocksAtSlot.json"), UTF_8);
assertThat(data).isEqualTo(expected);
final JsonNode expectedAsJsonNode = JsonTestUtil.parseAsJsonNode(expected);
assertThat(responseDataAsJsonNode).isEqualTo(expectedAsJsonNode);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@
import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.io.Resources;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import tech.pegasys.teku.beaconrestapi.AbstractMigratedBeaconHandlerTest;
import tech.pegasys.teku.infrastructure.json.JsonTestUtil;
import tech.pegasys.teku.spec.datastructures.operations.Attestation;

class GetAttestationsTest extends AbstractMigratedBeaconHandlerTest {
Expand Down Expand Up @@ -74,14 +75,16 @@ void metadata_shouldHandle500() throws JsonProcessingException {
}

@Test
void metadata_shouldHandle200() throws IOException {
void metadata_shouldHandle200() throws Exception {
List<Attestation> responseData =
List.of(dataStructureUtil.randomAttestation(), dataStructureUtil.randomAttestation());

final String data = getResponseStringFromMetadata(handler, SC_OK, responseData);
final JsonNode responseDataAsJsonNode = JsonTestUtil.parseAsJsonNode(data);
final String expected =
Resources.toString(
Resources.getResource(GetAttestationsTest.class, "getAttestations.json"), UTF_8);
assertThat(data).isEqualTo(expected);
final JsonNode expectedAsJsonNode = JsonTestUtil.parseAsJsonNode(expected);
assertThat(responseDataAsJsonNode).isEqualTo(expectedAsJsonNode);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@
import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.io.Resources;
import java.io.IOException;
import java.util.concurrent.ExecutionException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import tech.pegasys.teku.beaconrestapi.AbstractMigratedBeaconHandlerWithChainDataProviderTest;
import tech.pegasys.teku.infrastructure.json.JsonTestUtil;
import tech.pegasys.teku.spec.SpecMilestone;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
import tech.pegasys.teku.spec.datastructures.metadata.ObjectAndMetaData;
Expand Down Expand Up @@ -75,15 +76,17 @@ void metadata_shouldHandle500() throws JsonProcessingException {
}

@Test
void metadata_shouldHandle200() throws IOException {
void metadata_shouldHandle200() throws Exception {
final SignedBeaconBlock beaconBlock = dataStructureUtil.randomSignedBlindedBeaconBlock(1);
final ObjectAndMetaData<SignedBeaconBlock> responseData = withMetaData(beaconBlock);

final String data = getResponseStringFromMetadata(handler, SC_OK, responseData);
final JsonNode responseDataAsJsonNode = JsonTestUtil.parseAsJsonNode(data);
final String expected =
Resources.toString(
Resources.getResource(GetBlindedBlockTest.class, "getBlindedBlock.json"), UTF_8);
assertThat(data).isEqualTo(expected);
final JsonNode expectedAsJsonNode = JsonTestUtil.parseAsJsonNode(expected);
assertThat(responseDataAsJsonNode).isEqualTo(expectedAsJsonNode);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@
import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.io.Resources;
import java.io.IOException;
import java.util.List;
import java.util.Optional;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import tech.pegasys.teku.beaconrestapi.AbstractMigratedBeaconHandlerTest;
import tech.pegasys.teku.infrastructure.async.SafeFuture;
import tech.pegasys.teku.infrastructure.json.JsonTestUtil;
import tech.pegasys.teku.spec.datastructures.metadata.ObjectAndMetaData;
import tech.pegasys.teku.spec.datastructures.operations.Attestation;

Expand Down Expand Up @@ -74,13 +75,15 @@ void metadata_shouldHandle500() throws JsonProcessingException {
}

@Test
void metadata_shouldHandle200() throws IOException {
void metadata_shouldHandle200() throws Exception {
final String data = getResponseStringFromMetadata(handler, SC_OK, responseData);
final JsonNode responseDataAsJsonNode = JsonTestUtil.parseAsJsonNode(data);
final String expected =
Resources.toString(
Resources.getResource(GetBlockAttestationsTest.class, "getBlockAttestations.json"),
UTF_8);
assertThat(data).isEqualTo(expected);
final JsonNode expectedAsJsonNode = JsonTestUtil.parseAsJsonNode(expected);
assertThat(responseDataAsJsonNode).isEqualTo(expectedAsJsonNode);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@
import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.io.Resources;
import java.io.IOException;
import java.util.Optional;
import java.util.concurrent.ExecutionException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import tech.pegasys.teku.beaconrestapi.AbstractMigratedBeaconHandlerWithChainDataProviderTest;
import tech.pegasys.teku.bls.BLSSignature;
import tech.pegasys.teku.infrastructure.json.JsonTestUtil;
import tech.pegasys.teku.spec.SpecMilestone;
import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
Expand Down Expand Up @@ -79,12 +80,14 @@ void metadata_shouldHandle500() throws JsonProcessingException {
}

@Test
void metadata_shouldHandle200() throws IOException {
void metadata_shouldHandle200() throws Exception {
final String data = getResponseStringFromMetadata(handler, SC_OK, responseData);
final JsonNode responseDataAsJsonNode = JsonTestUtil.parseAsJsonNode(data);
final String expected =
Resources.toString(
Resources.getResource(GetBlockHeaderTest.class, "getBlockHeader.json"), UTF_8);
assertThat(data).isEqualTo(expected);
final JsonNode expectedAsJsonNode = JsonTestUtil.parseAsJsonNode(expected);
assertThat(responseDataAsJsonNode).isEqualTo(expectedAsJsonNode);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@
import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.io.Resources;
import java.io.IOException;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.ExecutionException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import tech.pegasys.teku.api.migrated.BlockHeadersResponse;
import tech.pegasys.teku.beaconrestapi.AbstractMigratedBeaconHandlerWithChainDataProviderTest;
import tech.pegasys.teku.infrastructure.json.JsonTestUtil;
import tech.pegasys.teku.spec.SpecMilestone;
import tech.pegasys.teku.spec.datastructures.metadata.BlockAndMetaData;

Expand Down Expand Up @@ -69,16 +70,18 @@ void metadata_shouldHandle500() throws JsonProcessingException {
}

@Test
void metadata_shouldHandle200() throws IOException {
void metadata_shouldHandle200() throws Exception {
final List<BlockAndMetaData> headers =
List.of(generateBlockHeaderData(), generateBlockHeaderData());
final BlockHeadersResponse responseData = new BlockHeadersResponse(true, false, headers);

final String data = getResponseStringFromMetadata(handler, SC_OK, responseData);
final JsonNode responseDataAsJsonNode = JsonTestUtil.parseAsJsonNode(data);
final String expected =
Resources.toString(
Resources.getResource(GetBlockHeadersTest.class, "getBlockHeaders.json"), UTF_8);
assertThat(data).isEqualTo(expected);
final JsonNode expectedAsJsonNode = JsonTestUtil.parseAsJsonNode(expected);
assertThat(responseDataAsJsonNode).isEqualTo(expectedAsJsonNode);
}

private BlockAndMetaData generateBlockHeaderData() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@
import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.io.Resources;
import java.io.IOException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import tech.pegasys.teku.beaconrestapi.AbstractMigratedBeaconHandlerWithChainDataProviderTest;
import tech.pegasys.teku.infrastructure.json.JsonTestUtil;
import tech.pegasys.teku.infrastructure.ssz.SszList;
import tech.pegasys.teku.spec.SpecMilestone;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.capella.BeaconBlockBodyCapella;
Expand Down Expand Up @@ -70,18 +71,19 @@ void metadata_shouldHandle501() throws JsonProcessingException {
}

@Test
void metadata_shouldHandle200() throws IOException {
void metadata_shouldHandle200() throws Exception {
final BeaconBlockBodyCapella beaconBlock =
BeaconBlockBodyCapella.required(dataStructureUtil.randomBeaconBlock(1).getBody());
final ObjectAndMetaData<SszList<Withdrawal>> responseData =
withMetaData(beaconBlock.getExecutionPayload().getWithdrawals());

final String data = getResponseStringFromMetadata(handler, SC_OK, responseData);
final JsonNode responseDataAsJsonNode = JsonTestUtil.parseAsJsonNode(data);
final String expected =
Resources.toString(
Resources.getResource(GetExpectedWithdrawalsTest.class, "getExpectedWithdrawals.json"),
UTF_8);
assertThat(data).isEqualTo(expected);
final JsonNode expectedAsJsonNode = JsonTestUtil.parseAsJsonNode(expected);
assertThat(responseDataAsJsonNode).isEqualTo(expectedAsJsonNode);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@
import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.io.Resources;
import java.io.IOException;
import java.util.Optional;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import tech.pegasys.teku.beaconrestapi.AbstractMigratedBeaconHandlerTest;
import tech.pegasys.teku.infrastructure.async.SafeFuture;
import tech.pegasys.teku.infrastructure.json.JsonTestUtil;
import tech.pegasys.teku.spec.SpecMilestone;
import tech.pegasys.teku.spec.datastructures.metadata.StateAndMetaData;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState;
Expand Down Expand Up @@ -78,13 +79,14 @@ void metadata_shouldHandle500() throws JsonProcessingException {
}

@Test
void metadata_shouldHandle200() throws IOException {
BeaconState responseData = dataStructureUtil.randomBeaconState();

void metadata_shouldHandle200() throws Exception {
final BeaconState responseData = dataStructureUtil.randomBeaconState();
final String data = getResponseStringFromMetadata(handler, SC_OK, responseData);
final JsonNode responseDataAsJsonNode = JsonTestUtil.parseAsJsonNode(data);
final String expected =
Resources.toString(Resources.getResource(GetStateTest.class, "getState.json"), UTF_8);
assertThat(data).isEqualTo(String.format(expected, responseData.getGenesisTime()));
final JsonNode expectedAsJsonNode = JsonTestUtil.parseAsJsonNode(expected);
assertThat(responseDataAsJsonNode).isEqualTo(expectedAsJsonNode);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@
import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.io.Resources;
import java.io.IOException;
import java.util.Optional;
import org.apache.tuweni.bytes.Bytes32;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import tech.pegasys.teku.beaconrestapi.AbstractMigratedBeaconHandlerTest;
import tech.pegasys.teku.infrastructure.async.SafeFuture;
import tech.pegasys.teku.infrastructure.json.JsonTestUtil;
import tech.pegasys.teku.infrastructure.unsigned.UInt64;
import tech.pegasys.teku.spec.datastructures.operations.Attestation;

Expand Down Expand Up @@ -76,15 +77,16 @@ void metadata_shouldHandle500() throws JsonProcessingException {
}

@Test
void metadata_shouldHandle200() throws IOException {
Attestation responseData = dataStructureUtil.randomAttestation();

void metadata_shouldHandle200() throws Exception {
final Attestation responseData = dataStructureUtil.randomAttestation();
final String data = getResponseStringFromMetadata(handler, SC_OK, responseData);
final JsonNode responseDataAsJsonNode = JsonTestUtil.parseAsJsonNode(data);
final String expected =
Resources.toString(
Resources.getResource(
GetAggregateAttestationTest.class, "getAggregateAttestation.json"),
UTF_8);
assertThat(data).isEqualTo(expected);
final JsonNode expectedAsJsonNode = JsonTestUtil.parseAsJsonNode(expected);
assertThat(responseDataAsJsonNode).isEqualTo(expectedAsJsonNode);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@
import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.io.Resources;
import java.io.IOException;
import java.util.concurrent.ExecutionException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import tech.pegasys.teku.beaconrestapi.AbstractMigratedBeaconHandlerWithChainDataProviderTest;
import tech.pegasys.teku.infrastructure.json.JsonTestUtil;
import tech.pegasys.teku.spec.SpecMilestone;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
import tech.pegasys.teku.spec.datastructures.metadata.ObjectAndMetaData;
Expand Down Expand Up @@ -75,14 +76,15 @@ void metadata_shouldHandle500() throws JsonProcessingException {
}

@Test
void metadata_shouldHandle200() throws IOException {
void metadata_shouldHandle200() throws Exception {
final SignedBeaconBlock beaconBlock = dataStructureUtil.randomSignedBeaconBlock(1);
final ObjectAndMetaData<SignedBeaconBlock> responseData = withMetaData(beaconBlock);

final String data = getResponseStringFromMetadata(handler, SC_OK, responseData);
final JsonNode responseDataAsJsonNode = JsonTestUtil.parseAsJsonNode(data);
final String expected =
Resources.toString(Resources.getResource(GetBlockTest.class, "getBlock.json"), UTF_8);
assertThat(data).isEqualTo(expected);
final JsonNode expectedAsJsonNode = JsonTestUtil.parseAsJsonNode(expected);
assertThat(responseDataAsJsonNode).isEqualTo(expectedAsJsonNode);
}

@Test
Expand Down
Loading

0 comments on commit ad0ff80

Please sign in to comment.