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

Write manifest file with storage and payable according the contract needs #129

Merged
merged 6 commits into from
Nov 9, 2019

Conversation

shargon
Copy link
Member

@shargon shargon commented Nov 6, 2019

Close #128

@devhawk
Copy link
Contributor

devhawk commented Nov 6, 2019

i like the use of attributes

@erikzhang
Copy link
Member

https://github.com/neo-project/neo/blob/4aff0d3dba34f228dfe44bf0e9b68b4164fc2c71/neo/SmartContract/Manifest/ContractFeatures.cs#L6-L12

Maybe we can just use one attribute.

@shargon
Copy link
Member Author

shargon commented Nov 7, 2019

For storage i can detect the syscall if you prefer

erikzhang
erikzhang previously approved these changes Nov 8, 2019
@lock9
Copy link
Contributor

lock9 commented Nov 8, 2019

Neo PR Test Report

Repository: neo-devpack-dotnet
Number: 129
Title: Write manifest file with storage and payable according the contract needs
Change description: Users can now use Payable and HasStorage flags.

Code version / branch

Neo-devpack-dotnet: shargon:fix-storage-payable

Test Results

Test Name OS Test Result
Initial UT Windows 10 x64 OK
Compile Contract using Payable attribute Windows 10 x64 OK
Compile Contract 2 using HasStorage attribute Windows 10 x64 OK
Compile Contract using both HasStorage and Payable attributes Windows 10 x64 OK

Additional info

Code worked as expected. The manifest file was generated correctly.
We noticed that it wasn't possible to compile the contract using the command line, but we suppose this is a different problem. The code is looking for the PDB file at the current folder, instead of the dll folder.

PS C:\Users\HP\Workspace\neo-devpack-dotnet> dotnet src\Neo.Compiler.MSIL\bin\Debug\netcoreapp2.0\neon.dll TestContract\bin\Debug\netstandard2.1\TestContract.dll
Neo.Compiler.MSIL console app v2.4.1.0
Open File Error:System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\HP\Workspace\neo-devpack-dotnet\TestContract\bin\Debug\netstandard2.1\TestContract\bin\Debug\netstandard2.1\TestContract.dll'.
   at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
   at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at System.IO.File.OpenRead(String path)
   at Neo.Compiler.Program.Main(String[] args) in C:\Users\HP\Workspace\neo-devpack-dotnet\src\Neo.Compiler.MSIL\Program.cs:line 60

Test List

1. Initial UT
Run solution unit tests.

2. Compile Contract using Payable attribute

Create a new SmartContract project and add the Payable attribute.

Expected result:

  • Contract manifest should contain property payable set to true.

2. Compile Contract using HasStorage attribute

Create a new SmartContract project and add the HasStorage attribute.

Expected result:

  • Contract manifest should contain property storage set to true.

2. Compile Contract using both HasStorage and Payable attributes

Create a new SmartContract project and add the HasStorage and Payable attributes.

Expected result:

  • Contract manifest should contain property storage and payable set to true.

Copy link
Contributor

@lock9 lock9 left a comment

Choose a reason for hiding this comment

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

Reviewed and tested. Thanks!

@lock9 lock9 added the OK Passed tests label Nov 8, 2019
@lock9 lock9 mentioned this pull request Nov 9, 2019
@shargon shargon merged commit a75cad5 into neo-project:master Nov 9, 2019
@shargon shargon deleted the fix-storage-payable branch November 9, 2019 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OK Passed tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NEON writes out manifest file with storage and payable false, regardless of what contract needs
4 participants