You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary or problem description calculatenetworkfee RPC method can provide transaction with partially-filled witnesses to Wallet.CalculateNetworkFee. But in case of contract-based witness verification, only a contract verification script will be used, although we can easily get invocation script from the provided transaction witnesses.
I.e. here we don't load invocation script and use only contract verification script:
// Check verify cost
using ApplicationEngine engine = ApplicationEngine.Create(TriggerType.Verification, tx, snapshot.CreateSnapshot(), settings: ProtocolSettings);
engine.LoadContract(contract, md, CallFlags.ReadOnly);
if (engine.Execute() == VMState.FAULT) throw new ArgumentException($"Smart contract {contract.Hash} verification fault.");
if (!engine.ResultStack.Pop().GetBoolean()) throw new ArgumentException($"Smart contract {contract.Hash} returns false.");
networkFee += engine.GasConsumed;
As a result, if the contract-based witness requires arguments for verify method (i.e. has non-zero invocation script), then we can't calculate network fee for this witness.
Do you have any solution you want to propose?
Lat's use invocation script from the provided transaction's witness for contract-based verification inside Wallet.CalculateNetworkFee:
// Check verify cost
using ApplicationEngine engine = ApplicationEngine.Create(TriggerType.Verification, tx, snapshot.CreateSnapshot(), settings: ProtocolSettings);
engine.LoadContract(contract, md, CallFlags.ReadOnly);
engine.LoadScript(tx.Witnesses[i].InvocationScript, configureState: p => p.CallFlags = CallFlags.None);
if (engine.Execute() == VMState.FAULT) throw new ArgumentException($"Smart contract {contract.Hash} verification fault.");
if (!engine.ResultStack.Pop().GetBoolean()) throw new ArgumentException($"Smart contract {contract.Hash} returns false.");
networkFee += engine.GasConsumed;
Neo Version
Neo 3
Where in the software does this update applies to?
RPC (HTTP): calculatenetworkfee method
The text was updated successfully, but these errors were encountered:
Summary or problem description
calculatenetworkfee
RPC method can provide transaction with partially-filled witnesses to Wallet.CalculateNetworkFee. But in case of contract-based witness verification, only a contract verification script will be used, although we can easily get invocation script from the provided transaction witnesses.I.e. here we don't load invocation script and use only contract verification script:
As a result, if the contract-based witness requires arguments for
verify
method (i.e. has non-zero invocation script), then we can't calculate network fee for this witness.Do you have any solution you want to propose?
Lat's use invocation script from the provided transaction's witness for contract-based verification inside Wallet.CalculateNetworkFee:
Neo Version
Where in the software does this update applies to?
calculatenetworkfee
methodThe text was updated successfully, but these errors were encountered: