Skip to content

Commit

Permalink
Fix CallFromNativeContract (neo-project#2159)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikzhang authored and Shawn committed Jan 8, 2021
1 parent 3bde341 commit 3ac01df
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/neo/SmartContract/ApplicationEngine.Contract.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,14 @@ protected internal void CallContract(UInt160 contractHash, string method, Array

protected internal void CallContractEx(UInt160 contractHash, string method, Array args, CallFlags callFlags)
{
if (method.StartsWith('_')) throw new ArgumentException($"Invalid Method Name: {method}");
if ((callFlags & ~CallFlags.All) != 0)
throw new ArgumentOutOfRangeException(nameof(callFlags));
CallContractInternal(contractHash, method, args, callFlags, ReturnTypeConvention.EnsureNotEmpty);
}

private void CallContractInternal(UInt160 contractHash, string method, Array args, CallFlags flags, ReturnTypeConvention convention)
{
if (method.StartsWith('_')) throw new ArgumentException($"Invalid Method Name: {method}");

ContractState contract = NativeContract.Management.GetContract(Snapshot, contractHash);
if (contract is null) throw new InvalidOperationException($"Called Contract Does Not Exist: {contractHash}");
ContractMethodDescriptor md = contract.Manifest.Abi.GetMethod(method);
Expand Down
2 changes: 1 addition & 1 deletion src/neo/SmartContract/Native/OracleContract.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ private void Request(ApplicationEngine engine, string url, string filter, string
//Check the arguments
if (Utility.StrictUTF8.GetByteCount(url) > MaxUrlLength
|| (filter != null && Utility.StrictUTF8.GetByteCount(filter) > MaxFilterLength)
|| Utility.StrictUTF8.GetByteCount(callback) > MaxCallbackLength
|| Utility.StrictUTF8.GetByteCount(callback) > MaxCallbackLength || callback.StartsWith('_')
|| gasForResponse < 0_10000000)
throw new ArgumentException();

Expand Down

0 comments on commit 3ac01df

Please sign in to comment.