Skip to content

Commit

Permalink
Merge pull request #2250 from area363/release/1.5.0-to-main
Browse files Browse the repository at this point in the history
Release/1.5.0 to main
  • Loading branch information
area363 authored Nov 21, 2023
2 parents 1969277 + cd2cefb commit 7f504d1
Show file tree
Hide file tree
Showing 460 changed files with 8,747 additions and 8,912 deletions.
9 changes: 1 addition & 8 deletions .Lib9c.Tests/Action/AccountStateDeltaExtensionsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,18 +115,11 @@ public void SetCouponWallet()
var agentAddress1 = new Address("0000000000000000000000000000000000000000");
var agentAddress2 = new Address("0000000000000000000000000000000000000001");

states = states.SetCouponWallet(
agentAddress1,
ImmutableDictionary<Guid, Coupon>.Empty
.Add(guid1, coupon1)
.Add(guid2, coupon2), true);

states = states.SetCouponWallet(
agentAddress2,
ImmutableDictionary<Guid, Coupon>.Empty);

Assert.Equal(
ActionBase.MarkChanged,
Assert.Null(
states.GetState(agentAddress1.Derive(SerializeKeys.CouponWalletKey)));
Assert.Equal(
Bencodex.Types.List.Empty,
Expand Down
55 changes: 0 additions & 55 deletions .Lib9c.Tests/Action/ActionBaseExtensionsTest.cs

This file was deleted.

26 changes: 0 additions & 26 deletions .Lib9c.Tests/Action/ActivateAccount0Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,32 +39,6 @@ public void Execute()
activatedAccounts.Accounts);
}

[Fact]
public void Rehearsal()
{
var nonce = new byte[] { 0x00, 0x01, 0x02, 0x03 };
var privateKey = new PrivateKey();
(ActivationKey activationKey, PendingActivationState pendingActivation) =
ActivationKey.Create(privateKey, nonce);

ActivateAccount0 action = activationKey.CreateActivateAccount0(nonce);
IAccount nextState = action.Execute(new ActionContext()
{
PreviousState = new Account(MockState.Empty),
Signer = default,
Rehearsal = true,
BlockIndex = 1,
});

Assert.Equal(
ImmutableHashSet.Create(
ActivatedAccountsState.Address,
pendingActivation.address
),
nextState.Delta.UpdatedAddresses
);
}

[Fact]
public void ExecuteWithInvalidSignature()
{
Expand Down
27 changes: 0 additions & 27 deletions .Lib9c.Tests/Action/ActivateAccountTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,33 +62,6 @@ public void Execute(bool invalid, bool pendingExist, bool alreadyActivated, Type
}
}

[Fact]
public void Rehearsal()
{
var nonce = new byte[] { 0x00, 0x01, 0x02, 0x03 };
var privateKey = new PrivateKey();
(ActivationKey activationKey, PendingActivationState pendingActivation) =
ActivationKey.Create(privateKey, nonce);

ActivateAccount action = activationKey.CreateActivateAccount(nonce);
Address activatedAddress = default(Address).Derive(ActivationKey.DeriveKey);
IAccount nextState = action.Execute(new ActionContext()
{
PreviousState = new Account(MockState.Empty),
Signer = default,
Rehearsal = true,
BlockIndex = 1,
});

Assert.Equal(
ImmutableHashSet.Create(
activatedAddress,
pendingActivation.address
),
nextState.Delta.UpdatedAddresses
);
}

[Fact]
public void PlainValue()
{
Expand Down
29 changes: 0 additions & 29 deletions .Lib9c.Tests/Action/AddActivatedAccount0Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,35 +39,6 @@ public void Execute()
);
}

[Fact]
public void Rehearsal()
{
var admin = new Address("8d9f76aF8Dc5A812aCeA15d8bf56E2F790F47fd7");
var state = new Account(
MockState.Empty
.SetState(AdminState.Address, new AdminState(admin, 100).Serialize())
.SetState(ActivatedAccountsState.Address, new ActivatedAccountsState().Serialize()));
var newComer = new Address("399bddF9F7B6d902ea27037B907B2486C9910730");
var action = new AddActivatedAccount0(newComer);

IAccount nextState = action.Execute(new ActionContext()
{
BlockIndex = 1,
Miner = default,
PreviousState = state,
Signer = admin,
Rehearsal = true,
});

Assert.Equal(
new[]
{
ActivatedAccountsState.Address,
}.ToImmutableHashSet(),
nextState.Delta.UpdatedAddresses
);
}

[Fact]
public void ExecuteWithNonExistsAccounts()
{
Expand Down
28 changes: 0 additions & 28 deletions .Lib9c.Tests/Action/AddActivatedAccountTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,34 +55,6 @@ public void Execute(bool isAdmin, long blockIndex, bool alreadyActivated, Type e
}
}

[Fact]
public void Rehearsal()
{
var admin = new Address("8d9f76aF8Dc5A812aCeA15d8bf56E2F790F47fd7");
var state = new Account(
MockState.Empty
.SetState(AdminState.Address, new AdminState(admin, 100).Serialize()));
var newComer = new Address("399bddF9F7B6d902ea27037B907B2486C9910730");
var action = new AddActivatedAccount(newComer);

IAccount nextState = action.Execute(new ActionContext()
{
BlockIndex = 1,
Miner = default,
PreviousState = state,
Signer = admin,
Rehearsal = true,
});

Assert.Equal(
new[]
{
newComer.Derive(ActivationKey.DeriveKey),
}.ToImmutableHashSet(),
nextState.Delta.UpdatedAddresses
);
}

[Fact]
public void PlainValue()
{
Expand Down
21 changes: 0 additions & 21 deletions .Lib9c.Tests/Action/AddRedeemCodeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,26 +105,5 @@ public void ExecuteThrowSheetRowValidateException()
})
);
}

[Fact]
public void Rehearsal()
{
var action = new AddRedeemCode
{
redeemCsv = "test",
};

var nextState = action.Execute(new ActionContext
{
BlockIndex = 0,
PreviousState = new Account(MockState.Empty),
Rehearsal = true,
});

Assert.Equal(
nextState.Delta.UpdatedAddresses,
new[] { Addresses.RedeemCode }.ToImmutableHashSet()
);
}
}
}
Loading

0 comments on commit 7f504d1

Please sign in to comment.