-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validate serialization during Contract deploy and Update #2948
Conversation
Can you put 0 before others? |
Cloud you check it @cschuchardt88 ? I'm not sure if this solve the problem, because it seems to be serialized as NULL |
if (skip < 1 || take < 1 || take > RestServerSettings.Current.MaxPageSize)
throw new InvalidParameterRangeException();
var contracts = NativeContract.ContractManagement.ListContracts(_neosystem.StoreView);
if (contracts.Any() == false)
return NoContent();
var contractRequestList = contracts.OrderBy(o => o.Manifest.Name).Skip((skip - 1) * take).Take(take); // crashes with Manifest.Name
if (contractRequestList.Any() == false)
return NoContent();
return Ok(contractRequestList); But ill resync to make sure. |
@cschuchardt88 is this your request? to which server? {
"id": 1,
"jsonrpc": "2.0",
"method": "getstorage",
"params": ["0x12fbec62fb765ce3f55845106ccf3717716723ad"]
} |
My localhost with your changes and But im resyncing to see if still erroring... so be sometime. |
I get {
"jsonrpc": "2.0",
"id": 1,
"error": {
"code": -2146233086,
"message": "Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')",
"data": " at Neo.Json.JArray.get_Item(Int32 index)\r\n at Neo.Plugins.RpcServer.GetStorage(JArray _params)\r\n at Neo.Plugins.RpcServer.ProcessRequestAsync(HttpContext context, JObject request)"
}
} But its not crashing now for I would say fixed |
@cschuchardt88 mmm looks like there are a manifest that it can't deserialize... |
We need to find why it fault, I tried to detect it with UT, but @cschuchardt88 still receiving an error.
|
sorry was an error on my part with the RPC method. Its working now. |
@cschuchardt88 is this your request? I receive |
You have to call it like this: You have to provide the storage key. But storage key is invalid which is fine. Because its calling {
"id": 1,
"jsonrpc": "2.0",
"method": "getstorage",
"params": ["0x12fbec62fb765ce3f55845106ccf3717716723ad", "MHgxMmZiZWM2MmZiNzY1Y2UzZjU1ODQ1MTA2Y2NmMzcxNzcxNjcyM2Fk"]
} |
Then i guess we should update the execption messgae then. |
using https://sync.ngd.network/ testnet data I get: {
"jsonrpc":"2.0","id":1,"error":{"code":-100,
"message":"Unknown storage",
"data":" at Neo.Plugins.RpcServer.GetStorage(JArray _params) in C:\\Red4Sec\\Neo\\neo-modules\\src\\RpcServer\\RpcServer.Blockchain.cs:line 204\r\n at Neo.Plugins.RpcServer.ProcessRequestAsync(HttpContext context, JObject request) in C:\\Red4Sec\\Neo\\neo-modules\\src\\RpcServer\\RpcServer.cs:line 245"}
} |
where it calls ListContracts for getStorage? I can't find it... |
Looks like it calls GetContract. But I use ListContracts, In RestServer, that's where i found the problem to begin with. It crashed on ContractState |
@superboyiii could you check that tx: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR LGTM, and #2829 should be finally fixed with these changes. However, it may affect not only the 0x154f30d743c97d22fb17c5d363040ac4c9d351a1068b77b3ca6a71f91dfdcfc1
, but also some other transactions in mainnet, because serialization checks were added everywhere including RuntimeNotify, and we need to check how it affects mainnet.
I'm a little bit worried about 3.6.2. This release supposed to be a quick stabilizing release without significant changes. I would suggest to postpone this PR until 3.7.0 and release 3.6.2 as it is now.
@AnnaShaleva, if we can test it in a few days (for example, before #2829 could celebrate its first year) and finally deal with #2829, it's worth doing that in 3.6.2. |
Took me a few seconds to understand the |
@@ -36,7 +36,7 @@ public ReadOnlyMemory<byte> Value | |||
return !value.IsEmpty ? value : value = cache switch | |||
{ | |||
BigInteger bi => bi.ToByteArrayStandard(), | |||
IInteroperable interoperable => BinarySerializer.Serialize(interoperable.ToStackItem(null), 1024 * 1024), | |||
IInteroperable interoperable => BinarySerializer.Serialize(interoperable.ToStackItem(null), ExecutionEngineLimits.Default), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could affect to other txs
Sure |
@shargon Only 1 storage differed by this PR on Block 2506873 |
That is the expected one, isn't it? |
We already have tests for Permission deserialisation, so port the first part of neo-project/neo#2948. Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
Follow the notion of neo-project/neo#2948. Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
Port the restrictive part of neo-project/neo#2948. Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
Follow the notion of neo-project/neo#2948. Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
Port the restrictive part of neo-project/neo#2948. Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
* master: (30 commits) Set project as nullable (neo-project#3042) Fix: fix equal (neo-project#3028) Added README to packages (neo-project#3026) Nuget MyGet Fix (neo-project#3031) Add: print out the stack (neo-project#3033) fixed myget (neo-project#3029) Fixed MyGet Workflow (neo-project#3027) Package icons - hotfix (neo-project#3022) Nuget Package Icon & Symbols (neo-project#3020) Fix warning (neo-project#3021) Neo-node Migration (neo-project#2990) Remove unnecessary default seedlist (neo-project#2980) Fix Neo VM target frameworks (neo-project#2989) Update Neo.VM location in README.md (neo-project#2988) Migrating Neo VM (neo-project#2970) 3.6.2 (neo-project#2962) fix ut (neo-project#2959) Validate serialization during Contract deploy and Update (neo-project#2948) code optimization (neo-project#2958) check null scriptcontainer (neo-project#2953) ...
Close #2899
Close #2829