Testnet Kleverscan Bug

Here is a bug in Kleverscan:

I create a transaction - SmartContract, Invoke and load the ABI.

Then it shows me the 2 arguments. bet_id and result, but when I want to set the result to False, it doesn’t want to create the transaction because it assumes it must be True. In my opinion this is a bug.

Part of ABI

{
            "name": "setOracleResult",
            "mutability": "mutable",
            "inputs": [
                {
                    "name": "bet_id",
                    "type": "u32"
                },
                {
                    "name": "result",
                    "type": "bool"
                }
            ],
            "outputs": []
        }
2 Likes

Tks @CryptoJaeger the kleverscan team will evaluate it. I circle back to you.

FYI @Marcel_Assis @Samuel_Facanha_Marti

2 Likes

Hey @CryptoJaeger
Could you test it now?

FYI @Duka

1 Like

No, it doesn’t work yet. If I set the CheckBox to False and then to CreateTransaction, it automatically scrolls up to the checkbox. See the video.

testnet

Hi @CryptoJaeger
Please clear your cache and reload the screen.
I saw in your screenshot that it’s not the new version.
In the new version, the checkbox is not required.

Thank you. Problem solved. :pray:

2 Likes

Is there any news about the upgrade contract function? So far only Deploy and Invoke work.

@Moises_Abraao @Duka

Hello mate, this feature is on pipe of the Kleverscan team, I circle back to u when done. BTW we’ve updated the IDE extension, have you checked it already? You will be able to upgrade your contract by IDE extension meanwhile

So I don’t see any update in the Klever IDE extension in VS-Code. The problem is still the same. I also think that you should not enter the owner address for the upgrade, but rather the contract address. Anyway, I have tried both. Here is the result. A spinning circle.

upgrade

Identifier

klever-org.vscode-kvm-ide

Version

1.0.10

Last Updated

2025-02-21, 06:50:45

Size

1012.63KB

Marketplace

Published

2024-03-08, 14:57:45

Last Released

2025-02-20, 20:32:22

We’re checking, circle back soon…

Hello @CryptoJaeger!

Can you help me with some additional info?

:one: Is deployment working fine on your current version (1.0.10)? Aside from the upgrade issue you mentioned, does deploy function as expected?

:two: Regarding the endless spinning circle, could you please provide the logs from the extension?

To get the logs:

  • First, reproduce the error.
  • Once the spinning circle appears, open the Output tab in VSCode and select “Klever Blockchain” on the right. (See screenshot below)

If this Output bar isn’t visible in your VSCode, you can enable it by:
:backhand_index_pointing_right: Clicking View -> Output in the main menu of your IDE.

Select Build-Contract with success, but the output says, can not build contract.

(1/1)
In \\?\C:\Users\Marco\Documents\KLV-Workplace\chain\chain\meta
Calling `cargo run build`
   Compiling chain v0.0.0 (C:\Users\Marco\Documents\KLV-Workplace\chain\chain)
   Compiling chain-meta v0.0.0 (C:\Users\Marco\Documents\KLV-Workplace\chain\chain\meta)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 15.50s
     Running `\\?\C:\Users\Marco\Documents\KLV-Workplace\chain\chain\target\debug\chain-meta.exe build`
Warning: wasm-opt not installed
Warning: wasm-objdump not installed
Building chain.wasm in \\?\C:\Users\Marco\Documents\KLV-Workplace\chain\chain\wasm ...
RUSTFLAGS="-C link-arg=-s -C link-arg=-zstack-size=131072" cargo build --target=wasm32-unknown-unknown --release
   Compiling chain-wasm v0.0.0 (C:\Users\Marco\Documents\KLV-Workplace\chain\chain\wasm)
    Finished `release` profile [optimized] target(s) in 4.13s
Copying ../wasm/target/wasm32-unknown-unknown/release/chain_wasm.wasm to ../output/chain.wasm ...
Packing ../output/chain.kleversc.json ...
Contract size: 47779 bytes.

So far I have always deployed directly via testnet.kleverscan.org and the contract has been running for quite a while, but in the menu it would be practical to do an upgrade and throws this error:

Output:

ERROR [2025-03-06T06:06:54.203Z]: Could not build Smart Contract
Error: Could not build Smart Contract
	at Object.<anonymous> (c:\Users\Marco\.vscode\extensions\klever-org.vscode-kvm-ide-1.0.10\dist\extension.js:2:96961)
	at Generator.next (<anonymous>)
	at c:\Users\Marco\.vscode\extensions\klever-org.vscode-kvm-ide-1.0.10\dist\extension.js:2:86358
	at new Promise (<anonymous>)
	at n (c:\Users\Marco\.vscode\extensions\klever-org.vscode-kvm-ide-1.0.10\dist\extension.js:2:86103)
	at t.manageContract (c:\Users\Marco\.vscode\extensions\klever-org.vscode-kvm-ide-1.0.10\dist\extension.js:2:92132)
	at c:\Users\Marco\.vscode\extensions\klever-org.vscode-kvm-ide-1.0.10\dist\extension.js:2:77498
	at Generator.next (<anonymous>)
	at c:\Users\Marco\.vscode\extensions\klever-org.vscode-kvm-ide-1.0.10\dist\extension.js:2:75761
	at new Promise (<anonymous>)
	at n (c:\Users\Marco\.vscode\extensions\klever-org.vscode-kvm-ide-1.0.10\dist\extension.js:2:75506)
	at S (c:\Users\Marco\.vscode\extensions\klever-org.vscode-kvm-ide-1.0.10\dist\extension.js:2:77441)
	at c:\Users\Marco\.vscode\extensions\klever-org.vscode-kvm-ide-1.0.10\dist\extension.js:2:79211
	at mw.h (file:///c:/Users/Marco/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:112:32741)
	at mw.$executeContributedCommand (file:///c:/Users/Marco/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:112:33579)
	at Uy.S (file:///c:/Users/Marco/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:29:114979)
	at Uy.Q (file:///c:/Users/Marco/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:29:114759)
	at Uy.M (file:///c:/Users/Marco/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:29:113848)
	at Uy.L (file:///c:/Users/Marco/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:29:112953)
	at Ah.value (file:///c:/Users/Marco/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:29:111750)
	at D.B (file:///c:/Users/Marco/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:27:2373)
	at D.fire (file:///c:/Users/Marco/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:27:2591)
	at Xn.fire (file:///c:/Users/Marco/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:29:9458)
	at Ah.value (file:///c:/Users/Marco/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:190:13296)
	at D.B (file:///c:/Users/Marco/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:27:2373)
	at D.fire (file:///c:/Users/Marco/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:27:2591)
	at Xn.fire (file:///c:/Users/Marco/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:29:9458)
	at MessagePortMain.<anonymous> (file:///c:/Users/Marco/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:190:11588)
	at MessagePortMain.emit (node:events:518:28)
	at MessagePortMain._internalPort.emit (node:electron/js2c/utility_init:2:2949)

Hmm… Now I see the problem.

To use our IDE extension on Windows, you must run it inside WSL Ubuntu. It looks like you’re running it directly on Windows, which currently lacks the necessary dependencies to communicate with the node.

Solution:

To unlock all the features of your IDE, use WSL2 Ubuntu in windows or run it on a Ubuntu/macOS machine.

Let me know if you need help setting it up!

Even under Ubuntu:

Error: Command failed: KLEVER_NODE=https://node.testnet.klever.finance /home/marco/klever-sdk/koperator --key-file=/home/marco/Klever-Work/extension.pem sc upgrade klv1qqqqqqqqqqqqqpgqguh5mp6ea8cv05dt7m93gryjgqv88eck64fs434ufh   --upgradeable --readable --payable --payableBySC  --wasm="/home/marco/Klever-Work/kex/output/kex.wasm" --await --sign
commit: v1.7.7-0-g343a4339-dirty, error: error creating transaction: validation error: invalid transaction type
try adding a `--help` flag
Error: Command failed: KLEVER_NODE=https://node.testnet.klever.finance /home/marco/klever-sdk/koperator --key-file=/home/marco/Klever-Work/extension.pem sc upgrade klv1v9mcl3m25tymxzs2tu3zztp7y5ceg3yy9z2glj5wykywanf564fsd5djjt   --upgradeable --readable --payable --payableBySC  --wasm="/home/marco/Klever-Work/kex/output/kex.wasm" --await --sign
commit: v1.7.7-0-g343a4339-dirty, error: error creating transaction: validation error: invalid transaction type

I tried it with ContractAddress and OwnerAddress.

Hello @CryptoJaeger,

You just need a version update.

Your logs show commit: 1.7.7, while the latest Testnet version is 1.7.11.

This time, you’ll need to perform some manual operations, but based on our last interactions, we made the new version of the extension able to automatically handle future updates.


:small_blue_diamond: Update Instructions

With these changes, we recommend starting with a clean setup. Follow these steps:

:one: Delete the SDK Folder:

  • Navigate to your SDK location (default: ~/klever-sdk, unless configured otherwise).
  • Delete this folder.

:two: Uninstall the Previous Extension:

  • Remove the old version of the KleverChain IDE extension from VSCode.

:three: Restart VSCode.

:four: Delete Old Workspace Files:

  • Remove any kleverchain.workspace.json files from previous projects.

:five: Install v1.0.10:

  • Add the latest version of the KleverChain IDE extension.

:warning: One More Important Step!

When starting a new project, run the following commands to ensure the correct Rustup version:

rustup override set nightly-2024-06-12
rustup target add wasm32-unknown-unknown

Also, remember to update the wallet address in your extension settings when generating a new wallet. This ensures the faucet functions properly.


Let me know if you need any help during the update! :rocket:

I’d also like to provide an update on Windows support.

I’m working on making it available to everyone, and WSL2 currently seems to be the most promising solution. However, as I’m still testing and experimenting, I haven’t created a tutorial yet for setting it up on Windows.

Once it’s ready, I’ll create a forum topic with detailed instructions.

I just wanted to give you a quick follow-up because you seem to be an active Windows developer, just like I am. So believe me when I say that I’m one of the most interested in having a stable and secure environment for Windows.

2 Likes

I will do that on my Linux machine, but I won’t use it there. Constantly moving the code back and forth. My work machine is on Windows, so it would be really cool if at least testnet.kleverscan.org supported an upgrade.

@Nicollas

I have done all the steps like this. I even deployed the contract on the Windows computer beforehand to see that it works.

Then I did the upgrade in the fresh Linux VS code and it says “OwnerAddress” which I think is wrong. Since I have made around 149 deploys with my OwnerAddress.

It should say “ContractAddress”, right?

In any case. It doesn’t work for me.

Here with OwnerAddress:

Error: Command failed: KLEVER_NODE=https://node.testnet.klever.finance /home/marco/klever-sdk/koperator --key-file=/home/marco/Klever-Work/extension.pem sc upgrade klv1v9mcl3m25tymxzs2tu3zztp7y5ceg3yy9z2glj5wykywanf564fsd5djjt   --upgradeable --readable --payable --payableBySC  --wasm="/home/marco/kleverwork/kex/output/kex.wasm" --await --sign
commit: v1.7.11-0-g4e957dbc-dirty, error: error creating transaction: validation error: invalid argument: upgrade is allowed only for owner - (upgrade is allowed only for owner)
try adding a `--help` flag

Here with ContractAddress:

Error: Command failed: KLEVER_NODE=https://node.testnet.klever.finance /home/marco/klever-sdk/koperator --key-file=/home/marco/Klever-Work/extension.pem sc upgrade klv1qqqqqqqqqqqqqpgq2drh4ptnvdhu458xvdurw0zrkae656nj64fsk3d38l   --upgradeable --readable --payable --payableBySC  --wasm="/home/marco/kleverwork/kex/output/kex.wasm" --await --sign
commit: v1.7.11-0-g4e957dbc-dirty, error: error creating transaction: validation error: invalid argument: VMFunctionNotFound - (invalid function (not found))
try adding a `--help` flag

Hello @CryptoJaeger!

Yes, you are absolutely right—it should indeed say “contractAddress”. I’m updating it right now.

About Your New Error

The good news is that this error should be easy to fix!

When a contract performs an upgrade, it calls its own upgrade function, allowing the code to handle migration, storage updates, and other necessary operations (if necessary).

So when you see the error “invalid function” during a contract update, it means we tried to call the upgrade function, but it wasn’t found in your contract.

Solution: Implement an Upgrade Function

To fix this, simply add an upgrade function to your contract.

Example 1: Declaring an empty upgrade function

#[upgrade]
fn upgrade(&self) {}

Example 2: Upgrade function with an argument

#[upgrade]
fn upgrade(&self, example_argument: BigUint) {
    // your code
}

Let me know if you need further clarification! :rocket:

2 Likes

Thats easy. Copy & Paste. :sweat_smile:

Thank you @Nicollas :flexed_biceps:

1 Like