Skip to content

Commit 640eb69

Browse files
committed
fix compare
1 parent 0546904 commit 640eb69

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

solana/mvm.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ import (
1111
"time"
1212

1313
"github.com/MixinNetwork/bot-api-go-client/v3"
14+
solanaApp "github.com/MixinNetwork/computer/apps/solana"
15+
"github.com/MixinNetwork/computer/store"
1416
mc "github.com/MixinNetwork/mixin/common"
1517
"github.com/MixinNetwork/mixin/crypto"
1618
"github.com/MixinNetwork/mixin/logger"
1719
"github.com/MixinNetwork/mixin/util/base58"
1820
"github.com/MixinNetwork/safe/apps/mixin"
19-
solanaApp "github.com/MixinNetwork/computer/apps/solana"
2021
"github.com/MixinNetwork/safe/common"
21-
"github.com/MixinNetwork/computer/store"
2222
"github.com/MixinNetwork/safe/mtg"
2323
"github.com/gagliardetto/solana-go"
2424
"github.com/gofrs/uuid/v5"
@@ -512,7 +512,7 @@ func (node *Node) processConfirmCall(ctx context.Context, req *store.Request) ([
512512
}
513513
outputs = os
514514

515-
post, err = node.getPostProcessCall(ctx, req, call, extra[n*64:])
515+
post, err = node.getPostProcessCall(ctx, req, flag, call, extra[n*64:])
516516
logger.Printf("node.getPostProcessCall(%v %v) => %v %v", req, call, post, err)
517517
if err != nil {
518518
return node.failRequest(ctx, req, "")
@@ -568,7 +568,7 @@ func (node *Node) processConfirmCall(ctx context.Context, req *store.Request) ([
568568
}
569569

570570
var session *store.Session
571-
post, err := node.getPostProcessCall(ctx, req, call, extra[16:])
571+
post, err := node.getPostProcessCall(ctx, req, flag, call, extra[16:])
572572
logger.Printf("node.getPostProcessCall(%v %v) => %v %v", req, call, post, err)
573573
if err != nil {
574574
return node.failRequest(ctx, req, "")

solana/system_call.go

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ import (
88
"math/big"
99
"slices"
1010

11+
solanaApp "github.com/MixinNetwork/computer/apps/solana"
12+
"github.com/MixinNetwork/computer/store"
1113
mc "github.com/MixinNetwork/mixin/common"
1214
"github.com/MixinNetwork/mixin/crypto"
1315
"github.com/MixinNetwork/mixin/logger"
14-
solanaApp "github.com/MixinNetwork/computer/apps/solana"
1516
"github.com/MixinNetwork/safe/common"
16-
"github.com/MixinNetwork/computer/store"
1717
"github.com/gagliardetto/solana-go"
1818
"github.com/gofrs/uuid/v5"
1919
"github.com/shopspring/decimal"
@@ -214,7 +214,7 @@ func (node *Node) getSystemCallFeeFromXIN(ctx context.Context, call *store.Syste
214214
}, nil
215215
}
216216

217-
func (node *Node) getPostProcessCall(ctx context.Context, req *store.Request, call *store.SystemCall, data []byte) (*store.SystemCall, error) {
217+
func (node *Node) getPostProcessCall(ctx context.Context, req *store.Request, flag byte, call *store.SystemCall, data []byte) (*store.SystemCall, error) {
218218
if call.Type != store.CallTypeMain || len(data) == 0 {
219219
return nil, nil
220220
}
@@ -247,10 +247,16 @@ func (node *Node) getPostProcessCall(ctx context.Context, req *store.Request, ca
247247
panic(fmt.Errorf("node.GetSystemCallReferenceTxs(%s) => %v", call.RequestId, err))
248248
}
249249
ras := node.GetSystemCallRelatedAsset(ctx, os)
250-
err = node.comparePostCallWithSolanaTx(ctx, ras, tx, call.Hash.String, user.ChainAddress)
251-
logger.Printf("node.comparePostCallWithSolanaTx(%s %s) => %v", call.Hash.String, user.ChainAddress, err)
252-
if err != nil {
253-
return nil, err
250+
251+
switch flag {
252+
case FlagConfirmCallSuccess:
253+
err = node.comparePostCallWithSolanaTx(ctx, ras, tx, call.Hash.String, user.ChainAddress)
254+
logger.Printf("node.comparePostCallWithSolanaTx(%s %s) => %v", call.Hash.String, user.ChainAddress, err)
255+
if err != nil {
256+
return nil, err
257+
}
258+
case FlagConfirmCallFail:
259+
// TODO compare with user outputs
254260
}
255261
return post, nil
256262
}

0 commit comments

Comments
 (0)