Add EventsRoot field to message receipt

This commit is contained in:
Ian Davis 2022-11-10 11:58:39 +00:00
parent c9c53c9745
commit 85df74ff43
3 changed files with 33 additions and 4 deletions

24
chain/types/event.go Normal file
View File

@ -0,0 +1,24 @@
package types
import (
"github.com/filecoin-project/go-address"
)
type Event struct {
// The ID of the actor that emitted this event.
Emitter address.Address
// Key values making up this event.
Entries []EventEntry
}
type EventEntry struct {
// A bitmap conveying metadata or hints about this entry.
Flags uint8
// The key of this event entry
Key []byte
// Any DAG-CBOR encodeable type.
Value []byte
}

View File

@ -3,6 +3,8 @@ package types
import ( import (
"bytes" "bytes"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/go-state-types/exitcode" "github.com/filecoin-project/go-state-types/exitcode"
) )
@ -10,8 +12,9 @@ type MessageReceipt struct {
ExitCode exitcode.ExitCode ExitCode exitcode.ExitCode
Return []byte Return []byte
GasUsed int64 GasUsed int64
EventsRoot cid.Cid // Root of Event AMT
} }
func (mr *MessageReceipt) Equals(o *MessageReceipt) bool { func (mr *MessageReceipt) Equals(o *MessageReceipt) bool {
return mr.ExitCode == o.ExitCode && bytes.Equal(mr.Return, o.Return) && mr.GasUsed == o.GasUsed return mr.ExitCode == o.ExitCode && bytes.Equal(mr.Return, o.Return) && mr.GasUsed == o.GasUsed && mr.EventsRoot == o.EventsRoot
} }

View File

@ -34,6 +34,8 @@ func main() {
types.BeaconEntry{}, types.BeaconEntry{},
types.StateRoot{}, types.StateRoot{},
types.StateInfo0{}, types.StateInfo0{},
types.Event{},
types.EventEntry{},
) )
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)