-
Notifications
You must be signed in to change notification settings - Fork 458
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3161505
commit 8eaabaa
Showing
2 changed files
with
63 additions
and
3 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
src/Nethermind/Nethermind.Evm.Test/TransactionSubstateTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Copyright (c) 2021 Demerzel Solutions Limited | ||
// This file is part of the Nethermind library. | ||
// | ||
// The Nethermind library is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Lesser General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// The Nethermind library is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Lesser General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public License | ||
// along with the Nethermind. If not, see <http://www.gnu.org/licenses/>. | ||
// | ||
|
||
using System; | ||
using FluentAssertions; | ||
using Nethermind.Core; | ||
using NUnit.Framework; | ||
|
||
namespace Nethermind.Evm.Test | ||
{ | ||
public class TransactionSubstateTests | ||
{ | ||
[Test] | ||
public void should_return_proper_revert_error_when_there_is_no_exception() | ||
{ | ||
byte[] data = {0, 0, 0, 0, | ||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x20, | ||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x5, | ||
0x05, 0x06, 0x07, 0x08, 0x09}; | ||
ReadOnlyMemory<byte> readOnlyMemory = new(data); | ||
TransactionSubstate transactionSubstate = new(readOnlyMemory, | ||
0, | ||
new ArraySegment<Address>(), | ||
new LogEntry[] {}, | ||
true, | ||
true); | ||
transactionSubstate.Error.Should().Be("Reverted 0x0506070809"); | ||
} | ||
|
||
[Test] | ||
public void should_return_proper_revert_error_when_there_is_exception() | ||
{ | ||
byte[] data = {0x05, 0x06, 0x07, 0x08, 0x09}; | ||
ReadOnlyMemory<byte> readOnlyMemory = new(data); | ||
TransactionSubstate transactionSubstate = new(readOnlyMemory, | ||
0, | ||
new ArraySegment<Address>(), | ||
new LogEntry[] {}, | ||
true, | ||
true); | ||
transactionSubstate.Error.Should().Be("Reverted 0x0506070809"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters