Skip to content

Commit

Permalink
Add txBatchSize to location config.
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephen Cirner committed Aug 31, 2021
1 parent 00a708a commit 8937edc
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ p8e {
chainId: System.getenv('CHAIN_ID'),
encryptionPrivateKey: System.getenv('ENCRYPTION_PRIVATE_KEY'),
signingPrivateKey: System.getenv('SIGNING_PRIVATE_KEY'),
txBatchSize: "10",
audience: [
local1: new io.provenance.p8e.plugin.P8ePartyExtension(
Expand Down
1 change: 1 addition & 0 deletions example-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ p8e {
encryptionPrivateKey: System.getenv('ENCRYPTION_PRIVATE_KEY'),
signingPrivateKey: System.getenv('SIGNING_PRIVATE_KEY'),
chainId: System.getenv('CHAIN_ID'),
txBatchSize: "10",

audience: [
local1: new io.provenance.p8e.plugin.P8ePartyExtension(
Expand Down
1 change: 1 addition & 0 deletions example-kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ p8e {
encryptionPrivateKey: System.getenv('ENCRYPTION_PRIVATE_KEY'),
signingPrivateKey: System.getenv('SIGNING_PRIVATE_KEY'),
chainId: System.getenv('CHAIN_ID'),
txBatchSize: "10",

audience: [
local1: new io.provenance.p8e.plugin.P8ePartyExtension(
Expand Down
10 changes: 9 additions & 1 deletion src/main/kotlin/io/provenance/p8e/plugin/Bootstrapper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,14 @@ internal class Bootstrapper(
require(!location.osUrl.isNullOrBlank()) { "object-store url is required for location $name" }
require(!location.provenanceUrl.isNullOrBlank()) { "provenance url is required for location $name" }
require(!location.chainId.isNullOrBlank()) { "chainId is required for location $name" }
require(!location.txBatchSize.isNullOrBlank()) { "txBatchSize is required for location $name" }

try {
location.txBatchSize!!.toInt()
} catch (e: Exception) {
throw IllegalStateException("txBatchSize must be a valid int32 for location $name")

}
}

// TODO: add additional validation checks that configuration is good enough to publish
Expand Down Expand Up @@ -389,7 +397,7 @@ internal class Bootstrapper(
val serviceClient = ServiceGrpc.newBlockingStub(provenanceChannel)
val authClient = cosmos.auth.v1beta1.QueryGrpc.newBlockingStub(provenanceChannel)

tx.chunked(25).forEach { batch ->
tx.chunked(location.txBatchSize!!.toInt()).forEach { batch ->
project.logger.debug("tx batch: $batch")

val txBody = batch.toTxBody()
Expand Down
1 change: 1 addition & 0 deletions src/main/kotlin/io/provenance/p8e/plugin/Dsl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ open class P8eLocationExtension {
var audience: Map<String, P8ePartyExtension> = emptyMap()
var chainId: String? = ""
var mainNet: Boolean = chainId == "pio-mainnet-1"
var txBatchSize: String? = ""
}

open class P8eExtension {
Expand Down

0 comments on commit 8937edc

Please sign in to comment.