Skip to content

Commit

Permalink
Update core (#881)
Browse files Browse the repository at this point in the history
* Update core

* Update src/RpcServer/RpcServer.Wallet.cs

* Update submodule

* clean
  • Loading branch information
shargon authored Feb 23, 2024
1 parent d69f1c9 commit 2adf02b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion neo
Submodule neo updated 54 files
+23 −43 .github/workflows/main.yml
+89 −12 .github/workflows/pkgs-delete.yml
+2 −1 NuGet.Config
+1 −2 benchmarks/Neo.Benchmarks/Benchmarks.cs
+34 −1,442 src/Neo.VM/ExecutionEngine.cs
+65 −0 src/Neo.VM/JumpTable/JumpTable.Bitwisee.cs
+390 −0 src/Neo.VM/JumpTable/JumpTable.Compound.cs
+396 −0 src/Neo.VM/JumpTable/JumpTable.Control.cs
+265 −0 src/Neo.VM/JumpTable/JumpTable.Numeric.cs
+213 −0 src/Neo.VM/JumpTable/JumpTable.Push.cs
+363 −0 src/Neo.VM/JumpTable/JumpTable.Slot.cs
+106 −0 src/Neo.VM/JumpTable/JumpTable.Splice.cs
+124 −0 src/Neo.VM/JumpTable/JumpTable.Stack.cs
+60 −0 src/Neo.VM/JumpTable/JumpTable.Types.cs
+71 −0 src/Neo.VM/JumpTable/JumpTable.cs
+1 −0 src/Neo.VM/Neo.VM.csproj
+2 −1 src/Neo/Hardfork.cs
+1 −0 src/Neo/Neo.csproj
+12 −7 src/Neo/NeoSystem.cs
+1 −1 src/Neo/Persistence/DataCache.cs
+19 −0 src/Neo/Persistence/MemoryStoreProvider.cs
+19 −10 src/Neo/Persistence/StoreFactory.cs
+47 −5 src/Neo/ProtocolSettings.cs
+92 −50 src/Neo/SmartContract/ApplicationEngine.cs
+3 −1 src/Neo/SmartContract/IApplicationEngineProvider.cs
+165 −0 src/Neo/SmartContract/Native/ContractEventAttribute.cs
+33 −56 src/Neo/SmartContract/Native/ContractManagement.cs
+10 −0 src/Neo/SmartContract/Native/ContractMethodAttribute.cs
+4 −0 src/Neo/SmartContract/Native/ContractMethodMetadata.cs
+17 −1 src/Neo/SmartContract/Native/CryptoLib.cs
+9 −31 src/Neo/SmartContract/Native/FungibleToken.cs
+7 −3 src/Neo/SmartContract/Native/GasToken.cs
+1 −3 src/Neo/SmartContract/Native/LedgerContract.cs
+139 −32 src/Neo/SmartContract/Native/NativeContract.cs
+21 −64 src/Neo/SmartContract/Native/NeoToken.cs
+15 −56 src/Neo/SmartContract/Native/OracleContract.cs
+8 −7 src/Neo/SmartContract/Native/PolicyContract.cs
+4 −27 src/Neo/SmartContract/Native/RoleManagement.cs
+1 −1 src/Neo/SmartContract/Native/StdLib.cs
+10 −0 src/Neo/SmartContract/StorageItem.cs
+90 −0 src/Neo/Wallets/Helper.cs
+1 −88 src/Neo/Wallets/Wallet.cs
+2 −2 tests/Neo.UnitTests/Ledger/UT_MemoryPool.cs
+6 −0 tests/Neo.UnitTests/Persistence/UT_MemoryStore.cs
+151 −0 tests/Neo.UnitTests/SmartContract/Native/UT_ContractEventAttribute.cs
+32 −0 tests/Neo.UnitTests/SmartContract/Native/UT_ContractMethodAttribute.cs
+93 −0 tests/Neo.UnitTests/SmartContract/Native/UT_CryptoLib.cs
+21 −0 tests/Neo.UnitTests/SmartContract/Native/UT_NativeContract.cs
+5 −4 tests/Neo.UnitTests/SmartContract/UT_ApplicationEngineProvider.cs
+3 −3 tests/Neo.UnitTests/SmartContract/UT_InteropService.cs
+3 −3 tests/Neo.UnitTests/SmartContract/UT_JsonSerializer.cs
+8 −1 tests/Neo.UnitTests/TestBlockchain.cs
+127 −0 tests/Neo.UnitTests/UT_ProtocolSettings.cs
+15 −4 tests/Neo.VM.Tests/Types/TestEngine.cs
2 changes: 1 addition & 1 deletion src/RpcServer/RpcServer.Blockchain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ protected virtual JToken GetCommittee(JArray _params)
[RpcMethod]
protected virtual JToken GetNativeContracts(JArray _params)
{
return new JArray(NativeContract.Contracts.Select(p => p.NativeContractToJson(system.Settings)));
return new JArray(NativeContract.Contracts.Select(p => p.NativeContractToJson(system)));
}
}
}
6 changes: 4 additions & 2 deletions src/RpcServer/RpcServer.Wallet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,12 @@ protected virtual JToken ImportPrivKey(JArray _params)
[RpcMethod]
protected virtual JToken CalculateNetworkFee(JArray _params)
{
byte[] tx = Convert.FromBase64String(_params[0].AsString());
var tx = Convert.FromBase64String(_params[0].AsString());

JObject account = new();
long networkfee = (wallet ?? new DummyWallet(system.Settings)).CalculateNetworkFee(system.StoreView, tx.AsSerializable<Transaction>());
var networkfee = Wallets.Helper.CalculateNetworkFee(
tx.AsSerializable<Transaction>(), system.StoreView, system.Settings,
wallet is not null ? a => wallet.GetAccount(a).Contract.Script : null);
account["networkfee"] = networkfee.ToString();
return account;
}
Expand Down
9 changes: 6 additions & 3 deletions src/RpcServer/Utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,17 @@ public static JObject TransactionToJson(Transaction tx, ProtocolSettings setting
return json;
}

public static JObject NativeContractToJson(this NativeContract contract, ProtocolSettings settings)
public static JObject NativeContractToJson(this NativeContract contract, NeoSystem system)
{
var state = contract.GetContractState(system.Settings,
NativeContract.Ledger.CurrentIndex(system.StoreView));

return new JObject
{
["id"] = contract.Id,
["hash"] = contract.Hash.ToString(),
["nef"] = contract.Nef.ToJson(),
["manifest"] = contract.Manifest.ToJson()
["nef"] = state.Nef.ToJson(),
["manifest"] = state.Manifest.ToJson()
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Neo.Plugins.OracleService.Tests/TestBlockchain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static class TestBlockchain
static TestBlockchain()
{
Console.WriteLine("initialize NeoSystem");
TheNeoSystem = new NeoSystem(ProtocolSettings.Load("config.json"), null, null);
TheNeoSystem = new NeoSystem(ProtocolSettings.Load("config.json"), new MemoryStoreProvider());
}

public static void InitializeMockNeoSystem()
Expand Down

0 comments on commit 2adf02b

Please sign in to comment.