Skip to content

Contract fails with error {"CompilationError":{"PrepareError":"Deserialization"}}} #225

@fadeevab

Description

@fadeevab

I'm trying to build, deploy, and run a simple project (https://github.com/NEARFoundation/near-smart-contract-rust-template) on near-workspaces JS.

Deployment code snippet:

  // Deploy passes successfully
  const contract = await root.devDeploy(config.wasmPath, {
    initialBalance: NEAR.parse('30 N').toJSON(),
  });

  // Throws an ERROR
  await owner.call(contract, 'new', { owner_id: owner.accountId });

I get the following error on a function call:

Click me for more error logs
  "result": {
    "receipts_outcome": [
      {
        "block_hash": "3zbHTEui45Hf9WJCh5yw6UN7PDw2Exb4VJeTRfbhYLZJ",
        "id": "BjooygTASH8QEazVHx1buA2QWY2QEzzXvG7nupZeqRfn",
        "outcome": {
          "executor_id": "dev-83854-55840.test.near",
          "gas_burnt": 2427994785822,
          "logs": [],
          "metadata": {
            "gas_profile": [],
            "version": 1
          },
          "receipt_ids": [
            "4JNTEHbG2q3U4qfGNQ7euTpQkrk68jr8CWDYCAhjB8nd"
          ],
          "status": {
            "Failure": {
              "ActionError": {
                "index": 0,
                "kind": {
                  "FunctionCallError": {
                    "CompilationError": {
                      "PrepareError": "Deserialization"
                    }
                  }
                }
              }
            }
          },
          "tokens_burnt": "242799478582200000000"
        },
        "proof": []
      },
      {
        "block_hash": "9kAMfdUEKhSyy71pvT3Fdp3AtUjs3erV9H6jb6siTZZb",
        "id": "4JNTEHbG2q3U4qfGNQ7euTpQkrk68jr8CWDYCAhjB8nd",
        "outcome": {
          "executor_id": "owner.test.near",
          "gas_burnt": 223182562500,
          "logs": [],
          "metadata": {
            "gas_profile": [],
            "version": 1
          },
          "receipt_ids": [],
          "status": {
            "SuccessValue": ""
          },
          "tokens_burnt": "0"
        },
        "proof": []
      }
    ],
    "status": {
      "Failure": {
        "ActionError": {
          "index": 0,
          "kind": {
            "FunctionCallError": {
              "CompilationError": {
                "PrepareError": "Deserialization"
              }
            }
          }
        }
      }
    },
    "transaction": {
      "actions": [
        {
          "FunctionCall": {
            "args": "eyJvd25lcl9pZCI6Im93bmVyLnRlc3QubmVhciJ9",
            "deposit": "0",
            "gas": 30000000000000,
            "method_name": "new"
          }
        }
      ],
      "hash": "6ZmhkZAod8eStQdPEZEDPWaLp29yseeTXKVzP7u5hoqC",
      "nonce": 2000001,
      "public_key": "ed25519:6iS8Hs33NS2A4aph7u7qt7j3yq3qh15hFSaG1jEWYoqs",
      "receiver_id": "dev-83854-55840.test.near",
      "signature": "ed25519:3JG6Hts53K45G9TsZJcQjpeqERC2rAEryBBcrkMXeNRfCmMsgxxgUxtMpH6CYg93LeRVr52BrZbP6B8DypyVwzTk",
      "signer_id": "owner.test.near"
    },
    "transaction_outcome": {
      "block_hash": "AJ6Vk6YSU2uYLTBzpmYLBBcN2HNR6ZW32SUTPuNZHwpT",
      "id": "6ZmhkZAod8eStQdPEZEDPWaLp29yseeTXKVzP7u5hoqC",
      "outcome": {
        "executor_id": "owner.test.near",
        "gas_burnt": 2427994785822,
        "logs": [],
        "metadata": {
          "gas_profile": null,
          "version": 1
        },
        "receipt_ids": [
          "BjooygTASH8QEazVHx1buA2QWY2QEzzXvG7nupZeqRfn"
        ],
        "status": {
          "SuccessReceiptId": "BjooygTASH8QEazVHx1buA2QWY2QEzzXvG7nupZeqRfn"
        },
        "tokens_burnt": "242799478582200000000"
      },
      "proof": []
    }
  },
  "startMs": 1700296986086,
  "endMs": 1700296988632,
  "config": {
    "network": "sandbox",
    "rootAccountId": "test.near",
    "rpcAddr": "http://localhost:7433",
    "initialBalance": "100000000000000000000000000",
    "homeDir": "/tmp/sandbox/35b8fc25-8938-4a1b-b074-c7efe1382c5c",
    "port": 7433,
    "rm": false,
    "refDir": null
  }
"FunctionCallError": {
  "CompilationError": {
    "PrepareError": "Deserialization"
  }
}

Cargo.toml:

[package]
# ...

[dependencies]
near-contract-standards = "4.1.1"
near-sdk = "4.1.1"
near-sdk-contract-tools = "2.1.0"

[lib]
crate-type = ["cdylib"]

[profile.release]
codegen-units = 1
debug = false
lto = true
opt-level = "z"
overflow-checks = true
panic = "abort"

# ...

Toolchain versions I tried:

  1. 1.70
  2. 1.74

NOTE: near dev-deploy on the actual testnet works fine.
NOTE2: Smart contract successfully deploys on the "near-sandbox": "^0.0.17".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions