Illegal operations and penalties
Illegal operation
The illegal operation/invalid operation code compiled from the smart contract not only cannot be deployed/executed, but also generates a full fine of fee_limit. Users usually set the cost limit to 1000VS (upper limit), so this is a strong penalty; if the user tries to automatically retry the operation, the cost will be higher.
There are two common forms of triggering invalid action codes:
The user manually attempts to insert any invalid operation code into the smart contract bytecode.
The user uses a newer compiler before the new operation code is supported. Especially in the previous example, in the "VRC-10 token transfer in a smart contract" getAllowVvmTransferVrc10, if the user happens to be using the experience compiler to deploy/execute the smart contract, the full fine of fee_limit will be removed from the user account deduct.
pragma solidity ^0.4.24;
contract transferTokenContract {
constructor() payable public{}
function() payable public{}
function transferTokenTest(address toAddress, uint256 tokenValue, vrcToken id) payable public {
require(id > 100000);
toAddress.transferToken(tokenValue, id);
}
function msgTokenValueAndTokenIdTest() public payable returns (vrcToken, uint256) {
vrcToken id = msg.tokenid;
uint256 value = msg.tokenvalue;
return (id, value);
}
function getTokenBalanceTest(address accountAddress) payable public returns (uint256) {
vrcToken id = 100001;
require(id > 100000);
return accountAddress.tokenBalance(id);
}
}
In the above example, transferToken is mapped to opcode 0xd0, tokenBalance is mapped to opcode 0xd1, msg.tokenid is mapped to opcode 0xd2, and msg.tokenvalue is mapped to opcode 0xd3. If the user uses any of these functions before the network activates the new VRC-10 transfer proposal, VVM will reject this operation and penalize the entire fee_limit.
The normal operation is to always use the latest VisionWeb/VisionBox to compile/deploy/execute the contract. When the user switches between the test network and the main network, all contracts must be recompiled to prevent different network parameters from defining different effective operating code sets.
Updated about 3 years ago