Skip to content

Commit bb0a35f

Browse files
authored
Merge pull request #426 from tonkeeper/new-bounce-hotfix
TX-428: external_flags hotfix
2 parents 3950ecb + 93a1cdc commit bb0a35f

File tree

8 files changed

+79
-6
lines changed

8 files changed

+79
-6
lines changed

abi/generated_test.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2439,6 +2439,40 @@ func TestMessageDecoder(t *testing.T) {
24392439
},
24402440
},
24412441
},
2442+
{
2443+
name: "new_bounce_flag_1",
2444+
boc: "b5ee9c720101030100a3000213fffffffe00ffffffff40010200ff000000007364676c6b647368676a736168676b6a61736468676a6b647368676b6a7368616a6b676864736b6a6768736b6a6468676b6a736468676a6b647368676b6a736864676a68736468736a6b68676b6a736468677368646b6a67686473676a6b6873646b6a676873646b6a68676b6a736867646a6b7364686b6a676873650021405f5e10000001225ea9938c134733ab6c",
2445+
wantOpName: BounceV2MsgOp,
2446+
wantValue: BounceV2MsgBody{
2447+
OriginalBody: tlb.Any(mustHexToCell("b5ee9c720101010100820000ff000000007364676c6b647368676a736168676b6a61736468676a6b647368676b6a7368616a6b676864736b6a6768736b6a6468676b6a736468676a6b647368676b6a736864676a68736468736a6b68676b6a736468677368646b6a67686473676a6b6873646b6a676873646b6a68676b6a736867646a6b7364686b6a67687365")),
2448+
OriginalInfo: NewBounceOriginalInfo{
2449+
Value: tlb.CurrencyCollection{
2450+
Grams: tlb.Grams(100000000),
2451+
},
2452+
CreatedLt: 39908118000002,
2453+
CreatedAt: 1759933805,
2454+
},
2455+
BouncedByPhase: 0,
2456+
ExitCode: -1,
2457+
},
2458+
},
2459+
{
2460+
name: "new_bounce_flag_3",
2461+
boc: "b5ee9c72010103010054000213fffffffe00ffffffff40010200620000000068692120686f70652069742077696c6c20626520656e6f75676820666f7220627579696e6720612079616368740021405f5e10000001225d27569813473370b4",
2462+
wantOpName: BounceV2MsgOp,
2463+
wantValue: BounceV2MsgBody{
2464+
OriginalBody: tlb.Any(mustHexToCell("b5ee9c720101010100330000620000000068692120686f70652069742077696c6c20626520656e6f75676820666f7220627579696e672061207961636874")),
2465+
OriginalInfo: NewBounceOriginalInfo{
2466+
Value: tlb.CurrencyCollection{
2467+
Grams: tlb.Grams(100000000),
2468+
},
2469+
CreatedLt: 39907308000002,
2470+
CreatedAt: 1759931926,
2471+
},
2472+
BouncedByPhase: 0,
2473+
ExitCode: -1,
2474+
},
2475+
},
24422476
}
24432477
for _, tt := range tests {
24442478
t.Run(tt.name, func(t *testing.T) {

abi/messages.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ The list below contains the supported message operations, their names and opcode
4242
| BidaskSwapV2| 0x87d36990 |
4343
| BidaskSwapV2| 0x87d36990 |
4444
| Bounce| 0xffffffff |
45+
| BounceV2| 0xfffffffe |
4546
| ChallengeQuarantinedChannelState| 0x088eaa32 |
4647
| ChangeDnsRecord| 0x4eb1f0f9 |
4748
| ChannelClosed| 0xdddc88ba |

abi/messages_generated.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,8 @@ var (
561561
decodeFuncElectorRecoverStakeResponseMsgBody = decodeMsg(tlb.Tag{Val: 0xf96f7324, Len: 32}, ElectorRecoverStakeResponseMsgOp, ElectorRecoverStakeResponseMsgBody{})
562562
// 0xfb88e119
563563
decodeFuncJettonClaimAdminMsgBody = decodeMsg(tlb.Tag{Val: 0xfb88e119, Len: 32}, JettonClaimAdminMsgOp, JettonClaimAdminMsgBody{})
564+
// 0xfffffffe
565+
decodeFuncBounceV2MsgBody = decodeMsg(tlb.Tag{Val: 0xfffffffe, Len: 32}, BounceV2MsgOp, BounceV2MsgBody{})
564566
// 0xffffffff
565567
decodeFuncBounceMsgBody = decodeMsg(tlb.Tag{Val: 0xffffffff, Len: 32}, BounceMsgOp, BounceMsgBody{})
566568
)
@@ -1404,6 +1406,9 @@ var opcodedMsgInDecodeFunctions = map[uint32]msgDecoderFunc{
14041406
// 0xfb88e119
14051407
JettonClaimAdminMsgOpCode: decodeFuncJettonClaimAdminMsgBody,
14061408

1409+
// 0xfffffffe
1410+
BounceV2MsgOpCode: decodeFuncBounceV2MsgBody,
1411+
14071412
// 0xffffffff
14081413
BounceMsgOpCode: decodeFuncBounceMsgBody,
14091414
}
@@ -1686,6 +1691,7 @@ const (
16861691
CoffeeStakingDepositMsgOp MsgOpName = "CoffeeStakingDeposit"
16871692
ElectorRecoverStakeResponseMsgOp MsgOpName = "ElectorRecoverStakeResponse"
16881693
JettonClaimAdminMsgOp MsgOpName = "JettonClaimAdmin"
1694+
BounceV2MsgOp MsgOpName = "BounceV2"
16891695
BounceMsgOp MsgOpName = "Bounce"
16901696
)
16911697

@@ -1967,6 +1973,7 @@ const (
19671973
CoffeeStakingDepositMsgOpCode MsgOpCode = 0xf9471134
19681974
ElectorRecoverStakeResponseMsgOpCode MsgOpCode = 0xf96f7324
19691975
JettonClaimAdminMsgOpCode MsgOpCode = 0xfb88e119
1976+
BounceV2MsgOpCode MsgOpCode = 0xfffffffe
19701977
BounceMsgOpCode MsgOpCode = 0xffffffff
19711978
)
19721979

@@ -3856,6 +3863,14 @@ type JettonClaimAdminMsgBody struct {
38563863
QueryId uint64
38573864
}
38583865

3866+
type BounceV2MsgBody struct {
3867+
OriginalBody tlb.Any `tlb:"^"`
3868+
OriginalInfo NewBounceOriginalInfo `tlb:"^"`
3869+
BouncedByPhase uint8
3870+
ExitCode int32
3871+
ComputePhase *NewBounceComputePhaseInfo `tlb:"maybe"`
3872+
}
3873+
38593874
type BounceMsgBody struct {
38603875
Payload tlb.Any
38613876
}
@@ -4138,6 +4153,7 @@ var KnownMsgInTypes = map[string]any{
41384153
CoffeeStakingDepositMsgOp: CoffeeStakingDepositMsgBody{},
41394154
ElectorRecoverStakeResponseMsgOp: ElectorRecoverStakeResponseMsgBody{},
41404155
JettonClaimAdminMsgOp: JettonClaimAdminMsgBody{},
4156+
BounceV2MsgOp: BounceV2MsgBody{},
41414157
BounceMsgOp: BounceMsgBody{},
41424158
}
41434159

abi/schemas/known.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
<abi>
2+
<types>
3+
_ value:CurrencyCollection created_lt:uint64 created_at:uint32 = NewBounceOriginalInfo;
4+
_ gas_used:uint32 vm_steps:uint32 = NewBounceComputePhaseInfo;
5+
</types>
26

37
<!-- Internal messages -->
48
<internal name="bounce">
59
bounce_message#ffffffff payload:Cell = InternalMsgBody;
610
</internal>
711

12+
<internal name="bounce_v2">
13+
new_bounce_body#fffffffe original_body:^Cell original_info:^NewBounceOriginalInfo bounced_by_phase:uint8 exit_code:int32 compute_phase:(Maybe NewBounceComputePhaseInfo) = InternalMsgBody;
14+
</internal>
15+
816
<!-- Text -->
917
<internal name="text_comment">
1018
text_comment#00000000 text:Text = InternalMsgBody;

abi/types.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package abi
55
import (
66
"encoding/json"
77
"fmt"
8-
98
"github.com/tonkeeper/tongo/tlb"
109
)
1110

@@ -223,6 +222,17 @@ func (t *JettonForceAction) MarshalJSON() ([]byte, error) {
223222
}
224223
}
225224

225+
type NewBounceComputePhaseInfo struct {
226+
GasUsed uint32
227+
VmSteps uint32
228+
}
229+
230+
type NewBounceOriginalInfo struct {
231+
Value tlb.CurrencyCollection
232+
CreatedLt uint64
233+
CreatedAt uint32
234+
}
235+
226236
type TonstakersControllerData struct {
227237
ControllerId uint32
228238
Validator tlb.MsgAddress

tlb/messages.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ type CommonMsgInfo struct {
104104
Src MsgAddress
105105
Dest MsgAddress
106106
Value CurrencyCollection
107-
IhrFee Grams
107+
IhrFee VarUInteger16
108108
FwdFee Grams
109109
CreatedLt uint64
110110
CreatedAt uint32

tontest/helpers.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package tontest
33
import (
44
"crypto/rand"
55
"fmt"
6+
"math/big"
67
"time"
78

89
"github.com/tonkeeper/tongo/boc"
@@ -266,7 +267,7 @@ func (b messageBuilder) Message() (tlb.Message, error) {
266267
Src tlb.MsgAddress
267268
Dest tlb.MsgAddress
268269
Value tlb.CurrencyCollection
269-
IhrFee tlb.Grams
270+
IhrFee tlb.VarUInteger16
270271
FwdFee tlb.Grams
271272
CreatedLt uint64
272273
CreatedAt uint32
@@ -277,7 +278,7 @@ func (b messageBuilder) Message() (tlb.Message, error) {
277278
Src: b.from.ToMsgAddress(),
278279
Dest: b.to.ToMsgAddress(),
279280
Value: tlb.CurrencyCollection{Grams: b.value},
280-
IhrFee: 0,
281+
IhrFee: tlb.VarUInteger16(*big.NewInt(0)),
281282
FwdFee: 0,
282283
CreatedLt: 100500,
283284
CreatedAt: uint32(time.Now().Unix())}

wallet/models.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"fmt"
66
"github.com/tonkeeper/tongo/utils"
7+
"math/big"
78
"time"
89

910
"github.com/tonkeeper/tongo/boc"
@@ -210,7 +211,7 @@ func (m SimpleTransfer) ToInternal() (message tlb.Message, mode uint8, err error
210211
Src tlb.MsgAddress
211212
Dest tlb.MsgAddress
212213
Value tlb.CurrencyCollection
213-
IhrFee tlb.Grams
214+
IhrFee tlb.VarUInteger16
214215
FwdFee tlb.Grams
215216
CreatedLt uint64
216217
CreatedAt uint32
@@ -219,6 +220,7 @@ func (m SimpleTransfer) ToInternal() (message tlb.Message, mode uint8, err error
219220
Bounce: m.Bounceable,
220221
Src: (*ton.AccountID)(nil).ToMsgAddress(),
221222
Dest: m.Address.ToMsgAddress(),
223+
IhrFee: tlb.VarUInteger16(*big.NewInt(0)),
222224
}
223225
info.IntMsgInfo.Value.Grams = m.Amount
224226
for k, v := range m.ExtraCurrency {
@@ -263,7 +265,7 @@ func (m Message) ToInternal() (message tlb.Message, mode uint8, err error) {
263265
Src tlb.MsgAddress
264266
Dest tlb.MsgAddress
265267
Value tlb.CurrencyCollection
266-
IhrFee tlb.Grams
268+
IhrFee tlb.VarUInteger16
267269
FwdFee tlb.Grams
268270
CreatedLt uint64
269271
CreatedAt uint32
@@ -272,6 +274,7 @@ func (m Message) ToInternal() (message tlb.Message, mode uint8, err error) {
272274
Bounce: m.Bounce,
273275
Src: (*ton.AccountID)(nil).ToMsgAddress(),
274276
Dest: m.Address.ToMsgAddress(),
277+
IhrFee: tlb.VarUInteger16(*big.NewInt(0)),
275278
}
276279
info.IntMsgInfo.Value.Grams = m.Amount
277280

0 commit comments

Comments
 (0)