Skip to content

Commit

Permalink
adopts pr suggestions
Browse files Browse the repository at this point in the history
Signed-off-by: Justin Florentine <justin+github@florentine.us>
  • Loading branch information
jflo committed Jun 21, 2023
1 parent a7ee538 commit ec9c2ce
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import org.hyperledger.besu.ethereum.core.blobs.KZGCommitment;
import org.hyperledger.besu.ethereum.core.blobs.KZGProof;
import org.hyperledger.besu.ethereum.core.blobs.VersionedHash;
import org.hyperledger.besu.ethereum.core.encoding.BlobTransactionDecoder;
import org.hyperledger.besu.ethereum.core.encoding.BlobTransactionEncoder;
import org.hyperledger.besu.ethereum.core.encoding.TransactionDecoder;
import org.hyperledger.besu.ethereum.core.encoding.TransactionEncoder;
import org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput;
Expand Down Expand Up @@ -1017,7 +1017,7 @@ private static Bytes blobPreimage(
accessList,
rlpOutput);
rlpOutput.writeUInt256Scalar(maxFeePerDataGas);
BlobTransactionDecoder.writeBlobVersionedHashes(rlpOutput, versionedHashes);
BlobTransactionEncoder.writeBlobVersionedHashes(rlpOutput, versionedHashes);
rlpOutput.endList();
});
return Bytes.concatenate(Bytes.of(TransactionType.BLOB.getSerializedType()), encoded);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.hyperledger.besu.ethereum.core.blobs.KZGProof;
import org.hyperledger.besu.ethereum.core.blobs.VersionedHash;
import org.hyperledger.besu.ethereum.rlp.RLPInput;
import org.hyperledger.besu.ethereum.rlp.RLPOutput;
import org.hyperledger.besu.evm.AccessListEntry;
import org.hyperledger.besu.plugin.data.TransactionType;

Expand Down Expand Up @@ -106,9 +105,4 @@ private static Transaction readNetworkWrapperInner(final RLPInput input) {
builder.kzgBlobs(commitments, blobs, proofs);
return builder.build();
}

public static void writeBlobVersionedHashes(
final RLPOutput rlpOutput, final List<VersionedHash> versionedHashes) {
rlpOutput.writeList(versionedHashes, (h, out) -> out.writeBytes(h.toBytes()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@
import org.hyperledger.besu.ethereum.core.blobs.Blob;
import org.hyperledger.besu.ethereum.core.blobs.KZGCommitment;
import org.hyperledger.besu.ethereum.core.blobs.KZGProof;
import org.hyperledger.besu.ethereum.core.blobs.VersionedHash;
import org.hyperledger.besu.ethereum.rlp.RLP;
import org.hyperledger.besu.ethereum.rlp.RLPOutput;

import java.util.List;

import org.apache.tuweni.bytes.Bytes;
import org.slf4j.Logger;

Expand Down Expand Up @@ -76,4 +79,9 @@ private static Bytes encodeOpaqueBytesNetwork(final Transaction transaction) {
Bytes.of(transaction.getType().getSerializedType()),
RLP.encode(rlpOutput -> encodeEIP4844Network(transaction, rlpOutput)));
}

public static void writeBlobVersionedHashes(
final RLPOutput rlpOutput, final List<VersionedHash> versionedHashes) {
rlpOutput.writeList(versionedHashes, (h, out) -> out.writeBytes(h.toBytes()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@

public class TransactionDecoder {

// private static final UInt32 BLOB_TRANSACTION_OFFSET = UInt32.fromHexString("0x3c000000");

// private static final Logger LOG = getLogger(TransactionDecoder.class);

@FunctionalInterface
interface Decoder {
Transaction decode(RLPInput input);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ static TransactionPriceCalculator eip1559() {
};
}

// curiously named as in the spec
// https://eips.ethereum.org/EIPS/eip-4844#cryptographic-helpers
private static BigInteger fakeExponential(
final BigInteger factor, final BigInteger numerator, final BigInteger denominator) {
int i = 1;
Expand Down
20 changes: 20 additions & 0 deletions gradle/check-licenses.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -193,4 +193,24 @@ task lazyDownloadLicenses() {
task checkLicenses {
description "Verify that all dependencies use accepted licenses."
dependsOn ':lazyDownloadLicenses'

def bads = ""
doLast {
def xml = new XmlParser().parse("${rootProject.buildDir}/reports/license/license-dependency.xml")
xml.each { license ->
if (!acceptedLicenses.contains((license.@name).toLowerCase())) {
def depStrings = []
license.dependency.each { depStrings << it.text() }
bads = bads + depStrings + " => ${license.@name} \n"
}
}
if (bads != "") {
throw new GradleException("Some 3rd parties are using licenses not in our accepted licenses list:\n" +
bads +
"If it's a license acceptable for us, add it in the file check-licenses.gradle\n" +
"Be careful, some 3rd parties may accept multiple licenses.\n" +
"In this case, select the one you want to use by changing downloadLicenses.licenses\n"
)
}
}
}

0 comments on commit ec9c2ce

Please sign in to comment.