Skip to content

Commit 74b7859

Browse files
authored
Merge pull request #52 from make-software/use-tolowerinvariant
Use `ToLowerInvariant()` to avoid CultureInfo issues
2 parents c3d7e4b + f27ba82 commit 74b7859

File tree

9 files changed

+22
-22
lines changed

9 files changed

+22
-22
lines changed

Casper.Network.SDK.Test/NctlContractTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public async Task DeployContractTest()
3333
50_000_000_000,
3434
_chainName,
3535
1, //gasPrice=1
36-
45011500); //ttl='12h 30m 11s 500ms'
36+
3_600_000*2); //ttl='2h'
3737
deploy.Sign(_faucetKey);
3838

3939
var putResponse = await _client.PutDeploy(deploy);
@@ -92,7 +92,7 @@ public async Task CallContractByNameTest()
9292
150_000_000,
9393
_chainName,
9494
1, //gasPrice=1
95-
18*3_600_000); //ttl='18h'
95+
2*3_600_000); //ttl='2h'
9696
deploy.Sign(_faucetKey);
9797

9898
var putResponse = await _client.PutDeploy(deploy);

Casper.Network.SDK.Test/NctlSpeculativeExecutionTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public async Task SpeculativeExecutionTest()
4848
50_000_000_000,
4949
_chainName,
5050
1, //gasPrice=1
51-
45011500); //ttl='12h 30m 11s 500ms'
51+
3_600_000*2); //ttl='2h'
5252
deploy.Sign(_faucetKey);
5353

5454
var rpcResponse = await _client.SpeceulativeExecution(deploy);

Casper.Network.SDK/SSE/ServerEventsClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ private Task ListenChannelAsync(ChannelType channelType, int? startFrom, Cancell
276276
try
277277
{
278278
var uriBuilder = new UriBuilder(new Uri(client.BaseAddress +
279-
$"events/{channelType.ToString().ToLower()}"));
279+
$"events/{channelType.ToString().ToLowerInvariant()}"));
280280

281281
if (startFrom != null && startFrom != int.MaxValue)
282282
uriBuilder.Query = $"start_from={startFrom}";

Casper.Network.SDK/Types/Delegator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ public override Delegator Read(
6767

6868
while (reader.TokenType == JsonTokenType.PropertyName)
6969
{
70-
var property = reader.GetString();
70+
var property = reader.GetString()?.ToLowerInvariant();
7171
reader.Read();
7272

73-
switch (property.ToLower())
73+
switch (property)
7474
{
7575
case "delegator_public_key":
7676
case "public_key":

Casper.Network.SDK/Types/EntryPoint.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public override EntryPointAccess Read(
3232
if (reader.TokenType == JsonTokenType.String)
3333
{
3434
var value = reader.GetString();
35-
if (value.ToLower() == "public")
35+
if (value.ToLowerInvariant() == "public")
3636
return new EntryPointAccess()
3737
{
3838
IsPublic = true,
@@ -44,7 +44,7 @@ public override EntryPointAccess Read(
4444
reader.Read(); // start object
4545
var value = reader.GetString(); // read property
4646
reader.Read();
47-
if (value.ToLower() == "groups")
47+
if (value.ToLowerInvariant() == "groups")
4848
{
4949
List<string> groups = JsonSerializer.Deserialize<List<string>>(ref reader, options);
5050
reader.Read(); // end array

Casper.Network.SDK/Types/ExecutionResult.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public override ExecutionResult Read(
7070
var property = reader.GetString();
7171
reader.Read();
7272

73-
switch (property.ToLower())
73+
switch (property.ToLowerInvariant())
7474
{
7575
case "block_hash":
7676
blockHash = reader.GetString();

Casper.Network.SDK/Types/PublicKey.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public void WriteToPem(string filePath)
168168
public string GetAccountHash()
169169
{
170170
var bcBl2bdigest = new Org.BouncyCastle.Crypto.Digests.Blake2bDigest(256);
171-
string algo = KeyAlgorithm.ToString().ToLower();
171+
string algo = KeyAlgorithm.ToString().ToLowerInvariant();
172172
bcBl2bdigest.BlockUpdate(System.Text.Encoding.UTF8.GetBytes(algo), 0, algo.Length);
173173
bcBl2bdigest.Update(0x00);
174174
bcBl2bdigest.BlockUpdate(RawBytes, 0, RawBytes.Length);

Casper.Network.SDK/Types/SeigniorageAllocation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public override SeigniorageAllocation Read(
7474

7575
return new SeigniorageAllocation()
7676
{
77-
IsDelegator = propertyName?.ToLower() == "delegator",
77+
IsDelegator = propertyName?.ToLowerInvariant() == "delegator",
7878
DelegatorPublicKey = delegatorPk != null ? PublicKey.FromHexString(delegatorPk) : null,
7979
ValidatorPublicKey = PublicKey.FromHexString(validatorPk),
8080
Amount = amount

Casper.Network.SDK/Types/StoredValue.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ public override StoredValue Read(
4545
if (reader.TokenType != JsonTokenType.PropertyName)
4646
throw new JsonException("Cannot deserialize StoredValue. PropertyName expected");
4747

48-
var propertyName = reader.GetString();
48+
var propertyName = reader.GetString()?.ToLowerInvariant();
4949
reader.Read();
5050

51-
if (propertyName.ToLower() == "contract")
51+
if (propertyName == "contract")
5252
{
5353
var contract = JsonSerializer.Deserialize<Contract>(ref reader, options);
5454
reader.Read(); // end Contract object
@@ -57,7 +57,7 @@ public override StoredValue Read(
5757
Contract = contract
5858
};
5959
}
60-
else if (propertyName.ToLower() == "clvalue")
60+
else if (propertyName == "clvalue")
6161
{
6262
var clValue = JsonSerializer.Deserialize<CLValue>(ref reader, options);
6363
reader.Read(); // end CLValue object
@@ -66,7 +66,7 @@ public override StoredValue Read(
6666
CLValue = clValue
6767
};
6868
}
69-
else if (propertyName.ToLower() == "account")
69+
else if (propertyName == "account")
7070
{
7171
var account = JsonSerializer.Deserialize<Account>(ref reader, options);
7272
reader.Read(); // end Account object
@@ -75,7 +75,7 @@ public override StoredValue Read(
7575
Account = account
7676
};
7777
}
78-
else if (propertyName.ToLower() == "contractwasm")
78+
else if (propertyName == "contractwasm")
7979
{
8080
var wasmBytes = reader.GetString();
8181
reader.Read(); // wasm bytes
@@ -84,7 +84,7 @@ public override StoredValue Read(
8484
ContractWasm = wasmBytes
8585
};
8686
}
87-
else if (propertyName.ToLower() == "contractpackage")
87+
else if (propertyName == "contractpackage")
8888
{
8989
var contractPackage = JsonSerializer.Deserialize<ContractPackage>(ref reader, options);
9090
reader.Read(); // end ContractPackage object
@@ -93,7 +93,7 @@ public override StoredValue Read(
9393
ContractPackage = contractPackage
9494
};
9595
}
96-
else if (propertyName.ToLower() == "transfer")
96+
else if (propertyName == "transfer")
9797
{
9898
var transfer = JsonSerializer.Deserialize<Transfer>(ref reader, options);
9999
reader.Read(); // end Transfer object
@@ -102,7 +102,7 @@ public override StoredValue Read(
102102
Transfer = transfer
103103
};
104104
}
105-
else if (propertyName.ToLower() == "deployinfo")
105+
else if (propertyName == "deployinfo")
106106
{
107107
var deployInfo = JsonSerializer.Deserialize<DeployInfo>(ref reader, options);
108108
reader.Read(); // end DeployInfo object
@@ -111,7 +111,7 @@ public override StoredValue Read(
111111
DeployInfo = deployInfo
112112
};
113113
}
114-
else if (propertyName.ToLower() == "erainfo")
114+
else if (propertyName == "erainfo")
115115
{
116116
var eraInfo = JsonSerializer.Deserialize<EraInfo>(ref reader, options);
117117
reader.Read(); // end EraInfo object
@@ -120,7 +120,7 @@ public override StoredValue Read(
120120
EraInfo = eraInfo
121121
};
122122
}
123-
else if (propertyName.ToLower() == "bid")
123+
else if (propertyName == "bid")
124124
{
125125
var bid = JsonSerializer.Deserialize<Bid>(ref reader, options);
126126
reader.Read(); // end Bid object
@@ -129,7 +129,7 @@ public override StoredValue Read(
129129
Bid = bid
130130
};
131131
}
132-
else if (propertyName.ToLower() == "withdraw")
132+
else if (propertyName == "withdraw")
133133
{
134134
var withdraw = JsonSerializer.Deserialize<List<UnbondingPurse>>(ref reader, options);
135135
reader.Read(); // end Withdraw object

0 commit comments

Comments
 (0)