Skip to content

Commit

Permalink
Updated to latest stable commit 562d33a (#422)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mingela authored Jun 14, 2024
1 parent 7ebb851 commit 541e68b
Show file tree
Hide file tree
Showing 13 changed files with 154 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package jp.co.soramitsu.iroha2

import jp.co.soramitsu.iroha2.generated.RawGenesisBlock
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
import java.io.File
import kotlin.test.assertEquals

@Disabled
class DeserializerTest {
@Test
fun `should deserialize genesis block`() {
Expand Down
Binary file modified modules/block/src/test/resources/executor.wasm
100755 → 100644
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import jp.co.soramitsu.iroha2.generated.ExecutionTime
import jp.co.soramitsu.iroha2.generated.FilterBox
import jp.co.soramitsu.iroha2.generated.FilterOptOfAccountEventFilter
import jp.co.soramitsu.iroha2.generated.FilterOptOfAccountFilter
import jp.co.soramitsu.iroha2.generated.FilterOptOfAccountId.AcceptAll
import jp.co.soramitsu.iroha2.generated.FilterOptOfAccountId.BySome
import jp.co.soramitsu.iroha2.generated.FilterOptOfAssetDefinitionEventFilter
import jp.co.soramitsu.iroha2.generated.FilterOptOfAssetDefinitionFilter
import jp.co.soramitsu.iroha2.generated.FilterOptOfAssetEventFilter
Expand Down Expand Up @@ -88,7 +90,13 @@ object Filters {
triggerId: TriggerId,
authority: AccountId,
) = TriggeringFilterBox.ExecuteTrigger(
ExecuteTriggerEventFilter(triggerId, authority),
ExecuteTriggerEventFilter(triggerId, BySome(authority)),
)

fun executeTrigger(
triggerId: TriggerId,
) = TriggeringFilterBox.ExecuteTrigger(
ExecuteTriggerEventFilter(triggerId, AcceptAll()),
)

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ object Instructions {
Executable.Instructions(isi),
repeats,
accountId,
Filters.executeTrigger(triggerId, accountId),
Filters.executeTrigger(triggerId),
metadata,
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ opt-level = "z" # Optimize for size vs speed with "s"/"z"(removes vectorizat
codegen-units = 1 # Further reduces binary size but increases compilation time

[dependencies]
iroha_trigger = { git = "https://github.com/hyperledger/iroha/", branch = "iroha2-stable", features = ["debug"] }
iroha_trigger = { git = "https://github.com/hyperledger/iroha/", rev = "562d33aff8c6fd4c68c3b1ccdbe934c6ad860a12", features = ["debug"] }

lol_alloc = "0.4.0"
panic-halt = "0.2.0"
2 changes: 1 addition & 1 deletion modules/client/src/test/executor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ codegen-units = 1 # Further reduces binary size but increases compilation time
crate-type = ['cdylib']

[dependencies]
iroha_executor = { git = "https://github.com/hyperledger/iroha/", branch = "iroha2-stable", features = ["debug"] }
iroha_executor = { git = "https://github.com/hyperledger/iroha/", rev = "562d33aff8c6fd4c68c3b1ccdbe934c6ad860a12", features = ["debug"] }

lol_alloc = "0.4.0"
panic-halt = "0.2.0"
Expand Down
Binary file not shown.
Binary file modified modules/client/src/test/resources/executor.wasm
100755 → 100644
Binary file not shown.
15 changes: 14 additions & 1 deletion modules/codegen/src/main/resources/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1323,7 +1323,7 @@
},
{
"name": "authority",
"type": "AccountId"
"type": "FilterOpt<AccountId>"
}
]
},
Expand Down Expand Up @@ -1545,6 +1545,19 @@
}
]
},
"FilterOpt<AccountId>": {
"Enum": [
{
"tag": "AcceptAll",
"discriminant": 0
},
{
"tag": "BySome",
"discriminant": 1,
"type": "AccountId"
}
]
},
"FilterOpt<AssetDefinitionEventFilter>": {
"Enum": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ import kotlin.Unit
*/
public data class ExecuteTriggerEventFilter(
public val triggerId: TriggerId,
public val authority: AccountId,
public val authority: FilterOptOfAccountId,
) {
public companion object :
ScaleReader<ExecuteTriggerEventFilter>,
ScaleWriter<ExecuteTriggerEventFilter> {
override fun read(reader: ScaleCodecReader): ExecuteTriggerEventFilter = try {
ExecuteTriggerEventFilter(
TriggerId.read(reader),
AccountId.read(reader),
FilterOptOfAccountId.read(reader),
)
} catch (ex: Exception) {
throw wrapException(ex)
}

override fun write(writer: ScaleCodecWriter, instance: ExecuteTriggerEventFilter): Unit = try {
TriggerId.write(writer, instance.triggerId)
AccountId.write(writer, instance.authority)
FilterOptOfAccountId.write(writer, instance.authority)
} catch (ex: Exception) {
throw wrapException(ex)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
//
// Auto-generated file. DO NOT EDIT!
//
package jp.co.soramitsu.iroha2.generated

import jp.co.soramitsu.iroha2.ModelEnum
import jp.co.soramitsu.iroha2.codec.ScaleCodecReader
import jp.co.soramitsu.iroha2.codec.ScaleCodecWriter
import jp.co.soramitsu.iroha2.codec.ScaleReader
import jp.co.soramitsu.iroha2.codec.ScaleWriter
import jp.co.soramitsu.iroha2.wrapException
import kotlin.Any
import kotlin.Boolean
import kotlin.Int
import kotlin.Unit

/**
* FilterOptOfAccountId
*
* Generated from 'FilterOptOfAccountId' enum
*/
public sealed class FilterOptOfAccountId : ModelEnum {
/**
* @return Discriminator of variant in enum
*/
public abstract fun discriminant(): Int

override fun equals(other: Any?): Boolean = when (this) {
is AcceptAll -> AcceptAll.equals(this, other)
else -> super.equals(other) }

override fun hashCode(): Int = when (this) {
is AcceptAll -> AcceptAll.hashCode()
else -> super.hashCode() }

/**
* 'AcceptAll' variant
*/
public class AcceptAll : FilterOptOfAccountId() {
override fun discriminant(): Int = DISCRIMINANT

public companion object :
ScaleReader<jp.co.soramitsu.iroha2.generated.FilterOptOfAccountId.AcceptAll>,
ScaleWriter<jp.co.soramitsu.iroha2.generated.FilterOptOfAccountId.AcceptAll> {
public const val DISCRIMINANT: Int = 0

override fun read(reader: ScaleCodecReader): jp.co.soramitsu.iroha2.generated.FilterOptOfAccountId.AcceptAll = try {
AcceptAll()
} catch (ex: Exception) {
throw wrapException(ex)
}

override fun write(
writer: ScaleCodecWriter,
instance: jp.co.soramitsu.iroha2.generated.FilterOptOfAccountId.AcceptAll,
): Unit = try {
} catch (ex: Exception) {
throw wrapException(ex)
}

public fun equals(
o1: jp.co.soramitsu.iroha2.generated.FilterOptOfAccountId.AcceptAll,
o2: Any?,
): Boolean = when (o2) {
null -> false
else -> o2::class == o1::class
}

override fun hashCode(): Int = ".FilterOptOfAccountId.AcceptAll".hashCode()
}
}

/**
* 'BySome' variant
*/
public data class BySome(
public val accountId: AccountId,
) : FilterOptOfAccountId() {
override fun discriminant(): Int = DISCRIMINANT

public companion object :
ScaleReader<jp.co.soramitsu.iroha2.generated.FilterOptOfAccountId.BySome>,
ScaleWriter<jp.co.soramitsu.iroha2.generated.FilterOptOfAccountId.BySome> {
public const val DISCRIMINANT: Int = 1

override fun read(reader: ScaleCodecReader): jp.co.soramitsu.iroha2.generated.FilterOptOfAccountId.BySome = try {
BySome(
AccountId.read(reader),
)
} catch (ex: Exception) {
throw wrapException(ex)
}

override fun write(
writer: ScaleCodecWriter,
instance: jp.co.soramitsu.iroha2.generated.FilterOptOfAccountId.BySome,
): Unit = try {
AccountId.write(writer, instance.accountId)
} catch (ex: Exception) {
throw wrapException(ex)
}
}
}

public companion object : ScaleReader<FilterOptOfAccountId>, ScaleWriter<FilterOptOfAccountId> {
override fun read(reader: ScaleCodecReader): FilterOptOfAccountId = when (
val discriminant =
reader.readUByte()
) {
0 -> AcceptAll.read(reader)
1 -> BySome.read(reader)
else -> throw RuntimeException("Unresolved discriminant of the enum variant: $discriminant") }

override fun write(writer: ScaleCodecWriter, instance: FilterOptOfAccountId) {
writer.directWrite(instance.discriminant())
when (val discriminant = instance.discriminant()) {
0 -> AcceptAll.write(writer, instance as AcceptAll)
1 -> BySome.write(writer, instance as BySome)
else -> throw RuntimeException("Unresolved discriminant of the enum variant: $discriminant") }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ open class IrohaContainer : GenericContainer<IrohaContainer> {
}.let { DockerImageName.parse(it) }

const val NETWORK_ALIAS = "iroha"
const val DEFAULT_IMAGE_TAG = "sha256:4dfa7012d79479770e42a9d72ff04436da28cea71863a13907a4f6592e9c0d12"
const val DEFAULT_IMAGE_TAG = "sha256:fe46be1666b09e9e01a13c90d0ee29c56ea97af57296e05a473d7b6eb1f200a6"
const val DEFAULT_IMAGE_NAME = "hyperledger/iroha2"
const val DEFAULT_EXECUTOR_FILE_NAME = "executor.wasm"
const val DEFAULT_GENESIS_FILE_NAME = "genesis.json"
Expand Down
Binary file modified modules/test-tools/src/main/resources/executor.wasm
100755 → 100644
Binary file not shown.

0 comments on commit 541e68b

Please sign in to comment.