All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hedera.hapi.services.auxiliary.tss.schema.TssVoteTransactionBodySchema Maven / Gradle / Ivy

package com.hedera.hapi.services.auxiliary.tss.schema;

import com.hedera.pbj.runtime.FieldDefinition;
import com.hedera.pbj.runtime.FieldType;
import com.hedera.pbj.runtime.Schema;


/**
 * Schema for TssVoteTransactionBody model object. Generate based on protobuf schema.
 */
public final class TssVoteTransactionBodySchema implements Schema {

    // -- FIELD DEFINITIONS ---------------------------------------------

    /**
     * (1) A hash of the roster containing the node generating this TssVote.
     */
    public static final FieldDefinition SOURCE_ROSTER_HASH = new FieldDefinition("source_roster_hash", FieldType.BYTES, false, false, false, 1);


    /**
     * (2) A hash of the roster that this TssVote is for.
     */
    public static final FieldDefinition TARGET_ROSTER_HASH = new FieldDefinition("target_roster_hash", FieldType.BYTES, false, false, false, 2);


    /**
     * (3) An identifier (and public key) computed from the TssMessages for the target
     * roster.
     */
    public static final FieldDefinition LEDGER_ID = new FieldDefinition("ledger_id", FieldType.BYTES, false, false, false, 3);


    /**
     * (4) A signature produced by the node.
     * 

* This signature SHALL be produced using the node RSA signing key to sign * the ledger_id.
* This signature SHALL be used to establish a chain of trust in the ledger id. */ public static final FieldDefinition NODE_SIGNATURE = new FieldDefinition("node_signature", FieldType.BYTES, false, false, false, 4); /** * (5) A bit vector of message statuses. *

* #### Example *

  • The least significant bit of byte[0] SHALL be the 0th item in the sequence.
  • *
  • The most significant bit of byte[0] SHALL be the 7th item in the sequence.
  • *
  • The least significant bit of byte[1] SHALL be the 8th item in the sequence.
  • *
  • The most significant bit of byte[1] SHALL be the 15th item in the sequence.
  • *
* A bit SHALL be set if the `TssMessage` for the `TssMessageTransaction` * with a sequence number matching that bit index has been * received, and is valid.
* A bit SHALL NOT be set if the `TssMessage` has not been received or was * received but not valid. */ public static final FieldDefinition TSS_VOTE = new FieldDefinition("tss_vote", FieldType.BYTES, false, false, false, 5); // -- OTHER METHODS ------------------------------------------------- /** * Check if a field definition belongs to this schema. * * @param f field def to check * @return true if it belongs to this schema */ public static boolean valid(FieldDefinition f) { return f != null && getField(f.number()) == f; } /** * Get a field definition given a field number * * @param fieldNumber the fields number to get def for * @return field def or null if field number does not exist */ public static FieldDefinition getField(final int fieldNumber) { return switch(fieldNumber) { case 1 -> SOURCE_ROSTER_HASH; case 2 -> TARGET_ROSTER_HASH; case 3 -> LEDGER_ID; case 4 -> NODE_SIGNATURE; case 5 -> TSS_VOTE; default -> null; }; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy