Skip to content
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

Change json fields to all lower case for consistency #277

Merged
merged 15 commits into from
Jul 8, 2020
2 changes: 1 addition & 1 deletion src/LevelDBStore/LevelDBStore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Neo" Version="3.0.0-CI00958" />
<PackageReference Include="Neo" Version="3.0.0-CI00961" />
</ItemGroup>

</Project>
5 changes: 3 additions & 2 deletions src/LevelDBStore/Plugins/Storage/Snapshot.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Neo.IO.Caching;
using Neo.IO.Data.LevelDB;
using Neo.Persistence;
using System.Collections.Generic;
Expand Down Expand Up @@ -35,9 +36,9 @@ public void Dispose()
snapshot.Dispose();
}

public IEnumerable<(byte[] Key, byte[] Value)> Find(byte table, byte[] prefix)
public IEnumerable<(byte[] Key, byte[] Value)> Seek(byte table, byte[] keyOrPrefix, SeekDirection direction = SeekDirection.Forward)
{
return db.Find(options, Helper.CreateKey(table, prefix), (k, v) => (k[1..], v));
return db.Find(options, Helper.CreateKey(table, keyOrPrefix), (k, v) => (k[1..], v));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

direction is not working

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm trying to fix this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shargon ByteArrayComparer is internal, which I cannot use it here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you help to fix this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Waiting for #279

}

public void Put(byte table, byte[] key, byte[] value)
Expand Down
3 changes: 2 additions & 1 deletion src/LevelDBStore/Plugins/Storage/Store.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Neo.IO.Caching;
using Neo.IO.Data.LevelDB;
using Neo.Persistence;
using System;
Expand Down Expand Up @@ -49,7 +50,7 @@ public void Dispose()
db.Dispose();
}

public IEnumerable<(byte[], byte[])> Find(byte table, byte[] prefix)
public IEnumerable<(byte[], byte[])> Seek(byte table, byte[] prefix, SeekDirection direction = SeekDirection.Forward)
{
return db.Find(ReadOptions.Default, Helper.CreateKey(table, prefix), (k, v) => (k[1..], v));
shargon marked this conversation as resolved.
Show resolved Hide resolved
}
Expand Down
2 changes: 1 addition & 1 deletion src/RpcClient/Models/RpcApplicationLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public JObject ToJson()
public static RpcApplicationLog FromJson(JObject json)
{
RpcApplicationLog log = new RpcApplicationLog();
log.TxId = json["txid"] is null ? null : UInt256.Parse(json["tx_id"].AsString());
log.TxId = json["txid"] is null ? null : UInt256.Parse(json["txid"].AsString());
log.Trigger = json["trigger"].TryGetEnum<TriggerType>();
log.VMState = json["vmstate"].TryGetEnum<VMState>();
log.GasConsumed = long.Parse(json["gasconsumed"].AsString());
Expand Down
2 changes: 1 addition & 1 deletion src/RpcClient/RpcClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Neo" Version="3.0.0-CI00958" />
<PackageReference Include="Neo" Version="3.0.0-CI00961" />
</ItemGroup>

</Project>
8 changes: 4 additions & 4 deletions src/RpcClient/Utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public static Block BlockFromJson(JObject json)
Block block = new Block();
BlockBase blockBase = block;
blockBase.FromJson(json);
block.ConsensusData = ConsensusDataFromJson(json["consensus_data"]);
block.ConsensusData = ConsensusDataFromJson(json["consensusdata"]);
block.Transactions = ((JArray)json["tx"]).Select(p => TransactionFromJson(p)).ToArray();
return block;
}
Expand All @@ -120,9 +120,9 @@ public static Transaction TransactionFromJson(JObject json)
tx.Version = byte.Parse(json["version"].AsString());
tx.Nonce = uint.Parse(json["nonce"].AsString());
tx.Sender = json["sender"].AsString().ToScriptHash();
tx.SystemFee = long.Parse(json["sys_fee"].AsString());
tx.NetworkFee = long.Parse(json["net_fee"].AsString());
tx.ValidUntilBlock = uint.Parse(json["valid_until_block"].AsString());
tx.SystemFee = long.Parse(json["sysfee"].AsString());
tx.NetworkFee = long.Parse(json["netfee"].AsString());
tx.ValidUntilBlock = uint.Parse(json["validuntilblock"].AsString());
tx.Attributes = ((JArray)json["attributes"]).Select(p => TransactionAttributeFromJson(p)).ToArray();
tx.Script = Convert.FromBase64String(json["script"].AsString());
tx.Witnesses = ((JArray)json["witnesses"]).Select(p => WitnessFromJson(p)).ToArray();
Expand Down
2 changes: 1 addition & 1 deletion src/RpcServer/RpcServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.ResponseCompression" Version="2.2.0" />
<PackageReference Include="Neo" Version="3.0.0-CI00958" />
<PackageReference Include="Neo" Version="3.0.0-CI00961" />
</ItemGroup>

</Project>
22 changes: 11 additions & 11 deletions tests/Neo.Network.RPC.Tests/RpcTestCases.json
Original file line number Diff line number Diff line change
Expand Up @@ -338,13 +338,13 @@
}
],
"offset": 0,
"returnType": "ByteArray"
"returntype": "ByteArray"
},
{
"name": "Destroy",
"parameters": [],
"offset": 400,
"returnType": "Boolean"
"returntype": "Boolean"
},
{
"name": "Migrate",
Expand All @@ -359,7 +359,7 @@
}
],
"offset": 408,
"returnType": "Boolean"
"returntype": "Boolean"
},
{
"name": "BalanceOf",
Expand All @@ -370,43 +370,43 @@
}
],
"offset": 474,
"returnType": "Integer"
"returntype": "Integer"
},
{
"name": "Decimals",
"parameters": [],
"offset": 585,
"returnType": "Integer"
"returntype": "Integer"
},
{
"name": "Deploy",
"parameters": [],
"offset": 610,
"returnType": "Boolean"
"returntype": "Boolean"
},
{
"name": "Name",
"parameters": [],
"offset": 763,
"returnType": "String"
"returntype": "String"
},
{
"name": "Symbol",
"parameters": [],
"offset": 787,
"returnType": "String"
"returntype": "String"
},
{
"name": "SupportedStandards",
"parameters": [],
"offset": 793,
"returnType": "Array"
"returntype": "Array"
},
{
"name": "TotalSupply",
"parameters": [],
"offset": 827,
"returnType": "Integer"
"returntype": "Integer"
}
],
"events": [
Expand Down Expand Up @@ -436,7 +436,7 @@
}
],
"trusts": [],
"safeMethods": [],
"safemethods": [],
"extra": null
}
}
Expand Down