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

Check witnesses on isStandard #1754

Merged
merged 8 commits into from
Jul 8, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add coverage
shargon committed Jul 7, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 39849e09f9cc2e5034d0a2f7c9d0548b832b5f62
36 changes: 36 additions & 0 deletions tests/neo.UnitTests/SmartContract/UT_InteropService.NEO.cs
Original file line number Diff line number Diff line change
@@ -125,6 +125,42 @@ public void TestAccount_IsStandard()
engine.IsStandardContract(state.ScriptHash).Should().BeTrue();
}

[TestMethod]
public void TestAccount_IsDeployed()
{
var engine = GetEngine(false, true);
var hash = new byte[] { 0x01, 0x01, 0x01 ,0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01 };
engine.IsDeployedContract(new UInt160(hash)).Should().BeFalse();

var snapshot = Blockchain.Singleton.GetSnapshot();
var state = TestUtils.GetContract();
snapshot.Contracts.Add(state.ScriptHash, state);
engine = new ApplicationEngine(TriggerType.Application, null, snapshot, 0, true);
engine.LoadScript(new byte[] { 0x01 });
engine.IsDeployedContract(state.ScriptHash).Should().BeTrue();
}

[TestMethod]
public void TestAccount_IsPayable()
{
var engine = GetEngine(false, true);
var hash = new byte[] { 0x01, 0x01, 0x01 ,0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01 };
engine.IsPayableContract(new UInt160(hash)).Should().BeFalse();

var snapshot = Blockchain.Singleton.GetSnapshot();
var state = TestUtils.GetContract();
snapshot.Contracts.Add(state.ScriptHash, state);
engine = new ApplicationEngine(TriggerType.Application, null, snapshot, 0, true);
engine.LoadScript(new byte[] { 0x01 });
engine.IsPayableContract(state.ScriptHash).Should().BeFalse();
}

[TestMethod]
public void TestContract_Create()
{