Expose chain ID in the BlockchainService plugin API (#7702)

Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
pull/7713/head
Gabriel-Trintinalia 2 months ago committed by GitHub
parent fbec990bd2
commit 49bf37cc31
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 9
      besu/src/main/java/org/hyperledger/besu/services/BlockchainServiceImpl.java
  3. 2
      plugin-api/build.gradle
  4. 9
      plugin-api/src/main/java/org/hyperledger/besu/plugin/services/BlockchainService.java

@ -16,6 +16,7 @@
- Add configuration of Consolidation Request Contract Address via genesis configuration [#7647](https://github.com/hyperledger/besu/pull/7647) - Add configuration of Consolidation Request Contract Address via genesis configuration [#7647](https://github.com/hyperledger/besu/pull/7647)
- Interrupt pending transaction processing on block creation timeout [#7673](https://github.com/hyperledger/besu/pull/7673) - Interrupt pending transaction processing on block creation timeout [#7673](https://github.com/hyperledger/besu/pull/7673)
- Align gas cap calculation for transaction simulation to Geth approach [#7703](https://github.com/hyperledger/besu/pull/7703) - Align gas cap calculation for transaction simulation to Geth approach [#7703](https://github.com/hyperledger/besu/pull/7703)
- Expose chainId in the `BlockchainService` [7702](https://github.com/hyperledger/besu/pull/7702)
### Bug fixes ### Bug fixes
- Fix mounted data path directory permissions for besu user [#7575](https://github.com/hyperledger/besu/pull/7575) - Fix mounted data path directory permissions for besu user [#7575](https://github.com/hyperledger/besu/pull/7575)

@ -30,6 +30,7 @@ import org.hyperledger.besu.plugin.data.BlockHeader;
import org.hyperledger.besu.plugin.data.TransactionReceipt; import org.hyperledger.besu.plugin.data.TransactionReceipt;
import org.hyperledger.besu.plugin.services.BlockchainService; import org.hyperledger.besu.plugin.services.BlockchainService;
import java.math.BigInteger;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.function.Supplier; import java.util.function.Supplier;
@ -182,4 +183,12 @@ public class BlockchainServiceImpl implements BlockchainService {
} }
}; };
} }
@Override
public Optional<BigInteger> getChainId() {
if (protocolSchedule == null) {
return Optional.empty();
}
return protocolSchedule.getChainId();
}
} }

@ -71,7 +71,7 @@ Calculated : ${currentHash}
tasks.register('checkAPIChanges', FileStateChecker) { tasks.register('checkAPIChanges', FileStateChecker) {
description = "Checks that the API for the Plugin-API project does not change without deliberate thought" description = "Checks that the API for the Plugin-API project does not change without deliberate thought"
files = sourceSets.main.allJava.files files = sourceSets.main.allJava.files
knownHash = '5H+3gUzCwZtLByfnk11kf+kAPwykQ+WR+n3xWgyfsyY=' knownHash = '4jVaj9yW88nHbX0KmTR3dPQRvj9x8Pvh5E9Ry7KRT6w='
} }
check.dependsOn('checkAPIChanges') check.dependsOn('checkAPIChanges')

@ -22,6 +22,7 @@ import org.hyperledger.besu.plugin.data.BlockContext;
import org.hyperledger.besu.plugin.data.BlockHeader; import org.hyperledger.besu.plugin.data.BlockHeader;
import org.hyperledger.besu.plugin.data.TransactionReceipt; import org.hyperledger.besu.plugin.data.TransactionReceipt;
import java.math.BigInteger;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
@ -106,5 +107,11 @@ public interface BlockchainService extends BesuService {
* @throws UnsupportedOperationException if the network is a PoS network * @throws UnsupportedOperationException if the network is a PoS network
*/ */
void setSafeBlock(Hash blockHash) throws IllegalArgumentException, UnsupportedOperationException; void setSafeBlock(Hash blockHash) throws IllegalArgumentException, UnsupportedOperationException;
;
/**
* Get the chain id
*
* @return the chain id
*/
Optional<BigInteger> getChainId();
} }

Loading…
Cancel
Save