Describe the bug
When I use the Storage.CurrentContext for a static field variable in a smart contract I cannot successfully call the calculatenetworkfee RPC method with a transaction that withdraws tokens from that contract.
To Reproduce
- Run a Neo network based on the Neo3-preview5 release.
- Create, compile, and deploy a simple dummy smart contract like the following one:
class DotnetContract : SmartContract
{
private static StorageContext sc = Storage.CurrentContext;
public static bool verify() {
return true;
}
public static void onNEP17Payment(UInt160 from, int amount, object data) {
return;
}
}
- Send some GAS to the contract's address.
- Create a transaction withdrawing GAS from the contract (make sure to attach the correct witnesses).
- Send the transaction hex with the
calculatenetworkfee RPC method to a neo-node in your network.
- Should return the following error: "Smart contract {contract.Hash} verification fault."
Do the same but without the static StorageContext variable. Then it should work.
Expected behavior
Calling the calculatenetworkfee method with a transaction that withdraws tokens from a contract successfully calls the verify method and ends in VM state HALT even if the contract uses Storage.CurrentContext for a static field variable.
Describe the bug
When I use the
Storage.CurrentContextfor a static field variable in a smart contract I cannot successfully call thecalculatenetworkfeeRPC method with a transaction that withdraws tokens from that contract.To Reproduce
calculatenetworkfeeRPC method to a neo-node in your network.Do the same but without the static
StorageContextvariable. Then it should work.Expected behavior
Calling the calculatenetworkfee method with a transaction that withdraws tokens from a contract successfully calls the verify method and ends in VM state HALT even if the contract uses
Storage.CurrentContextfor a static field variable.