Skip to content

Commit

Permalink
(unfinished) messages
Browse files Browse the repository at this point in the history
  • Loading branch information
pro-wh committed Dec 30, 2023
1 parent 074327e commit 6fad4ad
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
13 changes: 13 additions & 0 deletions storage/oasis/nodeapi/cobalt/convert.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cobalt

import (
"encoding/json"
"strings"

"github.com/oasisprotocol/oasis-core/go/common/cbor"
Expand Down Expand Up @@ -327,6 +328,18 @@ func convertEvent(e txResultsCobalt.Event) nodeapi.Event {
"err", err,
)
}
messagesRaw := make([]json.RawMessage, len(computeBody.Messages))
for i, message := range computeBody.Messages {
messageJSON, err := json.Marshal(message)
if err != nil {
logger.Error("convert event: roothash executor committed: compute body message error marshaling",
"event", e,
"message_index", i,
"err", err,
)
}
messagesRaw[i] = messageJSON
}
ret = nodeapi.Event{
RoothashExecutorCommitted: &nodeapi.ExecutorCommittedEvent{
RuntimeID: e.RootHash.RuntimeID,
Expand Down
5 changes: 5 additions & 0 deletions storage/oasis/nodeapi/eden/convert.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package eden

import (
"encoding/json"
"strings"

"github.com/oasisprotocol/oasis-core/go/common/cbor"
Expand Down Expand Up @@ -399,6 +400,10 @@ func convertEvent(e txResultsEden.Event) nodeapi.Event {
case e.RootHash != nil:
switch {
case e.RootHash.ExecutorCommitted != nil:
messagesRaw := make([]json.RawMessage, len(e.RootHash.ExecutorCommitted.Commit.Messages))
for i, message := range e.RootHash.ExecutorCommitted.Commit.Messages {
messagesRaw[i] = common.TryAsJSON(message)
}
ret = nodeapi.Event{
RoothashExecutorCommitted: &nodeapi.ExecutorCommittedEvent{
RuntimeID: e.RootHash.RuntimeID,
Expand Down

0 comments on commit 6fad4ad

Please sign in to comment.