Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
huangzhiran committed Oct 17, 2024
1 parent 2375164 commit e69ed6f
Show file tree
Hide file tree
Showing 9 changed files with 552 additions and 626 deletions.
2 changes: 1 addition & 1 deletion build/docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ services:
- 4003:4001

risc0:
image: ghcr.io/iotexproject/risc0server:v0.0.7
image: ghcr.io/iotexproject/risc0server:v0.0.8
depends_on:
- "postgres"
container_name: risc0-service
Expand Down
30 changes: 12 additions & 18 deletions vm/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,28 @@ import (
"github.com/iotexproject/w3bstream/vm/proto"
)

func create(ctx context.Context, conn *grpc.ClientConn, projectID uint64, executeBinary, expParam string) error {
cli := proto.NewVmRuntimeClient(conn)
func create(ctx context.Context, conn *grpc.ClientConn, projectID uint64, executeBinary, expParam []byte) error {
cli := proto.NewVMClient(conn)

req := &proto.CreateRequest{
req := &proto.NewProjectRequest{
ProjectID: projectID,
Content: executeBinary,
ExpParam: expParam,
Binary: executeBinary,
Metadata: expParam,
}
if _, err := cli.Create(ctx, req); err != nil {
if _, err := cli.NewProject(ctx, req); err != nil {
return errors.Wrap(err, "failed to create vm instance")
}
return nil
}

func execute(ctx context.Context, conn *grpc.ClientConn, task *task.Task) ([]byte, error) {
ds := []string{}
for _, d := range task.Payloads {
ds = append(ds, string(d))
req := &proto.ExecuteTaskRequest{
ProjectID: task.ProjectID,
TaskID: task.ID.Bytes(),
Payloads: task.Payloads,
}
req := &proto.ExecuteRequest{
ProjectID: task.ProjectID,
TaskID: 0, // TODO
ClientID: "0", // TODO
SequencerSignature: "", // TODO
Datas: ds,
}
cli := proto.NewVmRuntimeClient(conn)
resp, err := cli.Execute(ctx, req)
cli := proto.NewVMClient(conn)
resp, err := cli.ExecuteTask(ctx, req)
if err != nil {
return nil, errors.Wrap(err, "failed to execute vm instance")
}
Expand Down
76 changes: 0 additions & 76 deletions vm/instance_test.go

This file was deleted.

Loading

0 comments on commit e69ed6f

Please sign in to comment.