-
Notifications
You must be signed in to change notification settings - Fork 102
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
BigInteger
comparer for ByteString
#863
Comments
Wait, what? Aren't them all string? |
No,
|
I mean in your code: public static bool Main(ByteString i)
{
ByteString stored = Storage.Get(Storage.CurrentContext, "i");
return i == stored;
} ByteString i == ByteString stored I dont see any problem here |
Passing an |
I think the compiler is OK, because it is always just an INITSLOT for the start of a method. |
How are you calling the method? In `RPC? |
using System.ComponentModel;
using Neo.SmartContract.Framework;
using Neo.SmartContract.Framework.Attributes;
using Neo.SmartContract.Framework.Services;
namespace BigIntegerTest
{
[DisplayName("BigIntegerTest")]
[ManifestExtra("Author", "Hecate2")]
[ManifestExtra("Email", "[email protected]")]
[ManifestExtra("Description", "ByteString comparison")]
public class BigIntegerTest : SmartContract
{
public static void _deploy(object data, bool update)
{
Storage.Put(Storage.CurrentContext, "i", 1);
}
public static bool Main(ByteString i)
{
ByteString stored = Storage.Get(Storage.CurrentContext, "i");
return i == stored;
}
}
} from neo_fairy_client import FairyClient, Hash160Str
user = Hash160Str('0xb1983fa2479a0c8e2beae032d2df564b5451b7a5')
c = FairyClient(fairy_session='biginteger', wallet_address_or_scripthash=user)
c.virutal_deploy_from_path('./bin/sc/BigIntegerTest.nef')
print(c.invokefunction('main', [1]))
print(c.invokefunction('main', ['\x01']))
c.delete_source_code_breakpoints()
c.set_source_code_breakpoint('BigIntegerTest.cs', 21)
print(c.debug_function_with_session('main', [1]))
print('stored:', c.get_variable_value_by_name('stored'))
print('i:', c.get_variable_value_by_name('i'))
|
Yes, in neo-fairy-client. |
You using |
neo-fairy-client development by them is a very useful tool, @cschuchardt88 you can check it out. |
@Jim8y either way. There is a problem with the |
you want extra parameter type check,,,, make sense,,,, and we can make it, ABI actually contains the parameter type. |
@Jim8y looks like when you pass in type |
In our contract example, we never defined any BigInteger, and it should be quite OK to compare two ByteStrings. Maybe we can add a method in the RPC and neo-cli to invoke contracts with strict types. |
@Hecate2 we wouldn't have the contract |
Hello, neo-project/neo#1891. |
I don't know if this
ApplicationEngine
problem or compiler. But we need to do this. It compilers fine. But doesn't work. Because one is anInteger
and one is aByteString
.The text was updated successfully, but these errors were encountered: