Skip to content

Commit

Permalink
Revert impl of IsView on assembly executive.
Browse files Browse the repository at this point in the history
  • Loading branch information
eanzhao committed Dec 12, 2024
1 parent 22f9d8d commit 71dd178
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 29 deletions.
5 changes: 3 additions & 2 deletions src/AElf.Runtime.WebAssembly/Executive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,9 @@ public string GetJsonStringOfParameters(string methodName, byte[] paramsBytes)

public bool IsView(string methodName)
{
var selector = _solangAbi.GetSelector(methodName);
return !_solangAbi.GetMutates(selector);;
return false;
// var selector = _solangAbi.GetSelector(methodName);
// return !_solangAbi.GetMutates(selector);
}

public byte[] GetFileDescriptorSet()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Threading.Tasks;
using AElf.Types;
using Scale;
using Shouldly;
using Xunit.Abstractions;
Expand Down Expand Up @@ -39,5 +40,16 @@ public async Task MyTokenTest()

AddressType.From(txResult.ReturnValue.ToByteArray()).Value.ShouldBe(DefaultSender);
}

{
var result = await QueryAsync(contractAddress, "test",
TupleType<AddressType, BoolType>.GetByteStringFrom(
AddressType.From(DefaultSender.ToByteArray()),
BoolType.From(true)
));

AddressType.From(result.ToByteArray()).Value.ShouldBe(DefaultSender);
Address.FromBytes(result.ToByteArray()).ShouldBe(DefaultSender);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -285,34 +285,35 @@ internal async Task<ByteString> QueryAsync(Address contractAddress, string field
_outputHelper.WriteLine("\nExecuting query: " + fieldName);

var tx = await GetTransactionAsync(DefaultSenderKeyPair, contractAddress, fieldName, parameter);
var txResult = await TestTransactionExecutor.ExecuteAsync(tx);
var txResult = await TestTransactionExecutor.ReadAsync(tx);
//txResult.Status.ShouldBe(TransactionResultStatus.Mined);

_outputHelper.WriteLine("[Prints]");
foreach (var print in txResult.GetPrints())
{
_outputHelper.WriteLine(print);
}

_outputHelper.WriteLine("[Runtime logs]");
foreach (var runtimeLog in txResult.GetRuntimeLogs())
{
_outputHelper.WriteLine(runtimeLog);
}

_outputHelper.WriteLine("[Debug messages]");
foreach (var debugMessage in txResult.GetDebugMessages())
{
_outputHelper.WriteLine(debugMessage);
}

_outputHelper.WriteLine("[Error messages]");
foreach (var errorMessage in txResult.GetErrorMessages())
{
_outputHelper.WriteLine(errorMessage);
}

return txResult.ReturnValue;
//
// _outputHelper.WriteLine("[Prints]");
// foreach (var print in txResult.GetPrints())
// {
// _outputHelper.WriteLine(print);
// }
//
// _outputHelper.WriteLine("[Runtime logs]");
// foreach (var runtimeLog in txResult.GetRuntimeLogs())
// {
// _outputHelper.WriteLine(runtimeLog);
// }
//
// _outputHelper.WriteLine("[Debug messages]");
// foreach (var debugMessage in txResult.GetDebugMessages())
// {
// _outputHelper.WriteLine(debugMessage);
// }
//
// _outputHelper.WriteLine("[Error messages]");
// foreach (var errorMessage in txResult.GetErrorMessages())
// {
// _outputHelper.WriteLine(errorMessage);
// }

// return txResult.ReturnValue;
return txResult;
}

internal async Task<ByteString> QueryWithExceptionAsync(Address contractAddress, string fieldName,
Expand Down

0 comments on commit 71dd178

Please sign in to comment.