// Copyright Rivtower Technologies LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

import "common.proto";
import "blockchain.proto";

package executor;

// executor won't define structure of executed block/receipt/log etc.
// implement can customize it.

message CallRequest {
    // 1. length is 20 bytes for evm.
    // 2. if executor is multi-vm, it will be a path.
    bytes to = 1;
    bytes from = 2;
    // 4 bytes for evm.
    bytes method = 3;
    repeated bytes args = 4;
    // 5 block height for evm.
    uint64 height = 5;
}

message CallResponse {
    bytes value = 1;
}

service ExecutorService {
    // exec a block return executed_block_hash
    rpc Exec(blockchain.Block) returns (common.HashResponse);

    rpc Call(CallRequest) returns (CallResponse);
}
