Update to production KZG ceremony output (#6066)

* updates static integration test so txs are committed to using mainnet trusted setup
* new static vectors for precompile checks
* moves trusted setup to main

---------

Signed-off-by: Justin Florentine <justin+github@florentine.us>
pull/6172/head
Justin Florentine 1 year ago committed by GitHub
parent 817cbf7853
commit 7743627b37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/jsonrpc/ExecutionEngineCancunBlockBuildingAcceptanceTest.java
  2. 17
      acceptance-tests/tests/src/test/resources/jsonrpc/engine/cancun/test-cases/block-production/01_cancun_send_blob_tx.json
  3. 45
      acceptance-tests/tests/src/test/resources/jsonrpc/engine/cancun/test-cases/block-production/02_cancun_get_blob_tx.json
  4. 15
      acceptance-tests/tests/src/test/resources/jsonrpc/engine/cancun/test-cases/block-production/03_cancun_send_blob_tx.json
  5. 15
      acceptance-tests/tests/src/test/resources/jsonrpc/engine/cancun/test-cases/block-production/04_cancun_send_blob_tx.json
  6. 15
      acceptance-tests/tests/src/test/resources/jsonrpc/engine/cancun/test-cases/block-production/05_cancun_send_blob_tx.json
  7. 15
      acceptance-tests/tests/src/test/resources/jsonrpc/engine/cancun/test-cases/block-production/06_cancun_send_blob_tx.json
  8. 15
      acceptance-tests/tests/src/test/resources/jsonrpc/engine/cancun/test-cases/block-production/07_cancun_send_blob_tx.json
  9. 15
      acceptance-tests/tests/src/test/resources/jsonrpc/engine/cancun/test-cases/block-production/08_cancun_send_blob_tx.json
  10. 94
      acceptance-tests/tests/src/test/resources/jsonrpc/engine/cancun/test-cases/block-production/10_cancun_build_on_genesis.json
  11. 115
      acceptance-tests/tests/src/test/resources/jsonrpc/engine/cancun/test-cases/block-production/12_cancun_get_built_block.json
  12. 8320
      config/src/main/resources/kzg-trusted-setups/mainnet.txt
  13. 2
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcErrorConverter.java
  14. 4
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/response/RpcErrorType.java
  15. 2
      ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/BlobTestFixture.java
  16. 3
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPool.java
  17. 16
      evm/src/main/java/org/hyperledger/besu/evm/precompile/KZGPointEvalPrecompiledContract.java
  18. 4163
      evm/src/main/resources/kzg-trusted-setups/mainnet.txt
  19. 2
      evm/src/test/java/org/hyperledger/besu/evm/precompile/KZGPointEvalPrecompileContractTest.java
  20. 8
      evm/src/test/resources/org/hyperledger/besu/evm/precompile/pointEvaluationPrecompile.json
  21. 14
      gradle/verification-metadata.xml
  22. 2
      gradle/versions.gradle

@ -83,10 +83,10 @@ public class ExecutionEngineCancunBlockBuildingAcceptanceTest extends AbstractJs
assertThat(blobsBundle.get("blobs").getNodeType()).isEqualTo(JsonNodeType.ARRAY); assertThat(blobsBundle.get("blobs").getNodeType()).isEqualTo(JsonNodeType.ARRAY);
final ArrayNode blobs = (ArrayNode) blobsBundle.get("blobs"); final ArrayNode blobs = (ArrayNode) blobsBundle.get("blobs");
final ArrayNode proofs = (ArrayNode) blobsBundle.get("proofs"); final ArrayNode proofs = (ArrayNode) blobsBundle.get("proofs");
assertThat(2).isEqualTo(transactions.size()); assertThat(3).isEqualTo(transactions.size());
assertThat(6).isEqualTo(commitments.size()); assertThat(3).isEqualTo(commitments.size());
assertThat(6).isEqualTo(blobs.size()); assertThat(3).isEqualTo(blobs.size());
assertThat(6).isEqualTo(proofs.size()); assertThat(3).isEqualTo(proofs.size());
} }
} }

@ -1,95 +1,5 @@
{ {
"request": { "request" : {"jsonrpc":"2.0","id":5,"method":"engine_forkchoiceUpdatedV3","params":[{"headBlockHash":"0x33235e7b7a78302cdb54e5ddba66c7ae49b01c1f5498bb00cd0c8ed5206784bf","safeBlockHash":"0x0000000000000000000000000000000000000000000000000000000000000000","finalizedBlockHash":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"timestamp":"0x1236","prevRandao":"0xc13da06dc53836ca0766057413b9683eb9a8773bbb8fcc5691e41c25b56dda1d","suggestedFeeRecipient":"0x0000000000000000000000000000000000000000","withdrawals":[{"index":"0xb","validatorIndex":"0x0","address":"0x0000000000000000000000000000000000000000","amount":"0x64"},{"index":"0xc","validatorIndex":"0x1","address":"0x0100000000000000000000000000000000000000","amount":"0x64"},{"index":"0xd","validatorIndex":"0x2","address":"0x0200000000000000000000000000000000000000","amount":"0x64"},{"index":"0xe","validatorIndex":"0x3","address":"0x0300000000000000000000000000000000000000","amount":"0x64"},{"index":"0xf","validatorIndex":"0x4","address":"0x0400000000000000000000000000000000000000","amount":"0x64"},{"index":"0x10","validatorIndex":"0x5","address":"0x0500000000000000000000000000000000000000","amount":"0x64"},{"index":"0x11","validatorIndex":"0x6","address":"0x0600000000000000000000000000000000000000","amount":"0x64"},{"index":"0x12","validatorIndex":"0x7","address":"0x0700000000000000000000000000000000000000","amount":"0x64"},{"index":"0x13","validatorIndex":"0x8","address":"0x0800000000000000000000000000000000000000","amount":"0x64"},{"index":"0x14","validatorIndex":"0x9","address":"0x0900000000000000000000000000000000000000","amount":"0x64"}],"parentBeaconBlockRoot":"0x062367f0b23e2d49ad5e770d9ad17b83c0c1c625c3f9a290cd9572b3fc6cfc9e"}]},
"jsonrpc": "2.0", "response" : {"jsonrpc":"2.0","id":5,"result":{"payloadStatus":{"status":"VALID","latestValidHash":"0x33235e7b7a78302cdb54e5ddba66c7ae49b01c1f5498bb00cd0c8ed5206784bf","validationError":null},"payloadId":"0x29e12df730769ab6"}},
"id": 1,
"method": "engine_forkchoiceUpdatedV3",
"params": [
{
"headBlockHash": "0x33235e7b7a78302cdb54e5ddba66c7ae49b01c1f5498bb00cd0c8ed5206784bf",
"safeBlockHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"finalizedBlockHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
},
{
"timestamp": "0x1235",
"prevRandao": "0x31a3b9b03c64172b39b7fa7d35d86eaa0f9cbac30e2abbf9895a32b80ae1cd76",
"suggestedFeeRecipient": "0x0000000000000000000000000000000000000000",
"withdrawals": [
{
"index": "0x1",
"validatorIndex": "0x0",
"address": "0x0000000000000000000000000000000000000000",
"amount": "0x64"
},
{
"index": "0x2",
"validatorIndex": "0x1",
"address": "0x0100000000000000000000000000000000000000",
"amount": "0x64"
},
{
"index": "0x3",
"validatorIndex": "0x2",
"address": "0x0200000000000000000000000000000000000000",
"amount": "0x64"
},
{
"index": "0x4",
"validatorIndex": "0x3",
"address": "0x0300000000000000000000000000000000000000",
"amount": "0x64"
},
{
"index": "0x5",
"validatorIndex": "0x4",
"address": "0x0400000000000000000000000000000000000000",
"amount": "0x64"
},
{
"index": "0x6",
"validatorIndex": "0x5",
"address": "0x0500000000000000000000000000000000000000",
"amount": "0x64"
},
{
"index": "0x7",
"validatorIndex": "0x6",
"address": "0x0600000000000000000000000000000000000000",
"amount": "0x64"
},
{
"index": "0x8",
"validatorIndex": "0x7",
"address": "0x0700000000000000000000000000000000000000",
"amount": "0x64"
},
{
"index": "0x9",
"validatorIndex": "0x8",
"address": "0x0800000000000000000000000000000000000000",
"amount": "0x64"
},
{
"index": "0xa",
"validatorIndex": "0x9",
"address": "0x0900000000000000000000000000000000000000",
"amount": "0x64"
}
],
"parentBeaconBlockRoot": "0x169630f535b4a41330164c6e5c92b1224c0c407f582d407d0ac3d206cd32fd52"
}
]
},
"response": {
"jsonrpc": "2.0",
"id": 1,
"result": {
"payloadStatus": {
"status": "VALID",
"latestValidHash": "0x33235e7b7a78302cdb54e5ddba66c7ae49b01c1f5498bb00cd0c8ed5206784bf",
"validationError": null
},
"payloadId": "0x78d3b312ed5adeb5"
}
},
"statusCode" : 200 "statusCode" : 200
} }

File diff suppressed because it is too large Load Diff

@ -77,6 +77,8 @@ public class JsonRpcErrorConverter {
return RpcErrorType.TX_POOL_DISABLED; return RpcErrorType.TX_POOL_DISABLED;
case PLUGIN_TX_VALIDATOR: case PLUGIN_TX_VALIDATOR:
return RpcErrorType.PLUGIN_TX_VALIDATOR; return RpcErrorType.PLUGIN_TX_VALIDATOR;
case INVALID_BLOBS:
return RpcErrorType.INVALID_BLOBS;
default: default:
return RpcErrorType.INTERNAL_ERROR; return RpcErrorType.INTERNAL_ERROR;
} }

@ -213,7 +213,9 @@ public enum RpcErrorType {
BLOCK_RLP_IMPORT_ERROR(-32000, "Could not decode RLP for Block"), BLOCK_RLP_IMPORT_ERROR(-32000, "Could not decode RLP for Block"),
BLOCK_IMPORT_ERROR(-32000, "Could not import Block"), BLOCK_IMPORT_ERROR(-32000, "Could not import Block"),
UNKNOWN(-32603, "Unknown internal error"); UNKNOWN(-32603, "Unknown internal error"),
INVALID_BLOBS(-32603, "blobs failed kzg validation");
private final int code; private final int code;
private final String message; private final String message;

@ -45,7 +45,7 @@ public class BlobTestFixture {
// and ignore errors in case no trusted setup was already loaded // and ignore errors in case no trusted setup was already loaded
} }
try { try {
CKZG4844JNI.loadNativeLibrary(CKZG4844JNI.Preset.MAINNET); CKZG4844JNI.loadNativeLibrary();
CKZG4844JNI.loadTrustedSetupFromResource( CKZG4844JNI.loadTrustedSetupFromResource(
"/kzg-trusted-setups/mainnet.txt", BlobTestFixture.class); "/kzg-trusted-setups/mainnet.txt", BlobTestFixture.class);

@ -271,9 +271,10 @@ public class TransactionPool implements BlockAddedObserver {
} }
} else { } else {
LOG.atTrace() LOG.atTrace()
.setMessage("Discard invalid transaction {}, reason {}") .setMessage("Discard invalid transaction {}, reason {}, because {}")
.addArgument(transaction::toTraceLog) .addArgument(transaction::toTraceLog)
.addArgument(validationResult.result::getInvalidReason) .addArgument(validationResult.result::getInvalidReason)
.addArgument(validationResult.result::getErrorMessage)
.log(); .log();
metrics.incrementRejected( metrics.incrementRejected(
isLocal, hasPriority, validationResult.result.getInvalidReason(), "txpool"); isLocal, hasPriority, validationResult.result.getInvalidReason(), "txpool");

@ -28,17 +28,21 @@ import ethereum.ckzg4844.CKZG4844JNI;
import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32; import org.apache.tuweni.bytes.Bytes32;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** The KZGPointEval precompile contract. */ /** The KZGPointEval precompile contract. */
public class KZGPointEvalPrecompiledContract implements PrecompiledContract { public class KZGPointEvalPrecompiledContract implements PrecompiledContract {
private static final AtomicBoolean loaded = new AtomicBoolean(false); private static final AtomicBoolean loaded = new AtomicBoolean(false);
private static final Logger LOG = LoggerFactory.getLogger(KZGPointEvalPrecompiledContract.class);
private static Bytes successResult; private static Bytes successResult;
private static void init() { private static void init() {
CKZG4844JNI.loadNativeLibrary(CKZG4844JNI.Preset.MAINNET); CKZG4844JNI.loadNativeLibrary();
Bytes fieldElementsPerBlob = Bytes fieldElementsPerBlob =
Bytes32.wrap(Words.intBytes(CKZG4844JNI.getFieldElementsPerBlob()).xor(Bytes32.ZERO)); Bytes32.wrap(Words.intBytes(CKZG4844JNI.FIELD_ELEMENTS_PER_BLOB).xor(Bytes32.ZERO));
Bytes blsModulus = Bytes blsModulus =
Bytes32.wrap(Bytes.of(CKZG4844JNI.BLS_MODULUS.toByteArray()).xor(Bytes32.ZERO)); Bytes32.wrap(Bytes.of(CKZG4844JNI.BLS_MODULUS.toByteArray()).xor(Bytes32.ZERO));
@ -54,7 +58,9 @@ public class KZGPointEvalPrecompiledContract implements PrecompiledContract {
public static void init(final Path trustedSetupFile) { public static void init(final Path trustedSetupFile) {
if (loaded.compareAndSet(false, true)) { if (loaded.compareAndSet(false, true)) {
init(); init();
CKZG4844JNI.loadTrustedSetup(trustedSetupFile.toAbsolutePath().toString()); final String trustedSetupResourceName = trustedSetupFile.toAbsolutePath().toString();
LOG.info("Loading trusted setup from user-specified resource {}", trustedSetupResourceName);
CKZG4844JNI.loadTrustedSetup(trustedSetupResourceName);
} else { } else {
throw new IllegalStateException("KZG trusted setup was already loaded"); throw new IllegalStateException("KZG trusted setup was already loaded");
} }
@ -64,7 +70,7 @@ public class KZGPointEvalPrecompiledContract implements PrecompiledContract {
* Init the C-KZG native lib using a resource identified by the passed network name as trusted * Init the C-KZG native lib using a resource identified by the passed network name as trusted
* setup * setup
* *
* @param networkName used to select the resource that contains the trusted setup * @param networkName used to select the resource in /kzg-trusted-setups/ to use.
* @throws IllegalStateException is the trusted setup was already loaded * @throws IllegalStateException is the trusted setup was already loaded
*/ */
public static void init(final String networkName) { public static void init(final String networkName) {
@ -72,6 +78,8 @@ public class KZGPointEvalPrecompiledContract implements PrecompiledContract {
init(); init();
final String trustedSetupResourceName = final String trustedSetupResourceName =
"/kzg-trusted-setups/" + networkName.toLowerCase() + ".txt"; "/kzg-trusted-setups/" + networkName.toLowerCase() + ".txt";
LOG.info(
"Loading network trusted setup from classpath resource {}", trustedSetupResourceName);
CKZG4844JNI.loadTrustedSetupFromResource( CKZG4844JNI.loadTrustedSetupFromResource(
trustedSetupResourceName, KZGPointEvalPrecompiledContract.class); trustedSetupResourceName, KZGPointEvalPrecompiledContract.class);
} else { } else {

File diff suppressed because it is too large Load Diff

@ -44,7 +44,7 @@ public class KZGPointEvalPrecompileContractTest {
@BeforeAll @BeforeAll
public static void init() { public static void init() {
KZGPointEvalPrecompiledContract.init("foo"); KZGPointEvalPrecompiledContract.init("mainnet");
contract = new KZGPointEvalPrecompiledContract(); contract = new KZGPointEvalPrecompiledContract();
} }

@ -2,22 +2,22 @@
"PrecompileReturnValue": "000000000000000000000000000000000000000000000000000000000000100073eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001", "PrecompileReturnValue": "000000000000000000000000000000000000000000000000000000000000100073eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001",
"TestCases": [ "TestCases": [
{ {
"Input": "012801238108394529333e45adfaff59edde33727fa766ee99752921b472893600000000000000000000000000000000000000000000000000000000000020010f69060fb771fa559a9e842e1dd79dde8a107486e801707032d93b5965d0cd48abb6bcbe313530ce7779abdf633d5a3594a41fbad9a79f4a9b46b89c0cfe78f6a15948dec92c4404aedac8b5e7dd60598ad6f539bc7280de6af4c95e7cef39bb6873f18c46ee5eb67299324ee7c6e6da71be2dbd5e2cbafbae4b2d60b40a808c", "Input": "010657f37554c781402a22917dee2f75def7ab966d7b770905398eba3c444014623ce31cf9759a5c8daf3a357992f9f3dd7f9339d8998bc8e68373e54f00b75e0000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"FailureMode": "", "FailureMode": "",
"Valid": true "Valid": true
}, },
{ {
"Input": "012801238108394569333e45adfaff59edde33727fa766ee99752921b472893600000000000000000000000000000000000000000000000000000000000020010f69060fb771fa559a9e842e1dd79dde8a107486e801707032d93b5965d0cd48abb6bcbe313530ce7779abdf633d5a3594a41fbad9a79f4a9b46b89c0cfe78f6a15948dec92c4404aedac8b5e7dd60598ad6f539bc7280de6af4c95e7cef39bb6873f18c46ee5eb67299324ee7c6e6da71be2dbd5e2cbafbae4b2d60b40a808c", "Input": "010657f37554c781402a22917bee2f75def7ab966d7b770905398eba3c444014623ce31cf9759a5c8daf3a357992f9f3dd7f9339d8998bc8e68373e54f00b75e0000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"FailureMode": "busted versioned hash", "FailureMode": "busted versioned hash",
"Valid": false "Valid": false
}, },
{ {
"Input": "012801238108394529333e45adfaff59edde33727fa766ee99752921b472893600000000000000000000000000000000000000000000000000000000000020010f69060fb771fa559a9e842e1dd79dde8a107486e801707032d93b5965d0cd48abb6bcbe313370ce7779abdf633d5a3594a41fbad9a79f4a9b46b89c0cfe78f6a15948dec92c4404aedac8b5e7dd60598ad6f539bc7280de6af4c95e7cef39bb6873f18c46ee5eb67299324ee7c6e6da71be2dbd5e2cbafbae4b2d60b40a808c", "Input": "010657f37554c781402a22917dee2f75def7ab966d7b770905398eba3c444014623ce31cf9759a5c8daf3a357992f9f3dd7f9339d8998bc8e68373e54f00b75e0000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"FailureMode": "busted commitment", "FailureMode": "busted commitment",
"Valid": false "Valid": false
}, },
{ {
"Input": "012801238108394529333e45adfaff59edde33727fa766ee99752921b472893600000000000000000000000000000000000000000000000000000000000020010f69060fb771fa559a9e842e1dd79dde8a107486e801707032d93b5965d0cd48abb6bcbe313530ce7779abdf633d5a3594a41fbad9a79f4a9b46b89c0cfe78f6a15948dec92c4404aedac8b5e7dd60598ad6f539bc7280de6af4c95e7cef39bb6873f18c46ee5eb67299324ee7c6e6da71be2dbd5e2cafebabeb2d60b40a808c", "Input": "010657f37554c781402a22917dee2f75def7ab966d7b770905398eba3c444014623ce31cf9759a5c8daf3a357992f9f3dd7f9339d8998bc8e68373e54f00b75e0000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000",
"FailureMode": "busted proof", "FailureMode": "busted proof",
"Valid": false "Valid": false
} }

@ -5480,15 +5480,15 @@
<sha256 value="43c761f92b549c8b08fb992080253e49f0a983e544ef0663c1f4f9d68eb52616" origin="Generated by Gradle"/> <sha256 value="43c761f92b549c8b08fb992080253e49f0a983e544ef0663c1f4f9d68eb52616" origin="Generated by Gradle"/>
</artifact> </artifact>
</component> </component>
<component group="tech.pegasys" name="jc-kzg-4844" version="0.7.0"> <component group="tech.pegasys" name="jc-kzg-4844" version="0.8.0">
<artifact name="jc-kzg-4844-0.7.0.jar"> <artifact name="jc-kzg-4844-0.8.0.jar">
<sha256 value="c909ba51d12d1c686eb77b60bf403db826d5f94051516f8c9566def9faefd90b" origin="Generated by Gradle"/> <sha256 value="dc52dcca22772671825a081d9819d774753dfc8d2fe751e8ba75506649cc4793" origin="Generated by Gradle"/>
</artifact> </artifact>
<artifact name="jc-kzg-4844-0.7.0.module"> <artifact name="jc-kzg-4844-0.8.0.module">
<sha256 value="55802e5e957861b5bc4b92f55cbf46bb160cd2599a2051a1ab9d8f408192341b" origin="Generated by Gradle"/> <sha256 value="1f3ff9df2825c47611e9dd3c4090c0a8223c547a53e6210b2157c78442fd3a3b" origin="Generated by Gradle"/>
</artifact> </artifact>
<artifact name="jc-kzg-4844-0.7.0.pom"> <artifact name="jc-kzg-4844-0.8.0.pom">
<sha256 value="ed2dbfb82d035907f68c6448b1a959aa121b04c15650f10f3de0a891af519cc0" origin="Generated by Gradle"/> <sha256 value="0eabc50a504a10b49e6965523e91943d3cbceb0f70cde5962f4a215dcc198f32" origin="Generated by Gradle"/>
</artifact> </artifact>
</component> </component>
<component group="tech.pegasys.discovery" name="discovery" version="22.2.0"> <component group="tech.pegasys.discovery" name="discovery" version="22.2.0">

@ -158,7 +158,7 @@ dependencyManagement {
dependency 'org.fusesource.jansi:jansi:2.4.0' dependency 'org.fusesource.jansi:jansi:2.4.0'
dependency 'org.openjdk.jol:jol-core:0.17' dependency 'org.openjdk.jol:jol-core:0.17'
dependency 'tech.pegasys:jc-kzg-4844:0.7.0' dependency 'tech.pegasys:jc-kzg-4844:0.8.0'
dependencySet(group: 'org.hyperledger.besu', version: '0.8.2') { dependencySet(group: 'org.hyperledger.besu', version: '0.8.2') {
entry 'arithmetic' entry 'arithmetic'

Loading…
Cancel
Save