syntax = "proto3";

import "blockchain.proto";

enum Ret {
    OK = 0;
    InvalidNonce = 1;
    Dup = 2;
    InvalidUntilBlock = 3;
    BadSig = 4;
    NotReady = 5;
    Busy = 6;
    BadChainId = 7;
    QuotaNotEnough = 8;
    Forbidden = 9;
    InvalidValue = 10;
}

message VerifyTxReq {
    uint64 valid_until_block = 1;
    bytes hash = 2;
    bytes signature = 3;
    Crypto crypto = 4;
    bytes tx_hash = 5;
    bytes signer = 6; // public key only set in BlockReq
    string nonce = 7;
    uint32 chain_id = 8;
    uint64 quota = 9;
    bytes value = 10;
}

message VerifyTxResp {
    bytes tx_hash = 1;
    Ret ret = 2;
    bytes signer = 3; // public key only set in TxResp
    uint32 received_chain_id = 4;
    uint32 expected_chain_id = 5;
}

message VerifyBlockReq {
    uint64 id = 1;
    repeated VerifyTxReq reqs = 2;
}

message VerifyBlockResp {
    uint64 id = 1;
    Ret ret = 2;
}

message BlockTxHashes {
    uint64 height = 1;
    repeated bytes tx_hashes = 2;
    uint64 block_gas_limit = 3;
    AccountGasLimit account_gas_limit = 4;
    bool check_quota = 5;
    bytes admin_address = 6;
}

message BlockTxHashesReq {
    uint64 height = 1;
}

message Miscellaneous {
    uint32 chain_id = 1;
}

message MiscellaneousReq {
}
