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,15 +3,18 @@ package types
import (
"bytes"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/go-state-types/exitcode"
)
type MessageReceipt struct {
ExitCode exitcode.ExitCode
Return []byte
GasUsed int64
ExitCode exitcode.ExitCode
Return []byte
GasUsed int64
EventsRoot cid.Cid // Root of Event AMT
}
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.StateRoot{},
types.StateInfo0{},
types.Event{},
types.EventEntry{},
)
if err != nil {
fmt.Println(err)