Skip to content

Commit

Permalink
Fix missed cskip_suspended$110
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksej-paschenko committed Sep 3, 2024
1 parent 6f6de06 commit d275897
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tlb/transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,14 @@ type TrComputePhase struct {
// cskip_no_state$00 = ComputeSkipReason;
// cskip_bad_state$01 = ComputeSkipReason;
// cskip_no_gas$10 = ComputeSkipReason;
// cskip_suspended$110 = ComputeSkipReason;
type ComputeSkipReason string

const (
ComputeSkipReasonNoState ComputeSkipReason = "cskip_no_state"
ComputeSkipReasonBadState ComputeSkipReason = "cskip_bad_state"
ComputeSkipReasonNoGas ComputeSkipReason = "cskip_no_gas"
ComputeSkipSuspended ComputeSkipReason = "cskip_suspended"
)

func (a ComputeSkipReason) MarshalTLB(c *boc.Cell, encoder *Encoder) error {
Expand All @@ -362,6 +364,11 @@ func (a ComputeSkipReason) MarshalTLB(c *boc.Cell, encoder *Encoder) error {
return c.WriteUint(1, 2)
case ComputeSkipReasonNoGas:
return c.WriteUint(2, 2)
case ComputeSkipSuspended:
if err := c.WriteUint(3, 2); err != nil {
return err
}
return c.WriteUint(0, 1)
}
return nil
}
Expand All @@ -378,6 +385,16 @@ func (a *ComputeSkipReason) UnmarshalTLB(c *boc.Cell, decoder *Decoder) error {
*a = ComputeSkipReasonBadState
case 2:
*a = ComputeSkipReasonNoGas
case 3:
nextBit, err := c.ReadUint(1)
if err != nil {
return err
}
if nextBit == 0 {
*a = ComputeSkipSuspended
return nil
}
return fmt.Errorf("unknown ComputeSkipReason")
}
return nil
}
Expand Down
1 change: 1 addition & 0 deletions tlb/transactions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func TestComputeSkipReason_MarshalTLB(t *testing.T) {
{reason: ComputeSkipReasonNoGas},
{reason: ComputeSkipReasonNoState},
{reason: ComputeSkipReasonBadState},
{reason: ComputeSkipSuspended},
}
for _, tt := range tests {
t.Run(string(tt.reason), func(t *testing.T) {
Expand Down

0 comments on commit d275897

Please sign in to comment.