make-software / casper-net-sdk Goto Github PK
View Code? Open in Web Editor NEW.NET SDK to interact with the Casper Network nodes via RPC
License: Apache License 2.0
.NET SDK to interact with the Casper Network nodes via RPC
License: Apache License 2.0
What happened?
Can't serialize results to JSON.
Since switch blocks are more than 10MB per era I wanted to dump a few switch blocks as JSON to process them offline so I don't need to request them again and again from the network. Seems like this isn't supported?
What did you expect to happen?
That serialization just works. Indeed I saw that quite a few Write
methods aren't implemented yet:
BidsListConverter: throw new NotImplementedException("Write method for Bid not yet implemented");
Delegator: throw new NotImplementedException("Write method for Delegator not yet implemented");
EntryPoint: throw new NotImplementedException("Write method for EntryPointAccess not yet implemented");
SeigniorageAllocation: throw new NotImplementedException("Write method for SeigniorageAllocation not yet implemented");
StoredValue: throw new NotImplementedException("Write method for StoredValue not yet implemented");
Transform: throw new NotImplementedException("Write method for Transform not yet implemented");
Are you willing to submit a pull request to fix this bug?
Sorry, no.
What happened?
It looks like the Account Info Standard is not directly supported by the .Net SDK.
What did you expect to happen?
Support of the Account Info Standard in the .Net SDK to make it easier to retrieve that info instead of doing this manually.
Two possible solutions:
For the contract hashes:
I think it would be OK to store them for the MainNet and TestNet since they shouldn't change.
But for internal test networks I think it also has to be configurable or be passed as an optional parameter somehow.
Are you willing to submit a pull request to fix this bug?
Maybe, I'll have to get some spare time to dig deeper here how a potential implementation could look like.
-> Better don't count on it and I think you have all the skills and knowledge at hand already so it should be pretty straightforward :-)
What happened?
A Secp256k1 account is created and funded via the faucet account
A transfer is deployed with the new account as the approver
The deploy result is returned and the approval account is analysed
The signer contains the algorithm type ED25519
What did you expect to happen?
The signer contains the algorithm type Secp256k1
Thanks
Carl Norburn
room@Rooms-MacBook-Pro caspertest1 % dotnet add CasperTest1 package Casper.Network.SDK --version 0.9.4-beta
Determining projects to restore...
Writing /var/folders/kb/v9pqm1312tv73dv25dxvcw240000gn/T/tmpP2WN6V.tmp
info : Adding PackageReference for package 'Casper.Network.SDK' into project '/Users/room/Projects/CasperTest1/CasperTest1/CasperTest1.csproj'.
info : Restoring packages for /Users/room/Projects/CasperTest1/CasperTest1/CasperTest1.csproj...
info : GET https://api.nuget.org/v3-flatcontainer/casper.network.sdk/index.json
info : NotFound https://api.nuget.org/v3-flatcontainer/casper.network.sdk/index.json 885ms
error: NU1101: Unable to find package Casper.Network.SDK. No packages exist with this id in source(s): nuget.org
error: Package 'Casper.Network.SDK' is incompatible with 'all' frameworks in project '/Users/room/Projects/CasperTest1/CasperTest1/CasperTest1.csproj'.
Could you please take a look @davidatwhiletrue ?
What happened?
Integration tests are failing for me:
@davidatwhiletrue could you trigger "Integration testing" workflow in order to verify this?
Reproduction steps
v2.0.0
:$ git describe
v2.0.0
$ dotnet build
MSBuild version 17.4.8+6918b863a for .NET
Determining projects to restore...
All projects are up-to-date for restore.
Casper.Network.SDK -> /home/andrew/casper-net-sdk/Casper.Network.SDK/bin/Debug/net7.0/Casper.Network.SDK.dll
Casper.Network.SDK.Test -> /home/andrew/casper-net-sdk/Casper.Network.SDK.Test/bin/Debug/net7.0/Casper.Network.SDK.Test.dll
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:00.61
$ docker run --rm -it --name casper-nctl -d -p 11101:11101 -p 14101:14101 -p 18101:18101 -p 25101:25101 -e DEPLOY_DELAY="5sec" makesoftware/casper-nctl:latest
$ while [ "`docker inspect -f {{.State.Health.Status}} casper-nctl`" != "healthy" ]; do sleep 1; done
$ docker exec -t casper-nctl cat /home/casper/casper-node/utils/nctl/assets/net-1/faucet/secret_key.pem > Casper.Network.SDK.Test/TestData/faucetact.pem
$ dotnet test --no-build --verbosity normal --settings Casper.Network.SDK.Test/test.runsettings --filter="TestCategory=NCTL"
...
Failed! - Failed: 26, Passed: 15, Skipped: 0, Total: 41, Duration: 614 ms
...
26 failed tests ๐จ
Let us try again, this time using NCTL launched with -e PREDEFINED_ACCOUNTS="true"
:
Build started 8/30/2023 12:09:02PM.
1>Project "/home/andrew/casper-net-sdk/Casper.Network.SDK.sln" on node 1 (VSTest target(s)).
1>ValidateSolutionConfiguration:
Building solution configuration "Debug|Any CPU".
Test run for /home/andrew/casper-net-sdk/Casper.Network.SDK.Test/bin/Debug/net7.0/Casper.Network.SDK.Test.dll (.NETCoreApp,Version=v7.0)
Microsoft (R) Test Execution Command Line Tool Version 17.4.1+79d56b02b69a582cd90428878a5e9411ab7538f5 (x64)
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Failed GetEraSummaryTest [25 ms]
Error Message:
Expected: True
But was: False
Stack Trace:
at NetCasperTest.NctlGetXTest.GetEraSummaryTest() in /home/andrew/casper-net-sdk/Casper.Network.SDK.Test/NctlGetXTest.cs:line 225
at NUnit.Framework.Internal.TaskAwaitAdapter.GenericAdapter`1.BlockUntilCompleted()
at NUnit.Framework.Internal.MessagePumpStrategy.NoMessagePumpStrategy.WaitForCompletion(AwaitAdapter awaiter)
at NUnit.Framework.Internal.AsyncToSyncAdapter.Await(Func`1 invoke)
at NUnit.Framework.Internal.Commands.TestMethodCommand.RunTestMethod(TestExecutionContext context)
at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(TestExecutionContext context)
at NUnit.Framework.Internal.Commands.BeforeAndAfterTestCommand.<>c__DisplayClass1_0.<Execute>b__0()
at NUnit.Framework.Internal.Commands.DelegatingTestCommand.RunTestMethodInThreadAbortSafeZone(TestExecutionContext context, Action action)
1) at NetCasperTest.NctlGetXTest.GetEraSummaryTest() in /home/andrew/casper-net-sdk/Casper.Network.SDK.Test/NctlGetXTest.cs:line 225
Failed! - Failed: 1, Passed: 40, Skipped: 0, Total: 41, Duration: 1 m 40 s - Casper.Network.SDK.Test.dll (net7.0)
1>Done Building Project "/home/andrew/casper-net-sdk/Casper.Network.SDK.sln" (VSTest target(s)) -- FAILED.
Build FAILED.
0 Warning(s)
0 Error(s)
Time Elapsed 00:01:42.54
Only 1 failed test! This is much better, but still needs to be fixed.
Add a deploy template to create a redelegate
transaction between two validators.
What happened?
Tried to add user defined NamedArgs to a ContractDeploy
Could not see a way to do this:
`
var paymentArgs = new List{
new ("amount", CLValue.U512(payment)),
new ("token_decimals", CLValue.U8(tokenDecimals)),
new ("token_name", CLValue.String(tokenName)),
new ("token_symbol", CLValue.String(tokenSymbol)),
new ("token_total_supply", CLValue.U256(tokenTotalSupply))
`
What did you expect to happen?
The above list of NamedArgs can be added to the ContractDeploy
Thanks
Carl Norburn
What happened?
The SDK GetAccountBalance(accountMainPurse, stateRootHash) returns a null Merkle proof
What did you expect to happen?
Expected a valid Merkle proof to be returned
Thanks
Carl Norburn
Try to deserialize the "System proposed switch block" -> the .Net SDK fails because the Proposer is normally a PublicKey but now it is "00" which is invalid.
Reported by "X Y" from the community. He is willing to provide more info if needed.
Hi
A CLType of Key is added as a NamedArg to RunTimeArgs in a Session Deploy
Before the Deploy the Key has the correct bytes
After the Deploy the NamedArg with the Key value returns the bytes with the last two characters missing:
Expected string length 79 but was 77. Strings differ at index 77. Expected: "...3127D815871618B6F639CF4A4A2DF4EDEACB8A0DF662822707A5E570C9D32" But was: "...3127D815871618B6F639CF4A4A2DF4EDEACB8A0DF662822707A5E570C9D" -------------------------------------------------------------------------^
This is being tested here:
I'm creating the Key here:
Happy to accept I'm doing it wrong!
Many thanks
Telegram: @cnorburn
What happened?
I see that xml comments are not present in the nuget.org.
What did you expect to happen?
Even though the xml comments are present they are pushed to nuget.org without them.
Are you willing to submit a pull request to fix this bug?
No. I think by default it goes to nuget without xml comments. Enabling and pushing again should work.
We have recently updated the Casper SDK Specification. You can find the updated documentation here: https://docs.casperlabs.io/dapp-dev-guide/sdkspec/introduction/.
Refer to the updated Casper SDK Specification and please make necessary updates/changes to the .Net Client SDK Libraries.
Should you have any questions or feedback regarding the updated SDK Specification, please do not hesitate to revert on this issue.
Hi
A complex type is created with inner simple types.
Deploy is successful, the complex type is accessible but the inner types cannot be accessed to test their values.
Java, Python and Typescript SDK's all pass this test
The complex types are here
The test is here
Happy to discuss this further
Many thanks
Telegram: @cnorburn
GetDictionaryItem() method first parameter is dictionaryItem and it should be dictionaryKey.
XML Documentation says:
/// <summary>
/// Lookup a dictionary item from its dictionary item key.
/// </summary>
/// <param name="dictionaryItem">The dictionary item key to retrieve.</param>
/// <param name="stateRootHash">Hash of the state root.</param>
and it should be:
/// <summary>
/// Lookup a dictionary item from its dictionary key.
/// </summary>
/// <param name="dictionaryeyK">The dictionary key to retrieve.</param>
/// <param name="stateRootHash">Hash of the state root.</param>
Changes from casper-node
1.5.5 that are relevant for the SDK:
What happened?
A StandardTransfer is executed
A block added event with the deploy hash is waited for
The deploy result is then retrieved
The session object of the deploy result is then analysed
The target argument type is ByteArray
What did you expect to happen?
The expected argument type is expected to be of type PublicKey
I can see that it is being stored as an AccountHash, which in turn is being converted to a CLType of ByteArray
It needs to be stored as a PublicKey to bring in line with the other SDK's
Thanks
Carl Norburn
What happened?
PublicKey
- more specifically ToAccountHex()
which is also used by ToString()
- is using checksummed addresses which were deactivated and postponed to another future version (AFAIK).
Using checksummed addresses causes issues on e. g. cspr.live -> Wallet -> Transfer CSPR -> Casper Signer will error out if using checksummed addresses. casperholders.io has the same issue, too.
I've also used Wireshark to check if the checksummed addresses are returned by RPC calls and saw that RPC responses contain lower-cased addresses which I think is correct -> the Casper .NET SDK is the reason.
Maybe this issue needs to be raised to the Casper Signer and/or cspr.live, too to handle checksummed addresses more carefully and simply lower-case public keys.
Sample code to reproduce:
PublicKey publicKey = PublicKey.FromHexString("0154a4d3a719b76861e56dcd4b5a6ef43814ef3c512346bd6af1d07dc69401c1e9");
Trace.WriteLine(publicKey);
Output (mixed-case):
0154a4d3A719b76861E56DcD4b5A6Ef43814eF3C512346bD6af1D07DC69401C1E9
What did you expect to happen?
Expected output (lower-case):
0154a4d3a719b76861e56dcd4b5a6ef43814ef3c512346bd6af1d07dc69401c1e9
All public keys should be lower case and not using checksummed addresses to avoid confusion and issues as long as it is not officially enabled again.
Are you willing to submit a pull request to fix this bug?
No since I think I would miss something anyway and I'm not sure if this is considered as an issue or not.
An easy and probably hacky fix without running tests etc. could look like this:
Change line 112 in CEP57Checksum.cs:
// Before
return sb.ToString();
// After
return sb.ToString().ToLower();
I didn't run any tests and it is very likely that this breaks something so be warned.
What happened?
An erc20 contract was deployed.
The deploy result is retrieved
The ExecutionResult is false
What did you expect to happen?
The ExecutionResult is true
The contract is here: erc20.wasm.zip
Thanks
Carl Norburn
The following CLTypes can be successfully built and deployed
They can not be unwrapped from the deploy result to be verified:
Thanks
Carl Norburn
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.