Skip to content

Commit

Permalink
Release 22.7.7 (#4545)
Browse files Browse the repository at this point in the history
* The block variable was keeping too much memory while waiting for future to finish (#4489)

Signed-off-by: Jiri Peinlich <jiri.peinlich@gmail.com>

* Reduce the number of runtime exceptions (SecurityModuleException) (#4508)

* During handshake, flip the encrypted message decryption by starting with the new format (EIP-8), and if there is an exception, try the old format. This will reduce the number of exceptions and unnecessary executions.

Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>

* update CHANGELOG.md to give more context on this PR.

Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>

* update CHANGELOG.md to give more context on this PR.

Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>

* Delete some debug code committed by error

Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>

Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
Signed-off-by: ahamlat <ameziane.hamlat@consensys.net>

* Upgrade Apache Commons Text to 1.10.0 (#4542)

* upgraded Apache Commons Text to fix CVE-2022-42889

Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>

* add changelog

Signed-off-by: garyschulte <garyschulte@gmail.com>

Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>
Signed-off-by: garyschulte <garyschulte@gmail.com>
Co-authored-by: garyschulte <garyschulte@gmail.com>

* Tune EthScheduler thread pools to avoid to recreate too many threads (#4529)

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>

* Make GraphQL scalar parsing compatible with variables (#4522)

Our current GraphQL scalar parsing interacts poorly with the variables
support in the library.  Revise the parsing so it works correctly.

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>

* don't add to bad blocks manager on StorageException (#4524)

* don't add to bad blocks manager on StorageException
* add bugfix to changelog
* adds test coverage

Signed-off-by: Justin Florentine <justin+github@florentine.us>

* CHANGELOG for 22.7.7

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>

* Release 22.7.7

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>

Signed-off-by: Jiri Peinlich <jiri.peinlich@gmail.com>
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
Signed-off-by: ahamlat <ameziane.hamlat@consensys.net>
Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>
Signed-off-by: garyschulte <garyschulte@gmail.com>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
Co-authored-by: Jiri Peinlich <jiri.peinlich@gmail.com>
Co-authored-by: ahamlat <ameziane.hamlat@consensys.net>
Co-authored-by: Daniel Lehrner <daniel.lehrner@consensys.net>
Co-authored-by: garyschulte <garyschulte@gmail.com>
Co-authored-by: Danno Ferrin <danno.ferrin@gmail.com>
Co-authored-by: Justin Florentine <justin+github@florentine.us>
  • Loading branch information
7 people committed Oct 19, 2022
1 parent 0a04381 commit fdb7e91
Show file tree
Hide file tree
Showing 22 changed files with 399 additions and 159 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## 22.7.7

### Additions and Improvements
- Tune EthScheduler thread pools to avoid recreating too many threads [#4529](https://github.com/hyperledger/besu/issues/4529)
- Reduce the number of runtime exceptions (SecurityModuleException) and unnecessary executions during ECIES handshake, by trying to decrypt EIP-8 formatted messages first [#4508](https://github.com/hyperledger/besu/pull/4508).
- The block variable was keeping too much memory while waiting for future to finish [#4489](https://github.com/hyperledger/besu/issues/4489)

### Bug Fixes
- Corrects treating a block as bad on internal error [#4512](https://github.com/hyperledger/besu/issues/4512)
- update appache-commons-text to 1.10.0 to address CVE-2022-42889 [#4542](https://github.com/hyperledger/besu/pull/4542)
- In GraphQL update scalar parsing to be variable friendly [#4522](https://github.com/hyperledger/besu/pull/4522)

### Download Links

## 22.7.6
Hotfix release of the 22.7.x series to address [#4495](https://github.com/hyperledger/besu/issues/4495) which could result in failed block proposals on merge networks.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package org.hyperledger.besu.ethereum.api.graphql.internal;

import org.hyperledger.besu.datatypes.Address;
import org.hyperledger.besu.datatypes.Hash;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.Quantity;

import graphql.language.IntValue;
Expand All @@ -28,156 +27,239 @@
import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32;
import org.apache.tuweni.units.bigints.UInt256;
import org.apache.tuweni.units.bigints.UInt256Value;

public class Scalars {

private static final Coercing<Object, Object> ADDRESS_COERCING =
new Coercing<Object, Object>() {
private Scalars() {}

private static final Coercing<Address, String> ADDRESS_COERCING =
new Coercing<Address, String>() {
Address convertImpl(final Object input) {
if (input instanceof Address) {
return (Address) input;
} else if (input instanceof Bytes) {
if (((Bytes) input).size() <= 20) {
return Address.wrap((Bytes) input);
} else {
return null;
}
} else if (input instanceof StringValue) {
return convertImpl(((StringValue) input).getValue());
} else if (input instanceof String) {
try {
return Address.fromHexStringStrict((String) input);
} catch (IllegalArgumentException iae) {
return null;
}
} else {
return null;
}
}

@Override
public String serialize(final Object input) throws CoercingSerializeException {
if (input instanceof Address) {
return input.toString();
Address result = convertImpl(input);
if (result != null) {
return result.toHexString();
} else {
throw new CoercingSerializeException("Unable to serialize " + input + " as an Address");
}
throw new CoercingSerializeException("Unable to serialize " + input + " as an Address");
}

@Override
public String parseValue(final Object input) throws CoercingParseValueException {
if (input instanceof Address) {
return input.toString();
public Address parseValue(final Object input) throws CoercingParseValueException {
Address result = convertImpl(input);
if (result != null) {
return result;
} else {
throw new CoercingParseValueException(
"Unable to parse variable value " + input + " as an Address");
}
throw new CoercingParseValueException(
"Unable to parse variable value " + input + " as an Address");
}

@Override
public Address parseLiteral(final Object input) throws CoercingParseLiteralException {
if (!(input instanceof StringValue)) {
throw new CoercingParseLiteralException("Value is not any Address : '" + input + "'");
}
String inputValue = ((StringValue) input).getValue();
try {
return Address.fromHexStringStrict(inputValue);
} catch (final IllegalArgumentException e) {
Address result = convertImpl(input);
if (result != null) {
return result;
} else {
throw new CoercingParseLiteralException("Value is not any Address : '" + input + "'");
}
}
};

private static final Coercing<Object, Object> BIG_INT_COERCING =
new Coercing<Object, Object>() {
private static final Coercing<String, String> BIG_INT_COERCING =
new Coercing<String, String>() {

String convertImpl(final Object input) {
if (input instanceof String) {
try {
return Bytes.fromHexStringLenient((String) input).toShortHexString();
} catch (IllegalArgumentException iae) {
return null;
}
} else if (input instanceof Bytes) {
return ((Bytes) input).toShortHexString();
} else if (input instanceof StringValue) {
return convertImpl(((StringValue) input).getValue());
} else if (input instanceof IntValue) {
return UInt256.valueOf(((IntValue) input).getValue()).toShortHexString();
} else {
return null;
}
}

@Override
public String serialize(final Object input) throws CoercingSerializeException {
if (input instanceof UInt256Value) {
return ((UInt256Value) input).toShortHexString();
var result = convertImpl(input);
if (result != null) {
return result;
} else {
throw new CoercingSerializeException("Unable to serialize " + input + " as an BigInt");
}
throw new CoercingSerializeException("Unable to serialize " + input + " as an BigInt");
}

@Override
public String parseValue(final Object input) throws CoercingParseValueException {
if (input instanceof UInt256Value) {
return ((UInt256Value) input).toShortHexString();
var result = convertImpl(input);
if (result != null) {
return result;
} else {
throw new CoercingParseValueException(
"Unable to parse variable value " + input + " as an BigInt");
}
throw new CoercingParseValueException(
"Unable to parse variable value " + input + " as an BigInt");
}

@Override
public UInt256 parseLiteral(final Object input) throws CoercingParseLiteralException {
try {
if (input instanceof StringValue) {
return UInt256.fromHexString(((StringValue) input).getValue());
} else if (input instanceof IntValue) {
return UInt256.valueOf(((IntValue) input).getValue());
}
} catch (final IllegalArgumentException e) {
// fall through
public String parseLiteral(final Object input) throws CoercingParseLiteralException {
var result = convertImpl(input);
if (result != null) {
return result;
} else {
throw new CoercingParseLiteralException("Value is not any BigInt : '" + input + "'");
}
throw new CoercingParseLiteralException("Value is not any BigInt : '" + input + "'");
}
};

private static final Coercing<Object, Object> BYTES_COERCING =
new Coercing<Object, Object>() {
private static final Coercing<Bytes, String> BYTES_COERCING =
new Coercing<Bytes, String>() {

Bytes convertImpl(final Object input) {
if (input instanceof Bytes) {
return (Bytes) input;
} else if (input instanceof StringValue) {
return convertImpl(((StringValue) input).getValue());
} else if (input instanceof String) {
if (!Quantity.isValid((String) input)) {
throw new CoercingParseLiteralException(
"Bytes value '" + input + "' is not prefixed with 0x");
}
try {
return Bytes.fromHexStringLenient((String) input);
} catch (IllegalArgumentException iae) {
return null;
}
} else {
return null;
}
}

@Override
public String serialize(final Object input) throws CoercingSerializeException {
if (input instanceof Bytes) {
return input.toString();
var result = convertImpl(input);
if (result != null) {
return result.toHexString();
} else {
throw new CoercingSerializeException("Unable to serialize " + input + " as an Bytes");
}
throw new CoercingSerializeException("Unable to serialize " + input + " as an Bytes");
}

@Override
public String parseValue(final Object input) throws CoercingParseValueException {
if (input instanceof Bytes) {
return input.toString();
public Bytes parseValue(final Object input) throws CoercingParseValueException {
var result = convertImpl(input);
if (result != null) {
return result;
} else {
throw new CoercingParseValueException(
"Unable to parse variable value " + input + " as an Bytes");
}
throw new CoercingParseValueException(
"Unable to parse variable value " + input + " as an Bytes");
}

@Override
public Bytes parseLiteral(final Object input) throws CoercingParseLiteralException {
if (!(input instanceof StringValue)) {
throw new CoercingParseLiteralException("Value is not any Bytes : '" + input + "'");
}
String inputValue = ((StringValue) input).getValue();
if (!Quantity.isValid(inputValue)) {
throw new CoercingParseLiteralException(
"Bytes value '" + inputValue + "' is not prefixed with 0x");
}
try {
return Bytes.fromHexStringLenient(inputValue);
} catch (final IllegalArgumentException e) {
var result = convertImpl(input);
if (result != null) {
return result;
} else {
throw new CoercingParseLiteralException("Value is not any Bytes : '" + input + "'");
}
}
};

private static final Coercing<Object, Object> BYTES32_COERCING =
new Coercing<Object, Object>() {
private static final Coercing<Bytes32, String> BYTES32_COERCING =
new Coercing<Bytes32, String>() {

Bytes32 convertImpl(final Object input) {
if (input instanceof Bytes32) {
return (Bytes32) input;
} else if (input instanceof Bytes) {
if (((Bytes) input).size() <= 32) {
return Bytes32.leftPad((Bytes) input);
} else {
return null;
}
} else if (input instanceof StringValue) {
return convertImpl((((StringValue) input).getValue()));
} else if (input instanceof String) {
if (!Quantity.isValid((String) input)) {
throw new CoercingParseLiteralException(
"Bytes32 value '" + input + "' is not prefixed with 0x");
} else {
try {
return Bytes32.fromHexStringLenient((String) input);
} catch (IllegalArgumentException iae) {
return null;
}
}
} else {
return null;
}
}

@Override
public String serialize(final Object input) throws CoercingSerializeException {
if (input instanceof Hash) {
return ((Hash) input).toString();
}
if (input instanceof Bytes32) {
return input.toString();
var result = convertImpl(input);
if (result == null) {
throw new CoercingSerializeException("Unable to serialize " + input + " as an Bytes32");
} else {
return result.toHexString();
}
throw new CoercingSerializeException("Unable to serialize " + input + " as an Bytes32");
}

@Override
public String parseValue(final Object input) throws CoercingParseValueException {
if (input instanceof Bytes32) {
return input.toString();
public Bytes32 parseValue(final Object input) throws CoercingParseValueException {
var result = convertImpl(input);
if (result == null) {
throw new CoercingParseValueException(
"Unable to parse variable value " + input + " as an Bytes32");
} else {
return result;
}
throw new CoercingParseValueException(
"Unable to parse variable value " + input + " as an Bytes32");
}

@Override
public Bytes32 parseLiteral(final Object input) throws CoercingParseLiteralException {
if (!(input instanceof StringValue)) {
throw new CoercingParseLiteralException("Value is not any Bytes32 : '" + input + "'");
}
String inputValue = ((StringValue) input).getValue();
if (!Quantity.isValid(inputValue)) {
throw new CoercingParseLiteralException(
"Bytes32 value '" + inputValue + "' is not prefixed with 0x");
}
try {
return Bytes32.fromHexStringLenient(inputValue);
} catch (final IllegalArgumentException e) {
var result = convertImpl(input);
if (result == null) {
throw new CoercingParseLiteralException("Value is not any Bytes32 : '" + input + "'");
} else {
return result;
}
}
};

private static final Coercing<Object, Object> LONG_COERCING =
new Coercing<Object, Object>() {
private static final Coercing<Number, Number> LONG_COERCING =
new Coercing<Number, Number>() {
@Override
public Number serialize(final Object input) throws CoercingSerializeException {
if (input instanceof Number) {
Expand Down Expand Up @@ -210,7 +292,7 @@ public Number parseValue(final Object input) throws CoercingParseValueException
}

@Override
public Object parseLiteral(final Object input) throws CoercingParseLiteralException {
public Number parseLiteral(final Object input) throws CoercingParseLiteralException {
try {
if (input instanceof IntValue) {
return ((IntValue) input).getValue().longValue();
Expand Down

0 comments on commit fdb7e91

Please sign in to comment.