diff --git a/example/src/main/kotlin/CreateAndOnboardScope.kt b/example/src/main/kotlin/CreateAndOnboardScope.kt index 32280a8..e18f601 100644 --- a/example/src/main/kotlin/CreateAndOnboardScope.kt +++ b/example/src/main/kotlin/CreateAndOnboardScope.kt @@ -89,7 +89,7 @@ fun Message.toAny() = Any.pack(this, "") fun main() { val client = PbClient("pio-testnet-1", URI("grpcs://grpc.test.provenance.io:443"), GasEstimationMethod.MSG_FEE_CALCULATION) - val osClient = CachedOsClient(OsClient(URI("grpc://localhost:5005"), 30_000), 1, 1, 0) + val osClient = CachedOsClient(OsClient(URI("grpc://localhost:5005"), 30_000), 1, 1, 1, 1) val scopeUuid = UUID.randomUUID() val scopeAddress = MetadataAddress.forScope(scopeUuid).toString() diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d20d8ef..f410ba2 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -24,8 +24,8 @@ protobuf = "3.23.2" provenance-blockapi = "0.2.1" provenance-client = "1.3.0" provenance-hdwallet = "0.1.15" -provenance-proto = "1.13.0" -provenance-scope = "0.4.9" +provenance-proto = "1.17.0" +provenance-scope = "0.7.0" scarlet = "0.1.12" springboot = "3.1.1" sqlite = "3.42.0.0" diff --git a/server/src/main/kotlin/tech/figure/objectstore/gateway/configuration/AppConfig.kt b/server/src/main/kotlin/tech/figure/objectstore/gateway/configuration/AppConfig.kt index e5dc973..2c4f7e9 100644 --- a/server/src/main/kotlin/tech/figure/objectstore/gateway/configuration/AppConfig.kt +++ b/server/src/main/kotlin/tech/figure/objectstore/gateway/configuration/AppConfig.kt @@ -19,7 +19,7 @@ class AppConfig { fun objectStoreClient(objectStoreProperties: ObjectStoreProperties, provenanceProperties: ProvenanceProperties): CachedOsClient { val osClient = OsClient(objectStoreProperties.uri, 30000) - return CachedOsClient(osClient, objectStoreProperties.decryptionWorkerThreads, objectStoreProperties.concurrencySize, objectStoreProperties.cacheRecordSizeBytes) + return CachedOsClient(osClient, objectStoreProperties.decryptionWorkerThreads, objectStoreProperties.concurrencySize, objectStoreProperties.cacheRecordSizeBytes, objectStoreProperties.cacheJarSizeBytes) } @Bean(BeanQualifiers.OBJECTSTORE_ENCRYPTION_KEYS) diff --git a/server/src/main/kotlin/tech/figure/objectstore/gateway/configuration/AppProperties.kt b/server/src/main/kotlin/tech/figure/objectstore/gateway/configuration/AppProperties.kt index 6008556..b3ca700 100644 --- a/server/src/main/kotlin/tech/figure/objectstore/gateway/configuration/AppProperties.kt +++ b/server/src/main/kotlin/tech/figure/objectstore/gateway/configuration/AppProperties.kt @@ -42,7 +42,8 @@ data class ObjectStoreProperties @ConstructorBinding constructor( val masterKey: String, val decryptionWorkerThreads: Short = 10, val concurrencySize: Short = 10, - val cacheRecordSizeBytes: Long = 10_000_000 + val cacheRecordSizeBytes: Long = 10_000_000, + val cacheJarSizeBytes: Long = 1_000_000 ) @Validated diff --git a/server/src/test/kotlin/tech/figure/objectstore/gateway/server/ObjectStoreGatewayServerTest.kt b/server/src/test/kotlin/tech/figure/objectstore/gateway/server/ObjectStoreGatewayServerTest.kt index 1f4526a..9d55dc1 100644 --- a/server/src/test/kotlin/tech/figure/objectstore/gateway/server/ObjectStoreGatewayServerTest.kt +++ b/server/src/test/kotlin/tech/figure/objectstore/gateway/server/ObjectStoreGatewayServerTest.kt @@ -61,6 +61,7 @@ import tech.figure.objectstore.gateway.service.AddressVerificationService import tech.figure.objectstore.gateway.service.ObjectService import tech.figure.objectstore.gateway.service.ScopeFetchService import tech.figure.objectstore.gateway.service.ScopePermissionsService +import java.io.InputStream import java.net.URI import java.security.KeyPair import java.security.PublicKey @@ -523,7 +524,7 @@ class ObjectStoreGatewayServerTest { val objectBytes = Random.nextBytes(100) val obj = objectFromParts(objectBytes, "some_type") val byteHash = objectBytes.sha256String() - every { objectStoreClient.osClient.put(any(), any(), any(), any(), any(), any(), any(), any()).get().hash } returns byteHash.toByteString() + every { objectStoreClient.osClient.put(any(), any(), any(), any(), any(), any(), any(), any()).get().hash } returns byteHash.toByteString() return objectService.putObject( obj = obj, requesterPublicKey = requester, diff --git a/server/src/test/kotlin/tech/figure/objectstore/gateway/service/ObjectServiceTest.kt b/server/src/test/kotlin/tech/figure/objectstore/gateway/service/ObjectServiceTest.kt index a92f0e8..9f64147 100644 --- a/server/src/test/kotlin/tech/figure/objectstore/gateway/service/ObjectServiceTest.kt +++ b/server/src/test/kotlin/tech/figure/objectstore/gateway/service/ObjectServiceTest.kt @@ -105,7 +105,7 @@ class ObjectServiceTest { val objectHash = objectBytes.sha256String() every { accountsRepository.isAddressEnabled(any()) } returns false - every { osClient.osClient.put(any(), masterKey.publicKey, any(), objectBytes.size.toLong(), setOf(masterKey.publicKey), mapOf(), any(), false) } returns Futures.immediateFuture( + every { osClient.osClient.put(any(), masterKey.publicKey, any(), objectBytes.size.toLong(), setOf(masterKey.publicKey), mapOf(), any(), true, false) } returns Futures.immediateFuture( Objects.ObjectResponse.newBuilder().setHash(objectHash.base64Decode().toByteString()).build() ) @@ -124,7 +124,7 @@ class ObjectServiceTest { assertEquals(objectHash, response) verifyAll { - osClient.osClient.put(any(), masterKey.publicKey, any(), objectBytes.size.toLong(), setOf(masterKey.publicKey), mapOf(), any(), false) + osClient.osClient.put(any(), masterKey.publicKey, any(), objectBytes.size.toLong(), setOf(masterKey.publicKey), mapOf(), any(), true, false) objectPermissionsRepository.addAccessPermission( objectHash = objectHash, granterAddress = masterKeyAddress, @@ -144,7 +144,7 @@ class ObjectServiceTest { every { accountsRepository.isAddressEnabled(any()) } returns true - every { osClient.osClient.put(any(), masterKey.publicKey, any(), objectBytes.size.toLong(), setOf(ownerKey), mapOf(), any(), false) } returns Futures.immediateFuture( + every { osClient.osClient.put(any(), masterKey.publicKey, any(), objectBytes.size.toLong(), setOf(ownerKey), mapOf(), any(), true, false) } returns Futures.immediateFuture( Objects.ObjectResponse.newBuilder().setHash(objectHash.base64Decode().toByteString()).build() ) @@ -163,7 +163,7 @@ class ObjectServiceTest { assertEquals(objectHash, response) verifyAll { - osClient.osClient.put(any(), masterKey.publicKey, any(), objectBytes.size.toLong(), setOf(ownerKey), mapOf(), any(), false) + osClient.osClient.put(any(), masterKey.publicKey, any(), objectBytes.size.toLong(), setOf(ownerKey), mapOf(), any(), true, false) objectPermissionsRepository.addAccessPermission( objectHash = objectHash, granterAddress = ownerKeyAddress, @@ -183,7 +183,7 @@ class ObjectServiceTest { every { accountsRepository.isAddressEnabled(any()) } returns true - every { osClient.osClient.put(any(), masterKey.publicKey, any(), objectBytes.size.toLong(), setOf(ownerKey), mapOf(), any(), false) } returns Futures.immediateFuture( + every { osClient.osClient.put(any(), masterKey.publicKey, any(), objectBytes.size.toLong(), setOf(ownerKey), mapOf(), any(), true, false) } returns Futures.immediateFuture( Objects.ObjectResponse.newBuilder().setHash(objectHash.base64Decode().toByteString()).build() ) @@ -202,7 +202,7 @@ class ObjectServiceTest { assertEquals(objectHash, response) verifyAll { - osClient.osClient.put(any(), masterKey.publicKey, any(), objectBytes.size.toLong(), setOf(ownerKey), mapOf(), any(), false) + osClient.osClient.put(any(), masterKey.publicKey, any(), objectBytes.size.toLong(), setOf(ownerKey), mapOf(), any(), true, false) objectPermissionsRepository.addAccessPermission( objectHash = objectHash, granterAddress = ownerKeyAddress, @@ -223,7 +223,7 @@ class ObjectServiceTest { every { accountsRepository.isAddressEnabled(any()) } returns true - every { osClient.osClient.put(any(), masterKey.publicKey, any(), objectBytes.size.toLong(), setOf(ownerKey, otherKey), mapOf(), any(), false) } returns Futures.immediateFuture( + every { osClient.osClient.put(any(), masterKey.publicKey, any(), objectBytes.size.toLong(), setOf(ownerKey, otherKey), mapOf(), any(), true, false) } returns Futures.immediateFuture( Objects.ObjectResponse.newBuilder().setHash(objectHash.base64Decode().toByteString()).build() ) @@ -286,7 +286,7 @@ class ObjectServiceTest { val keyToUse = if (useOwnKey) requesterKey else masterKey val keyToUseAddress = keyToUse.publicKey.getAddress(false) - every { osClient.osClient.put(any(), keyToUse.publicKey, any(), objectBytes.size.toLong(), setOf(requesterKey.publicKey, otherKey), mapOf(), any(), false) } returns Futures.immediateFuture( + every { osClient.osClient.put(any(), keyToUse.publicKey, any(), objectBytes.size.toLong(), setOf(requesterKey.publicKey, otherKey), mapOf(), any(), true, false) } returns Futures.immediateFuture( Objects.ObjectResponse.newBuilder().setHash(objectHash.base64Decode().toByteString()).build() )