Skip to content

Commit

Permalink
use VMState as marker
Browse files Browse the repository at this point in the history
  • Loading branch information
ixje committed Jan 22, 2025
1 parent 90c18b7 commit d1d0921
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/core/state/notification_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ func (aer *AppExecResult) EncodeBinary(w *io.BinWriter) {
func (aer *AppExecResult) EncodeBinaryWithContext(w *io.BinWriter, sc *stackitem.SerializationContext) {
w.WriteBytes(aer.Container[:])
w.WriteB(byte(aer.Trigger))
invocLen := len(aer.Invocations)
if invocLen > 0 {
aer.VMState |= 0x80
}
w.WriteB(byte(aer.VMState))
w.WriteU64LE(uint64(aer.GasConsumed))
// Stack items are expected to be marshaled one by one.
Expand All @@ -95,7 +99,7 @@ func (aer *AppExecResult) EncodeBinaryWithContext(w *io.BinWriter, sc *stackitem
aer.Events[i].EncodeBinaryWithContext(w, sc)
}
w.WriteVarBytes([]byte(aer.FaultException))
if invocLen := len(aer.Invocations); invocLen > 0 {
if invocLen > 0 {
w.WriteVarUint(uint64(invocLen))
for i := range aer.Invocations {
aer.Invocations[i].EncodeBinaryWithContext(w, sc)
Expand Down Expand Up @@ -126,7 +130,7 @@ func (aer *AppExecResult) DecodeBinary(r *io.BinReader) {
aer.Stack = arr
r.ReadArray(&aer.Events)
aer.FaultException = r.ReadString()
if r.Len() > 0 {
if aer.VMState&0x80 != 0 {
r.ReadArray(&aer.Invocations)
}
}
Expand Down

0 comments on commit d1d0921

Please sign in to comment.