From 46eff13cf43551d98f574369dc3985f8f9f9fc77 Mon Sep 17 00:00:00 2001 From: Qiang Zhou Date: Wed, 31 Jan 2024 15:07:10 +0800 Subject: [PATCH] update randata Signed-off-by: Qiang Zhou --- cairoVM/cairo.go | 1 - cairoVM/invoke.go | 10 ++++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/cairoVM/cairo.go b/cairoVM/cairo.go index 915263b..bd31a0f 100644 --- a/cairoVM/cairo.go +++ b/cairoVM/cairo.go @@ -127,7 +127,6 @@ func (c *Cairo) HandleDeclareTx(tx *core.DeclareTransaction, class core.Class) ( } func (c *Cairo) HandleInvokeTx(tx *core.InvokeTransaction) (*vm.TransactionTrace, error) { - tx.Nonce = &felt.Zero tx.MaxFee = c.MaxFee tx.SenderAddress = &felt.Zero txnHash, err := core.TransactionHash(tx, c.cfg.Network) diff --git a/cairoVM/invoke.go b/cairoVM/invoke.go index d717e4d..d1ea176 100644 --- a/cairoVM/invoke.go +++ b/cairoVM/invoke.go @@ -21,10 +21,7 @@ func NewInvoke() (*core.InvokeTransaction, error) { // Converting the contractAddress from hex to felt contractAddress := new(felt.Felt).SetUint64(2) - randata, err := utils.HexToFelt("0x9184e72a000") - if err != nil { - panic(err.Error()) - } + randata := new(felt.Felt).SetUint64(2) // Building the functionCall struct, where : FnCall := rpc.FunctionCall{ ContractAddress: contractAddress, //contractAddress is the contract that we want to call @@ -34,13 +31,14 @@ func NewInvoke() (*core.InvokeTransaction, error) { InvokeTx.Calldata = account.FmtCalldataCairo2([]rpc.FunctionCall{FnCall}) + nonce := new(felt.Felt).SetUint64(1) tx := core.InvokeTransaction{ - Nonce: &felt.Zero, + Nonce: nonce, MaxFee: &felt.Zero, Version: new(core.TransactionVersion).SetUint64(1), ContractAddress: contractAddress, EntryPointSelector: utils.GetSelectorFromNameFelt(contractMethod), - CallData: InvokeTx.Calldata, + CallData: []*felt.Felt{randata}, } return &tx, nil