Skip to content

Commit

Permalink
Fix compilation bug (#444)
Browse files Browse the repository at this point in the history
* [RpcServer] Querying contracts by ID/name (#378)

* fixed-bug-1021

* Update src/RpcServer/RpcServer.SmartContract.cs

* 😂

* draft

* draft

* update

* fixed bug with decimal of GAS consumed in invokefunction/invokescript

* remove modify of invokescript

* Querying contracts by ID/name, server side

* update

* Enable using native.name for search

Enable using native.name for search

* Using keyword instead of addressOrScriptHash

* revert

* _initialize

* split

* update

* Update exception message in ApplicationLog

* Update src/ApplicationLogs/LogReader.cs

Co-authored-by: Luchuan <luchuan@ngd.neo.org>

* update

* a

* More fix

* fix

* Fixed UT

* Simplify Code

* Simplify Code 2

* Update RpcServer

* update

Co-authored-by: Shargon <shargon@gmail.com>
Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com>
Co-authored-by: superboyiii <573504781@qq.com>
Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>
Co-authored-by: Luchuan <luchuan@ngd.neo.org>

* MPT in StateService from core (#410)

* Unify GetUnclaimedGas and GetWalletUnclaimedGas with decimal (#413)

* Unify GetUnclaimedGas and GetWalletUnclaimedGas with decimal

* fix

* Fixed UT (Neo CI01089) (#416)

* [RpcServer] Querying contracts by ID/name (#378)

* fixed-bug-1021

* Update src/RpcServer/RpcServer.SmartContract.cs

* 😂

* draft

* draft

* update

* fixed bug with decimal of GAS consumed in invokefunction/invokescript

* remove modify of invokescript

* Querying contracts by ID/name, server side

* update

* Enable using native.name for search

Enable using native.name for search

* Using keyword instead of addressOrScriptHash

* revert

* _initialize

* split

* update

* Update exception message in ApplicationLog

* Update src/ApplicationLogs/LogReader.cs

Co-authored-by: Luchuan <luchuan@ngd.neo.org>

* update

* a

* More fix

* fix

* Fixed UT

* Simplify Code

* Simplify Code 2

* Update RpcServer

* update

Co-authored-by: Shargon <shargon@gmail.com>
Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com>
Co-authored-by: superboyiii <573504781@qq.com>
Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>
Co-authored-by: Luchuan <luchuan@ngd.neo.org>

* MPT in StateService from core (#410)

* Unify GetUnclaimedGas and GetWalletUnclaimedGas with decimal (#413)

* Unify GetUnclaimedGas and GetWalletUnclaimedGas with decimal

* fix

* Fixed UT (Neo CI01089)

Co-authored-by: Shargon <shargon@gmail.com>
Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com>
Co-authored-by: superboyiii <573504781@qq.com>
Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>
Co-authored-by: Luchuan <luchuan@ngd.neo.org>
Co-authored-by: ZhangTao <ztgoforit@163.com>

* Nep17 (#412)

* [RpcServer] Querying contracts by ID/name (#378)

* fixed-bug-1021

* Update src/RpcServer/RpcServer.SmartContract.cs

* 😂

* draft

* draft

* update

* fixed bug with decimal of GAS consumed in invokefunction/invokescript

* remove modify of invokescript

* Querying contracts by ID/name, server side

* update

* Enable using native.name for search

Enable using native.name for search

* Using keyword instead of addressOrScriptHash

* revert

* _initialize

* split

* update

* Update exception message in ApplicationLog

* Update src/ApplicationLogs/LogReader.cs

Co-authored-by: Luchuan <luchuan@ngd.neo.org>

* update

* a

* More fix

* fix

* Fixed UT

* Simplify Code

* Simplify Code 2

* Update RpcServer

* update

Co-authored-by: Shargon <shargon@gmail.com>
Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com>
Co-authored-by: superboyiii <573504781@qq.com>
Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>
Co-authored-by: Luchuan <luchuan@ngd.neo.org>

* String Substitution

* Modify filename and name methods

* update

* update

* Update src/RpcClient/Models/RpcNep5TokenInfo.cs

Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>

* Update src/RpcClient/Nep17API.cs

Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>

* MPT in StateService from core (#410)

* Unify GetUnclaimedGas and GetWalletUnclaimedGas with decimal (#413)

* Unify GetUnclaimedGas and GetWalletUnclaimedGas with decimal

* fix

* Fixed UT (Neo CI01089)

* Update Nep17API.cs

* Update README.md

Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com>

* update filename

* Fix UT

* Format

* fix

* update

* update UT

* Add Unit Tests

* update

Co-authored-by: Shargon <shargon@gmail.com>
Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com>
Co-authored-by: superboyiii <573504781@qq.com>
Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>
Co-authored-by: Luchuan <luchuan@ngd.neo.org>
Co-authored-by: ZhangTao <ztgoforit@163.com>

* merge

* clear

* Transfer bug fix (#429)

* [RpcServer] Querying contracts by ID/name (#378)

* fixed-bug-1021

* Update src/RpcServer/RpcServer.SmartContract.cs

* 😂

* draft

* draft

* update

* fixed bug with decimal of GAS consumed in invokefunction/invokescript

* remove modify of invokescript

* Querying contracts by ID/name, server side

* update

* Enable using native.name for search

Enable using native.name for search

* Using keyword instead of addressOrScriptHash

* revert

* _initialize

* split

* update

* Update exception message in ApplicationLog

* Update src/ApplicationLogs/LogReader.cs

Co-authored-by: Luchuan <luchuan@ngd.neo.org>

* update

* a

* More fix

* fix

* Fixed UT

* Simplify Code

* Simplify Code 2

* Update RpcServer

* update

Co-authored-by: Shargon <shargon@gmail.com>
Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com>
Co-authored-by: superboyiii <573504781@qq.com>
Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>
Co-authored-by: Luchuan <luchuan@ngd.neo.org>

* MPT in StateService from core (#410)

* Unify GetUnclaimedGas and GetWalletUnclaimedGas with decimal (#413)

* Unify GetUnclaimedGas and GetWalletUnclaimedGas with decimal

* fix

* Fixed UT (Neo CI01089) (#416)

* [RpcServer] Querying contracts by ID/name (#378)

* fixed-bug-1021

* Update src/RpcServer/RpcServer.SmartContract.cs

* 😂

* draft

* draft

* update

* fixed bug with decimal of GAS consumed in invokefunction/invokescript

* remove modify of invokescript

* Querying contracts by ID/name, server side

* update

* Enable using native.name for search

Enable using native.name for search

* Using keyword instead of addressOrScriptHash

* revert

* _initialize

* split

* update

* Update exception message in ApplicationLog

* Update src/ApplicationLogs/LogReader.cs

Co-authored-by: Luchuan <luchuan@ngd.neo.org>

* update

* a

* More fix

* fix

* Fixed UT

* Simplify Code

* Simplify Code 2

* Update RpcServer

* update

Co-authored-by: Shargon <shargon@gmail.com>
Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com>
Co-authored-by: superboyiii <573504781@qq.com>
Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>
Co-authored-by: Luchuan <luchuan@ngd.neo.org>

* MPT in StateService from core (#410)

* Unify GetUnclaimedGas and GetWalletUnclaimedGas with decimal (#413)

* Unify GetUnclaimedGas and GetWalletUnclaimedGas with decimal

* fix

* Fixed UT (Neo CI01089)

Co-authored-by: Shargon <shargon@gmail.com>
Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com>
Co-authored-by: superboyiii <573504781@qq.com>
Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>
Co-authored-by: Luchuan <luchuan@ngd.neo.org>
Co-authored-by: ZhangTao <ztgoforit@163.com>

* Nep17 (#412)

* [RpcServer] Querying contracts by ID/name (#378)

* fixed-bug-1021

* Update src/RpcServer/RpcServer.SmartContract.cs

* 😂

* draft

* draft

* update

* fixed bug with decimal of GAS consumed in invokefunction/invokescript

* remove modify of invokescript

* Querying contracts by ID/name, server side

* update

* Enable using native.name for search

Enable using native.name for search

* Using keyword instead of addressOrScriptHash

* revert

* _initialize

* split

* update

* Update exception message in ApplicationLog

* Update src/ApplicationLogs/LogReader.cs

Co-authored-by: Luchuan <luchuan@ngd.neo.org>

* update

* a

* More fix

* fix

* Fixed UT

* Simplify Code

* Simplify Code 2

* Update RpcServer

* update

Co-authored-by: Shargon <shargon@gmail.com>
Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com>
Co-authored-by: superboyiii <573504781@qq.com>
Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>
Co-authored-by: Luchuan <luchuan@ngd.neo.org>

* String Substitution

* Modify filename and name methods

* update

* update

* Update src/RpcClient/Models/RpcNep5TokenInfo.cs

Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>

* Update src/RpcClient/Nep17API.cs

Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>

* MPT in StateService from core (#410)

* Unify GetUnclaimedGas and GetWalletUnclaimedGas with decimal (#413)

* Unify GetUnclaimedGas and GetWalletUnclaimedGas with decimal

* fix

* Fixed UT (Neo CI01089)

* Update Nep17API.cs

* Update README.md

Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com>

* update filename

* Fix UT

* Format

* fix

* update

* update UT

* Add Unit Tests

* update

Co-authored-by: Shargon <shargon@gmail.com>
Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com>
Co-authored-by: superboyiii <573504781@qq.com>
Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>
Co-authored-by: Luchuan <luchuan@ngd.neo.org>
Co-authored-by: ZhangTao <ztgoforit@163.com>

* merge

* fixed bug

* clear

* UT

* Add a little code coverage

Co-authored-by: Shargon <shargon@gmail.com>
Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com>
Co-authored-by: superboyiii <573504781@qq.com>
Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>
Co-authored-by: Luchuan <luchuan@ngd.neo.org>
Co-authored-by: ZhangTao <ztgoforit@163.com>

* Preview4 (#430)

* Preview4

* Remove syslog in README.md

* dotnet 5.0 (#407)

* CI01123 (#435)

* Fix dotnet5 (#442)

* fixed compiler bug

* Update RpcTestCases.json

* Update RpcTestCases.json

* Update ContractClient.cs

Co-authored-by: 陈志同 <chenzhitong12@hotmail.com>
Co-authored-by: Shargon <shargon@gmail.com>
Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com>
Co-authored-by: superboyiii <573504781@qq.com>
Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>
Co-authored-by: Luchuan <luchuan@ngd.neo.org>
Co-authored-by: ZhangTao <ztgoforit@163.com>
Co-authored-by: Erik Zhang <erik@neo.org>
Co-authored-by: Shine Li <bfshm@qq.com>
  • Loading branch information
10 people committed Dec 29, 2020
1 parent 4057acc commit 52d0d33
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 45 deletions.
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Neo" Version="3.0.0-CI01125" />
<PackageReference Include="Neo" Version="3.0.0-CI01130" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions src/RpcClient/ContractClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public ContractClient(RpcClient rpc, uint? magic = null)
/// <returns></returns>
public Task<RpcInvokeResult> TestInvokeAsync(UInt160 scriptHash, string operation, params object[] args)
{
byte[] script = scriptHash.MakeScript(operation, args);
byte[] script = scriptHash.MakeScript(operation, true, args);
return rpcClient.InvokeScriptAsync(script);
}

Expand All @@ -57,7 +57,7 @@ public async Task<Transaction> CreateDeployContractTxAsync(byte[] nefFile, Contr
byte[] script;
using (ScriptBuilder sb = new ScriptBuilder())
{
sb.EmitAppCall(NativeContract.ContractManagement.Hash, "deploy", nefFile, manifest.ToString());
sb.EmitDynamicCall(NativeContract.ContractManagement.Hash, "deploy", true, nefFile, manifest.ToString());
script = sb.ToArray();
}
UInt160 sender = Contract.CreateSignatureRedeemScript(key.PublicKey).ToScriptHash();
Expand Down
10 changes: 5 additions & 5 deletions src/RpcClient/Nep17API.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ public async Task<BigInteger> TotalSupplyAsync(UInt160 scriptHash)
public async Task<RpcNep17TokenInfo> GetTokenInfoAsync(UInt160 scriptHash)
{
byte[] script = Concat(
scriptHash.MakeScript("symbol"),
scriptHash.MakeScript("decimals"),
scriptHash.MakeScript("totalSupply"));
scriptHash.MakeScript("symbol", true),
scriptHash.MakeScript("decimals", true),
scriptHash.MakeScript("totalSupply", true));

var contractState = await rpcClient.GetContractStateAsync(scriptHash.ToString()).ConfigureAwait(false);
var name = contractState.Manifest.Name;
Expand Down Expand Up @@ -110,7 +110,7 @@ public async Task<Transaction> CreateTransferTxAsync(UInt160 scriptHash, KeyPair
var sender = Contract.CreateSignatureRedeemScript(fromKey.PublicKey).ToScriptHash();
Signer[] signers = new[] { new Signer { Scopes = WitnessScope.CalledByEntry, Account = sender } };

byte[] script = scriptHash.MakeScript("transfer", sender, to, amount, data);
byte[] script = scriptHash.MakeScript("transfer", true, sender, to, amount, data);

TransactionManagerFactory factory = new TransactionManagerFactory(rpcClient, magic);
TransactionManager manager = await factory.MakeTransactionAsync(script, signers).ConfigureAwait(false);
Expand All @@ -137,7 +137,7 @@ public async Task<Transaction> CreateTransferTxAsync(UInt160 scriptHash, int m,
var sender = Contract.CreateMultiSigContract(m, pubKeys).ScriptHash;
Signer[] signers = new[] { new Signer { Scopes = WitnessScope.CalledByEntry, Account = sender } };

byte[] script = scriptHash.MakeScript("transfer", sender, to, amount, data);
byte[] script = scriptHash.MakeScript("transfer", true, sender, to, amount, data);

TransactionManagerFactory factory = new TransactionManagerFactory(rpcClient, magic);
TransactionManager manager = await factory.MakeTransactionAsync(script, signers).ConfigureAwait(false);
Expand Down
6 changes: 3 additions & 3 deletions src/RpcServer/RpcServer.SmartContract.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ private JObject GetVerificationResult(UInt160 scriptHash, ContractParameter[] ar
};

using ApplicationEngine engine = ApplicationEngine.Create(TriggerType.Verification, tx, snapshot.Clone());
engine.LoadContract(contract, methodName, CallFlags.None);
engine.LoadContract(contract, methodName, CallFlags.None, true, 0);

engine.LoadScript(new ScriptBuilder().EmitAppCall(scriptHash, methodName, args).ToArray(), CallFlags.AllowCall);
engine.LoadScript(new ScriptBuilder().EmitDynamicCall(scriptHash, methodName, true, args).ToArray());

JObject json = new JObject();
json["script"] = Convert.ToBase64String(contract.Script);
Expand Down Expand Up @@ -169,7 +169,7 @@ protected virtual JObject InvokeFunction(JArray _params)
byte[] script;
using (ScriptBuilder sb = new ScriptBuilder())
{
script = sb.EmitAppCall(script_hash, operation, args).ToArray();
script = sb.EmitDynamicCall(script_hash, operation, true, args).ToArray();
}
return GetInvokeResult(script, signers);
}
Expand Down
27 changes: 27 additions & 0 deletions tests/Neo.Network.RPC.Tests/RpcTestCases.json
Original file line number Diff line number Diff line change
Expand Up @@ -1135,6 +1135,33 @@
}
}
},
{
"Name": "invokescriptasync",
"Request": {
"jsonrpc": "2.0",
"id": 1,
"method": "invokescript",
"params": [
"EBEfDAhkZWNpbWFscwwU++3+LtIiZZK2SMTal7nJzV3BpqZBYn1bUg=="
]
},
"Response": {
"jsonrpc": "2.0",
"id": 1,
"result": {
"script": "EBEfDAhkZWNpbWFscwwU++3+LtIiZZK2SMTal7nJzV3BpqZBYn1bUg==",
"state": "HALT",
"gasconsumed": "0.0099918",
"exception": null,
"stack": [
{
"type": "Integer",
"value": "8"
}
]
}
}
},
{
"Name": "getnewaddressasync",
"Request": {
Expand Down
4 changes: 2 additions & 2 deletions tests/Neo.Network.RPC.Tests/UT_ContractClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void TestSetup()
[TestMethod]
public async Task TestInvoke()
{
byte[] testScript = NativeContract.GAS.Hash.MakeScript("balanceOf", UInt160.Zero);
byte[] testScript = NativeContract.GAS.Hash.MakeScript("balanceOf", true, UInt160.Zero);
UT_TransactionManager.MockInvokeScript(rpcClientMock, testScript, new ContractParameter { Type = ContractParameterType.ByteArray, Value = "00e057eb481b".HexToBytes() });

ContractClient contractClient = new ContractClient(rpcClientMock.Object);
Expand Down Expand Up @@ -55,7 +55,7 @@ public async Task TestDeployContract()
};
using (ScriptBuilder sb = new ScriptBuilder())
{
sb.EmitAppCall(NativeContract.ContractManagement.Hash, "deploy", new byte[1], manifest.ToString());
sb.EmitDynamicCall(NativeContract.ContractManagement.Hash, "deploy", true, new byte[1], manifest.ToString());
script = sb.ToArray();
}

Expand Down
24 changes: 12 additions & 12 deletions tests/Neo.Network.RPC.Tests/UT_Nep17API.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void TestSetup()
[TestMethod]
public async Task TestBalanceOf()
{
byte[] testScript = NativeContract.GAS.Hash.MakeScript("balanceOf", UInt160.Zero);
byte[] testScript = NativeContract.GAS.Hash.MakeScript("balanceOf", true, UInt160.Zero);
UT_TransactionManager.MockInvokeScript(rpcClientMock, testScript, new ContractParameter { Type = ContractParameterType.Integer, Value = new BigInteger(10000) });

var balance = await nep17API.BalanceOfAsync(NativeContract.GAS.Hash, UInt160.Zero);
Expand All @@ -41,7 +41,7 @@ public async Task TestBalanceOf()
[TestMethod]
public async Task TestGetSymbol()
{
byte[] testScript = NativeContract.GAS.Hash.MakeScript("symbol");
byte[] testScript = NativeContract.GAS.Hash.MakeScript("symbol", true);
UT_TransactionManager.MockInvokeScript(rpcClientMock, testScript, new ContractParameter { Type = ContractParameterType.String, Value = NativeContract.GAS.Symbol });

var result = await nep17API.SymbolAsync(NativeContract.GAS.Hash);
Expand All @@ -51,7 +51,7 @@ public async Task TestGetSymbol()
[TestMethod]
public async Task TestGetDecimals()
{
byte[] testScript = NativeContract.GAS.Hash.MakeScript("decimals");
byte[] testScript = NativeContract.GAS.Hash.MakeScript("decimals", true);
UT_TransactionManager.MockInvokeScript(rpcClientMock, testScript, new ContractParameter { Type = ContractParameterType.Integer, Value = new BigInteger(NativeContract.GAS.Decimals) });

var result = await nep17API.DecimalsAsync(NativeContract.GAS.Hash);
Expand All @@ -61,7 +61,7 @@ public async Task TestGetDecimals()
[TestMethod]
public async Task TestGetTotalSupply()
{
byte[] testScript = NativeContract.GAS.Hash.MakeScript("totalSupply");
byte[] testScript = NativeContract.GAS.Hash.MakeScript("totalSupply", true);
UT_TransactionManager.MockInvokeScript(rpcClientMock, testScript, new ContractParameter { Type = ContractParameterType.Integer, Value = new BigInteger(1_00000000) });

var result = await nep17API.TotalSupplyAsync(NativeContract.GAS.Hash);
Expand All @@ -72,19 +72,19 @@ public async Task TestGetTotalSupply()
public async Task TestGetTokenInfo()
{
UInt160 scriptHash = NativeContract.GAS.Hash;
byte[] testScript = scriptHash.MakeScript("symbol")
.Concat(scriptHash.MakeScript("decimals"))
.Concat(scriptHash.MakeScript("totalSupply"))
byte[] testScript = scriptHash.MakeScript("symbol", true)
.Concat(scriptHash.MakeScript("decimals", true))
.Concat(scriptHash.MakeScript("totalSupply", true))
.ToArray();
UT_TransactionManager.MockInvokeScript(rpcClientMock, testScript,
new ContractParameter { Type = ContractParameterType.String, Value = NativeContract.GAS.Symbol },
new ContractParameter { Type = ContractParameterType.Integer, Value = new BigInteger(NativeContract.GAS.Decimals) },
new ContractParameter { Type = ContractParameterType.Integer, Value = new BigInteger(1_00000000) });

scriptHash = NativeContract.NEO.Hash;
testScript = scriptHash.MakeScript("symbol")
.Concat(scriptHash.MakeScript("decimals"))
.Concat(scriptHash.MakeScript("totalSupply"))
testScript = scriptHash.MakeScript("symbol", true)
.Concat(scriptHash.MakeScript("decimals", true))
.Concat(scriptHash.MakeScript("totalSupply", true))
.ToArray();
UT_TransactionManager.MockInvokeScript(rpcClientMock, testScript,
new ContractParameter { Type = ContractParameterType.String, Value = NativeContract.NEO.Symbol },
Expand Down Expand Up @@ -120,12 +120,12 @@ public async Task TestGetTokenInfo()
[TestMethod]
public async Task TestTransfer()
{
byte[] testScript = NativeContract.GAS.Hash.MakeScript("transfer", sender, UInt160.Zero, new BigInteger(1_00000000), null);
byte[] testScript = NativeContract.GAS.Hash.MakeScript("transfer", true, sender, UInt160.Zero, new BigInteger(1_00000000), null);
UT_TransactionManager.MockInvokeScript(rpcClientMock, testScript, new ContractParameter());

var result = await nep17API.CreateTransferTxAsync(NativeContract.GAS.Hash, keyPair1, UInt160.Zero, new BigInteger(1_00000000));

testScript = NativeContract.GAS.Hash.MakeScript("transfer", sender, UInt160.Zero, new BigInteger(1_00000000), string.Empty);
testScript = NativeContract.GAS.Hash.MakeScript("transfer", true, sender, UInt160.Zero, new BigInteger(1_00000000), string.Empty);
UT_TransactionManager.MockInvokeScript(rpcClientMock, testScript, new ContractParameter());

result = await nep17API.CreateTransferTxAsync(NativeContract.GAS.Hash, keyPair1, UInt160.Zero, new BigInteger(1_00000000), string.Empty);
Expand Down
8 changes: 4 additions & 4 deletions tests/Neo.Network.RPC.Tests/UT_PolicyAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void TestSetup()
[TestMethod]
public async Task TestGetMaxTransactionsPerBlock()
{
byte[] testScript = NativeContract.Policy.Hash.MakeScript("getMaxTransactionsPerBlock");
byte[] testScript = NativeContract.Policy.Hash.MakeScript("getMaxTransactionsPerBlock", true);
UT_TransactionManager.MockInvokeScript(rpcClientMock, testScript, new ContractParameter { Type = ContractParameterType.Integer, Value = new BigInteger(512) });

var result = await policyAPI.GetMaxTransactionsPerBlockAsync();
Expand All @@ -39,7 +39,7 @@ public async Task TestGetMaxTransactionsPerBlock()
[TestMethod]
public async Task TestGetMaxBlockSize()
{
byte[] testScript = NativeContract.Policy.Hash.MakeScript("getMaxBlockSize");
byte[] testScript = NativeContract.Policy.Hash.MakeScript("getMaxBlockSize", true);
UT_TransactionManager.MockInvokeScript(rpcClientMock, testScript, new ContractParameter { Type = ContractParameterType.Integer, Value = new BigInteger(1024u * 256u) });

var result = await policyAPI.GetMaxBlockSizeAsync();
Expand All @@ -49,7 +49,7 @@ public async Task TestGetMaxBlockSize()
[TestMethod]
public async Task TestGetFeePerByte()
{
byte[] testScript = NativeContract.Policy.Hash.MakeScript("getFeePerByte");
byte[] testScript = NativeContract.Policy.Hash.MakeScript("getFeePerByte", true);
UT_TransactionManager.MockInvokeScript(rpcClientMock, testScript, new ContractParameter { Type = ContractParameterType.Integer, Value = new BigInteger(1000) });

var result = await policyAPI.GetFeePerByteAsync();
Expand All @@ -59,7 +59,7 @@ public async Task TestGetFeePerByte()
[TestMethod]
public async Task TestIsBlocked()
{
byte[] testScript = NativeContract.Policy.Hash.MakeScript("isBlocked", UInt160.Zero);
byte[] testScript = NativeContract.Policy.Hash.MakeScript("isBlocked", true, UInt160.Zero);
UT_TransactionManager.MockInvokeScript(rpcClientMock, testScript, new ContractParameter { Type = ContractParameterType.Boolean, Value = true });
var result = await policyAPI.IsBlockedAsync(UInt160.Zero);
Assert.AreEqual(true, result);
Expand Down
8 changes: 4 additions & 4 deletions tests/Neo.Network.RPC.Tests/UT_TransactionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ public static Mock<RpcClient> MockRpcClient(UInt160 sender, byte[] script)
.Verifiable();

// MockGasBalance
byte[] balanceScript = NativeContract.GAS.Hash.MakeScript("balanceOf", sender);
byte[] balanceScript = NativeContract.GAS.Hash.MakeScript("balanceOf", true, sender);
var balanceResult = new ContractParameter() { Type = ContractParameterType.Integer, Value = BigInteger.Parse("10000000000000000") };

MockInvokeScript(mockRpc, balanceScript, balanceResult);

// MockFeePerByte
byte[] policyScript = NativeContract.Policy.Hash.MakeScript("getFeePerByte");
byte[] policyScript = NativeContract.Policy.Hash.MakeScript("getFeePerByte", true);
var policyResult = new ContractParameter() { Type = ContractParameterType.Integer, Value = BigInteger.Parse("1000") };

MockInvokeScript(mockRpc, policyScript, policyResult);
Expand All @@ -87,13 +87,13 @@ public static Mock<RpcClient> MockMultiSig(UInt160 multiHash, byte[] script)
.Verifiable();

// MockGasBalance
byte[] balanceScript = NativeContract.GAS.Hash.MakeScript("balanceOf", multiHash);
byte[] balanceScript = NativeContract.GAS.Hash.MakeScript("balanceOf", true, multiHash);
var balanceResult = new ContractParameter() { Type = ContractParameterType.Integer, Value = BigInteger.Parse("10000000000000000") };

MockInvokeScript(mockRpc, balanceScript, balanceResult);

// MockFeePerByte
byte[] policyScript = NativeContract.Policy.Hash.MakeScript("getFeePerByte");
byte[] policyScript = NativeContract.Policy.Hash.MakeScript("getFeePerByte", true);
var policyResult = new ContractParameter() { Type = ContractParameterType.Integer, Value = BigInteger.Parse("1000") };

MockInvokeScript(mockRpc, policyScript, policyResult);
Expand Down
Loading

0 comments on commit 52d0d33

Please sign in to comment.