Skip to content

Commit

Permalink
Merge pull request #2152 from planetarium/release/1.1.0
Browse files Browse the repository at this point in the history
Release/1.1.0
  • Loading branch information
ipdae authored Sep 19, 2023
2 parents 8132d80 + aa9018c commit fe86a78
Show file tree
Hide file tree
Showing 659 changed files with 7,672 additions and 2,466 deletions.
2 changes: 1 addition & 1 deletion .Lib9c.Benchmarks/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ private static ImmutableDictionary<string, IValue> GetTotalDelta(
.SelectMany(a => a.OutputState.Delta.UpdatedFungibleAssets)
.ToImmutableHashSet();

IAccountStateDelta lastStates = actionEvaluations.Count > 0
IAccount lastStates = actionEvaluations.Count > 0
? actionEvaluations[actionEvaluations.Count - 1].OutputState
: null;
ImmutableDictionary<string, IValue> totalDelta =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class UnlockCraftActionTest
private readonly TableSheets _tableSheets;
private readonly Address _agentAddress;
private readonly Address _avatarAddress;
private readonly IAccountStateDelta _initialStateV2;
private readonly IAccount _initialStateV2;
private readonly Address _worldInformationAddress;

public UnlockCraftActionTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class UnlockRecipeTest
private readonly TableSheets _tableSheets;
private readonly Address _agentAddress;
private readonly Address _avatarAddress;
private readonly IAccountStateDelta _initialStateV2;
private readonly IAccount _initialStateV2;
private readonly Address _recipeAddress;

public UnlockRecipeTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace Lib9c.DevExtensions.Tests.Action
{
public class CreateOrReplaceAvatarTest
{
private readonly IAccountStateDelta _initialStates;
private readonly IAccount _initialStates;

public CreateOrReplaceAvatarTest()
{
Expand Down Expand Up @@ -410,7 +410,7 @@ public void Execute_Failure(
}

private static void Execute(
IAccountStateDelta previousStates,
IAccount previousStates,
long blockIndex,
Address agentAddr,
int avatarIndex,
Expand Down
2 changes: 1 addition & 1 deletion .Lib9c.DevExtensions.Tests/Action/FaucetCurrencyTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Lib9c.DevExtensions.Tests.Action
{
public class FaucetCurrencyTest
{
private readonly IAccountStateDelta _initialState;
private readonly IAccount _initialState;
private readonly Address _agentAddress;
private readonly Currency _ncg;
private readonly Currency _crystal;
Expand Down
2 changes: 1 addition & 1 deletion .Lib9c.DevExtensions.Tests/Action/FaucetRuneTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace Lib9c.DevExtensions.Tests.Action
{
public class FaucetRuneTest
{
private readonly IAccountStateDelta _initialState;
private readonly IAccount _initialState;
private readonly Address _avatarAddress;
private readonly RuneSheet _runeSheet;

Expand Down
14 changes: 7 additions & 7 deletions .Lib9c.DevExtensions.Tests/Action/ManipulateStateTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class ManipulateStateTest
private readonly TableSheets _tableSheets;
private readonly Address _agentAddress;
private readonly Address _avatarAddress;
private readonly IAccountStateDelta _initialStateV2;
private readonly IAccount _initialStateV2;
private readonly Address _inventoryAddress;
private readonly Address _worldInformationAddress;
private readonly Address _questListAddress;
Expand Down Expand Up @@ -345,8 +345,8 @@ public static IEnumerable<object[]> FetchBalance()
// ~MemberData

// Logics
private IAccountStateDelta Manipulate(
IAccountStateDelta state,
private IAccount Manipulate(
IAccount state,
List<(Address addr, IValue value)> targetStateList,
List<(Address addr, FungibleAssetValue fav)> targetBalanceList
)
Expand All @@ -366,7 +366,7 @@ private IAccountStateDelta Manipulate(
}

private void TestAvatarState(
IAccountStateDelta state,
IAccount state,
string? name, int? level, long? exp, int? actionPoint,
long? blockIndex, long? dailyRewardReceivedIndex,
int? hair, int? lens, int? ear, int? tail
Expand Down Expand Up @@ -425,7 +425,7 @@ private void TestAvatarState(
}
}

private void TestInventoryState(IAccountStateDelta state, Inventory targetInventory)
private void TestInventoryState(IAccount state, Inventory targetInventory)
{
var avatarState = state.GetAvatarStateV2(_avatarAddress);
var inventoryState = avatarState.inventory;
Expand Down Expand Up @@ -475,7 +475,7 @@ public void SetAvatarState(
);
}

private void TestQuestState(IAccountStateDelta state, List<int> targetQuestIdList)
private void TestQuestState(IAccount state, List<int> targetQuestIdList)
{
var avatarState = state.GetAvatarStateV2(_avatarAddress);
var questState = avatarState.questList;
Expand All @@ -485,7 +485,7 @@ private void TestQuestState(IAccountStateDelta state, List<int> targetQuestIdLis
}
}

private void TestWorldInformation(IAccountStateDelta state, int lastClearedStage)
private void TestWorldInformation(IAccount state, int lastClearedStage)
{
var avatarState = state.GetAvatarStateV2(_avatarAddress);
var worldInformation = avatarState.worldInformation;
Expand Down
2 changes: 1 addition & 1 deletion .Lib9c.DevExtensions.Tests/Action/Stage/ClearStageTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class ClearStageTest
private readonly TableSheets _tableSheets;
private readonly Address _agentAddress;
private readonly Address _avatarAddress;
private readonly IAccountStateDelta _initialStateV2;
private readonly IAccount _initialStateV2;
private readonly Address _worldInfoAddress;

public ClearStageTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void LoadPlainValue(IValue plainValue)
AvatarAddress = new Address(((Binary)((Dictionary)plainValue)["a"]).ByteArray);
}

public IAccountStateDelta Execute(IActionContext context)
public IAccount Execute(IActionContext context)
{
context.UseGas(1);
return context.PreviousState;
Expand Down
6 changes: 3 additions & 3 deletions .Lib9c.Tests/Action/AccountStateDeltaExtensionsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public AccountStateDeltaExtensionsTest()
public void SetWorldBossKillReward(int level, int expectedRune, int expectedCrystal, Type exc)
{
var context = new ActionContext();
IAccountStateDelta states = new MockStateDelta();
IAccount states = new MockStateDelta();
var rewardInfoAddress = new PrivateKey().ToAddress();
var rewardRecord = new WorldBossKillRewardRecord();
for (int i = 0; i < level; i++)
Expand Down Expand Up @@ -105,7 +105,7 @@ public void SetWorldBossKillReward(int level, int expectedRune, int expectedCrys
[Fact]
public void SetCouponWallet()
{
IAccountStateDelta states = new MockStateDelta();
IAccount states = new MockStateDelta();
var guid1 = new Guid("6856AE42-A820-4041-92B0-5D7BAA52F2AA");
var guid2 = new Guid("701BA698-CCB9-4FC7-B88F-7CB8C707D135");
var guid3 = new Guid("910296E7-34E4-45D7-9B4E-778ED61F278B");
Expand Down Expand Up @@ -168,7 +168,7 @@ public void Mead(int agentBalance)
var mead = Currencies.Mead;
var price = RequestPledge.DefaultRefillMead * mead;
ActionContext context = new ActionContext();
IAccountStateDelta states = new MockStateDelta()
IAccount states = new MockStateDelta()
.SetState(
agentContractAddress,
List.Empty.Add(patron.Serialize()).Add(true.Serialize()))
Expand Down
10 changes: 5 additions & 5 deletions .Lib9c.Tests/Action/AccountStateViewExtensionsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public void TryGetAgentAvatarStatesV2(bool backward)
[Fact]
public void GetStatesAsDict()
{
IAccountStateDelta states = new MockStateDelta();
IAccount states = new MockStateDelta();
var dict = new Dictionary<Address, IValue>
{
{ new PrivateKey().ToAddress(), Null.Value },
Expand All @@ -213,7 +213,7 @@ public void GetStatesAsDict()
[Fact]
public void GetSheets()
{
IAccountStateDelta states = new MockStateDelta();
IAccount states = new MockStateDelta();
SheetsExtensionsTest.InitSheets(
states,
out _,
Expand All @@ -240,7 +240,7 @@ public void GetSheets()
[InlineData(true)]
public void GetCrystalCostState(bool exist)
{
IAccountStateDelta state = new MockStateDelta();
IAccount state = new MockStateDelta();
int expectedCount = exist ? 1 : 0;
FungibleAssetValue expectedCrystal = exist
? 100 * CrystalCalculator.CRYSTAL
Expand Down Expand Up @@ -273,7 +273,7 @@ public void GetCrystalCostStates(long blockIndex, bool previousWeeklyExist)
Address previousCostAddress = Addresses.GetWeeklyCrystalCostAddress(weeklyIndex - 1);
Address beforePreviousCostAddress = Addresses.GetWeeklyCrystalCostAddress(weeklyIndex - 2);
var crystalCostState = new CrystalCostState(default, 100 * CrystalCalculator.CRYSTAL);
IAccountStateDelta state = new MockStateDelta()
IAccount state = new MockStateDelta()
.SetState(dailyCostAddress, crystalCostState.Serialize())
.SetState(weeklyCostAddress, crystalCostState.Serialize())
.SetState(previousCostAddress, crystalCostState.Serialize())
Expand Down Expand Up @@ -303,7 +303,7 @@ public void GetCrystalCostStates(long blockIndex, bool previousWeeklyExist)
[Fact]
public void GetCouponWallet()
{
IAccountStateDelta states = new MockStateDelta();
IAccount states = new MockStateDelta();
var guid1 = new Guid("6856AE42-A820-4041-92B0-5D7BAA52F2AA");
var guid2 = new Guid("701BA698-CCB9-4FC7-B88F-7CB8C707D135");
var guid3 = new Guid("910296E7-34E4-45D7-9B4E-778ED61F278B");
Expand Down
2 changes: 1 addition & 1 deletion .Lib9c.Tests/Action/ActionContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class ActionContext : IActionContext

public bool Rehearsal { get; set; }

public IAccountStateDelta PreviousState { get; set; }
public IAccount PreviousState { get; set; }

public IRandom Random { get; set; }

Expand Down
2 changes: 1 addition & 1 deletion .Lib9c.Tests/Action/ActionEvaluationTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class ActionEvaluationTest
private readonly Currency _currency;
private readonly Address _signer;
private readonly Address _sender;
private readonly IAccountStateDelta _states;
private readonly IAccount _states;

public ActionEvaluationTest()
{
Expand Down
6 changes: 3 additions & 3 deletions .Lib9c.Tests/Action/ActivateAccount0Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public void Execute()
.SetState(pendingActivation.address, pendingActivation.Serialize()));

ActivateAccount0 action = activationKey.CreateActivateAccount0(nonce);
IAccountStateDelta nextState = action.Execute(new ActionContext()
IAccount nextState = action.Execute(new ActionContext()
{
PreviousState = state,
Signer = default,
Expand All @@ -48,7 +48,7 @@ public void Rehearsal()
ActivationKey.Create(privateKey, nonce);

ActivateAccount0 action = activationKey.CreateActivateAccount0(nonce);
IAccountStateDelta nextState = action.Execute(new ActionContext()
IAccount nextState = action.Execute(new ActionContext()
{
PreviousState = new MockStateDelta(),
Signer = default,
Expand Down Expand Up @@ -151,7 +151,7 @@ public void ForbidReusingActivationKey()
.SetState(pendingActivation.address, pendingActivation.Serialize()));

ActivateAccount0 action = activationKey.CreateActivateAccount0(nonce);
IAccountStateDelta nextState = action.Execute(new ActionContext()
IAccount nextState = action.Execute(new ActionContext()
{
PreviousState = state,
Signer = default,
Expand Down
4 changes: 2 additions & 2 deletions .Lib9c.Tests/Action/ActivateAccountTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void Execute(bool invalid, bool pendingExist, bool alreadyActivated, Type

if (exc is null)
{
IAccountStateDelta nextState = action.Execute(new ActionContext()
IAccount nextState = action.Execute(new ActionContext()
{
PreviousState = state,
Signer = default,
Expand Down Expand Up @@ -72,7 +72,7 @@ public void Rehearsal()

ActivateAccount action = activationKey.CreateActivateAccount(nonce);
Address activatedAddress = default(Address).Derive(ActivationKey.DeriveKey);
IAccountStateDelta nextState = action.Execute(new ActionContext()
IAccount nextState = action.Execute(new ActionContext()
{
PreviousState = new MockStateDelta(),
Signer = default,
Expand Down
4 changes: 2 additions & 2 deletions .Lib9c.Tests/Action/AddActivatedAccount0Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public void Execute()
var newComer = new Address("399bddF9F7B6d902ea27037B907B2486C9910730");
var action = new AddActivatedAccount0(newComer);

IAccountStateDelta nextState = action.Execute(new ActionContext()
IAccount nextState = action.Execute(new ActionContext()
{
BlockIndex = 1,
Miner = default,
Expand Down Expand Up @@ -50,7 +50,7 @@ public void Rehearsal()
var newComer = new Address("399bddF9F7B6d902ea27037B907B2486C9910730");
var action = new AddActivatedAccount0(newComer);

IAccountStateDelta nextState = action.Execute(new ActionContext()
IAccount nextState = action.Execute(new ActionContext()
{
BlockIndex = 1,
Miner = default,
Expand Down
4 changes: 2 additions & 2 deletions .Lib9c.Tests/Action/AddActivatedAccountTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void Execute(bool isAdmin, long blockIndex, bool alreadyActivated, Type e

if (exc is null)
{
IAccountStateDelta nextState = action.Execute(new ActionContext()
IAccount nextState = action.Execute(new ActionContext()
{
BlockIndex = blockIndex,
Miner = default,
Expand Down Expand Up @@ -65,7 +65,7 @@ public void Rehearsal()
var newComer = new Address("399bddF9F7B6d902ea27037B907B2486C9910730");
var action = new AddActivatedAccount(newComer);

IAccountStateDelta nextState = action.Execute(new ActionContext()
IAccount nextState = action.Execute(new ActionContext()
{
BlockIndex = 1,
Miner = default,
Expand Down
4 changes: 2 additions & 2 deletions .Lib9c.Tests/Action/ApprovePledgeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public void Execute(int mead)
var address = new PrivateKey().ToAddress();
var patron = new PrivateKey().ToAddress();
var contractAddress = address.Derive(nameof(RequestPledge));
IAccountStateDelta states = new MockStateDelta()
IAccount states = new MockStateDelta()
.SetState(
contractAddress,
List.Empty.Add(patron.Serialize()).Add(false.Serialize()).Add(mead.Serialize())
Expand Down Expand Up @@ -61,7 +61,7 @@ public void Execute_Throw_Exception(bool invalidPatron, bool alreadyContract, Ty
contract = List.Empty.Add(patron.Serialize()).Add(true.Serialize());
}

IAccountStateDelta states = new MockStateDelta().SetState(contractAddress, contract);
IAccount states = new MockStateDelta().SetState(contractAddress, contract);

var action = new ApprovePledge
{
Expand Down
2 changes: 1 addition & 1 deletion .Lib9c.Tests/Action/ArenahelperTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace Lib9c.Tests.Action

public class ArenaHelperTest
{
private IAccountStateDelta _state;
private IAccount _state;
private Currency _crystal;
private Address _agent1Address;
private Address _avatar1Address;
Expand Down
6 changes: 3 additions & 3 deletions .Lib9c.Tests/Action/BattleArena10Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class BattleArena10Test
private readonly Address _avatar4Address;
private readonly Currency _crystal;
private readonly Currency _ncg;
private IAccountStateDelta _initialStates;
private IAccount _initialStates;

public BattleArena10Test(ITestOutputHelper outputHelper)
{
Expand Down Expand Up @@ -1283,9 +1283,9 @@ private void Execute(
Assert.InRange(materialCount, 0, high);
}

private IAccountStateDelta JoinArena(
private IAccount JoinArena(
IActionContext context,
IAccountStateDelta states,
IAccount states,
Address signer,
Address avatarAddress,
long blockIndex,
Expand Down
6 changes: 3 additions & 3 deletions .Lib9c.Tests/Action/BattleArena11Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class BattleArena11Test
private readonly Address _avatar4Address;
private readonly Currency _crystal;
private readonly Currency _ncg;
private IAccountStateDelta _initialStates;
private IAccount _initialStates;

public BattleArena11Test(ITestOutputHelper outputHelper)
{
Expand Down Expand Up @@ -1283,9 +1283,9 @@ private void Execute(
Assert.InRange(materialCount, 0, high);
}

private IAccountStateDelta JoinArena(
private IAccount JoinArena(
IActionContext context,
IAccountStateDelta states,
IAccount states,
Address signer,
Address avatarAddress,
long blockIndex,
Expand Down
6 changes: 3 additions & 3 deletions .Lib9c.Tests/Action/BattleArena12Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class BattleArena12Test
private readonly Address _avatar4Address;
private readonly Currency _crystal;
private readonly Currency _ncg;
private IAccountStateDelta _initialStates;
private IAccount _initialStates;

public BattleArena12Test(ITestOutputHelper outputHelper)
{
Expand Down Expand Up @@ -1322,9 +1322,9 @@ private void Execute(
Assert.InRange(materialCount, 0, high);
}

private IAccountStateDelta JoinArena(
private IAccount JoinArena(
IActionContext context,
IAccountStateDelta states,
IAccount states,
Address signer,
Address avatarAddress,
long blockIndex,
Expand Down
Loading

0 comments on commit fe86a78

Please sign in to comment.