-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Description
Currently, protos in references have all their message as internal. This is an issue because services in protos can be 'inherited' and rpcs with message references will have accessibility mismatch issue (message being internal and rpc being public). The solution is placing the proto in the message folder. This is misleading since message that not say anything about the nature of the proto class.
Steps To Reproduce
- In contract/hello_world_contract.proto:
syntax = "proto3";
import "aelf/options.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/wrappers.proto";
import "Protobuf/reference/acs12.proto";
import "Protobuf/reference/request_interface.proto";
// The namespace of this class
option csharp_namespace = "AElf.Contracts.VrfTest";
service VrfTest {
// The name of the state class the smart contract is going to use to access blockchain state
option (aelf.csharp_state) = "AElf.Contracts.VrfTest.VrfTestState";
option (aelf.base) = "Protobuf/reference/acs12.proto";
option (aelf.base) = "Protobuf/reference/request_interface.proto";
// Actions (methods that modify contract state)
// Stores the value in contract state
rpc Update (google.protobuf.StringValue) returns (google.protobuf.Empty) {
}
// Views (methods that don't modify contract state)
// Get the value stored from contract state
rpc Read (google.protobuf.Empty) returns (google.protobuf.StringValue) {
option (aelf.is_view) = true;
}
}
// An event that will be emitted from contract method call
message UpdatedMessage {
option (aelf.is_event) = true;
string value = 1;
}- In reference/request_interface.proto:
// the version of the language, use proto3 for contracts
syntax = "proto3";
// some core imports for AElf chain types
import "aelf/core.proto";
import "aelf/options.proto";
import "Protobuf/reference/acs12.proto";
package oracle;
// import for using the google.protobuf.* type.
import "google/protobuf/empty.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/timestamp.proto";
option (aelf.identity) = "request_interface";
// the name of the C# namespace in which the contract code will be,
// generated code will also be in this namespace.
option csharp_namespace = "AElf.Contracts.VrfTest";
// the contract definition: a gRPC service definition.
service RequestInterface {
// the full name of the C# class that will contain the state (here <namespace>.<state-class-name> format).
rpc StartOracleRequest(StartOracleRequestInput) returns (google.protobuf.Empty);
rpc HandleOracleFulfillment(HandleOracleFulfillmentInput) returns (google.protobuf.Empty);
}
message StartOracleRequestInput {
int64 subscription_id = 1;
int32 request_type_index = 2;
bytes specific_data = 3;
}
message HandleOracleFulfillmentInput {
aelf.Hash request_id = 1;
bytes response = 2;
bytes err = 3;
int32 request_type_index = 4;
}
message OracleResponse {
bytes response = 1;
bytes err = 2;
}Current Behavior
- Compile error
Expected Behavior
- Compile successfully with contracts in reference used for 'inheritance' purposes. Rename message
foldertobasefolder instead.
Environment
- dotnet 7.0
- AElf.Tools 1.0.2
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working