diff --git a/.Lib9c.DevExtensions.Tests/Action/CreateOrReplaceAvatarTest.cs b/.Lib9c.DevExtensions.Tests/Action/CreateOrReplaceAvatarTest.cs index 8e134f0219..25db6e3ce2 100644 --- a/.Lib9c.DevExtensions.Tests/Action/CreateOrReplaceAvatarTest.cs +++ b/.Lib9c.DevExtensions.Tests/Action/CreateOrReplaceAvatarTest.cs @@ -28,7 +28,7 @@ public class CreateOrReplaceAvatarTest public CreateOrReplaceAvatarTest() { - _initialStates = new Lib9c.Tests.Action.State(); + _initialStates = new Lib9c.Tests.Action.StateDelta(); #pragma warning disable CS0618 var ncgCurrency = Currency.Legacy("NCG", 2, null); diff --git a/.Lib9c.DevExtensions.Tests/Action/FaucetCurrencyTest.cs b/.Lib9c.DevExtensions.Tests/Action/FaucetCurrencyTest.cs index 9ee0deb070..1bda863d0e 100644 --- a/.Lib9c.DevExtensions.Tests/Action/FaucetCurrencyTest.cs +++ b/.Lib9c.DevExtensions.Tests/Action/FaucetCurrencyTest.cs @@ -35,7 +35,7 @@ public FaucetCurrencyTest(ITestOutputHelper outputHelper) var balance = ImmutableDictionary<(Address Address, Currency Currency), FungibleAssetValue>.Empty .Add((GoldCurrencyState.Address, _ncg), _ncg * int.MaxValue); - _initialState = new Lib9c.Tests.Action.State(balance: balance); + _initialState = new Lib9c.Tests.Action.StateDelta(balances: balance); var goldCurrencyState = new GoldCurrencyState(_ncg); _agentAddress = new PrivateKey().ToAddress(); diff --git a/.Lib9c.DevExtensions.Tests/Action/FaucetRuneTest.cs b/.Lib9c.DevExtensions.Tests/Action/FaucetRuneTest.cs index d99fc5d94f..a44e4deec6 100644 --- a/.Lib9c.DevExtensions.Tests/Action/FaucetRuneTest.cs +++ b/.Lib9c.DevExtensions.Tests/Action/FaucetRuneTest.cs @@ -33,7 +33,7 @@ public FaucetRuneTest(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new Lib9c.Tests.Action.State(); + _initialState = new Lib9c.Tests.Action.StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { diff --git a/.Lib9c.Tests/Action/AccountStateDeltaExtensionsTest.cs b/.Lib9c.Tests/Action/AccountStateDeltaExtensionsTest.cs index 32fe6157f0..f6dd740d07 100644 --- a/.Lib9c.Tests/Action/AccountStateDeltaExtensionsTest.cs +++ b/.Lib9c.Tests/Action/AccountStateDeltaExtensionsTest.cs @@ -46,7 +46,7 @@ public AccountStateDeltaExtensionsTest() public void SetWorldBossKillReward(int level, int expectedRune, int expectedCrystal, Type exc) { var context = new ActionContext(); - IAccountStateDelta states = new State(); + IAccountStateDelta states = new StateDelta(); var rewardInfoAddress = new PrivateKey().ToAddress(); var rewardRecord = new WorldBossKillRewardRecord(); for (int i = 0; i < level; i++) @@ -106,7 +106,7 @@ public void SetWorldBossKillReward(int level, int expectedRune, int expectedCrys [Fact] public void SetCouponWallet() { - IAccountStateDelta states = new State(); + IAccountStateDelta states = new StateDelta(); 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"); @@ -169,7 +169,7 @@ public void Mead(int agentBalance) var mead = Currencies.Mead; var price = RequestPledge.DefaultRefillMead * mead; ActionContext context = new ActionContext(); - IAccountStateDelta states = new State() + IAccountStateDelta states = new StateDelta() .SetState( agentContractAddress, List.Empty.Add(patron.Serialize()).Add(true.Serialize())) diff --git a/.Lib9c.Tests/Action/AccountStateViewExtensionsTest.cs b/.Lib9c.Tests/Action/AccountStateViewExtensionsTest.cs index e1b50771da..497d4f5f80 100644 --- a/.Lib9c.Tests/Action/AccountStateViewExtensionsTest.cs +++ b/.Lib9c.Tests/Action/AccountStateViewExtensionsTest.cs @@ -49,8 +49,8 @@ public AccountStateViewExtensionsTest() [Fact] public void TryGetAvatarState() { - var states = new State(); - states = (State)states.SetState(_avatarAddress, _avatarState.Serialize()); + var states = new StateDelta(); + states = (StateDelta)states.SetState(_avatarAddress, _avatarState.Serialize()); Assert.True(states.TryGetAvatarState(_agentAddress, _avatarAddress, out var avatarState2)); Assert.Equal(_avatarAddress, avatarState2.address); @@ -60,7 +60,7 @@ public void TryGetAvatarState() [Fact] public void TryGetAvatarStateEmptyAddress() { - var states = new State(); + var states = new StateDelta(); Assert.False(states.TryGetAvatarState(default, default, out _)); } @@ -68,7 +68,7 @@ public void TryGetAvatarStateEmptyAddress() [Fact] public void TryGetAvatarStateAddressKeyNotFoundException() { - var states = new State().SetState(default, Dictionary.Empty); + var states = new StateDelta().SetState(default, Dictionary.Empty); Assert.False(states.TryGetAvatarState(default, default, out _)); } @@ -76,7 +76,7 @@ public void TryGetAvatarStateAddressKeyNotFoundException() [Fact] public void TryGetAvatarStateKeyNotFoundException() { - var states = new State() + var states = new StateDelta() .SetState( default, Dictionary.Empty @@ -89,7 +89,7 @@ public void TryGetAvatarStateKeyNotFoundException() [Fact] public void TryGetAvatarStateInvalidCastException() { - var states = new State().SetState(default, default(Text)); + var states = new StateDelta().SetState(default, default(Text)); Assert.False(states.TryGetAvatarState(default, default, out _)); } @@ -97,7 +97,7 @@ public void TryGetAvatarStateInvalidCastException() [Fact] public void TryGetAvatarStateInvalidAddress() { - var states = new State().SetState(default, _avatarState.Serialize()); + var states = new StateDelta().SetState(default, _avatarState.Serialize()); Assert.False(states.TryGetAvatarState(Addresses.GameConfig, _avatarAddress, out _)); } @@ -105,8 +105,8 @@ public void TryGetAvatarStateInvalidAddress() [Fact] public void GetAvatarStateV2() { - var states = new State(); - states = (State)states + var states = new StateDelta(); + states = (StateDelta)states .SetState(_avatarAddress, _avatarState.SerializeV2()) .SetState(_avatarAddress.Derive(LegacyInventoryKey), _avatarState.inventory.Serialize()) .SetState(_avatarAddress.Derive(LegacyWorldInformationKey), _avatarState.worldInformation.Serialize()) @@ -124,13 +124,13 @@ public void GetAvatarStateV2() [InlineData(LegacyQuestListKey)] public void GetAvatarStateV2_Throw_FailedLoadStateException(string key) { - var states = new State(); - states = (State)states + var states = new StateDelta(); + states = (StateDelta)states .SetState(_avatarAddress, _avatarState.SerializeV2()) .SetState(_avatarAddress.Derive(LegacyInventoryKey), _avatarState.inventory.Serialize()) .SetState(_avatarAddress.Derive(LegacyWorldInformationKey), _avatarState.worldInformation.Serialize()) .SetState(_avatarAddress.Derive(LegacyQuestListKey), _avatarState.questList.Serialize()); - states = (State)states.SetState(_avatarAddress.Derive(key), null); + states = (StateDelta)states.SetState(_avatarAddress.Derive(key), null); var exc = Assert.Throws(() => states.GetAvatarStateV2(_avatarAddress)); Assert.Contains(key, exc.Message); } @@ -140,15 +140,15 @@ public void GetAvatarStateV2_Throw_FailedLoadStateException(string key) [InlineData(false)] public void TryGetAvatarStateV2(bool backward) { - var states = new State(); + var states = new StateDelta(); if (backward) { - states = (State)states + states = (StateDelta)states .SetState(_avatarAddress, _avatarState.Serialize()); } else { - states = (State)states + states = (StateDelta)states .SetState(_avatarAddress, _avatarState.SerializeV2()) .SetState(_avatarAddress.Derive(LegacyInventoryKey), _avatarState.inventory.Serialize()) .SetState(_avatarAddress.Derive(LegacyWorldInformationKey), _avatarState.worldInformation.Serialize()) @@ -164,16 +164,16 @@ public void TryGetAvatarStateV2(bool backward) [InlineData(false)] public void TryGetAgentAvatarStatesV2(bool backward) { - var states = new State().SetState(_agentAddress, _agentState.Serialize()); + var states = new StateDelta().SetState(_agentAddress, _agentState.Serialize()); if (backward) { - states = (State)states + states = (StateDelta)states .SetState(_avatarAddress, _avatarState.Serialize()); } else { - states = (State)states + states = (StateDelta)states .SetState(_avatarAddress, _avatarState.SerializeV2()) .SetState(_avatarAddress.Derive(LegacyInventoryKey), _avatarState.inventory.Serialize()) .SetState(_avatarAddress.Derive(LegacyWorldInformationKey), _avatarState.worldInformation.Serialize()) @@ -187,7 +187,7 @@ public void TryGetAgentAvatarStatesV2(bool backward) [Fact] public void GetStatesAsDict() { - IAccountStateDelta states = new State(); + IAccountStateDelta states = new StateDelta(); var dict = new Dictionary { { new PrivateKey().ToAddress(), Null.Value }, @@ -214,7 +214,7 @@ public void GetStatesAsDict() [Fact] public void GetSheets() { - IAccountStateDelta states = new State(); + IAccountStateDelta states = new StateDelta(); SheetsExtensionsTest.InitSheets( states, out _, @@ -241,7 +241,7 @@ public void GetSheets() [InlineData(true)] public void GetCrystalCostState(bool exist) { - IAccountStateDelta state = new State(); + IAccountStateDelta state = new StateDelta(); int expectedCount = exist ? 1 : 0; FungibleAssetValue expectedCrystal = exist ? 100 * CrystalCalculator.CRYSTAL @@ -274,7 +274,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 State() + IAccountStateDelta state = new StateDelta() .SetState(dailyCostAddress, crystalCostState.Serialize()) .SetState(weeklyCostAddress, crystalCostState.Serialize()) .SetState(previousCostAddress, crystalCostState.Serialize()) @@ -304,7 +304,7 @@ public void GetCrystalCostStates(long blockIndex, bool previousWeeklyExist) [Fact] public void GetCouponWallet() { - IAccountStateDelta states = new State(); + IAccountStateDelta states = new StateDelta(); 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"); diff --git a/.Lib9c.Tests/Action/ActionContextExtensionsTest.cs b/.Lib9c.Tests/Action/ActionContextExtensionsTest.cs index 25340a8a81..5aac0bc58b 100644 --- a/.Lib9c.Tests/Action/ActionContextExtensionsTest.cs +++ b/.Lib9c.Tests/Action/ActionContextExtensionsTest.cs @@ -142,7 +142,7 @@ public static IEnumerable IsPreviewNetTestcases() [MemberData(nameof(IsMainNetTestcases))] public void IsMainNet(GoldCurrencyState goldCurrencyState, bool expected) { - var state = new State().SetState(Addresses.GoldCurrency, goldCurrencyState.Serialize()); + var state = new StateDelta().SetState(Addresses.GoldCurrency, goldCurrencyState.Serialize()); IActionContext context = new ActionContext { PreviousState = state, diff --git a/.Lib9c.Tests/Action/ActionEvaluationTest.cs b/.Lib9c.Tests/Action/ActionEvaluationTest.cs index 5f09b12a60..1101824cf1 100644 --- a/.Lib9c.Tests/Action/ActionEvaluationTest.cs +++ b/.Lib9c.Tests/Action/ActionEvaluationTest.cs @@ -33,7 +33,7 @@ public ActionEvaluationTest() #pragma warning restore CS0618 _signer = new PrivateKey().ToAddress(); _sender = new PrivateKey().ToAddress(); - _states = new State() + _states = new StateDelta() .SetState(_signer, (Text)"ANYTHING") .SetState(default, Dictionary.Empty.Add("key", "value")) .MintAsset(context, _signer, _currency * 10000); diff --git a/.Lib9c.Tests/Action/ActivateAccount0Test.cs b/.Lib9c.Tests/Action/ActivateAccount0Test.cs index 908805f306..7ce9dee414 100644 --- a/.Lib9c.Tests/Action/ActivateAccount0Test.cs +++ b/.Lib9c.Tests/Action/ActivateAccount0Test.cs @@ -19,7 +19,7 @@ public void Execute() var privateKey = new PrivateKey(); (ActivationKey activationKey, PendingActivationState pendingActivation) = ActivationKey.Create(privateKey, nonce); - var state = new State(ImmutableDictionary.Empty + var state = new StateDelta(ImmutableDictionary.Empty .Add(ActivatedAccountsState.Address, new ActivatedAccountsState().Serialize()) .Add(pendingActivation.address, pendingActivation.Serialize())); @@ -50,7 +50,7 @@ public void Rehearsal() ActivateAccount0 action = activationKey.CreateActivateAccount0(nonce); IAccountStateDelta nextState = action.Execute(new ActionContext() { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = default, Rehearsal = true, BlockIndex = 1, @@ -72,7 +72,7 @@ public void ExecuteWithInvalidSignature() var privateKey = new PrivateKey(); (ActivationKey activationKey, PendingActivationState pendingActivation) = ActivationKey.Create(privateKey, nonce); - var state = new State(ImmutableDictionary.Empty + var state = new StateDelta(ImmutableDictionary.Empty .Add(ActivatedAccountsState.Address, new ActivatedAccountsState().Serialize()) .Add(pendingActivation.address, pendingActivation.Serialize()) ); @@ -99,7 +99,7 @@ public void ExecuteWithNonExistsPending() ActivationKey.Create(privateKey, nonce); // state에는 pendingActivation에 해당하는 대기가 없는 상태를 가정합니다. - var state = new State(ImmutableDictionary.Empty + var state = new StateDelta(ImmutableDictionary.Empty .Add(ActivatedAccountsState.Address, new ActivatedAccountsState().Serialize())); ActivateAccount0 action = activationKey.CreateActivateAccount0(nonce); @@ -123,7 +123,7 @@ public void ExecuteWithNonExistsAccounts() ActivationKey.Create(privateKey, nonce); // state가 올바르게 초기화되지 않은 상태를 가정합니다. - var state = new State(); + var state = new StateDelta(); ActivateAccount0 action = activationKey.CreateActivateAccount0(nonce); Assert.Throws(() => @@ -144,7 +144,7 @@ public void ForbidReusingActivationKey() var privateKey = new PrivateKey(); (ActivationKey activationKey, PendingActivationState pendingActivation) = ActivationKey.Create(privateKey, nonce); - var state = new State(ImmutableDictionary.Empty + var state = new StateDelta(ImmutableDictionary.Empty .Add(ActivatedAccountsState.Address, new ActivatedAccountsState().Serialize()) .Add(pendingActivation.address, pendingActivation.Serialize())); diff --git a/.Lib9c.Tests/Action/ActivateAccountTest.cs b/.Lib9c.Tests/Action/ActivateAccountTest.cs index 7b2432e5db..6303f17640 100644 --- a/.Lib9c.Tests/Action/ActivateAccountTest.cs +++ b/.Lib9c.Tests/Action/ActivateAccountTest.cs @@ -26,16 +26,16 @@ public void Execute(bool invalid, bool pendingExist, bool alreadyActivated, Type ActivationKey.Create(privateKey, nonce); Address activatedAddress = default(Address).Derive(ActivationKey.DeriveKey); - var state = new State(); + var state = new StateDelta(); if (pendingExist) { - state = (State)state.SetState(pendingActivation.address, pendingActivation.Serialize()); + state = (StateDelta)state.SetState(pendingActivation.address, pendingActivation.Serialize()); } if (alreadyActivated) { - state = (State)state.SetState(activatedAddress, true.Serialize()); + state = (StateDelta)state.SetState(activatedAddress, true.Serialize()); } ActivateAccount action = activationKey.CreateActivateAccount(invalid ? new byte[] { 0x00 } : nonce); @@ -75,7 +75,7 @@ public void Rehearsal() Address activatedAddress = default(Address).Derive(ActivationKey.DeriveKey); IAccountStateDelta nextState = action.Execute(new ActionContext() { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = default, Rehearsal = true, BlockIndex = 1, diff --git a/.Lib9c.Tests/Action/AddActivatedAccount0Test.cs b/.Lib9c.Tests/Action/AddActivatedAccount0Test.cs index 56dbf8f7ea..70bdb5e59e 100644 --- a/.Lib9c.Tests/Action/AddActivatedAccount0Test.cs +++ b/.Lib9c.Tests/Action/AddActivatedAccount0Test.cs @@ -14,7 +14,7 @@ public class AddActivatedAccount0Test public void Execute() { var admin = new Address("8d9f76aF8Dc5A812aCeA15d8bf56E2F790F47fd7"); - var state = new State( + var state = new StateDelta( ImmutableDictionary.Empty .Add(AdminState.Address, new AdminState(admin, 100).Serialize()) .Add(ActivatedAccountsState.Address, new ActivatedAccountsState().Serialize()) @@ -44,7 +44,7 @@ public void Execute() public void Rehearsal() { var admin = new Address("8d9f76aF8Dc5A812aCeA15d8bf56E2F790F47fd7"); - var state = new State( + var state = new StateDelta( ImmutableDictionary.Empty .Add(AdminState.Address, new AdminState(admin, 100).Serialize()) .Add(ActivatedAccountsState.Address, new ActivatedAccountsState().Serialize()) @@ -75,7 +75,7 @@ public void Rehearsal() public void ExecuteWithNonExistsAccounts() { var admin = new Address("8d9f76aF8Dc5A812aCeA15d8bf56E2F790F47fd7"); - var state = new State(); + var state = new StateDelta(); var newComer = new Address("399bddF9F7B6d902ea27037B907B2486C9910730"); var action = new AddActivatedAccount0(newComer); @@ -95,7 +95,7 @@ public void ExecuteWithNonExistsAccounts() public void CheckPermission() { var admin = new Address("8d9f76aF8Dc5A812aCeA15d8bf56E2F790F47fd7"); - var state = new State( + var state = new StateDelta( ImmutableDictionary.Empty .Add(AdminState.Address, new AdminState(admin, 100).Serialize()) .Add(ActivatedAccountsState.Address, new ActivatedAccountsState().Serialize()) diff --git a/.Lib9c.Tests/Action/AddActivatedAccountTest.cs b/.Lib9c.Tests/Action/AddActivatedAccountTest.cs index a8ef185cd7..0d2b7315cf 100644 --- a/.Lib9c.Tests/Action/AddActivatedAccountTest.cs +++ b/.Lib9c.Tests/Action/AddActivatedAccountTest.cs @@ -20,7 +20,7 @@ public class AddActivatedAccountTest public void Execute(bool isAdmin, long blockIndex, bool alreadyActivated, Type exc) { var admin = new Address("8d9f76aF8Dc5A812aCeA15d8bf56E2F790F47fd7"); - var state = new State( + var state = new StateDelta( ImmutableDictionary.Empty .Add(AdminState.Address, new AdminState(admin, 100).Serialize()) ); @@ -28,7 +28,7 @@ public void Execute(bool isAdmin, long blockIndex, bool alreadyActivated, Type e var activatedAddress = newComer.Derive(ActivationKey.DeriveKey); if (alreadyActivated) { - state = (State)state.SetState(activatedAddress, true.Serialize()); + state = (StateDelta)state.SetState(activatedAddress, true.Serialize()); } var action = new AddActivatedAccount(newComer); @@ -61,7 +61,7 @@ public void Execute(bool isAdmin, long blockIndex, bool alreadyActivated, Type e public void Rehearsal() { var admin = new Address("8d9f76aF8Dc5A812aCeA15d8bf56E2F790F47fd7"); - var state = new State( + var state = new StateDelta( ImmutableDictionary.Empty .Add(AdminState.Address, new AdminState(admin, 100).Serialize()) ); diff --git a/.Lib9c.Tests/Action/AddRedeemCodeTest.cs b/.Lib9c.Tests/Action/AddRedeemCodeTest.cs index 040f53181d..d30086de60 100644 --- a/.Lib9c.Tests/Action/AddRedeemCodeTest.cs +++ b/.Lib9c.Tests/Action/AddRedeemCodeTest.cs @@ -19,7 +19,7 @@ public void CheckPermission() var adminState = new AdminState(adminAddress, 100); var initStates = ImmutableDictionary.Empty .Add(AdminState.Address, adminState.Serialize()); - var state = new State(initStates); + var state = new StateDelta(initStates); var action = new AddRedeemCode { redeemCsv = "New Value", @@ -69,7 +69,7 @@ public void Execute() { Signer = adminAddress, BlockIndex = 0, - PreviousState = new State() + PreviousState = new StateDelta() .SetState(Addresses.Admin, adminState.Serialize()) .SetState(Addresses.RedeemCode, new RedeemCodeState(new RedeemCodeListSheet()).Serialize()), }); @@ -91,7 +91,7 @@ public void ExecuteThrowSheetRowValidateException() var sheet = new RedeemCodeListSheet(); sheet.Set(csv); - var state = new State() + var state = new StateDelta() .SetState(Addresses.RedeemCode, new RedeemCodeState(sheet).Serialize()); var action = new AddRedeemCode @@ -118,7 +118,7 @@ public void Rehearsal() var nextState = action.Execute(new ActionContext { BlockIndex = 0, - PreviousState = new State(), + PreviousState = new StateDelta(), Rehearsal = true, }); diff --git a/.Lib9c.Tests/Action/ApprovePledgeTest.cs b/.Lib9c.Tests/Action/ApprovePledgeTest.cs index 23b15e90dc..fcb86ad7a1 100644 --- a/.Lib9c.Tests/Action/ApprovePledgeTest.cs +++ b/.Lib9c.Tests/Action/ApprovePledgeTest.cs @@ -21,7 +21,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 State() + IAccountStateDelta states = new StateDelta() .SetState( contractAddress, List.Empty.Add(patron.Serialize()).Add(false.Serialize()).Add(mead.Serialize()) @@ -63,7 +63,7 @@ public void Execute_Throw_Exception(bool invalidPatron, bool alreadyContract, Ty contract = List.Empty.Add(patron.Serialize()).Add(true.Serialize()); } - IAccountStateDelta states = new State().SetState(contractAddress, contract); + IAccountStateDelta states = new StateDelta().SetState(contractAddress, contract); var action = new ApprovePledge { diff --git a/.Lib9c.Tests/Action/ArenahelperTest.cs b/.Lib9c.Tests/Action/ArenahelperTest.cs index 91d4034240..c1d3ad43a4 100644 --- a/.Lib9c.Tests/Action/ArenahelperTest.cs +++ b/.Lib9c.Tests/Action/ArenahelperTest.cs @@ -35,7 +35,7 @@ public ArenaHelperTest(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _state = new State(); + _state = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); var tableSheets = new TableSheets(sheets); diff --git a/.Lib9c.Tests/Action/BattleArena10Test.cs b/.Lib9c.Tests/Action/BattleArena10Test.cs index 23b30f1a16..5db9028619 100644 --- a/.Lib9c.Tests/Action/BattleArena10Test.cs +++ b/.Lib9c.Tests/Action/BattleArena10Test.cs @@ -47,7 +47,7 @@ public BattleArena10Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialStates = new State(); + _initialStates = new StateDelta(); _sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in _sheets) diff --git a/.Lib9c.Tests/Action/BattleArena11Test.cs b/.Lib9c.Tests/Action/BattleArena11Test.cs index 4b2247a291..cb22d646df 100644 --- a/.Lib9c.Tests/Action/BattleArena11Test.cs +++ b/.Lib9c.Tests/Action/BattleArena11Test.cs @@ -47,7 +47,7 @@ public BattleArena11Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialStates = new State(); + _initialStates = new StateDelta(); _sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in _sheets) diff --git a/.Lib9c.Tests/Action/BattleArena12Test.cs b/.Lib9c.Tests/Action/BattleArena12Test.cs index 54f7c8c132..ea0e19043c 100644 --- a/.Lib9c.Tests/Action/BattleArena12Test.cs +++ b/.Lib9c.Tests/Action/BattleArena12Test.cs @@ -47,7 +47,7 @@ public BattleArena12Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialStates = new State(); + _initialStates = new StateDelta(); _sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in _sheets) diff --git a/.Lib9c.Tests/Action/BattleArena1Test.cs b/.Lib9c.Tests/Action/BattleArena1Test.cs index 2693738add..085e0cfcec 100644 --- a/.Lib9c.Tests/Action/BattleArena1Test.cs +++ b/.Lib9c.Tests/Action/BattleArena1Test.cs @@ -48,7 +48,7 @@ public BattleArena1Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _state = new State(); + _state = new StateDelta(); _sheets = TableSheetsImporter.ImportSheets(); var tableSheets = new TableSheets(_sheets); diff --git a/.Lib9c.Tests/Action/BattleArena2Test.cs b/.Lib9c.Tests/Action/BattleArena2Test.cs index 1f52d9adc9..94a12524bc 100644 --- a/.Lib9c.Tests/Action/BattleArena2Test.cs +++ b/.Lib9c.Tests/Action/BattleArena2Test.cs @@ -50,7 +50,7 @@ public BattleArena2Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _state = new State(); + _state = new StateDelta(); _sheets = TableSheetsImporter.ImportSheets(); var tableSheets = new TableSheets(_sheets); diff --git a/.Lib9c.Tests/Action/BattleArena3Test.cs b/.Lib9c.Tests/Action/BattleArena3Test.cs index 27936fadae..4db0632c47 100644 --- a/.Lib9c.Tests/Action/BattleArena3Test.cs +++ b/.Lib9c.Tests/Action/BattleArena3Test.cs @@ -50,7 +50,7 @@ public BattleArena3Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _state = new State(); + _state = new StateDelta(); _sheets = TableSheetsImporter.ImportSheets(); var tableSheets = new TableSheets(_sheets); diff --git a/.Lib9c.Tests/Action/BattleArena4Test.cs b/.Lib9c.Tests/Action/BattleArena4Test.cs index dfc8226ddb..e576e4de78 100644 --- a/.Lib9c.Tests/Action/BattleArena4Test.cs +++ b/.Lib9c.Tests/Action/BattleArena4Test.cs @@ -50,7 +50,7 @@ public BattleArena4Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _state = new State(); + _state = new StateDelta(); _sheets = TableSheetsImporter.ImportSheets(); var tableSheets = new TableSheets(_sheets); diff --git a/.Lib9c.Tests/Action/BattleArena5Test.cs b/.Lib9c.Tests/Action/BattleArena5Test.cs index bb6eee0cda..2786440778 100644 --- a/.Lib9c.Tests/Action/BattleArena5Test.cs +++ b/.Lib9c.Tests/Action/BattleArena5Test.cs @@ -45,7 +45,7 @@ public BattleArena5Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialStates = new State(); + _initialStates = new StateDelta(); _sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in _sheets) diff --git a/.Lib9c.Tests/Action/BattleArena6Test.cs b/.Lib9c.Tests/Action/BattleArena6Test.cs index d269eaabed..a3f4b95d58 100644 --- a/.Lib9c.Tests/Action/BattleArena6Test.cs +++ b/.Lib9c.Tests/Action/BattleArena6Test.cs @@ -46,7 +46,7 @@ public BattleArena6Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialStates = new State(); + _initialStates = new StateDelta(); _sheets = TableSheetsImporter.ImportSheets(); _sheets.Remove(nameof(RuneOptionSheet)); diff --git a/.Lib9c.Tests/Action/BattleArena7Test.cs b/.Lib9c.Tests/Action/BattleArena7Test.cs index 7af91c4702..1d889cb93e 100644 --- a/.Lib9c.Tests/Action/BattleArena7Test.cs +++ b/.Lib9c.Tests/Action/BattleArena7Test.cs @@ -46,7 +46,7 @@ public BattleArena7Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialStates = new State(); + _initialStates = new StateDelta(); _sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in _sheets) diff --git a/.Lib9c.Tests/Action/BattleArena8Test.cs b/.Lib9c.Tests/Action/BattleArena8Test.cs index 28b4ecd60c..09f96c00d1 100644 --- a/.Lib9c.Tests/Action/BattleArena8Test.cs +++ b/.Lib9c.Tests/Action/BattleArena8Test.cs @@ -47,7 +47,7 @@ public BattleArena8Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialStates = new State(); + _initialStates = new StateDelta(); _sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in _sheets) diff --git a/.Lib9c.Tests/Action/BattleArena9Test.cs b/.Lib9c.Tests/Action/BattleArena9Test.cs index a61ec0ba6f..4e9a1f3369 100644 --- a/.Lib9c.Tests/Action/BattleArena9Test.cs +++ b/.Lib9c.Tests/Action/BattleArena9Test.cs @@ -47,7 +47,7 @@ public BattleArena9Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialStates = new State(); + _initialStates = new StateDelta(); _sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in _sheets) diff --git a/.Lib9c.Tests/Action/BattleGrandFinale1Test.cs b/.Lib9c.Tests/Action/BattleGrandFinale1Test.cs index a4302e7c5c..44f73955ef 100644 --- a/.Lib9c.Tests/Action/BattleGrandFinale1Test.cs +++ b/.Lib9c.Tests/Action/BattleGrandFinale1Test.cs @@ -46,7 +46,7 @@ public BattleGrandFinale1Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialStates = new State(); + _initialStates = new StateDelta(); _sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in _sheets) diff --git a/.Lib9c.Tests/Action/BattleGrandFinale2Test.cs b/.Lib9c.Tests/Action/BattleGrandFinale2Test.cs index 480fb2b3fa..831a6e7c78 100644 --- a/.Lib9c.Tests/Action/BattleGrandFinale2Test.cs +++ b/.Lib9c.Tests/Action/BattleGrandFinale2Test.cs @@ -46,7 +46,7 @@ public BattleGrandFinale2Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialStates = new State(); + _initialStates = new StateDelta(); _sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in _sheets) diff --git a/.Lib9c.Tests/Action/BattleGrandFinale3Test.cs b/.Lib9c.Tests/Action/BattleGrandFinale3Test.cs index 443c42faad..124a54bead 100644 --- a/.Lib9c.Tests/Action/BattleGrandFinale3Test.cs +++ b/.Lib9c.Tests/Action/BattleGrandFinale3Test.cs @@ -46,7 +46,7 @@ public BattleGrandFinale3Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialStates = new State(); + _initialStates = new StateDelta(); _sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in _sheets) diff --git a/.Lib9c.Tests/Action/Buy10Test.cs b/.Lib9c.Tests/Action/Buy10Test.cs index 5fbf10648e..19da0a9e7f 100644 --- a/.Lib9c.Tests/Action/Buy10Test.cs +++ b/.Lib9c.Tests/Action/Buy10Test.cs @@ -45,7 +45,7 @@ public Buy10Test(ITestOutputHelper outputHelper) .CreateLogger(); var context = new ActionContext(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -805,7 +805,7 @@ public void Rehearsal() OrderReceipt.DeriveAddress(_orderId), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/Buy11Test.cs b/.Lib9c.Tests/Action/Buy11Test.cs index 88b5a592f0..315dc786c4 100644 --- a/.Lib9c.Tests/Action/Buy11Test.cs +++ b/.Lib9c.Tests/Action/Buy11Test.cs @@ -47,7 +47,7 @@ public Buy11Test(ITestOutputHelper outputHelper) .CreateLogger(); var context = new ActionContext(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -811,7 +811,7 @@ public void Rehearsal() OrderReceipt.DeriveAddress(_orderId), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/Buy2Test.cs b/.Lib9c.Tests/Action/Buy2Test.cs index 277c38c9b1..e4f24e0dfb 100644 --- a/.Lib9c.Tests/Action/Buy2Test.cs +++ b/.Lib9c.Tests/Action/Buy2Test.cs @@ -36,7 +36,7 @@ public Buy2Test(ITestOutputHelper outputHelper) .CreateLogger(); var context = new ActionContext(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { diff --git a/.Lib9c.Tests/Action/Buy3Test.cs b/.Lib9c.Tests/Action/Buy3Test.cs index 35a191c62f..504da3c9a9 100644 --- a/.Lib9c.Tests/Action/Buy3Test.cs +++ b/.Lib9c.Tests/Action/Buy3Test.cs @@ -36,7 +36,7 @@ public Buy3Test(ITestOutputHelper outputHelper) .CreateLogger(); var context = new ActionContext(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -208,7 +208,7 @@ public void ExecuteThrowInvalidAddressException() Assert.Throws(() => action.Execute(new ActionContext() { BlockIndex = 0, - PreviousState = new State(), + PreviousState = new StateDelta(), Random = new TestRandom(), Signer = _buyerAgentAddress, }) @@ -229,7 +229,7 @@ public void ExecuteThrowFailedLoadStateException() Assert.Throws(() => action.Execute(new ActionContext() { BlockIndex = 0, - PreviousState = new State(), + PreviousState = new StateDelta(), Random = new TestRandom(), Signer = _buyerAgentAddress, }) diff --git a/.Lib9c.Tests/Action/Buy4Test.cs b/.Lib9c.Tests/Action/Buy4Test.cs index 8d4ffdc0e3..9572c64120 100644 --- a/.Lib9c.Tests/Action/Buy4Test.cs +++ b/.Lib9c.Tests/Action/Buy4Test.cs @@ -38,7 +38,7 @@ public Buy4Test(ITestOutputHelper outputHelper) .CreateLogger(); var context = new ActionContext(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -232,7 +232,7 @@ public void ExecuteThrowInvalidAddressException() Assert.Throws(() => action.Execute(new ActionContext() { BlockIndex = 0, - PreviousState = new State(), + PreviousState = new StateDelta(), Random = new TestRandom(), Signer = _buyerAgentAddress, }) @@ -253,7 +253,7 @@ public void ExecuteThrowFailedLoadStateException() Assert.Throws(() => action.Execute(new ActionContext() { BlockIndex = 0, - PreviousState = new State(), + PreviousState = new StateDelta(), Random = new TestRandom(), Signer = _buyerAgentAddress, }) diff --git a/.Lib9c.Tests/Action/Buy5Test.cs b/.Lib9c.Tests/Action/Buy5Test.cs index 569f1e65e6..9d3c4bdc05 100644 --- a/.Lib9c.Tests/Action/Buy5Test.cs +++ b/.Lib9c.Tests/Action/Buy5Test.cs @@ -39,7 +39,7 @@ public Buy5Test(ITestOutputHelper outputHelper) .CreateLogger(); var context = new ActionContext(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -366,7 +366,7 @@ public void Execute_Throw_FailedLoadStateException() Assert.Throws(() => action.Execute(new ActionContext() { BlockIndex = 0, - PreviousState = new State(), + PreviousState = new StateDelta(), Random = new TestRandom(), Signer = _buyerAgentAddress, }) diff --git a/.Lib9c.Tests/Action/Buy6Test.cs b/.Lib9c.Tests/Action/Buy6Test.cs index 6473ca1935..ff4e00c09c 100644 --- a/.Lib9c.Tests/Action/Buy6Test.cs +++ b/.Lib9c.Tests/Action/Buy6Test.cs @@ -40,7 +40,7 @@ public Buy6Test(ITestOutputHelper outputHelper) .CreateLogger(); var context = new ActionContext(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -444,7 +444,7 @@ public void Execute_Throw_FailedLoadStateException() Assert.Throws(() => action.Execute(new ActionContext() { BlockIndex = 0, - PreviousState = new State(), + PreviousState = new StateDelta(), Random = new TestRandom(), Signer = _buyerAgentAddress, }) diff --git a/.Lib9c.Tests/Action/Buy7Test.cs b/.Lib9c.Tests/Action/Buy7Test.cs index 8404cdffff..8ca9a3691b 100644 --- a/.Lib9c.Tests/Action/Buy7Test.cs +++ b/.Lib9c.Tests/Action/Buy7Test.cs @@ -40,7 +40,7 @@ public Buy7Test(ITestOutputHelper outputHelper) .CreateLogger(); var context = new ActionContext(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -445,7 +445,7 @@ public void Execute_Throw_FailedLoadStateException() Assert.Throws(() => action.Execute(new ActionContext() { BlockIndex = 0, - PreviousState = new State(), + PreviousState = new StateDelta(), Random = new TestRandom(), Signer = _buyerAgentAddress, }) diff --git a/.Lib9c.Tests/Action/Buy8Test.cs b/.Lib9c.Tests/Action/Buy8Test.cs index 2d33969982..716024d239 100644 --- a/.Lib9c.Tests/Action/Buy8Test.cs +++ b/.Lib9c.Tests/Action/Buy8Test.cs @@ -42,7 +42,7 @@ public Buy8Test(ITestOutputHelper outputHelper) .CreateLogger(); var context = new ActionContext(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -587,7 +587,7 @@ public void Rehearsal() OrderReceipt.DeriveAddress(_orderId), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/Buy9Test.cs b/.Lib9c.Tests/Action/Buy9Test.cs index cf6d11f757..71a7f0bf28 100644 --- a/.Lib9c.Tests/Action/Buy9Test.cs +++ b/.Lib9c.Tests/Action/Buy9Test.cs @@ -42,7 +42,7 @@ public Buy9Test(ITestOutputHelper outputHelper) .CreateLogger(); var context = new ActionContext(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -686,7 +686,7 @@ public void Rehearsal() OrderReceipt.DeriveAddress(_orderId), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/BuyMultipleTest.cs b/.Lib9c.Tests/Action/BuyMultipleTest.cs index f486e7a4f4..50a060ab31 100644 --- a/.Lib9c.Tests/Action/BuyMultipleTest.cs +++ b/.Lib9c.Tests/Action/BuyMultipleTest.cs @@ -37,7 +37,7 @@ public BuyMultipleTest(ITestOutputHelper outputHelper) .CreateLogger(); var context = new ActionContext(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -410,7 +410,7 @@ public void ExecuteThrowInvalidAddressException() Assert.Throws(() => action.Execute(new ActionContext() { BlockIndex = 0, - PreviousState = new State(), + PreviousState = new StateDelta(), Random = new TestRandom(), Signer = _buyerAgentAddress, }) @@ -429,7 +429,7 @@ public void ExecuteThrowFailedLoadStateException() Assert.Throws(() => action.Execute(new ActionContext() { BlockIndex = 0, - PreviousState = new State(), + PreviousState = new StateDelta(), Random = new TestRandom(), Signer = _buyerAgentAddress, }) diff --git a/.Lib9c.Tests/Action/BuyProduct0Test.cs b/.Lib9c.Tests/Action/BuyProduct0Test.cs index f387e8f7ed..a053bde411 100644 --- a/.Lib9c.Tests/Action/BuyProduct0Test.cs +++ b/.Lib9c.Tests/Action/BuyProduct0Test.cs @@ -46,7 +46,7 @@ public BuyProduct0Test(ITestOutputHelper outputHelper) .CreateLogger(); var context = new ActionContext(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { diff --git a/.Lib9c.Tests/Action/BuyProductTest.cs b/.Lib9c.Tests/Action/BuyProductTest.cs index eeeba5cc94..388241d9c3 100644 --- a/.Lib9c.Tests/Action/BuyProductTest.cs +++ b/.Lib9c.Tests/Action/BuyProductTest.cs @@ -46,7 +46,7 @@ public BuyProductTest(ITestOutputHelper outputHelper) .CreateLogger(); var context = new ActionContext(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { diff --git a/.Lib9c.Tests/Action/BuyTest.cs b/.Lib9c.Tests/Action/BuyTest.cs index 64c78afc61..e37e57f22e 100644 --- a/.Lib9c.Tests/Action/BuyTest.cs +++ b/.Lib9c.Tests/Action/BuyTest.cs @@ -45,7 +45,7 @@ public BuyTest(ITestOutputHelper outputHelper) .CreateLogger(); var context = new ActionContext(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { diff --git a/.Lib9c.Tests/Action/CancelMonsterCollectTest.cs b/.Lib9c.Tests/Action/CancelMonsterCollectTest.cs index 3fce08f27c..aaa8b145d4 100644 --- a/.Lib9c.Tests/Action/CancelMonsterCollectTest.cs +++ b/.Lib9c.Tests/Action/CancelMonsterCollectTest.cs @@ -22,7 +22,7 @@ public class CancelMonsterCollectTest public CancelMonsterCollectTest() { _signer = default; - _state = new State(); + _state = new StateDelta(); Dictionary sheets = TableSheetsImporter.ImportSheets(); _tableSheets = new TableSheets(sheets); var agentState = new AgentState(_signer); diff --git a/.Lib9c.Tests/Action/CancelProductRegistrationTest.cs b/.Lib9c.Tests/Action/CancelProductRegistrationTest.cs index f14baefb02..1567cfe6f4 100644 --- a/.Lib9c.Tests/Action/CancelProductRegistrationTest.cs +++ b/.Lib9c.Tests/Action/CancelProductRegistrationTest.cs @@ -34,7 +34,7 @@ public CancelProductRegistrationTest(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { diff --git a/.Lib9c.Tests/Action/ChargeActionPoint0Test.cs b/.Lib9c.Tests/Action/ChargeActionPoint0Test.cs index 46cb038aff..fc13ddbb3d 100644 --- a/.Lib9c.Tests/Action/ChargeActionPoint0Test.cs +++ b/.Lib9c.Tests/Action/ChargeActionPoint0Test.cs @@ -54,7 +54,7 @@ public void Execute() Assert.Equal(0, avatarState.actionPoint); - var state = new State() + var state = new StateDelta() .SetState(Addresses.GameConfig, gameConfigState.Serialize()) .SetState(agentAddress, agent.Serialize()) .SetState(avatarAddress, avatarState.Serialize()); diff --git a/.Lib9c.Tests/Action/ChargeActionPoint2Test.cs b/.Lib9c.Tests/Action/ChargeActionPoint2Test.cs index dbbae9e209..5607a4785d 100644 --- a/.Lib9c.Tests/Action/ChargeActionPoint2Test.cs +++ b/.Lib9c.Tests/Action/ChargeActionPoint2Test.cs @@ -44,7 +44,7 @@ public ChargeActionPoint2Test() }; agent.avatarAddresses.Add(0, _avatarAddress); - _initialState = new State() + _initialState = new StateDelta() .SetState(Addresses.GameConfig, gameConfigState.Serialize()) .SetState(_agentAddress, agent.Serialize()) .SetState(_avatarAddress, avatarState.Serialize()); @@ -111,7 +111,7 @@ public void Execute_Throw_FailedLoadStateException() Assert.Throws(() => action.Execute(new ActionContext() { BlockIndex = 0, - PreviousState = new State(), + PreviousState = new StateDelta(), Random = new TestRandom(), Signer = default, }) diff --git a/.Lib9c.Tests/Action/ChargeActionPointTest.cs b/.Lib9c.Tests/Action/ChargeActionPointTest.cs index 11e2df6d23..29762e2b23 100644 --- a/.Lib9c.Tests/Action/ChargeActionPointTest.cs +++ b/.Lib9c.Tests/Action/ChargeActionPointTest.cs @@ -47,7 +47,7 @@ public ChargeActionPointTest() }; agent.avatarAddresses.Add(0, _avatarAddress); - _initialState = new State() + _initialState = new StateDelta() .SetState(Addresses.GameConfig, gameConfigState.Serialize()) .SetState(_agentAddress, agent.Serialize()) .SetState(_avatarAddress, avatarState.Serialize()); @@ -186,7 +186,7 @@ public void Rehearsal() _avatarAddress.Derive(LegacyQuestListKey), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/ClaimMonsterCollectionReward0Test.cs b/.Lib9c.Tests/Action/ClaimMonsterCollectionReward0Test.cs index b59762101f..84876ff600 100644 --- a/.Lib9c.Tests/Action/ClaimMonsterCollectionReward0Test.cs +++ b/.Lib9c.Tests/Action/ClaimMonsterCollectionReward0Test.cs @@ -25,7 +25,7 @@ public ClaimMonsterCollectionReward0Test() { _signer = default; _avatarAddress = _signer.Derive("avatar"); - _state = new State(); + _state = new StateDelta(); Dictionary sheets = TableSheetsImporter.ImportSheets(); _tableSheets = new TableSheets(sheets); var rankingMapAddress = new PrivateKey().ToAddress(); diff --git a/.Lib9c.Tests/Action/ClaimMonsterCollectionReward2Test.cs b/.Lib9c.Tests/Action/ClaimMonsterCollectionReward2Test.cs index 6ae2b7e6ac..cfe1bedaaa 100644 --- a/.Lib9c.Tests/Action/ClaimMonsterCollectionReward2Test.cs +++ b/.Lib9c.Tests/Action/ClaimMonsterCollectionReward2Test.cs @@ -36,7 +36,7 @@ public ClaimMonsterCollectionReward2Test(ITestOutputHelper outputHelper) _signer = default; _avatarAddress = _signer.Derive("avatar"); - _state = new State(); + _state = new StateDelta(); Dictionary sheets = TableSheetsImporter.ImportSheets(); _tableSheets = new TableSheets(sheets); var rankingMapAddress = new PrivateKey().ToAddress(); @@ -211,7 +211,7 @@ public void Rehearsal() IAccountStateDelta nextState = action.Execute(new ActionContext { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _signer, BlockIndex = 0, Rehearsal = true, diff --git a/.Lib9c.Tests/Action/ClaimMonsterCollectionRewardTest.cs b/.Lib9c.Tests/Action/ClaimMonsterCollectionRewardTest.cs index c38af8b78d..4fd2bd793e 100644 --- a/.Lib9c.Tests/Action/ClaimMonsterCollectionRewardTest.cs +++ b/.Lib9c.Tests/Action/ClaimMonsterCollectionRewardTest.cs @@ -36,7 +36,7 @@ public ClaimMonsterCollectionRewardTest(ITestOutputHelper outputHelper) _signer = default; _avatarAddress = _signer.Derive("avatar"); - _state = new State(); + _state = new StateDelta(); Dictionary sheets = TableSheetsImporter.ImportSheets(); var tableSheets = new TableSheets(sheets); var rankingMapAddress = new PrivateKey().ToAddress(); @@ -188,7 +188,7 @@ public void Rehearsal() { IAccountStateDelta nextState = _action.Execute(new ActionContext { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _signer, BlockIndex = 0, Rehearsal = true, diff --git a/.Lib9c.Tests/Action/ClaimRaidRewardTest.cs b/.Lib9c.Tests/Action/ClaimRaidRewardTest.cs index 7b96725f0f..10d777d595 100644 --- a/.Lib9c.Tests/Action/ClaimRaidRewardTest.cs +++ b/.Lib9c.Tests/Action/ClaimRaidRewardTest.cs @@ -20,7 +20,7 @@ public ClaimRaidRewardTest() { var tableCsv = TableSheetsImporter.ImportSheets(); _tableSheets = new TableSheets(tableCsv); - _state = new State(); + _state = new StateDelta(); foreach (var kv in tableCsv) { _state = _state.SetState(Addresses.GetSheetAddress(kv.Key), kv.Value.Serialize()); diff --git a/.Lib9c.Tests/Action/ClaimStakeReward1Test.cs b/.Lib9c.Tests/Action/ClaimStakeReward1Test.cs index 4474248615..18e162daea 100644 --- a/.Lib9c.Tests/Action/ClaimStakeReward1Test.cs +++ b/.Lib9c.Tests/Action/ClaimStakeReward1Test.cs @@ -31,7 +31,7 @@ public ClaimStakeReward1Test(ITestOutputHelper outputHelper) .CreateLogger(); var context = new ActionContext(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) diff --git a/.Lib9c.Tests/Action/ClaimStakeReward2Test.cs b/.Lib9c.Tests/Action/ClaimStakeReward2Test.cs index 951940671d..8c45636376 100644 --- a/.Lib9c.Tests/Action/ClaimStakeReward2Test.cs +++ b/.Lib9c.Tests/Action/ClaimStakeReward2Test.cs @@ -32,7 +32,7 @@ public ClaimStakeReward2Test(ITestOutputHelper outputHelper) .CreateLogger(); var context = new ActionContext(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) diff --git a/.Lib9c.Tests/Action/ClaimWorldBossKillRewardTest.cs b/.Lib9c.Tests/Action/ClaimWorldBossKillRewardTest.cs index 76e02e8cb2..777c081c78 100644 --- a/.Lib9c.Tests/Action/ClaimWorldBossKillRewardTest.cs +++ b/.Lib9c.Tests/Action/ClaimWorldBossKillRewardTest.cs @@ -27,7 +27,7 @@ public void Execute(long blockIndex, Type exc) var tableSheets = new TableSheets(sheets); Address agentAddress = new PrivateKey().ToAddress(); Address avatarAddress = new PrivateKey().ToAddress(); - IAccountStateDelta state = new State(); + IAccountStateDelta state = new StateDelta(); var runeWeightSheet = new RuneWeightSheet(); runeWeightSheet.Set(@"id,boss_id,rank,rune_id,weight diff --git a/.Lib9c.Tests/Action/CombinationConsumable0Test.cs b/.Lib9c.Tests/Action/CombinationConsumable0Test.cs index 9e52bce9d1..64740ec198 100644 --- a/.Lib9c.Tests/Action/CombinationConsumable0Test.cs +++ b/.Lib9c.Tests/Action/CombinationConsumable0Test.cs @@ -52,7 +52,7 @@ public CombinationConsumable0Test() default ); - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, _avatarState.Serialize()); @@ -119,7 +119,7 @@ public void ExecuteThrowFailedLoadStateException() Assert.Throws(() => action.Execute(new ActionContext() { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, BlockIndex = 1, Random = _random, diff --git a/.Lib9c.Tests/Action/CombinationConsumable2Test.cs b/.Lib9c.Tests/Action/CombinationConsumable2Test.cs index 33a66af8b2..f5612edc52 100644 --- a/.Lib9c.Tests/Action/CombinationConsumable2Test.cs +++ b/.Lib9c.Tests/Action/CombinationConsumable2Test.cs @@ -52,7 +52,7 @@ public CombinationConsumable2Test() default ); - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, _avatarState.Serialize()); diff --git a/.Lib9c.Tests/Action/CombinationConsumable3Test.cs b/.Lib9c.Tests/Action/CombinationConsumable3Test.cs index d7a0f58f72..a031113dc9 100644 --- a/.Lib9c.Tests/Action/CombinationConsumable3Test.cs +++ b/.Lib9c.Tests/Action/CombinationConsumable3Test.cs @@ -52,7 +52,7 @@ public CombinationConsumable3Test() default ); - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, _avatarState.Serialize()); diff --git a/.Lib9c.Tests/Action/CombinationConsumable4Test.cs b/.Lib9c.Tests/Action/CombinationConsumable4Test.cs index 31c6d1f06d..8fc84bdd4f 100644 --- a/.Lib9c.Tests/Action/CombinationConsumable4Test.cs +++ b/.Lib9c.Tests/Action/CombinationConsumable4Test.cs @@ -52,7 +52,7 @@ public CombinationConsumable4Test() default ); - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, _avatarState.Serialize()); diff --git a/.Lib9c.Tests/Action/CombinationConsumable5Test.cs b/.Lib9c.Tests/Action/CombinationConsumable5Test.cs index c616dc6c9a..1532f18648 100644 --- a/.Lib9c.Tests/Action/CombinationConsumable5Test.cs +++ b/.Lib9c.Tests/Action/CombinationConsumable5Test.cs @@ -52,7 +52,7 @@ public CombinationConsumable5Test() default ); - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, _avatarState.Serialize()); diff --git a/.Lib9c.Tests/Action/CombinationConsumable6Test.cs b/.Lib9c.Tests/Action/CombinationConsumable6Test.cs index f0679812fa..cdec284064 100644 --- a/.Lib9c.Tests/Action/CombinationConsumable6Test.cs +++ b/.Lib9c.Tests/Action/CombinationConsumable6Test.cs @@ -53,7 +53,7 @@ public CombinationConsumable6Test() default ); - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, _avatarState.Serialize()); diff --git a/.Lib9c.Tests/Action/CombinationConsumable7Test.cs b/.Lib9c.Tests/Action/CombinationConsumable7Test.cs index e7bb05bc7c..a6d1df609b 100644 --- a/.Lib9c.Tests/Action/CombinationConsumable7Test.cs +++ b/.Lib9c.Tests/Action/CombinationConsumable7Test.cs @@ -52,7 +52,7 @@ public CombinationConsumable7Test() default ); - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, avatarState.Serialize()); diff --git a/.Lib9c.Tests/Action/CombinationConsumableTest.cs b/.Lib9c.Tests/Action/CombinationConsumableTest.cs index 8c61a55536..fadf006ed9 100644 --- a/.Lib9c.Tests/Action/CombinationConsumableTest.cs +++ b/.Lib9c.Tests/Action/CombinationConsumableTest.cs @@ -58,7 +58,7 @@ public CombinationConsumableTest() var gold = new GoldCurrencyState(Currency.Legacy("NCG", 2, null)); #pragma warning restore CS0618 - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, avatarState.Serialize()) .SetState( diff --git a/.Lib9c.Tests/Action/CombinationEquipment0Test.cs b/.Lib9c.Tests/Action/CombinationEquipment0Test.cs index 7a073c0065..b2c63fcb86 100644 --- a/.Lib9c.Tests/Action/CombinationEquipment0Test.cs +++ b/.Lib9c.Tests/Action/CombinationEquipment0Test.cs @@ -57,7 +57,7 @@ public CombinationEquipment0Test() #pragma warning restore CS0618 var context = new ActionContext(); - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, _avatarState.Serialize()) .SetState( @@ -185,7 +185,7 @@ public void ExecuteThrowFailedLoadStateException() Assert.Throws(() => action.Execute(new ActionContext() { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, Random = new TestRandom(), })); diff --git a/.Lib9c.Tests/Action/CombinationEquipment10Test.cs b/.Lib9c.Tests/Action/CombinationEquipment10Test.cs index 20e3778265..7ba3c76c09 100644 --- a/.Lib9c.Tests/Action/CombinationEquipment10Test.cs +++ b/.Lib9c.Tests/Action/CombinationEquipment10Test.cs @@ -69,7 +69,7 @@ public CombinationEquipment10Test(ITestOutputHelper outputHelper) var gold = new GoldCurrencyState(Currency.Legacy("NCG", 2, null)); #pragma warning restore CS0618 - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, avatarState.Serialize()) .SetState( @@ -141,7 +141,7 @@ public void Rehearsal() Addresses.Blacksmith, }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext { diff --git a/.Lib9c.Tests/Action/CombinationEquipment11Test.cs b/.Lib9c.Tests/Action/CombinationEquipment11Test.cs index c2a7db0c67..84a031cf61 100644 --- a/.Lib9c.Tests/Action/CombinationEquipment11Test.cs +++ b/.Lib9c.Tests/Action/CombinationEquipment11Test.cs @@ -72,7 +72,7 @@ public CombinationEquipment11Test(ITestOutputHelper outputHelper) var gold = new GoldCurrencyState(Currency.Legacy("NCG", 2, null)); #pragma warning restore CS0618 - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, avatarState.Serialize()) .SetState( @@ -148,7 +148,7 @@ public void Rehearsal() ItemEnhancement10.GetFeeStoreAddress(), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext { diff --git a/.Lib9c.Tests/Action/CombinationEquipment12Test.cs b/.Lib9c.Tests/Action/CombinationEquipment12Test.cs index 54a7e319ea..a46b9a042e 100644 --- a/.Lib9c.Tests/Action/CombinationEquipment12Test.cs +++ b/.Lib9c.Tests/Action/CombinationEquipment12Test.cs @@ -82,7 +82,7 @@ public CombinationEquipment12Test(ITestOutputHelper outputHelper) _slotAddress, GameConfig.RequireClearedStageLevel.CombinationEquipmentAction); - _initialState = new State() + _initialState = new StateDelta() .SetState(_slotAddress, combinationSlotState.Serialize()) .SetState(GoldCurrencyState.Address, gold.Serialize()); diff --git a/.Lib9c.Tests/Action/CombinationEquipment13Test.cs b/.Lib9c.Tests/Action/CombinationEquipment13Test.cs index 7c53244f65..e6d795e6ab 100644 --- a/.Lib9c.Tests/Action/CombinationEquipment13Test.cs +++ b/.Lib9c.Tests/Action/CombinationEquipment13Test.cs @@ -77,7 +77,7 @@ public CombinationEquipment13Test(ITestOutputHelper outputHelper) _slotAddress, GameConfig.RequireClearedStageLevel.CombinationEquipmentAction); - _initialState = new State() + _initialState = new StateDelta() .SetState(_slotAddress, combinationSlotState.Serialize()) .SetState(GoldCurrencyState.Address, gold.Serialize()); diff --git a/.Lib9c.Tests/Action/CombinationEquipment14Test.cs b/.Lib9c.Tests/Action/CombinationEquipment14Test.cs index 62f09d921f..5a0a918cd3 100644 --- a/.Lib9c.Tests/Action/CombinationEquipment14Test.cs +++ b/.Lib9c.Tests/Action/CombinationEquipment14Test.cs @@ -78,7 +78,7 @@ public CombinationEquipment14Test(ITestOutputHelper outputHelper) _slotAddress, GameConfig.RequireClearedStageLevel.CombinationEquipmentAction); - _initialState = new State() + _initialState = new StateDelta() .SetState(_slotAddress, combinationSlotState.Serialize()) .SetState(GoldCurrencyState.Address, gold.Serialize()); diff --git a/.Lib9c.Tests/Action/CombinationEquipment15Test.cs b/.Lib9c.Tests/Action/CombinationEquipment15Test.cs index cb7f0fcc1f..a4763d0575 100644 --- a/.Lib9c.Tests/Action/CombinationEquipment15Test.cs +++ b/.Lib9c.Tests/Action/CombinationEquipment15Test.cs @@ -78,7 +78,7 @@ public CombinationEquipment15Test(ITestOutputHelper outputHelper) _slotAddress, GameConfig.RequireClearedStageLevel.CombinationEquipmentAction); - _initialState = new State() + _initialState = new StateDelta() .SetState(_slotAddress, combinationSlotState.Serialize()) .SetState(GoldCurrencyState.Address, gold.Serialize()); diff --git a/.Lib9c.Tests/Action/CombinationEquipment2Test.cs b/.Lib9c.Tests/Action/CombinationEquipment2Test.cs index 96765f2ac7..1817e1e270 100644 --- a/.Lib9c.Tests/Action/CombinationEquipment2Test.cs +++ b/.Lib9c.Tests/Action/CombinationEquipment2Test.cs @@ -57,7 +57,7 @@ public CombinationEquipment2Test() #pragma warning restore CS0618 var context = new ActionContext(); - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, _avatarState.Serialize()) .SetState( diff --git a/.Lib9c.Tests/Action/CombinationEquipment3Test.cs b/.Lib9c.Tests/Action/CombinationEquipment3Test.cs index a4bd913f7e..3c406f882b 100644 --- a/.Lib9c.Tests/Action/CombinationEquipment3Test.cs +++ b/.Lib9c.Tests/Action/CombinationEquipment3Test.cs @@ -62,7 +62,7 @@ public CombinationEquipment3Test(ITestOutputHelper outputHelper) #pragma warning restore CS0618 var context = new ActionContext(); - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, _avatarState.Serialize()) .SetState( diff --git a/.Lib9c.Tests/Action/CombinationEquipment4Test.cs b/.Lib9c.Tests/Action/CombinationEquipment4Test.cs index 360da2243d..23850595ea 100644 --- a/.Lib9c.Tests/Action/CombinationEquipment4Test.cs +++ b/.Lib9c.Tests/Action/CombinationEquipment4Test.cs @@ -62,7 +62,7 @@ public CombinationEquipment4Test(ITestOutputHelper outputHelper) #pragma warning restore CS0618 var context = new ActionContext(); - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, _avatarState.Serialize()) .SetState( diff --git a/.Lib9c.Tests/Action/CombinationEquipment5Test.cs b/.Lib9c.Tests/Action/CombinationEquipment5Test.cs index 70ff103179..2fcf701a25 100644 --- a/.Lib9c.Tests/Action/CombinationEquipment5Test.cs +++ b/.Lib9c.Tests/Action/CombinationEquipment5Test.cs @@ -62,7 +62,7 @@ public CombinationEquipment5Test(ITestOutputHelper outputHelper) #pragma warning restore CS0618 var context = new ActionContext(); - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, _avatarState.Serialize()) .SetState( diff --git a/.Lib9c.Tests/Action/CombinationEquipment6Test.cs b/.Lib9c.Tests/Action/CombinationEquipment6Test.cs index 8fb6a7c97a..a866913345 100644 --- a/.Lib9c.Tests/Action/CombinationEquipment6Test.cs +++ b/.Lib9c.Tests/Action/CombinationEquipment6Test.cs @@ -64,7 +64,7 @@ public CombinationEquipment6Test(ITestOutputHelper outputHelper) #pragma warning restore CS0618 var context = new ActionContext(); - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, _avatarState.Serialize()) .SetState( @@ -254,7 +254,7 @@ public void Rehearsal() Addresses.Blacksmith, }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext { diff --git a/.Lib9c.Tests/Action/CombinationEquipment7Test.cs b/.Lib9c.Tests/Action/CombinationEquipment7Test.cs index 1df708dc1f..04931a5340 100644 --- a/.Lib9c.Tests/Action/CombinationEquipment7Test.cs +++ b/.Lib9c.Tests/Action/CombinationEquipment7Test.cs @@ -64,7 +64,7 @@ public CombinationEquipment7Test(ITestOutputHelper outputHelper) #pragma warning restore CS0618 var context = new ActionContext(); - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, _avatarState.Serialize()) .SetState( @@ -253,7 +253,7 @@ public void Rehearsal() Addresses.Blacksmith, }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext { diff --git a/.Lib9c.Tests/Action/CombinationEquipment8Test.cs b/.Lib9c.Tests/Action/CombinationEquipment8Test.cs index 27042fbb16..c18f12e814 100644 --- a/.Lib9c.Tests/Action/CombinationEquipment8Test.cs +++ b/.Lib9c.Tests/Action/CombinationEquipment8Test.cs @@ -68,7 +68,7 @@ public CombinationEquipment8Test(ITestOutputHelper outputHelper) var gold = new GoldCurrencyState(Currency.Legacy("NCG", 2, null)); #pragma warning restore CS0618 - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, avatarState.Serialize()) .SetState( @@ -140,7 +140,7 @@ public void Rehearsal() Addresses.Blacksmith, }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext { diff --git a/.Lib9c.Tests/Action/CombinationEquipment9Test.cs b/.Lib9c.Tests/Action/CombinationEquipment9Test.cs index 073b42e59e..79c7d98f34 100644 --- a/.Lib9c.Tests/Action/CombinationEquipment9Test.cs +++ b/.Lib9c.Tests/Action/CombinationEquipment9Test.cs @@ -68,7 +68,7 @@ public CombinationEquipment9Test(ITestOutputHelper outputHelper) var gold = new GoldCurrencyState(Currency.Legacy("NCG", 2, null)); #pragma warning restore CS0618 - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, avatarState.Serialize()) .SetState( @@ -140,7 +140,7 @@ public void Rehearsal() Addresses.Blacksmith, }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext { diff --git a/.Lib9c.Tests/Action/CombinationEquipmentTest.cs b/.Lib9c.Tests/Action/CombinationEquipmentTest.cs index c4bc27532b..883ddfd294 100644 --- a/.Lib9c.Tests/Action/CombinationEquipmentTest.cs +++ b/.Lib9c.Tests/Action/CombinationEquipmentTest.cs @@ -78,7 +78,7 @@ public CombinationEquipmentTest(ITestOutputHelper outputHelper) _slotAddress, GameConfig.RequireClearedStageLevel.CombinationEquipmentAction); - _initialState = new State() + _initialState = new StateDelta() .SetState(_slotAddress, combinationSlotState.Serialize()) .SetState(GoldCurrencyState.Address, gold.Serialize()); diff --git a/.Lib9c.Tests/Action/Coupons/IssueCouponsTest.cs b/.Lib9c.Tests/Action/Coupons/IssueCouponsTest.cs index b4eabefc01..167dff3434 100644 --- a/.Lib9c.Tests/Action/Coupons/IssueCouponsTest.cs +++ b/.Lib9c.Tests/Action/Coupons/IssueCouponsTest.cs @@ -18,7 +18,7 @@ public class IssueCouponsTest [Fact] public void Execute() { - IAccountStateDelta state = new Lib9c.Tests.Action.State() + IAccountStateDelta state = new Lib9c.Tests.Action.StateDelta() .SetState( AdminState.Address, new AdminState(CouponsFixture.AgentAddress1, 1) diff --git a/.Lib9c.Tests/Action/Coupons/RedeemCouponTest.cs b/.Lib9c.Tests/Action/Coupons/RedeemCouponTest.cs index 08f9808496..98d9409d49 100644 --- a/.Lib9c.Tests/Action/Coupons/RedeemCouponTest.cs +++ b/.Lib9c.Tests/Action/Coupons/RedeemCouponTest.cs @@ -20,7 +20,7 @@ public void Execute() { IRandom random = new TestRandom(); var sheets = TableSheetsImporter.ImportSheets(); - IAccountStateDelta state = new Lib9c.Tests.Action.State() + IAccountStateDelta state = new Lib9c.Tests.Action.StateDelta() .SetState( Addresses.GameConfig, new GameConfigState(sheets[nameof(GameConfigSheet)]).Serialize() diff --git a/.Lib9c.Tests/Action/Coupons/TransferCouponsTest.cs b/.Lib9c.Tests/Action/Coupons/TransferCouponsTest.cs index 0d00c7a419..bbf35930f0 100644 --- a/.Lib9c.Tests/Action/Coupons/TransferCouponsTest.cs +++ b/.Lib9c.Tests/Action/Coupons/TransferCouponsTest.cs @@ -17,7 +17,7 @@ public class TransferCouponsTest [Fact] public void Execute() { - IAccountStateDelta state = new Lib9c.Tests.Action.State(); + IAccountStateDelta state = new Lib9c.Tests.Action.StateDelta(); IRandom random = new TestRandom(); var coupon1 = new Coupon(CouponsFixture.Guid1, CouponsFixture.RewardSet1); diff --git a/.Lib9c.Tests/Action/CreateAvatar0Test.cs b/.Lib9c.Tests/Action/CreateAvatar0Test.cs index e40a67340e..c62daf16f3 100644 --- a/.Lib9c.Tests/Action/CreateAvatar0Test.cs +++ b/.Lib9c.Tests/Action/CreateAvatar0Test.cs @@ -53,7 +53,7 @@ public void Execute() var sheets = TableSheetsImporter.ImportSheets(); var context = new ActionContext(); - var state = new State() + var state = new StateDelta() .SetState(GoldCurrencyState.Address, gold.Serialize()) .SetState( Addresses.GoldDistribution, @@ -112,7 +112,7 @@ public void ExecuteThrowInvalidNamePatterException(string nickName) name = nickName, }; - var state = new State(); + var state = new StateDelta(); Assert.Throws(() => action.Execute(new ActionContext() { @@ -146,7 +146,7 @@ public void ExecuteThrowInvalidAddressException() name = "test", }; - var state = new State().SetState(_avatarAddress, avatarState.Serialize()); + var state = new StateDelta().SetState(_avatarAddress, avatarState.Serialize()); Assert.Throws(() => action.Execute(new ActionContext() { @@ -163,7 +163,7 @@ public void ExecuteThrowInvalidAddressException() public void ExecuteThrowAvatarIndexOutOfRangeException(int index) { var agentState = new AgentState(_agentAddress); - var state = new State().SetState(_agentAddress, agentState.Serialize()); + var state = new StateDelta().SetState(_agentAddress, agentState.Serialize()); var action = new CreateAvatar0() { avatarAddress = _avatarAddress, @@ -192,7 +192,7 @@ public void ExecuteThrowAvatarIndexAlreadyUsedException(int index) { var agentState = new AgentState(_agentAddress); agentState.avatarAddresses[index] = _avatarAddress; - var state = new State().SetState(_agentAddress, agentState.Serialize()); + var state = new StateDelta().SetState(_agentAddress, agentState.Serialize()); var action = new CreateAvatar0() { @@ -254,7 +254,7 @@ public void Rehearsal() updatedAddresses.Add(slotAddress); } - var state = new State() + var state = new StateDelta() .SetState(Addresses.Ranking, new RankingState0().Serialize()) .SetState(GoldCurrencyState.Address, gold.Serialize()); diff --git a/.Lib9c.Tests/Action/CreateAvatar2Test.cs b/.Lib9c.Tests/Action/CreateAvatar2Test.cs index a7abf239ae..112bf44ffd 100644 --- a/.Lib9c.Tests/Action/CreateAvatar2Test.cs +++ b/.Lib9c.Tests/Action/CreateAvatar2Test.cs @@ -50,7 +50,7 @@ public void Execute() var sheets = TableSheetsImporter.ImportSheets(); var context = new ActionContext(); - var state = new State() + var state = new StateDelta() .SetState(GoldCurrencyState.Address, gold.Serialize()) .SetState( Addresses.GoldDistribution, @@ -115,7 +115,7 @@ public void ExecuteThrowInvalidNamePatterException(string nickName) name = nickName, }; - var state = new State(); + var state = new StateDelta(); Assert.Throws(() => action.Execute(new ActionContext() { @@ -156,7 +156,7 @@ public void ExecuteThrowInvalidAddressException() name = "test", }; - var state = new State().SetState(avatarAddress, avatarState.Serialize()); + var state = new StateDelta().SetState(avatarAddress, avatarState.Serialize()); Assert.Throws(() => action.Execute(new ActionContext() { @@ -173,7 +173,7 @@ public void ExecuteThrowInvalidAddressException() public void ExecuteThrowAvatarIndexOutOfRangeException(int index) { var agentState = new AgentState(_agentAddress); - var state = new State().SetState(_agentAddress, agentState.Serialize()); + var state = new StateDelta().SetState(_agentAddress, agentState.Serialize()); var action = new CreateAvatar2() { index = index, @@ -208,7 +208,7 @@ public void ExecuteThrowAvatarIndexAlreadyUsedException(int index) ) ); agentState.avatarAddresses[index] = avatarAddress; - var state = new State().SetState(_agentAddress, agentState.Serialize()); + var state = new StateDelta().SetState(_agentAddress, agentState.Serialize()); var action = new CreateAvatar2() { @@ -277,7 +277,7 @@ public void Rehearsal(int index) updatedAddresses.Add(slotAddress); } - var state = new State() + var state = new StateDelta() .SetState(Addresses.Ranking, new RankingState0().Serialize()) .SetState(GoldCurrencyState.Address, gold.Serialize()); diff --git a/.Lib9c.Tests/Action/CreateAvatar3Test.cs b/.Lib9c.Tests/Action/CreateAvatar3Test.cs index ac718284b9..48c897a23d 100644 --- a/.Lib9c.Tests/Action/CreateAvatar3Test.cs +++ b/.Lib9c.Tests/Action/CreateAvatar3Test.cs @@ -51,7 +51,7 @@ public void Execute() var sheets = TableSheetsImporter.ImportSheets(); var context = new ActionContext(); - var state = new State() + var state = new StateDelta() .SetState(GoldCurrencyState.Address, gold.Serialize()) .SetState( Addresses.GoldDistribution, @@ -117,7 +117,7 @@ public void ExecuteThrowInvalidNamePatterException(string nickName) name = nickName, }; - var state = new State(); + var state = new StateDelta(); Assert.Throws(() => action.Execute(new ActionContext() { @@ -158,7 +158,7 @@ public void ExecuteThrowInvalidAddressException() name = "test", }; - var state = new State().SetState(avatarAddress, avatarState.Serialize()); + var state = new StateDelta().SetState(avatarAddress, avatarState.Serialize()); Assert.Throws(() => action.Execute(new ActionContext() { @@ -175,7 +175,7 @@ public void ExecuteThrowInvalidAddressException() public void ExecuteThrowAvatarIndexOutOfRangeException(int index) { var agentState = new AgentState(_agentAddress); - var state = new State().SetState(_agentAddress, agentState.Serialize()); + var state = new StateDelta().SetState(_agentAddress, agentState.Serialize()); var action = new CreateAvatar3() { index = index, @@ -210,7 +210,7 @@ public void ExecuteThrowAvatarIndexAlreadyUsedException(int index) ) ); agentState.avatarAddresses[index] = avatarAddress; - var state = new State().SetState(_agentAddress, agentState.Serialize()); + var state = new StateDelta().SetState(_agentAddress, agentState.Serialize()); var action = new CreateAvatar3() { @@ -282,7 +282,7 @@ public void Rehearsal(int index) updatedAddresses.Add(slotAddress); } - var state = new State() + var state = new StateDelta() .SetState(Addresses.Ranking, new RankingState0().Serialize()) .SetState(GoldCurrencyState.Address, gold.Serialize()); diff --git a/.Lib9c.Tests/Action/CreateAvatar6Test.cs b/.Lib9c.Tests/Action/CreateAvatar6Test.cs index acca5bed8a..0ab150f3e3 100644 --- a/.Lib9c.Tests/Action/CreateAvatar6Test.cs +++ b/.Lib9c.Tests/Action/CreateAvatar6Test.cs @@ -51,7 +51,7 @@ public void Execute() var sheets = TableSheetsImporter.ImportSheets(); var context = new ActionContext(); - var state = new State() + var state = new StateDelta() .SetState(GoldCurrencyState.Address, gold.Serialize()) .SetState( Addresses.GoldDistribution, @@ -117,7 +117,7 @@ public void ExecuteThrowInvalidNamePatterException(string nickName) name = nickName, }; - var state = new State(); + var state = new StateDelta(); Assert.Throws(() => action.Execute(new ActionContext() { @@ -158,7 +158,7 @@ public void ExecuteThrowInvalidAddressException() name = "test", }; - var state = new State().SetState(avatarAddress, avatarState.Serialize()); + var state = new StateDelta().SetState(avatarAddress, avatarState.Serialize()); Assert.Throws(() => action.Execute(new ActionContext() { @@ -175,7 +175,7 @@ public void ExecuteThrowInvalidAddressException() public void ExecuteThrowAvatarIndexOutOfRangeException(int index) { var agentState = new AgentState(_agentAddress); - var state = new State().SetState(_agentAddress, agentState.Serialize()); + var state = new StateDelta().SetState(_agentAddress, agentState.Serialize()); var action = new CreateAvatar6() { index = index, @@ -210,7 +210,7 @@ public void ExecuteThrowAvatarIndexAlreadyUsedException(int index) ) ); agentState.avatarAddresses[index] = avatarAddress; - var state = new State().SetState(_agentAddress, agentState.Serialize()); + var state = new StateDelta().SetState(_agentAddress, agentState.Serialize()); var action = new CreateAvatar6() { @@ -282,7 +282,7 @@ public void Rehearsal(int index) updatedAddresses.Add(slotAddress); } - var state = new State() + var state = new StateDelta() .SetState(Addresses.Ranking, new RankingState0().Serialize()) .SetState(GoldCurrencyState.Address, gold.Serialize()); diff --git a/.Lib9c.Tests/Action/CreateAvatar7Test.cs b/.Lib9c.Tests/Action/CreateAvatar7Test.cs index 4ba6d43537..61974d19fd 100644 --- a/.Lib9c.Tests/Action/CreateAvatar7Test.cs +++ b/.Lib9c.Tests/Action/CreateAvatar7Test.cs @@ -45,7 +45,7 @@ public void Execute() #pragma warning restore CS0618 var sheets = TableSheetsImporter.ImportSheets(); - var state = new State() + var state = new StateDelta() .SetState( Addresses.GameConfig, new GameConfigState(sheets[nameof(GameConfigSheet)]).Serialize() @@ -98,7 +98,7 @@ public void ExecuteThrowInvalidNamePatterException(string nickName) name = nickName, }; - var state = new State(); + var state = new StateDelta(); Assert.Throws(() => action.Execute(new ActionContext() { @@ -139,7 +139,7 @@ public void ExecuteThrowInvalidAddressException() name = "test", }; - var state = new State().SetState(avatarAddress, avatarState.Serialize()); + var state = new StateDelta().SetState(avatarAddress, avatarState.Serialize()); Assert.Throws(() => action.Execute(new ActionContext() { @@ -156,7 +156,7 @@ public void ExecuteThrowInvalidAddressException() public void ExecuteThrowAvatarIndexOutOfRangeException(int index) { var agentState = new AgentState(_agentAddress); - var state = new State().SetState(_agentAddress, agentState.Serialize()); + var state = new StateDelta().SetState(_agentAddress, agentState.Serialize()); var action = new CreateAvatar7() { index = index, @@ -191,7 +191,7 @@ public void ExecuteThrowAvatarIndexAlreadyUsedException(int index) ) ); agentState.avatarAddresses[index] = avatarAddress; - var state = new State().SetState(_agentAddress, agentState.Serialize()); + var state = new StateDelta().SetState(_agentAddress, agentState.Serialize()); var action = new CreateAvatar7() { @@ -261,7 +261,7 @@ public void Rehearsal(int index) updatedAddresses.Add(slotAddress); } - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/CreateAvatarTest.cs b/.Lib9c.Tests/Action/CreateAvatarTest.cs index 621a851a6b..5e35af337b 100644 --- a/.Lib9c.Tests/Action/CreateAvatarTest.cs +++ b/.Lib9c.Tests/Action/CreateAvatarTest.cs @@ -41,7 +41,7 @@ public void Execute() }; var sheets = TableSheetsImporter.ImportSheets(); - var state = new State() + var state = new StateDelta() .SetState( Addresses.GameConfig, new GameConfigState(sheets[nameof(GameConfigSheet)]).Serialize() @@ -97,7 +97,7 @@ public void ExecuteThrowInvalidNamePatterException(string nickName) name = nickName, }; - var state = new State(); + var state = new StateDelta(); Assert.Throws(() => action.Execute(new ActionContext() { @@ -138,7 +138,7 @@ public void ExecuteThrowInvalidAddressException() name = "test", }; - var state = new State().SetState(avatarAddress, avatarState.Serialize()); + var state = new StateDelta().SetState(avatarAddress, avatarState.Serialize()); Assert.Throws(() => action.Execute(new ActionContext() { @@ -155,7 +155,7 @@ public void ExecuteThrowInvalidAddressException() public void ExecuteThrowAvatarIndexOutOfRangeException(int index) { var agentState = new AgentState(_agentAddress); - var state = new State().SetState(_agentAddress, agentState.Serialize()); + var state = new StateDelta().SetState(_agentAddress, agentState.Serialize()); var action = new CreateAvatar() { index = index, @@ -190,7 +190,7 @@ public void ExecuteThrowAvatarIndexAlreadyUsedException(int index) ) ); agentState.avatarAddresses[index] = avatarAddress; - var state = new State().SetState(_agentAddress, agentState.Serialize()); + var state = new StateDelta().SetState(_agentAddress, agentState.Serialize()); var action = new CreateAvatar() { @@ -260,7 +260,7 @@ public void Rehearsal(int index) updatedAddresses.Add(slotAddress); } - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/CreatePendingActivationTest.cs b/.Lib9c.Tests/Action/CreatePendingActivationTest.cs index 7737c8c1d2..00ba335f2b 100644 --- a/.Lib9c.Tests/Action/CreatePendingActivationTest.cs +++ b/.Lib9c.Tests/Action/CreatePendingActivationTest.cs @@ -24,7 +24,7 @@ public void Execute() var action = new CreatePendingActivation(pendingActivation); var adminAddress = new Address("399bddF9F7B6d902ea27037B907B2486C9910730"); var adminState = new AdminState(adminAddress, 100); - var state = new State(ImmutableDictionary.Empty + var state = new StateDelta(ImmutableDictionary.Empty .Add(AdminState.Address, adminState.Serialize()) ); var actionContext = new ActionContext() @@ -52,7 +52,7 @@ public void CheckPermission() var action = new CreatePendingActivation(pendingActivation); var adminAddress = new Address("399bddF9F7B6d902ea27037B907B2486C9910730"); var adminState = new AdminState(adminAddress, 100); - var state = new State(ImmutableDictionary.Empty + var state = new StateDelta(ImmutableDictionary.Empty .Add(AdminState.Address, adminState.Serialize()) ); @@ -90,7 +90,7 @@ public void Rehearsal() BlockIndex = 101, Signer = default, Rehearsal = true, - PreviousState = new State(), + PreviousState = new StateDelta(), } ); Assert.Equal( diff --git a/.Lib9c.Tests/Action/CreatePendingActivationsTest.cs b/.Lib9c.Tests/Action/CreatePendingActivationsTest.cs index f26b858081..de2860732e 100644 --- a/.Lib9c.Tests/Action/CreatePendingActivationsTest.cs +++ b/.Lib9c.Tests/Action/CreatePendingActivationsTest.cs @@ -28,7 +28,7 @@ PendingActivationState CreatePendingActivation() var action = new CreatePendingActivations(activations); var adminAddress = new Address("399bddF9F7B6d902ea27037B907B2486C9910730"); var adminState = new AdminState(adminAddress, 100); - var state = new State(ImmutableDictionary.Empty + var state = new StateDelta(ImmutableDictionary.Empty .Add(AdminState.Address, adminState.Serialize()) ); var actionContext = new ActionContext() @@ -79,7 +79,7 @@ public void CheckPermission() var action = new CreatePendingActivations(); var adminAddress = new Address("399bddF9F7B6d902ea27037B907B2486C9910730"); var adminState = new AdminState(adminAddress, 100); - var state = new State(ImmutableDictionary.Empty + var state = new StateDelta(ImmutableDictionary.Empty .Add(AdminState.Address, adminState.Serialize()) ); diff --git a/.Lib9c.Tests/Action/CreatePledgeTest.cs b/.Lib9c.Tests/Action/CreatePledgeTest.cs index e269a20bf4..791478fdff 100644 --- a/.Lib9c.Tests/Action/CreatePledgeTest.cs +++ b/.Lib9c.Tests/Action/CreatePledgeTest.cs @@ -35,7 +35,7 @@ public void Execute(bool admin, Type exc) var agentAddress = new PrivateKey().ToAddress(); var pledgeAddress = agentAddress.GetPledgeAddress(); var context = new ActionContext(); - IAccountStateDelta states = new State() + IAccountStateDelta states = new StateDelta() .SetState(Addresses.Admin, adminState.Serialize()) .MintAsset(context, patronAddress, 4 * 500 * mead); diff --git a/.Lib9c.Tests/Action/DailyReward0Test.cs b/.Lib9c.Tests/Action/DailyReward0Test.cs index 4a3a250040..2966ba7bfc 100644 --- a/.Lib9c.Tests/Action/DailyReward0Test.cs +++ b/.Lib9c.Tests/Action/DailyReward0Test.cs @@ -23,7 +23,7 @@ public DailyReward0Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -85,7 +85,7 @@ public void ExecuteThrowFailedLoadStateException() Assert.Throws(() => action.Execute(new ActionContext() { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, BlockIndex = 0, }) diff --git a/.Lib9c.Tests/Action/DailyReward2Test.cs b/.Lib9c.Tests/Action/DailyReward2Test.cs index 65072cec81..9dcd6dda3f 100644 --- a/.Lib9c.Tests/Action/DailyReward2Test.cs +++ b/.Lib9c.Tests/Action/DailyReward2Test.cs @@ -25,7 +25,7 @@ public DailyReward2Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -98,7 +98,7 @@ public void ExecuteThrowFailedLoadStateException() Assert.Throws(() => action.Execute(new ActionContext() { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, BlockIndex = 0, }) diff --git a/.Lib9c.Tests/Action/DailyReward3Test.cs b/.Lib9c.Tests/Action/DailyReward3Test.cs index 5a3d3ca8ae..fff388b9a7 100644 --- a/.Lib9c.Tests/Action/DailyReward3Test.cs +++ b/.Lib9c.Tests/Action/DailyReward3Test.cs @@ -25,7 +25,7 @@ public DailyReward3Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -98,7 +98,7 @@ public void ExecuteThrowFailedLoadStateException() Assert.Throws(() => action.Execute(new ActionContext() { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, BlockIndex = 0, }) diff --git a/.Lib9c.Tests/Action/DailyReward4Test.cs b/.Lib9c.Tests/Action/DailyReward4Test.cs index 529280f8e2..6865fd5e80 100644 --- a/.Lib9c.Tests/Action/DailyReward4Test.cs +++ b/.Lib9c.Tests/Action/DailyReward4Test.cs @@ -28,7 +28,7 @@ public DailyReward4Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -113,7 +113,7 @@ public void ExecuteThrowFailedLoadStateException() Assert.Throws(() => action.Execute(new ActionContext() { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, BlockIndex = 0, }) @@ -131,7 +131,7 @@ public void Rehearsal() var nextState = action.Execute(new ActionContext { BlockIndex = 0, - PreviousState = new State(), + PreviousState = new StateDelta(), Random = new TestRandom(), Rehearsal = true, Signer = _agentAddress, diff --git a/.Lib9c.Tests/Action/DailyReward5Test.cs b/.Lib9c.Tests/Action/DailyReward5Test.cs index c58fa24790..9b2a92655c 100644 --- a/.Lib9c.Tests/Action/DailyReward5Test.cs +++ b/.Lib9c.Tests/Action/DailyReward5Test.cs @@ -26,7 +26,7 @@ public DailyReward5Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -70,7 +70,7 @@ public void Rehearsal() var nextState = action.Execute(new ActionContext { BlockIndex = 0, - PreviousState = new State(), + PreviousState = new StateDelta(), Random = new TestRandom(), Rehearsal = true, Signer = _agentAddress, @@ -119,7 +119,7 @@ public void Execute(int avatarStateSerializedVersion) [Fact] public void Execute_Throw_FailedLoadStateException() => - Assert.Throws(() => ExecuteInternal(new State())); + Assert.Throws(() => ExecuteInternal(new StateDelta())); [Theory] [InlineData(0, 0, true)] diff --git a/.Lib9c.Tests/Action/DailyReward6Test.cs b/.Lib9c.Tests/Action/DailyReward6Test.cs index 1f01d06695..e10df7056d 100644 --- a/.Lib9c.Tests/Action/DailyReward6Test.cs +++ b/.Lib9c.Tests/Action/DailyReward6Test.cs @@ -28,7 +28,7 @@ public DailyReward6Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -72,7 +72,7 @@ public void Rehearsal() var nextState = action.Execute(new ActionContext { BlockIndex = 0, - PreviousState = new State(), + PreviousState = new StateDelta(), Random = new TestRandom(), Rehearsal = true, Signer = _agentAddress, @@ -122,7 +122,7 @@ public void Execute(int avatarStateSerializedVersion) [Fact] public void Execute_Throw_FailedLoadStateException() => - Assert.Throws(() => ExecuteInternal(new State())); + Assert.Throws(() => ExecuteInternal(new StateDelta())); [Theory] [InlineData(0, 0, true)] diff --git a/.Lib9c.Tests/Action/DailyRewardTest.cs b/.Lib9c.Tests/Action/DailyRewardTest.cs index 2dd166a355..af809ddea8 100644 --- a/.Lib9c.Tests/Action/DailyRewardTest.cs +++ b/.Lib9c.Tests/Action/DailyRewardTest.cs @@ -26,7 +26,7 @@ public DailyRewardTest(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -70,7 +70,7 @@ public void Rehearsal() var nextState = action.Execute(new ActionContext { BlockIndex = 0, - PreviousState = new State(), + PreviousState = new StateDelta(), Random = new TestRandom(), Rehearsal = true, Signer = _agentAddress, @@ -114,7 +114,7 @@ public void Execute(bool legacy) [Fact] public void Execute_Throw_FailedLoadStateException() => - Assert.Throws(() => ExecuteInternal(new State())); + Assert.Throws(() => ExecuteInternal(new StateDelta())); [Theory] [InlineData(0, 0, true)] diff --git a/.Lib9c.Tests/Action/Delta.cs b/.Lib9c.Tests/Action/Delta.cs new file mode 100644 index 0000000000..4ca20b2265 --- /dev/null +++ b/.Lib9c.Tests/Action/Delta.cs @@ -0,0 +1,72 @@ +#nullable enable + +namespace Lib9c.Tests.Action +{ + using System.Collections.Immutable; + using System.Linq; + using System.Numerics; + using Bencodex.Types; + using Libplanet; + using Libplanet.Assets; + using Libplanet.Consensus; + using Libplanet.State; + + /// + /// Almost a replica of https://github.com/planetarium/libplanet/blob/main/Libplanet/State/AccountDelta.cs + /// except this has its constructors exposed as public for testing. + /// + public class Delta : IAccountDelta + { + public Delta() + { + States = ImmutableDictionary.Empty; + Fungibles = ImmutableDictionary<(Address, Currency), BigInteger>.Empty; + TotalSupplies = ImmutableDictionary.Empty; + ValidatorSet = null; + } + + public Delta( + IImmutableDictionary statesDelta, + IImmutableDictionary<(Address, Currency), BigInteger> fungiblesDelta, + IImmutableDictionary totalSuppliesDelta, + ValidatorSet? validatorSetDelta) + { + States = statesDelta; + Fungibles = fungiblesDelta; + TotalSupplies = totalSuppliesDelta; + ValidatorSet = validatorSetDelta; + } + + /// + public IImmutableSet
UpdatedAddresses => + StateUpdatedAddresses.Union(FungibleUpdatedAddresses); + + /// + public IImmutableSet
StateUpdatedAddresses => + States.Keys.ToImmutableHashSet(); + + /// + public IImmutableDictionary States { get; } + + /// + public IImmutableSet
FungibleUpdatedAddresses => + Fungibles.Keys.Select(pair => pair.Item1).ToImmutableHashSet(); + + /// + public IImmutableSet<(Address, Currency)> UpdatedFungibleAssets => + Fungibles.Keys.ToImmutableHashSet(); + + /// + public IImmutableDictionary<(Address, Currency), BigInteger> Fungibles { get; } + + /// + public IImmutableSet UpdatedTotalSupplyCurrencies => + TotalSupplies.Keys.ToImmutableHashSet(); + + /// + public IImmutableDictionary TotalSupplies { get; } + + /// + public ValidatorSet? ValidatorSet { get; } + } +} diff --git a/.Lib9c.Tests/Action/EndPledgeTest.cs b/.Lib9c.Tests/Action/EndPledgeTest.cs index 9cb4b7de06..e3f6846617 100644 --- a/.Lib9c.Tests/Action/EndPledgeTest.cs +++ b/.Lib9c.Tests/Action/EndPledgeTest.cs @@ -20,7 +20,7 @@ public void Execute(int balance) var patron = new PrivateKey().ToAddress(); var agent = new PrivateKey().ToAddress(); var context = new ActionContext(); - IAccountStateDelta states = new State() + IAccountStateDelta states = new StateDelta() .SetState(agent.GetPledgeAddress(), List.Empty.Add(patron.Serialize()).Add(true.Serialize())); var mead = Currencies.Mead; if (balance > 0) @@ -53,7 +53,7 @@ public void Execute_Throw_Exception(bool invalidSigner, bool invalidAgent, Type Address patron = new PrivateKey().ToAddress(); Address agent = new PrivateKey().ToAddress(); List contract = List.Empty.Add(patron.Serialize()).Add(true.Serialize()); - IAccountStateDelta states = new State().SetState(agent.GetPledgeAddress(), contract); + IAccountStateDelta states = new StateDelta().SetState(agent.GetPledgeAddress(), contract); var action = new EndPledge { diff --git a/.Lib9c.Tests/Action/EventConsumableItemCraftsTest.cs b/.Lib9c.Tests/Action/EventConsumableItemCraftsTest.cs index 29fb65fc43..fab28bf66a 100644 --- a/.Lib9c.Tests/Action/EventConsumableItemCraftsTest.cs +++ b/.Lib9c.Tests/Action/EventConsumableItemCraftsTest.cs @@ -25,7 +25,7 @@ public class EventConsumableItemCraftsTest public EventConsumableItemCraftsTest() { - _initialStates = new State(); + _initialStates = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { diff --git a/.Lib9c.Tests/Action/EventDungeonBattleV1Test.cs b/.Lib9c.Tests/Action/EventDungeonBattleV1Test.cs index bd0314b478..da10c06360 100644 --- a/.Lib9c.Tests/Action/EventDungeonBattleV1Test.cs +++ b/.Lib9c.Tests/Action/EventDungeonBattleV1Test.cs @@ -30,7 +30,7 @@ public class EventDungeonBattleV1Test public EventDungeonBattleV1Test() { - _initialStates = new State(); + _initialStates = new StateDelta(); #pragma warning disable CS0618 // Use of obsolete method Currency.Legacy(): https://github.com/planetarium/lib9c/discussions/1319 diff --git a/.Lib9c.Tests/Action/EventDungeonBattleV2Test.cs b/.Lib9c.Tests/Action/EventDungeonBattleV2Test.cs index 16ca596626..d8ed78a132 100644 --- a/.Lib9c.Tests/Action/EventDungeonBattleV2Test.cs +++ b/.Lib9c.Tests/Action/EventDungeonBattleV2Test.cs @@ -30,7 +30,7 @@ public class EventDungeonBattleV2Test public EventDungeonBattleV2Test() { - _initialStates = new State(); + _initialStates = new StateDelta(); #pragma warning disable CS0618 // Use of obsolete method Currency.Legacy(): https://github.com/planetarium/lib9c/discussions/1319 diff --git a/.Lib9c.Tests/Action/EventDungeonBattleV3Test.cs b/.Lib9c.Tests/Action/EventDungeonBattleV3Test.cs index 9c952d5793..07d80d907a 100644 --- a/.Lib9c.Tests/Action/EventDungeonBattleV3Test.cs +++ b/.Lib9c.Tests/Action/EventDungeonBattleV3Test.cs @@ -30,7 +30,7 @@ public class EventDungeonBattleV3Test public EventDungeonBattleV3Test() { - _initialStates = new State(); + _initialStates = new StateDelta(); #pragma warning disable CS0618 // Use of obsolete method Currency.Legacy(): https://github.com/planetarium/lib9c/discussions/1319 diff --git a/.Lib9c.Tests/Action/EventDungeonBattleV4Test.cs b/.Lib9c.Tests/Action/EventDungeonBattleV4Test.cs index c65500b7af..9b31575812 100644 --- a/.Lib9c.Tests/Action/EventDungeonBattleV4Test.cs +++ b/.Lib9c.Tests/Action/EventDungeonBattleV4Test.cs @@ -31,7 +31,7 @@ public class EventDungeonBattleV4Test public EventDungeonBattleV4Test() { - _initialStates = new State(); + _initialStates = new StateDelta(); #pragma warning disable CS0618 // Use of obsolete method Currency.Legacy(): https://github.com/planetarium/lib9c/discussions/1319 diff --git a/.Lib9c.Tests/Action/EventDungeonBattleV5Test.cs b/.Lib9c.Tests/Action/EventDungeonBattleV5Test.cs index 06b3031652..da7b2330c1 100644 --- a/.Lib9c.Tests/Action/EventDungeonBattleV5Test.cs +++ b/.Lib9c.Tests/Action/EventDungeonBattleV5Test.cs @@ -32,7 +32,7 @@ public class EventDungeonBattleV5Test public EventDungeonBattleV5Test() { - _initialStates = new State(); + _initialStates = new StateDelta(); #pragma warning disable CS0618 // Use of obsolete method Currency.Legacy(): https://github.com/planetarium/lib9c/discussions/1319 diff --git a/.Lib9c.Tests/Action/EventMaterialItemCraftsTest.cs b/.Lib9c.Tests/Action/EventMaterialItemCraftsTest.cs index f4dcc9f187..18d0105a21 100644 --- a/.Lib9c.Tests/Action/EventMaterialItemCraftsTest.cs +++ b/.Lib9c.Tests/Action/EventMaterialItemCraftsTest.cs @@ -27,7 +27,7 @@ public class EventMaterialItemCraftsTest public EventMaterialItemCraftsTest() { - _initialStates = new State(); + _initialStates = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { diff --git a/.Lib9c.Tests/Action/GrindingTest.cs b/.Lib9c.Tests/Action/GrindingTest.cs index faeeb3d95a..344f3762a2 100644 --- a/.Lib9c.Tests/Action/GrindingTest.cs +++ b/.Lib9c.Tests/Action/GrindingTest.cs @@ -61,7 +61,7 @@ public GrindingTest() #pragma warning restore CS0618 var goldCurrencyState = new GoldCurrencyState(_ncgCurrency); - _initialState = new State() + _initialState = new StateDelta() .SetState( Addresses.GetSheetAddress(), _tableSheets.CrystalMonsterCollectionMultiplierSheet.Serialize()) diff --git a/.Lib9c.Tests/Action/HackAndSlash0Test.cs b/.Lib9c.Tests/Action/HackAndSlash0Test.cs index 7825cb7aa4..20f7ad71cc 100644 --- a/.Lib9c.Tests/Action/HackAndSlash0Test.cs +++ b/.Lib9c.Tests/Action/HackAndSlash0Test.cs @@ -59,7 +59,7 @@ public HackAndSlash0Test() _weeklyArenaState = new WeeklyArenaState(0); - _initialState = new State() + _initialState = new StateDelta() .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, _avatarState.Serialize()) @@ -189,7 +189,7 @@ public void ExecuteThrowFailedLoadStateException() var exec = Assert.Throws(() => action.Execute(new ActionContext() { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, Random = new TestRandom(), })); @@ -591,7 +591,7 @@ public void Rehearsal() _rankingMapAddress, }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/HackAndSlash10Test.cs b/.Lib9c.Tests/Action/HackAndSlash10Test.cs index 72fb4462fc..c262a02920 100644 --- a/.Lib9c.Tests/Action/HackAndSlash10Test.cs +++ b/.Lib9c.Tests/Action/HackAndSlash10Test.cs @@ -72,7 +72,7 @@ public HackAndSlash10Test() _weeklyArenaState = new WeeklyArenaState(0); - _initialState = new State() + _initialState = new StateDelta() .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.SerializeV2()) .SetState(_avatarAddress, _avatarState.SerializeV2()) @@ -487,7 +487,7 @@ public void Execute_Throw_FailedLoadStateException(bool backward) avatarAddress = _avatarAddress, }; - IAccountStateDelta state = backward ? new State() : _initialState; + IAccountStateDelta state = backward ? new StateDelta() : _initialState; if (!backward) { state = _initialState @@ -1128,7 +1128,7 @@ public void Rehearsal() _avatarAddress.Derive(LegacyQuestListKey), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/HackAndSlash11Test.cs b/.Lib9c.Tests/Action/HackAndSlash11Test.cs index b5dbc9ca31..882f5abba0 100644 --- a/.Lib9c.Tests/Action/HackAndSlash11Test.cs +++ b/.Lib9c.Tests/Action/HackAndSlash11Test.cs @@ -72,7 +72,7 @@ public HackAndSlash11Test() _weeklyArenaState = new WeeklyArenaState(0); - _initialState = new State() + _initialState = new StateDelta() .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.SerializeV2()) .SetState(_avatarAddress, _avatarState.SerializeV2()) @@ -445,7 +445,7 @@ public void Execute_Throw_FailedLoadStateException(bool backward) avatarAddress = _avatarAddress, }; - IAccountStateDelta state = backward ? new State() : _initialState; + IAccountStateDelta state = backward ? new StateDelta() : _initialState; if (!backward) { state = _initialState @@ -1072,7 +1072,7 @@ public void Rehearsal() _avatarAddress.Derive(LegacyQuestListKey), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/HackAndSlash12Test.cs b/.Lib9c.Tests/Action/HackAndSlash12Test.cs index 0c26db2355..91c0e6dc1c 100644 --- a/.Lib9c.Tests/Action/HackAndSlash12Test.cs +++ b/.Lib9c.Tests/Action/HackAndSlash12Test.cs @@ -72,7 +72,7 @@ public HackAndSlash12Test() _weeklyArenaState = new WeeklyArenaState(0); - _initialState = new State() + _initialState = new StateDelta() .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.SerializeV2()) .SetState(_avatarAddress, _avatarState.SerializeV2()) @@ -429,7 +429,7 @@ public void Execute_Throw_FailedLoadStateException(bool backward) avatarAddress = _avatarAddress, }; - IAccountStateDelta state = backward ? new State() : _initialState; + IAccountStateDelta state = backward ? new StateDelta() : _initialState; if (!backward) { state = _initialState @@ -1068,7 +1068,7 @@ public void Rehearsal() _avatarAddress.Derive(LegacyQuestListKey), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext { diff --git a/.Lib9c.Tests/Action/HackAndSlash13Test.cs b/.Lib9c.Tests/Action/HackAndSlash13Test.cs index 73c193cfed..503bd19c3e 100644 --- a/.Lib9c.Tests/Action/HackAndSlash13Test.cs +++ b/.Lib9c.Tests/Action/HackAndSlash13Test.cs @@ -72,7 +72,7 @@ public HackAndSlash13Test() _weeklyArenaState = new WeeklyArenaState(0); - _initialState = new State() + _initialState = new StateDelta() .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.SerializeV2()) .SetState(_avatarAddress, _avatarState.SerializeV2()) @@ -435,7 +435,7 @@ public void Execute_Throw_FailedLoadStateException(bool backward) avatarAddress = _avatarAddress, }; - IAccountStateDelta state = backward ? new State() : _initialState; + IAccountStateDelta state = backward ? new StateDelta() : _initialState; if (!backward) { @@ -1106,7 +1106,7 @@ public void Rehearsal() _avatarAddress.Derive(LegacyQuestListKey), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext { diff --git a/.Lib9c.Tests/Action/HackAndSlash15Test.cs b/.Lib9c.Tests/Action/HackAndSlash15Test.cs index 7a3dfdbac9..be82243448 100644 --- a/.Lib9c.Tests/Action/HackAndSlash15Test.cs +++ b/.Lib9c.Tests/Action/HackAndSlash15Test.cs @@ -71,7 +71,7 @@ public HackAndSlash15Test() _weeklyArenaState = new WeeklyArenaState(0); - _initialState = new State() + _initialState = new StateDelta() .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.SerializeV2()) .SetState(_avatarAddress, _avatarState.SerializeV2()) @@ -431,7 +431,7 @@ public void Execute_Throw_FailedLoadStateException(bool backward) avatarAddress = _avatarAddress, }; - IAccountStateDelta state = backward ? new State() : _initialState; + IAccountStateDelta state = backward ? new StateDelta() : _initialState; if (!backward) { state = _initialState diff --git a/.Lib9c.Tests/Action/HackAndSlash16Test.cs b/.Lib9c.Tests/Action/HackAndSlash16Test.cs index e4c17f998d..487ee9373f 100644 --- a/.Lib9c.Tests/Action/HackAndSlash16Test.cs +++ b/.Lib9c.Tests/Action/HackAndSlash16Test.cs @@ -72,7 +72,7 @@ public HackAndSlash16Test() _weeklyArenaState = new WeeklyArenaState(0); - _initialState = new State() + _initialState = new StateDelta() .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.SerializeV2()) .SetState(_avatarAddress, _avatarState.SerializeV2()) @@ -432,7 +432,7 @@ public void Execute_Throw_FailedLoadStateException(bool backward) AvatarAddress = _avatarAddress, }; - IAccountStateDelta state = backward ? new State() : _initialState; + IAccountStateDelta state = backward ? new StateDelta() : _initialState; if (!backward) { state = _initialState diff --git a/.Lib9c.Tests/Action/HackAndSlash17Test.cs b/.Lib9c.Tests/Action/HackAndSlash17Test.cs index 15d4fa40e6..77d987f625 100644 --- a/.Lib9c.Tests/Action/HackAndSlash17Test.cs +++ b/.Lib9c.Tests/Action/HackAndSlash17Test.cs @@ -72,7 +72,7 @@ public HackAndSlash17Test() _weeklyArenaState = new WeeklyArenaState(0); - _initialState = new State() + _initialState = new StateDelta() .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.SerializeV2()) .SetState(_avatarAddress, _avatarState.SerializeV2()) @@ -432,7 +432,7 @@ public void Execute_Throw_FailedLoadStateException(bool backward) AvatarAddress = _avatarAddress, }; - IAccountStateDelta state = backward ? new State() : _initialState; + IAccountStateDelta state = backward ? new StateDelta() : _initialState; if (!backward) { state = _initialState diff --git a/.Lib9c.Tests/Action/HackAndSlash18Test.cs b/.Lib9c.Tests/Action/HackAndSlash18Test.cs index 8d07a23a86..2c1ff52e6e 100644 --- a/.Lib9c.Tests/Action/HackAndSlash18Test.cs +++ b/.Lib9c.Tests/Action/HackAndSlash18Test.cs @@ -78,7 +78,7 @@ public HackAndSlash18Test() var currency = Currency.Legacy("NCG", 2, null); #pragma warning restore CS0618 var goldCurrencyState = new GoldCurrencyState(currency); - _initialState = new State() + _initialState = new StateDelta() .SetState(Addresses.GoldCurrency, goldCurrencyState.Serialize()) .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.SerializeV2()) @@ -430,7 +430,7 @@ public void Execute_Throw_FailedLoadStateException(bool backward) AvatarAddress = _avatarAddress, }; - IAccountStateDelta state = backward ? new State() : _initialState; + IAccountStateDelta state = backward ? new StateDelta() : _initialState; if (!backward) { state = _initialState diff --git a/.Lib9c.Tests/Action/HackAndSlash19Test.cs b/.Lib9c.Tests/Action/HackAndSlash19Test.cs index 048ee555a2..97ca7592e0 100644 --- a/.Lib9c.Tests/Action/HackAndSlash19Test.cs +++ b/.Lib9c.Tests/Action/HackAndSlash19Test.cs @@ -77,7 +77,7 @@ public HackAndSlash19Test() var currency = Currency.Legacy("NCG", 2, null); #pragma warning restore CS0618 var goldCurrencyState = new GoldCurrencyState(currency); - _initialState = new State() + _initialState = new StateDelta() .SetState(Addresses.GoldCurrency, goldCurrencyState.Serialize()) .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.SerializeV2()) @@ -434,7 +434,7 @@ public void Execute_Throw_FailedLoadStateException(bool backward) AvatarAddress = _avatarAddress, }; - IAccountStateDelta state = backward ? new State() : _initialState; + IAccountStateDelta state = backward ? new StateDelta() : _initialState; if (!backward) { state = _initialState diff --git a/.Lib9c.Tests/Action/HackAndSlash20Test.cs b/.Lib9c.Tests/Action/HackAndSlash20Test.cs index 0f6c4c0954..3caff6bdf5 100644 --- a/.Lib9c.Tests/Action/HackAndSlash20Test.cs +++ b/.Lib9c.Tests/Action/HackAndSlash20Test.cs @@ -78,7 +78,7 @@ public HackAndSlash20Test() var currency = Currency.Legacy("NCG", 2, null); #pragma warning restore CS0618 var goldCurrencyState = new GoldCurrencyState(currency); - _initialState = new State() + _initialState = new StateDelta() .SetState(Addresses.GoldCurrency, goldCurrencyState.Serialize()) .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.SerializeV2()) @@ -435,7 +435,7 @@ public void Execute_Throw_FailedLoadStateException(bool backward) AvatarAddress = _avatarAddress, }; - IAccountStateDelta state = backward ? new State() : _initialState; + IAccountStateDelta state = backward ? new StateDelta() : _initialState; if (!backward) { state = _initialState diff --git a/.Lib9c.Tests/Action/HackAndSlash21Test.cs b/.Lib9c.Tests/Action/HackAndSlash21Test.cs index dfb9668154..fcf0ab5d7a 100644 --- a/.Lib9c.Tests/Action/HackAndSlash21Test.cs +++ b/.Lib9c.Tests/Action/HackAndSlash21Test.cs @@ -79,7 +79,7 @@ public HackAndSlash21Test() var currency = Currency.Legacy("NCG", 2, null); #pragma warning restore CS0618 var goldCurrencyState = new GoldCurrencyState(currency); - _initialState = new State() + _initialState = new StateDelta() .SetState(Addresses.GoldCurrency, goldCurrencyState.Serialize()) .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.SerializeV2()) @@ -436,7 +436,7 @@ public void Execute_Throw_FailedLoadStateException(bool backward) AvatarAddress = _avatarAddress, }; - IAccountStateDelta state = backward ? new State() : _initialState; + IAccountStateDelta state = backward ? new StateDelta() : _initialState; if (!backward) { state = _initialState diff --git a/.Lib9c.Tests/Action/HackAndSlash2Test.cs b/.Lib9c.Tests/Action/HackAndSlash2Test.cs index 77b6306edf..a8b61769bb 100644 --- a/.Lib9c.Tests/Action/HackAndSlash2Test.cs +++ b/.Lib9c.Tests/Action/HackAndSlash2Test.cs @@ -61,7 +61,7 @@ public HackAndSlash2Test() _weeklyArenaState = new WeeklyArenaState(0); - _initialState = new State() + _initialState = new StateDelta() .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, _avatarState.Serialize()) @@ -198,7 +198,7 @@ public void ExecuteThrowFailedLoadStateException() var exec = Assert.Throws(() => action.Execute(new ActionContext() { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, Random = new TestRandom(), })); @@ -600,7 +600,7 @@ public void Rehearsal() _rankingMapAddress, }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/HackAndSlash3Test.cs b/.Lib9c.Tests/Action/HackAndSlash3Test.cs index 85e2a377c4..c26b2e0770 100644 --- a/.Lib9c.Tests/Action/HackAndSlash3Test.cs +++ b/.Lib9c.Tests/Action/HackAndSlash3Test.cs @@ -58,7 +58,7 @@ public HackAndSlash3Test() _weeklyArenaState = new WeeklyArenaState(0); - _initialState = new State() + _initialState = new StateDelta() .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, _avatarState.Serialize()) diff --git a/.Lib9c.Tests/Action/HackAndSlash4Test.cs b/.Lib9c.Tests/Action/HackAndSlash4Test.cs index a398eef5d2..3f4e1165e4 100644 --- a/.Lib9c.Tests/Action/HackAndSlash4Test.cs +++ b/.Lib9c.Tests/Action/HackAndSlash4Test.cs @@ -61,7 +61,7 @@ public HackAndSlash4Test() _weeklyArenaState = new WeeklyArenaState(0); - _initialState = new State() + _initialState = new StateDelta() .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, _avatarState.Serialize()) @@ -379,7 +379,7 @@ public void ExecuteThrowFailedLoadStateException() var exec = Assert.Throws(() => action.Execute(new ActionContext() { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, Random = new TestRandom(), })); diff --git a/.Lib9c.Tests/Action/HackAndSlash5Test.cs b/.Lib9c.Tests/Action/HackAndSlash5Test.cs index 2f9f1a5a2d..48e429fb17 100644 --- a/.Lib9c.Tests/Action/HackAndSlash5Test.cs +++ b/.Lib9c.Tests/Action/HackAndSlash5Test.cs @@ -61,7 +61,7 @@ public HackAndSlash5Test() _weeklyArenaState = new WeeklyArenaState(0); - _initialState = new State() + _initialState = new StateDelta() .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, _avatarState.Serialize()) @@ -380,7 +380,7 @@ public void ExecuteThrowFailedLoadStateException() var exec = Assert.Throws(() => action.Execute(new ActionContext() { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, Random = new TestRandom(), })); diff --git a/.Lib9c.Tests/Action/HackAndSlash6Test.cs b/.Lib9c.Tests/Action/HackAndSlash6Test.cs index 1f71609ac6..42cf948925 100644 --- a/.Lib9c.Tests/Action/HackAndSlash6Test.cs +++ b/.Lib9c.Tests/Action/HackAndSlash6Test.cs @@ -63,7 +63,7 @@ public HackAndSlash6Test() _weeklyArenaState = new WeeklyArenaState(0); - _initialState = new State() + _initialState = new StateDelta() .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, _avatarState.Serialize()) @@ -396,7 +396,7 @@ public void Execute_Throw_FailedLoadStateException(bool backward) Assert.Null(action.Result); - IAccountStateDelta state = backward ? new State() : _initialState; + IAccountStateDelta state = backward ? new StateDelta() : _initialState; if (!backward) { state = _initialState @@ -813,7 +813,7 @@ public void Rehearsal() _avatarAddress.Derive(LegacyQuestListKey), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/HackAndSlash7Test.cs b/.Lib9c.Tests/Action/HackAndSlash7Test.cs index ed5c75663e..540d898391 100644 --- a/.Lib9c.Tests/Action/HackAndSlash7Test.cs +++ b/.Lib9c.Tests/Action/HackAndSlash7Test.cs @@ -72,7 +72,7 @@ public HackAndSlash7Test() _weeklyArenaState = new WeeklyArenaState(0); - _initialState = new State() + _initialState = new StateDelta() .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.SerializeV2()) .SetState(_avatarAddress, _avatarState.SerializeV2()) @@ -497,7 +497,7 @@ public void Execute_Throw_FailedLoadStateException(bool backward) WeeklyArenaAddress = _weeklyArenaState.address, }; - IAccountStateDelta state = backward ? new State() : _initialState; + IAccountStateDelta state = backward ? new StateDelta() : _initialState; if (!backward) { state = _initialState @@ -876,7 +876,7 @@ public void Rehearsal() _avatarAddress.Derive(LegacyQuestListKey), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/HackAndSlash8Test.cs b/.Lib9c.Tests/Action/HackAndSlash8Test.cs index 40f4082726..13542310cd 100644 --- a/.Lib9c.Tests/Action/HackAndSlash8Test.cs +++ b/.Lib9c.Tests/Action/HackAndSlash8Test.cs @@ -72,7 +72,7 @@ public HackAndSlash8Test() _weeklyArenaState = new WeeklyArenaState(0); - _initialState = new State() + _initialState = new StateDelta() .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.SerializeV2()) .SetState(_avatarAddress, _avatarState.SerializeV2()) @@ -490,7 +490,7 @@ public void Execute_Throw_FailedLoadStateException(bool backward) avatarAddress = _avatarAddress, }; - IAccountStateDelta state = backward ? new State() : _initialState; + IAccountStateDelta state = backward ? new StateDelta() : _initialState; if (!backward) { state = _initialState @@ -857,7 +857,7 @@ public void Rehearsal() _avatarAddress.Derive(LegacyQuestListKey), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/HackAndSlash9Test.cs b/.Lib9c.Tests/Action/HackAndSlash9Test.cs index c11a857f0e..0050150a54 100644 --- a/.Lib9c.Tests/Action/HackAndSlash9Test.cs +++ b/.Lib9c.Tests/Action/HackAndSlash9Test.cs @@ -72,7 +72,7 @@ public HackAndSlash9Test() _weeklyArenaState = new WeeklyArenaState(0); - _initialState = new State() + _initialState = new StateDelta() .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.SerializeV2()) .SetState(_avatarAddress, _avatarState.SerializeV2()) @@ -510,7 +510,7 @@ public void Execute_Throw_FailedLoadStateException(bool backward) avatarAddress = _avatarAddress, }; - IAccountStateDelta state = backward ? new State() : _initialState; + IAccountStateDelta state = backward ? new StateDelta() : _initialState; if (!backward) { state = _initialState @@ -1151,7 +1151,7 @@ public void Rehearsal() _avatarAddress.Derive(LegacyQuestListKey), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/HackAndSlashRandomBuffTest.cs b/.Lib9c.Tests/Action/HackAndSlashRandomBuffTest.cs index 3dd020ebc7..e87797e581 100644 --- a/.Lib9c.Tests/Action/HackAndSlashRandomBuffTest.cs +++ b/.Lib9c.Tests/Action/HackAndSlashRandomBuffTest.cs @@ -72,7 +72,7 @@ public HackAndSlashRandomBuffTest() _weeklyArenaState = new WeeklyArenaState(0); - _initialState = new State() + _initialState = new StateDelta() .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.SerializeV2()) .SetState(_avatarAddress, _avatarState.SerializeV2()) diff --git a/.Lib9c.Tests/Action/HackAndSlashSweep1Test.cs b/.Lib9c.Tests/Action/HackAndSlashSweep1Test.cs index 85c3efed39..b8d3b952e5 100644 --- a/.Lib9c.Tests/Action/HackAndSlashSweep1Test.cs +++ b/.Lib9c.Tests/Action/HackAndSlashSweep1Test.cs @@ -67,7 +67,7 @@ public HackAndSlashSweep1Test() _weeklyArenaState = new WeeklyArenaState(0); - _initialState = new State() + _initialState = new StateDelta() .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.SerializeV2()) .SetState(_avatarAddress, _avatarState.SerializeV2()) @@ -197,7 +197,7 @@ public void Execute_FailedLoadStateException(bool backward) stageId = 1, }; - var state = backward ? new State() : _initialState; + var state = backward ? new StateDelta() : _initialState; if (!backward) { state = _initialState diff --git a/.Lib9c.Tests/Action/HackAndSlashSweep2Test.cs b/.Lib9c.Tests/Action/HackAndSlashSweep2Test.cs index bcb460ce32..098e420508 100644 --- a/.Lib9c.Tests/Action/HackAndSlashSweep2Test.cs +++ b/.Lib9c.Tests/Action/HackAndSlashSweep2Test.cs @@ -67,7 +67,7 @@ public HackAndSlashSweep2Test() _weeklyArenaState = new WeeklyArenaState(0); - _initialState = new State() + _initialState = new StateDelta() .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.SerializeV2()) .SetState(_avatarAddress, _avatarState.SerializeV2()) @@ -197,7 +197,7 @@ public void Execute_FailedLoadStateException(bool backward) stageId = 1, }; - var state = backward ? new State() : _initialState; + var state = backward ? new StateDelta() : _initialState; if (!backward) { state = _initialState diff --git a/.Lib9c.Tests/Action/HackAndSlashSweep3Test.cs b/.Lib9c.Tests/Action/HackAndSlashSweep3Test.cs index 249e044903..4a932bad85 100644 --- a/.Lib9c.Tests/Action/HackAndSlashSweep3Test.cs +++ b/.Lib9c.Tests/Action/HackAndSlashSweep3Test.cs @@ -68,7 +68,7 @@ public HackAndSlashSweep3Test() _weeklyArenaState = new WeeklyArenaState(0); - _initialState = new State() + _initialState = new StateDelta() .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.SerializeV2()) .SetState(_avatarAddress, _avatarState.SerializeV2()) @@ -227,7 +227,7 @@ public void Execute_FailedLoadStateException(bool backward) stageId = 1, }; - var state = backward ? new State() : _initialState; + var state = backward ? new StateDelta() : _initialState; if (!backward) { state = _initialState diff --git a/.Lib9c.Tests/Action/HackAndSlashSweep4Test.cs b/.Lib9c.Tests/Action/HackAndSlashSweep4Test.cs index 5f4fa393ca..f3fac52d6d 100644 --- a/.Lib9c.Tests/Action/HackAndSlashSweep4Test.cs +++ b/.Lib9c.Tests/Action/HackAndSlashSweep4Test.cs @@ -68,7 +68,7 @@ public HackAndSlashSweep4Test() _weeklyArenaState = new WeeklyArenaState(0); - _initialState = new State() + _initialState = new StateDelta() .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.SerializeV2()) .SetState(_avatarAddress, _avatarState.SerializeV2()) @@ -247,7 +247,7 @@ public void Execute_FailedLoadStateException(bool backward) stageId = 1, }; - var state = backward ? new State() : _initialState; + var state = backward ? new StateDelta() : _initialState; if (!backward) { state = _initialState diff --git a/.Lib9c.Tests/Action/HackAndSlashSweep5Test.cs b/.Lib9c.Tests/Action/HackAndSlashSweep5Test.cs index 0f201f7b69..32de07aa62 100644 --- a/.Lib9c.Tests/Action/HackAndSlashSweep5Test.cs +++ b/.Lib9c.Tests/Action/HackAndSlashSweep5Test.cs @@ -69,7 +69,7 @@ public HackAndSlashSweep5Test() _weeklyArenaState = new WeeklyArenaState(0); - _initialState = new State() + _initialState = new StateDelta() .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.SerializeV2()) .SetState(_avatarAddress, _avatarState.SerializeV2()) @@ -250,7 +250,7 @@ public void Execute_FailedLoadStateException(bool backward) stageId = 1, }; - var state = backward ? new State() : _initialState; + var state = backward ? new StateDelta() : _initialState; if (!backward) { state = _initialState diff --git a/.Lib9c.Tests/Action/HackAndSlashSweep6Test.cs b/.Lib9c.Tests/Action/HackAndSlashSweep6Test.cs index 6fc7cd6a82..f9b2f199b5 100644 --- a/.Lib9c.Tests/Action/HackAndSlashSweep6Test.cs +++ b/.Lib9c.Tests/Action/HackAndSlashSweep6Test.cs @@ -75,7 +75,7 @@ public HackAndSlashSweep6Test() #pragma warning restore CS0618 var goldCurrencyState = new GoldCurrencyState(currency); _weeklyArenaState = new WeeklyArenaState(0); - _initialState = new State() + _initialState = new StateDelta() .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.SerializeV2()) .SetState(_avatarAddress, _avatarState.SerializeV2()) @@ -257,7 +257,7 @@ public void Execute_FailedLoadStateException(bool backward) stageId = 1, }; - var state = backward ? new State() : _initialState; + var state = backward ? new StateDelta() : _initialState; if (!backward) { state = _initialState diff --git a/.Lib9c.Tests/Action/HackAndSlashSweep7Test.cs b/.Lib9c.Tests/Action/HackAndSlashSweep7Test.cs index a77d4b50ff..43ccaa26c1 100644 --- a/.Lib9c.Tests/Action/HackAndSlashSweep7Test.cs +++ b/.Lib9c.Tests/Action/HackAndSlashSweep7Test.cs @@ -75,7 +75,7 @@ public HackAndSlashSweep7Test() #pragma warning restore CS0618 var goldCurrencyState = new GoldCurrencyState(currency); _weeklyArenaState = new WeeklyArenaState(0); - _initialState = new State() + _initialState = new StateDelta() .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.SerializeV2()) .SetState(_avatarAddress, _avatarState.SerializeV2()) @@ -260,7 +260,7 @@ public void Execute_FailedLoadStateException(bool backward) stageId = 1, }; - var state = backward ? new State() : _initialState; + var state = backward ? new StateDelta() : _initialState; if (!backward) { state = _initialState diff --git a/.Lib9c.Tests/Action/HackAndSlashSweep8Test.cs b/.Lib9c.Tests/Action/HackAndSlashSweep8Test.cs index 1079dfc082..5780c41b40 100644 --- a/.Lib9c.Tests/Action/HackAndSlashSweep8Test.cs +++ b/.Lib9c.Tests/Action/HackAndSlashSweep8Test.cs @@ -75,7 +75,7 @@ public HackAndSlashSweep8Test() #pragma warning restore CS0618 var goldCurrencyState = new GoldCurrencyState(currency); _weeklyArenaState = new WeeklyArenaState(0); - _initialState = new State() + _initialState = new StateDelta() .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.SerializeV2()) .SetState(_avatarAddress, _avatarState.SerializeV2()) @@ -262,7 +262,7 @@ public void Execute_FailedLoadStateException(bool backward) stageId = 1, }; - var state = backward ? new State() : _initialState; + var state = backward ? new StateDelta() : _initialState; if (!backward) { state = _initialState diff --git a/.Lib9c.Tests/Action/HackAndSlashSweep9Test.cs b/.Lib9c.Tests/Action/HackAndSlashSweep9Test.cs index e4215a82e6..8f08c468eb 100644 --- a/.Lib9c.Tests/Action/HackAndSlashSweep9Test.cs +++ b/.Lib9c.Tests/Action/HackAndSlashSweep9Test.cs @@ -76,7 +76,7 @@ public HackAndSlashSweep9Test() #pragma warning restore CS0618 var goldCurrencyState = new GoldCurrencyState(currency); _weeklyArenaState = new WeeklyArenaState(0); - _initialState = new State() + _initialState = new StateDelta() .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.SerializeV2()) .SetState(_avatarAddress, _avatarState.SerializeV2()) @@ -263,7 +263,7 @@ public void Execute_FailedLoadStateException(bool backward) stageId = 1, }; - var state = backward ? new State() : _initialState; + var state = backward ? new StateDelta() : _initialState; if (!backward) { state = _initialState diff --git a/.Lib9c.Tests/Action/HackAndSlashTest14.cs b/.Lib9c.Tests/Action/HackAndSlashTest14.cs index e551a92063..83d4341f21 100644 --- a/.Lib9c.Tests/Action/HackAndSlashTest14.cs +++ b/.Lib9c.Tests/Action/HackAndSlashTest14.cs @@ -71,7 +71,7 @@ public HackAndSlashTest14() _weeklyArenaState = new WeeklyArenaState(0); - _initialState = new State() + _initialState = new StateDelta() .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.SerializeV2()) .SetState(_avatarAddress, _avatarState.SerializeV2()) @@ -422,7 +422,7 @@ public void Execute_Throw_FailedLoadStateException(bool backward) avatarAddress = _avatarAddress, }; - IAccountStateDelta state = backward ? new State() : _initialState; + IAccountStateDelta state = backward ? new StateDelta() : _initialState; if (!backward) { state = _initialState diff --git a/.Lib9c.Tests/Action/InitializeStatesTest.cs b/.Lib9c.Tests/Action/InitializeStatesTest.cs index 7e1852b194..91af14d926 100644 --- a/.Lib9c.Tests/Action/InitializeStatesTest.cs +++ b/.Lib9c.Tests/Action/InitializeStatesTest.cs @@ -61,7 +61,7 @@ public void Execute() { BlockIndex = 0, Miner = default, - PreviousState = new State(), + PreviousState = new StateDelta(), }); var addresses = new List
() @@ -127,7 +127,7 @@ public void ExecuteWithAuthorizedMinersState() { BlockIndex = 0, Miner = default, - PreviousState = new State(), + PreviousState = new StateDelta(), }); var fetchedState = new AuthorizedMinersState( @@ -175,7 +175,7 @@ public void ExecuteWithActivateAdminKey() { BlockIndex = 0, Miner = default, - PreviousState = new State(), + PreviousState = new StateDelta(), }); var fetchedState = new ActivatedAccountsState( @@ -226,7 +226,7 @@ public void ExecuteWithCredits() { BlockIndex = 0, Miner = default, - PreviousState = new State(), + PreviousState = new StateDelta(), }); var fetchedState = new CreditsState( @@ -271,7 +271,7 @@ public void ExecuteWithoutAdminState() { BlockIndex = 0, Miner = default, - PreviousState = new State(), + PreviousState = new StateDelta(), }); var fetchedState = new ActivatedAccountsState( diff --git a/.Lib9c.Tests/Action/ItemEnhancement0Test.cs b/.Lib9c.Tests/Action/ItemEnhancement0Test.cs index 958d34b756..7e26d167e5 100644 --- a/.Lib9c.Tests/Action/ItemEnhancement0Test.cs +++ b/.Lib9c.Tests/Action/ItemEnhancement0Test.cs @@ -58,7 +58,7 @@ public ItemEnhancement0Test() _avatarAddress.Derive(string.Format(CultureInfo.InvariantCulture, CombinationSlotState.DeriveFormat, 0)); var context = new ActionContext(); - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, _avatarState.Serialize()) .SetState(_slotAddress, new CombinationSlotState(_slotAddress, 0).Serialize()) @@ -137,7 +137,7 @@ public void ExecuteThrowFailedLoadStateException() Assert.Throws(() => action.Execute(new ActionContext() { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, BlockIndex = 0, }) @@ -505,7 +505,7 @@ public void Rehearsal() Addresses.Blacksmith, }; - var state = new State() + var state = new StateDelta() .SetState(GoldCurrencyState.Address, gold.Serialize()); var nextState = action.Execute(new ActionContext() diff --git a/.Lib9c.Tests/Action/ItemEnhancement10Test.cs b/.Lib9c.Tests/Action/ItemEnhancement10Test.cs index 25d0af6cac..38a11bd3aa 100644 --- a/.Lib9c.Tests/Action/ItemEnhancement10Test.cs +++ b/.Lib9c.Tests/Action/ItemEnhancement10Test.cs @@ -63,7 +63,7 @@ public ItemEnhancement10Test() _avatarAddress.Derive(string.Format(CultureInfo.InvariantCulture, CombinationSlotState.DeriveFormat, 0)); var context = new ActionContext(); - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, _avatarState.Serialize()) .SetState(_slotAddress, new CombinationSlotState(_slotAddress, 0).Serialize()) @@ -227,7 +227,7 @@ public void Rehearsal() ItemEnhancement10.GetFeeStoreAddress(), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/ItemEnhancement2Test.cs b/.Lib9c.Tests/Action/ItemEnhancement2Test.cs index 2e73bc3f63..019a770fba 100644 --- a/.Lib9c.Tests/Action/ItemEnhancement2Test.cs +++ b/.Lib9c.Tests/Action/ItemEnhancement2Test.cs @@ -57,7 +57,7 @@ public ItemEnhancement2Test() _avatarAddress.Derive(string.Format(CultureInfo.InvariantCulture, CombinationSlotState.DeriveFormat, 0)); var context = new ActionContext(); - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, _avatarState.Serialize()) .SetState(_slotAddress, new CombinationSlotState(_slotAddress, 0).Serialize()) @@ -136,7 +136,7 @@ public void ExecuteThrowFailedLoadStateException() Assert.Throws(() => action.Execute(new ActionContext() { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, BlockIndex = 0, }) @@ -470,7 +470,7 @@ public void Rehearsal() Addresses.Blacksmith, }; - var state = new State() + var state = new StateDelta() .SetState(GoldCurrencyState.Address, gold.Serialize()); var nextState = action.Execute(new ActionContext() diff --git a/.Lib9c.Tests/Action/ItemEnhancement3Test.cs b/.Lib9c.Tests/Action/ItemEnhancement3Test.cs index 66b2781e90..612c1377c1 100644 --- a/.Lib9c.Tests/Action/ItemEnhancement3Test.cs +++ b/.Lib9c.Tests/Action/ItemEnhancement3Test.cs @@ -57,7 +57,7 @@ public ItemEnhancement3Test() _avatarAddress.Derive(string.Format(CultureInfo.InvariantCulture, CombinationSlotState.DeriveFormat, 0)); var context = new ActionContext(); - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, _avatarState.Serialize()) .SetState(_slotAddress, new CombinationSlotState(_slotAddress, 0).Serialize()) diff --git a/.Lib9c.Tests/Action/ItemEnhancement4Test.cs b/.Lib9c.Tests/Action/ItemEnhancement4Test.cs index fb19885476..89e2715e2b 100644 --- a/.Lib9c.Tests/Action/ItemEnhancement4Test.cs +++ b/.Lib9c.Tests/Action/ItemEnhancement4Test.cs @@ -58,7 +58,7 @@ public ItemEnhancement4Test() _avatarAddress.Derive(string.Format(CultureInfo.InvariantCulture, CombinationSlotState.DeriveFormat, 0)); var context = new ActionContext(); - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, _avatarState.Serialize()) .SetState(_slotAddress, new CombinationSlotState(_slotAddress, 0).Serialize()) diff --git a/.Lib9c.Tests/Action/ItemEnhancement5Test.cs b/.Lib9c.Tests/Action/ItemEnhancement5Test.cs index 58f26c9f01..feaf293f56 100644 --- a/.Lib9c.Tests/Action/ItemEnhancement5Test.cs +++ b/.Lib9c.Tests/Action/ItemEnhancement5Test.cs @@ -58,7 +58,7 @@ public ItemEnhancement5Test() _avatarAddress.Derive(string.Format(CultureInfo.InvariantCulture, CombinationSlotState.DeriveFormat, 0)); var context = new ActionContext(); - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, _avatarState.Serialize()) .SetState(_slotAddress, new CombinationSlotState(_slotAddress, 0).Serialize()) diff --git a/.Lib9c.Tests/Action/ItemEnhancement6Test.cs b/.Lib9c.Tests/Action/ItemEnhancement6Test.cs index 5ffd63b6ee..61ca635f02 100644 --- a/.Lib9c.Tests/Action/ItemEnhancement6Test.cs +++ b/.Lib9c.Tests/Action/ItemEnhancement6Test.cs @@ -58,7 +58,7 @@ public ItemEnhancement6Test() _avatarAddress.Derive(string.Format(CultureInfo.InvariantCulture, CombinationSlotState.DeriveFormat, 0)); var context = new ActionContext(); - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, _avatarState.Serialize()) .SetState(_slotAddress, new CombinationSlotState(_slotAddress, 0).Serialize()) diff --git a/.Lib9c.Tests/Action/ItemEnhancement7Test.cs b/.Lib9c.Tests/Action/ItemEnhancement7Test.cs index 8aa0a2734b..2c6396921a 100644 --- a/.Lib9c.Tests/Action/ItemEnhancement7Test.cs +++ b/.Lib9c.Tests/Action/ItemEnhancement7Test.cs @@ -60,7 +60,7 @@ public ItemEnhancement7Test() _avatarAddress.Derive(string.Format(CultureInfo.InvariantCulture, CombinationSlotState.DeriveFormat, 0)); var context = new ActionContext(); - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, _avatarState.Serialize()) .SetState(_slotAddress, new CombinationSlotState(_slotAddress, 0).Serialize()) @@ -196,7 +196,7 @@ public void Rehearsal() Addresses.Blacksmith, }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/ItemEnhancement8Test.cs b/.Lib9c.Tests/Action/ItemEnhancement8Test.cs index b867526d99..ddea1a0f2b 100644 --- a/.Lib9c.Tests/Action/ItemEnhancement8Test.cs +++ b/.Lib9c.Tests/Action/ItemEnhancement8Test.cs @@ -60,7 +60,7 @@ public ItemEnhancement8Test() _avatarAddress.Derive(string.Format(CultureInfo.InvariantCulture, CombinationSlotState.DeriveFormat, 0)); var context = new ActionContext(); - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, _avatarState.Serialize()) .SetState(_slotAddress, new CombinationSlotState(_slotAddress, 0).Serialize()) @@ -196,7 +196,7 @@ public void Rehearsal() Addresses.Blacksmith, }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/ItemEnhancement9Test.cs b/.Lib9c.Tests/Action/ItemEnhancement9Test.cs index d7c77f884c..fb39f9874f 100644 --- a/.Lib9c.Tests/Action/ItemEnhancement9Test.cs +++ b/.Lib9c.Tests/Action/ItemEnhancement9Test.cs @@ -61,7 +61,7 @@ public ItemEnhancement9Test() _avatarAddress.Derive(string.Format(CultureInfo.InvariantCulture, CombinationSlotState.DeriveFormat, 0)); var context = new ActionContext(); - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, _avatarState.Serialize()) .SetState(_slotAddress, new CombinationSlotState(_slotAddress, 0).Serialize()) @@ -221,7 +221,7 @@ public void Rehearsal() Addresses.Blacksmith, }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/ItemEnhancementTest.cs b/.Lib9c.Tests/Action/ItemEnhancementTest.cs index 9970c3ab39..baf816b226 100644 --- a/.Lib9c.Tests/Action/ItemEnhancementTest.cs +++ b/.Lib9c.Tests/Action/ItemEnhancementTest.cs @@ -57,7 +57,7 @@ public ItemEnhancementTest() var slotAddress = _avatarAddress.Derive(string.Format(CultureInfo.InvariantCulture, CombinationSlotState.DeriveFormat, 0)); var context = new ActionContext(); - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, _avatarState.Serialize()) .SetState(slotAddress, new CombinationSlotState(slotAddress, 0).Serialize()) diff --git a/.Lib9c.Tests/Action/JoinArena1Test.cs b/.Lib9c.Tests/Action/JoinArena1Test.cs index 4f68f7ddc3..84697d523f 100644 --- a/.Lib9c.Tests/Action/JoinArena1Test.cs +++ b/.Lib9c.Tests/Action/JoinArena1Test.cs @@ -46,7 +46,7 @@ public JoinArena1Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _state = new State(); + _state = new StateDelta(); _signer = new PrivateKey().ToAddress(); _avatarAddress = _signer.Derive("avatar"); diff --git a/.Lib9c.Tests/Action/JoinArena2Test.cs b/.Lib9c.Tests/Action/JoinArena2Test.cs index 06c18b1a50..31d274108f 100644 --- a/.Lib9c.Tests/Action/JoinArena2Test.cs +++ b/.Lib9c.Tests/Action/JoinArena2Test.cs @@ -46,7 +46,7 @@ public JoinArena2Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _state = new State(); + _state = new StateDelta(); _signer = new PrivateKey().ToAddress(); _avatarAddress = _signer.Derive("avatar"); diff --git a/.Lib9c.Tests/Action/JoinArena3Test.cs b/.Lib9c.Tests/Action/JoinArena3Test.cs index e720e28ab8..ba3c286b90 100644 --- a/.Lib9c.Tests/Action/JoinArena3Test.cs +++ b/.Lib9c.Tests/Action/JoinArena3Test.cs @@ -47,7 +47,7 @@ public JoinArena3Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _state = new State(); + _state = new StateDelta(); _signer = new PrivateKey().ToAddress(); _avatarAddress = _signer.Derive("avatar"); diff --git a/.Lib9c.Tests/Action/MarketValidationTest.cs b/.Lib9c.Tests/Action/MarketValidationTest.cs index ed0b4cc21d..93f6bf852e 100644 --- a/.Lib9c.Tests/Action/MarketValidationTest.cs +++ b/.Lib9c.Tests/Action/MarketValidationTest.cs @@ -24,7 +24,7 @@ public class MarketValidationTest public MarketValidationTest() { - _initialState = new State() + _initialState = new StateDelta() .SetState(GoldCurrencyState.Address, new GoldCurrencyState(Gold).Serialize()); } diff --git a/.Lib9c.Tests/Action/MigrateMonsterCollectionTest.cs b/.Lib9c.Tests/Action/MigrateMonsterCollectionTest.cs index afcfacf166..ae905f8c76 100644 --- a/.Lib9c.Tests/Action/MigrateMonsterCollectionTest.cs +++ b/.Lib9c.Tests/Action/MigrateMonsterCollectionTest.cs @@ -32,7 +32,7 @@ public MigrateMonsterCollectionTest(ITestOutputHelper outputHelper) _signer = default; _avatarAddress = _signer.Derive("avatar"); - _state = new State(); + _state = new StateDelta(); Dictionary sheets = TableSheetsImporter.ImportSheets(); var tableSheets = new TableSheets(sheets); var rankingMapAddress = new PrivateKey().ToAddress(); diff --git a/.Lib9c.Tests/Action/MigrationActivatedAccountsStateTest.cs b/.Lib9c.Tests/Action/MigrationActivatedAccountsStateTest.cs index 26258fb032..4e1a76b2a0 100644 --- a/.Lib9c.Tests/Action/MigrationActivatedAccountsStateTest.cs +++ b/.Lib9c.Tests/Action/MigrationActivatedAccountsStateTest.cs @@ -17,7 +17,7 @@ public void Execute() { var nonce = new byte[] { 0x00, 0x01, 0x02, 0x03 }; var admin = new Address("8d9f76aF8Dc5A812aCeA15d8bf56E2F790F47fd7"); - var state = new State(ImmutableDictionary.Empty + var state = new StateDelta(ImmutableDictionary.Empty .Add(AdminState.Address, new AdminState(admin, 100).Serialize()) .Add(ActivatedAccountsState.Address, new ActivatedAccountsState().AddAccount(default).Serialize()) ); diff --git a/.Lib9c.Tests/Action/MigrationAvatarStateTest.cs b/.Lib9c.Tests/Action/MigrationAvatarStateTest.cs index 3ea7fb1611..a47c5efc95 100644 --- a/.Lib9c.Tests/Action/MigrationAvatarStateTest.cs +++ b/.Lib9c.Tests/Action/MigrationAvatarStateTest.cs @@ -34,7 +34,7 @@ public void Execute() ); var nonce = new byte[] { 0x00, 0x01, 0x02, 0x03 }; var admin = new Address("8d9f76aF8Dc5A812aCeA15d8bf56E2F790F47fd7"); - var state = new State(ImmutableDictionary.Empty + var state = new StateDelta(ImmutableDictionary.Empty .Add(AdminState.Address, new AdminState(admin, 100).Serialize()) .Add(avatarAddress, avatarState.SerializeV2()) ); diff --git a/.Lib9c.Tests/Action/MigrationLegacyShopTest.cs b/.Lib9c.Tests/Action/MigrationLegacyShopTest.cs index a2be908f98..c43328f26f 100644 --- a/.Lib9c.Tests/Action/MigrationLegacyShopTest.cs +++ b/.Lib9c.Tests/Action/MigrationLegacyShopTest.cs @@ -28,7 +28,7 @@ public void Execute(bool isAdmin, bool expire, Type exc) { var adminAddress = new Address("399bddF9F7B6d902ea27037B907B2486C9910730"); var adminState = new AdminState(adminAddress, 100); - var states = new State().SetState(Addresses.Admin, adminState.Serialize()); + var states = new StateDelta().SetState(Addresses.Admin, adminState.Serialize()); var signer = isAdmin ? adminAddress : default; var blockIndex = expire ? 200 : 100; diff --git a/.Lib9c.Tests/Action/MimisbrunnrBattle0Test.cs b/.Lib9c.Tests/Action/MimisbrunnrBattle0Test.cs index befd7f7ef1..f92d474e23 100644 --- a/.Lib9c.Tests/Action/MimisbrunnrBattle0Test.cs +++ b/.Lib9c.Tests/Action/MimisbrunnrBattle0Test.cs @@ -57,7 +57,7 @@ public MimisbrunnrBattle0Test() _weeklyArenaState = new WeeklyArenaState(0); - _initialState = new State() + _initialState = new StateDelta() .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, avatarState.Serialize()) @@ -284,7 +284,7 @@ public void ExecuteThrowFailedLoadStateException() { action.Execute(new ActionContext() { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, }); }); diff --git a/.Lib9c.Tests/Action/MimisbrunnrBattle10Test.cs b/.Lib9c.Tests/Action/MimisbrunnrBattle10Test.cs index 5cf056e708..478d9b40af 100644 --- a/.Lib9c.Tests/Action/MimisbrunnrBattle10Test.cs +++ b/.Lib9c.Tests/Action/MimisbrunnrBattle10Test.cs @@ -55,7 +55,7 @@ public MimisbrunnrBattle10Test() }; agentState.avatarAddresses.Add(0, _avatarAddress); - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, avatarState.Serialize()) .SetState(_avatarAddress.Derive(LegacyInventoryKey), avatarState.inventory.Serialize()) @@ -257,7 +257,7 @@ public void ExecuteThrowFailedLoadStateException() { action.Execute(new ActionContext { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, }); }); diff --git a/.Lib9c.Tests/Action/MimisbrunnrBattle11Test.cs b/.Lib9c.Tests/Action/MimisbrunnrBattle11Test.cs index 3782e17c0c..d6588252eb 100644 --- a/.Lib9c.Tests/Action/MimisbrunnrBattle11Test.cs +++ b/.Lib9c.Tests/Action/MimisbrunnrBattle11Test.cs @@ -53,7 +53,7 @@ public MimisbrunnrBattle11Test() }; agentState.avatarAddresses.Add(0, _avatarAddress); - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, avatarState.Serialize()) .SetState(_avatarAddress.Derive(LegacyInventoryKey), avatarState.inventory.Serialize()) @@ -258,7 +258,7 @@ public void ExecuteThrowFailedLoadStateException() { action.Execute(new ActionContext { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, }); }); diff --git a/.Lib9c.Tests/Action/MimisbrunnrBattle12Test.cs b/.Lib9c.Tests/Action/MimisbrunnrBattle12Test.cs index 7c754a4c5e..fa1e6fa1e3 100644 --- a/.Lib9c.Tests/Action/MimisbrunnrBattle12Test.cs +++ b/.Lib9c.Tests/Action/MimisbrunnrBattle12Test.cs @@ -59,7 +59,7 @@ public MimisbrunnrBattle12Test() var currency = Currency.Legacy("NCG", 2, null); #pragma warning restore CS0618 var goldCurrencyState = new GoldCurrencyState(currency); - _initialState = new State() + _initialState = new StateDelta() .SetState(Addresses.GoldCurrency, goldCurrencyState.Serialize()) .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, avatarState.Serialize()) @@ -265,7 +265,7 @@ public void ExecuteThrowFailedLoadStateException() { action.Execute(new ActionContext { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, }); }); diff --git a/.Lib9c.Tests/Action/MimisbrunnrBattle13Test.cs b/.Lib9c.Tests/Action/MimisbrunnrBattle13Test.cs index e7e0d8f7d8..9b1162e760 100644 --- a/.Lib9c.Tests/Action/MimisbrunnrBattle13Test.cs +++ b/.Lib9c.Tests/Action/MimisbrunnrBattle13Test.cs @@ -60,7 +60,7 @@ public MimisbrunnrBattle13Test() var currency = Currency.Legacy("NCG", 2, null); #pragma warning restore CS0618 var goldCurrencyState = new GoldCurrencyState(currency); - _initialState = new State() + _initialState = new StateDelta() .SetState(Addresses.GoldCurrency, goldCurrencyState.Serialize()) .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, avatarState.Serialize()) @@ -266,7 +266,7 @@ public void ExecuteThrowFailedLoadStateException() { action.Execute(new ActionContext { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, }); }); diff --git a/.Lib9c.Tests/Action/MimisbrunnrBattle2Test.cs b/.Lib9c.Tests/Action/MimisbrunnrBattle2Test.cs index f13bb436e9..4d42eb2470 100644 --- a/.Lib9c.Tests/Action/MimisbrunnrBattle2Test.cs +++ b/.Lib9c.Tests/Action/MimisbrunnrBattle2Test.cs @@ -57,7 +57,7 @@ public MimisbrunnrBattle2Test() _weeklyArenaState = new WeeklyArenaState(0); - _initialState = new State() + _initialState = new StateDelta() .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, avatarState.Serialize()) @@ -284,7 +284,7 @@ public void ExecuteThrowFailedLoadStateException() { action.Execute(new ActionContext() { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, }); }); diff --git a/.Lib9c.Tests/Action/MimisbrunnrBattle3Test.cs b/.Lib9c.Tests/Action/MimisbrunnrBattle3Test.cs index 770835b632..38cadf5b52 100644 --- a/.Lib9c.Tests/Action/MimisbrunnrBattle3Test.cs +++ b/.Lib9c.Tests/Action/MimisbrunnrBattle3Test.cs @@ -57,7 +57,7 @@ public MimisbrunnrBattle3Test() _weeklyArenaState = new WeeklyArenaState(0); - _initialState = new State() + _initialState = new StateDelta() .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, avatarState.Serialize()) @@ -285,7 +285,7 @@ public void ExecuteThrowFailedLoadStateException() { action.Execute(new ActionContext() { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, }); }); diff --git a/.Lib9c.Tests/Action/MimisbrunnrBattle4Test.cs b/.Lib9c.Tests/Action/MimisbrunnrBattle4Test.cs index add4d9604a..f97a0240d1 100644 --- a/.Lib9c.Tests/Action/MimisbrunnrBattle4Test.cs +++ b/.Lib9c.Tests/Action/MimisbrunnrBattle4Test.cs @@ -58,7 +58,7 @@ public MimisbrunnrBattle4Test() _weeklyArenaState = new WeeklyArenaState(0); - _initialState = new State() + _initialState = new StateDelta() .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, avatarState.Serialize()) @@ -294,7 +294,7 @@ public void ExecuteThrowFailedLoadStateException() { action.Execute(new ActionContext() { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, }); }); @@ -612,7 +612,7 @@ public void Rehearsal() _avatarAddress.Derive(LegacyQuestListKey), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/MimisbrunnrBattle5Test.cs b/.Lib9c.Tests/Action/MimisbrunnrBattle5Test.cs index 449ace9afd..afb2610fe0 100644 --- a/.Lib9c.Tests/Action/MimisbrunnrBattle5Test.cs +++ b/.Lib9c.Tests/Action/MimisbrunnrBattle5Test.cs @@ -55,7 +55,7 @@ public MimisbrunnrBattle5Test() }; agentState.avatarAddresses.Add(0, _avatarAddress); - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, avatarState.Serialize()) .SetState(_rankingMapAddress, new RankingMapState(_rankingMapAddress).Serialize()); @@ -286,7 +286,7 @@ public void ExecuteThrowFailedLoadStateException() { action.Execute(new ActionContext() { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, }); }); @@ -596,7 +596,7 @@ public void Rehearsal() _avatarAddress.Derive(LegacyQuestListKey), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/MimisbrunnrBattle6Test.cs b/.Lib9c.Tests/Action/MimisbrunnrBattle6Test.cs index e8c6093a3c..d0a0b27567 100644 --- a/.Lib9c.Tests/Action/MimisbrunnrBattle6Test.cs +++ b/.Lib9c.Tests/Action/MimisbrunnrBattle6Test.cs @@ -56,7 +56,7 @@ public MimisbrunnrBattle6Test() }; agentState.avatarAddresses.Add(0, _avatarAddress); - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, avatarState.Serialize()) .SetState(_avatarAddress.Derive(LegacyInventoryKey), avatarState.inventory.Serialize()) @@ -298,7 +298,7 @@ public void ExecuteThrowFailedLoadStateException() { action.Execute(new ActionContext() { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, }); }); @@ -755,7 +755,7 @@ public void Rehearsal() _avatarAddress.Derive(LegacyQuestListKey), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/MimisbrunnrBattle7Test.cs b/.Lib9c.Tests/Action/MimisbrunnrBattle7Test.cs index 7fbe73cce5..ad350d609f 100644 --- a/.Lib9c.Tests/Action/MimisbrunnrBattle7Test.cs +++ b/.Lib9c.Tests/Action/MimisbrunnrBattle7Test.cs @@ -56,7 +56,7 @@ public MimisbrunnrBattle7Test() }; agentState.avatarAddresses.Add(0, _avatarAddress); - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, avatarState.Serialize()) .SetState(_avatarAddress.Derive(LegacyInventoryKey), avatarState.inventory.Serialize()) @@ -298,7 +298,7 @@ public void ExecuteThrowFailedLoadStateException() { action.Execute(new ActionContext() { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, }); }); @@ -755,7 +755,7 @@ public void Rehearsal() _avatarAddress.Derive(LegacyQuestListKey), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/MimisbrunnrBattle8Test.cs b/.Lib9c.Tests/Action/MimisbrunnrBattle8Test.cs index 83b44bb322..b02a1cf72d 100644 --- a/.Lib9c.Tests/Action/MimisbrunnrBattle8Test.cs +++ b/.Lib9c.Tests/Action/MimisbrunnrBattle8Test.cs @@ -53,7 +53,7 @@ public MimisbrunnrBattle8Test() }; agentState.avatarAddresses.Add(0, _avatarAddress); - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, avatarState.Serialize()) .SetState(_avatarAddress.Derive(LegacyInventoryKey), avatarState.inventory.Serialize()) @@ -281,7 +281,7 @@ public void ExecuteThrowFailedLoadStateException() { action.Execute(new ActionContext() { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, }); }); @@ -704,7 +704,7 @@ public void Rehearsal() _avatarAddress.Derive(LegacyQuestListKey), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/MimisbrunnrBattle9Test.cs b/.Lib9c.Tests/Action/MimisbrunnrBattle9Test.cs index 59519d322d..13fb4382cc 100644 --- a/.Lib9c.Tests/Action/MimisbrunnrBattle9Test.cs +++ b/.Lib9c.Tests/Action/MimisbrunnrBattle9Test.cs @@ -54,7 +54,7 @@ public MimisbrunnrBattle9Test() }; agentState.avatarAddresses.Add(0, _avatarAddress); - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, avatarState.Serialize()) .SetState(_avatarAddress.Derive(LegacyInventoryKey), avatarState.inventory.Serialize()) @@ -256,7 +256,7 @@ public void ExecuteThrowFailedLoadStateException() { action.Execute(new ActionContext { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, }); }); @@ -755,7 +755,7 @@ public void Rehearsal() _avatarAddress.Derive(LegacyQuestListKey), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext { diff --git a/.Lib9c.Tests/Action/MonsterCollect0Test.cs b/.Lib9c.Tests/Action/MonsterCollect0Test.cs index 7a417ec9c6..42ddc22650 100644 --- a/.Lib9c.Tests/Action/MonsterCollect0Test.cs +++ b/.Lib9c.Tests/Action/MonsterCollect0Test.cs @@ -28,7 +28,7 @@ public MonsterCollect0Test() var currency = Currency.Legacy("NCG", 2, null); #pragma warning restore CS0618 var goldCurrencyState = new GoldCurrencyState(currency); - _initialState = new State() + _initialState = new StateDelta() .SetState(Addresses.GoldCurrency, goldCurrencyState.Serialize()); foreach ((string key, string value) in sheets) { @@ -111,7 +111,7 @@ public void Execute_Throw_FailedLoadStateException() Assert.Throws(() => action.Execute(new ActionContext { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _signer, BlockIndex = 1, })); @@ -238,7 +238,7 @@ public void Rehearsal() }; IAccountStateDelta nextState = action.Execute(new ActionContext { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _signer, Rehearsal = true, }); diff --git a/.Lib9c.Tests/Action/MonsterCollect2Test.cs b/.Lib9c.Tests/Action/MonsterCollect2Test.cs index 48170016df..296300b94e 100644 --- a/.Lib9c.Tests/Action/MonsterCollect2Test.cs +++ b/.Lib9c.Tests/Action/MonsterCollect2Test.cs @@ -29,7 +29,7 @@ public MonsterCollect2Test() var currency = Currency.Legacy("NCG", 2, null); #pragma warning restore CS0618 var goldCurrencyState = new GoldCurrencyState(currency); - _initialState = new State() + _initialState = new StateDelta() .SetState(Addresses.GoldCurrency, goldCurrencyState.Serialize()); foreach ((string key, string value) in sheets) { @@ -133,7 +133,7 @@ public void Execute_Throw_FailedLoadStateException() Assert.Throws(() => action.Execute(new ActionContext { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _signer, BlockIndex = 1, })); @@ -164,7 +164,7 @@ public void Rehearsal() }; IAccountStateDelta nextState = action.Execute(new ActionContext { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _signer, Rehearsal = true, }); diff --git a/.Lib9c.Tests/Action/MonsterCollectTest.cs b/.Lib9c.Tests/Action/MonsterCollectTest.cs index 5d02d49ac7..57c97ced01 100644 --- a/.Lib9c.Tests/Action/MonsterCollectTest.cs +++ b/.Lib9c.Tests/Action/MonsterCollectTest.cs @@ -29,7 +29,7 @@ public MonsterCollectTest() var currency = Currency.Legacy("NCG", 2, null); #pragma warning restore CS0618 var goldCurrencyState = new GoldCurrencyState(currency); - _initialState = new State() + _initialState = new StateDelta() .SetState(Addresses.GoldCurrency, goldCurrencyState.Serialize()); foreach ((string key, string value) in sheets) { @@ -134,7 +134,7 @@ public void Execute_Throw_FailedLoadStateException() Assert.Throws(() => action.Execute(new ActionContext { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _signer, BlockIndex = 1, })); @@ -185,7 +185,7 @@ public void Rehearsal() }; IAccountStateDelta nextState = action.Execute(new ActionContext { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _signer, Rehearsal = true, }); diff --git a/.Lib9c.Tests/Action/PatchTableSheetTest.cs b/.Lib9c.Tests/Action/PatchTableSheetTest.cs index c4334f35ce..f43b494378 100644 --- a/.Lib9c.Tests/Action/PatchTableSheetTest.cs +++ b/.Lib9c.Tests/Action/PatchTableSheetTest.cs @@ -25,7 +25,7 @@ public PatchTableSheetTest(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -89,7 +89,7 @@ public void CheckPermission() var initStates = ImmutableDictionary.Empty .Add(AdminState.Address, adminState.Serialize()) .Add(Addresses.TableSheet.Derive(tableName), Dictionary.Empty.Add(tableName, "Initial")); - var state = new State(initStates); + var state = new StateDelta(initStates); var action = new PatchTableSheet() { TableName = tableName, @@ -132,7 +132,7 @@ public void ExecuteNewTable() var initStates = ImmutableDictionary.Empty .Add(AdminState.Address, adminState.Serialize()) .Add(Addresses.TableSheet.Derive(tableName), Dictionary.Empty.Add(tableName, "Initial")); - var state = new State(initStates); + var state = new StateDelta(initStates); var action = new PatchTableSheet() { TableName = nameof(CostumeStatSheet), diff --git a/.Lib9c.Tests/Action/PrepareRewardAssetsTest.cs b/.Lib9c.Tests/Action/PrepareRewardAssetsTest.cs index 9d24165999..14235e74ca 100644 --- a/.Lib9c.Tests/Action/PrepareRewardAssetsTest.cs +++ b/.Lib9c.Tests/Action/PrepareRewardAssetsTest.cs @@ -37,7 +37,7 @@ public void Execute(bool admin, bool includeNcg, Type exc) #pragma warning restore CS0618 } - IAccountStateDelta state = new State() + IAccountStateDelta state = new StateDelta() .SetState(Addresses.Admin, adminState.Serialize()); var action = new PrepareRewardAssets(poolAddress, assets); diff --git a/.Lib9c.Tests/Action/Raid1Test.cs b/.Lib9c.Tests/Action/Raid1Test.cs index 5f092de1a4..a52977b5d7 100644 --- a/.Lib9c.Tests/Action/Raid1Test.cs +++ b/.Lib9c.Tests/Action/Raid1Test.cs @@ -114,7 +114,7 @@ long executeOffset var fee = _tableSheets.WorldBossListSheet[raidId].EntranceFee; var context = new ActionContext(); - IAccountStateDelta state = new State() + IAccountStateDelta state = new StateDelta() .SetState(goldCurrencyState.address, goldCurrencyState.Serialize()) .SetState(_agentAddress, new AgentState(_agentAddress).Serialize()); @@ -376,7 +376,7 @@ public void Execute_With_Reward() Address bossAddress = Addresses.GetWorldBossAddress(raidId); Address worldBossKillRewardRecordAddress = Addresses.GetWorldBossKillRewardRecordAddress(_avatarAddress, raidId); - IAccountStateDelta state = new State() + IAccountStateDelta state = new StateDelta() .SetState(goldCurrencyState.address, goldCurrencyState.Serialize()) .SetState(_agentAddress, new AgentState(_agentAddress).Serialize()); @@ -528,7 +528,7 @@ public void Execute_Throw_ActionObsoletedException() Address bossAddress = Addresses.GetWorldBossAddress(raidId); Address worldBossKillRewardRecordAddress = Addresses.GetWorldBossKillRewardRecordAddress(_avatarAddress, raidId); - IAccountStateDelta state = new State() + IAccountStateDelta state = new StateDelta() .SetState(goldCurrencyState.address, goldCurrencyState.Serialize()) .SetState(_agentAddress, new AgentState(_agentAddress).Serialize()); diff --git a/.Lib9c.Tests/Action/Raid2Test.cs b/.Lib9c.Tests/Action/Raid2Test.cs index 1d5ab5feba..873647091a 100644 --- a/.Lib9c.Tests/Action/Raid2Test.cs +++ b/.Lib9c.Tests/Action/Raid2Test.cs @@ -117,7 +117,7 @@ bool raiderListExist var fee = _tableSheets.WorldBossListSheet[raidId].EntranceFee; var context = new ActionContext(); - IAccountStateDelta state = new State() + IAccountStateDelta state = new StateDelta() .SetState(goldCurrencyState.address, goldCurrencyState.Serialize()) .SetState(_agentAddress, new AgentState(_agentAddress).Serialize()); @@ -394,7 +394,7 @@ public void Execute_With_Reward() Address bossAddress = Addresses.GetWorldBossAddress(raidId); Address worldBossKillRewardRecordAddress = Addresses.GetWorldBossKillRewardRecordAddress(_avatarAddress, raidId); - IAccountStateDelta state = new State() + IAccountStateDelta state = new StateDelta() .SetState(goldCurrencyState.address, goldCurrencyState.Serialize()) .SetState(_agentAddress, new AgentState(_agentAddress).Serialize()); diff --git a/.Lib9c.Tests/Action/Raid3Test.cs b/.Lib9c.Tests/Action/Raid3Test.cs index b75b23dae1..31c1286096 100644 --- a/.Lib9c.Tests/Action/Raid3Test.cs +++ b/.Lib9c.Tests/Action/Raid3Test.cs @@ -118,7 +118,7 @@ bool raiderListExist var fee = _tableSheets.WorldBossListSheet[raidId].EntranceFee; var context = new ActionContext(); - IAccountStateDelta state = new State() + IAccountStateDelta state = new StateDelta() .SetState(goldCurrencyState.address, goldCurrencyState.Serialize()) .SetState(_agentAddress, new AgentState(_agentAddress).Serialize()); @@ -396,7 +396,7 @@ public void Execute_With_Reward() Address bossAddress = Addresses.GetWorldBossAddress(raidId); Address worldBossKillRewardRecordAddress = Addresses.GetWorldBossKillRewardRecordAddress(_avatarAddress, raidId); - IAccountStateDelta state = new State() + IAccountStateDelta state = new StateDelta() .SetState(goldCurrencyState.address, goldCurrencyState.Serialize()) .SetState(_agentAddress, new AgentState(_agentAddress).Serialize()); diff --git a/.Lib9c.Tests/Action/Raid4Test.cs b/.Lib9c.Tests/Action/Raid4Test.cs index 704b3f4674..8c9e4529a9 100644 --- a/.Lib9c.Tests/Action/Raid4Test.cs +++ b/.Lib9c.Tests/Action/Raid4Test.cs @@ -137,7 +137,7 @@ int runeId2 var fee = _tableSheets.WorldBossListSheet[raidId].EntranceFee; var context = new ActionContext(); - IAccountStateDelta state = new State() + IAccountStateDelta state = new StateDelta() .SetState(goldCurrencyState.address, goldCurrencyState.Serialize()) .SetState(_agentAddress, new AgentState(_agentAddress).Serialize()); @@ -437,7 +437,7 @@ public void Execute_With_Reward() Address bossAddress = Addresses.GetWorldBossAddress(raidId); Address worldBossKillRewardRecordAddress = Addresses.GetWorldBossKillRewardRecordAddress(_avatarAddress, raidId); - IAccountStateDelta state = new State() + IAccountStateDelta state = new StateDelta() .SetState(goldCurrencyState.address, goldCurrencyState.Serialize()) .SetState(_agentAddress, new AgentState(_agentAddress).Serialize()); @@ -589,7 +589,7 @@ public void Execute_With_Free_Crystal_Fee() "1,900002,0,100,0,1,1,40"; var goldCurrencyState = new GoldCurrencyState(_goldCurrency); - IAccountStateDelta state = new State() + IAccountStateDelta state = new StateDelta() .SetState(goldCurrencyState.address, goldCurrencyState.Serialize()) .SetState(_agentAddress, new AgentState(_agentAddress).Serialize()); diff --git a/.Lib9c.Tests/Action/Raid5Test.cs b/.Lib9c.Tests/Action/Raid5Test.cs index 5ca7c4298a..b80cec4df0 100644 --- a/.Lib9c.Tests/Action/Raid5Test.cs +++ b/.Lib9c.Tests/Action/Raid5Test.cs @@ -137,7 +137,7 @@ int runeId2 var fee = _tableSheets.WorldBossListSheet[raidId].EntranceFee; var context = new ActionContext(); - IAccountStateDelta state = new State() + IAccountStateDelta state = new StateDelta() .SetState(goldCurrencyState.address, goldCurrencyState.Serialize()) .SetState(_agentAddress, new AgentState(_agentAddress).Serialize()); @@ -437,7 +437,7 @@ public void Execute_With_Reward() Address bossAddress = Addresses.GetWorldBossAddress(raidId); Address worldBossKillRewardRecordAddress = Addresses.GetWorldBossKillRewardRecordAddress(_avatarAddress, raidId); - IAccountStateDelta state = new State() + IAccountStateDelta state = new StateDelta() .SetState(goldCurrencyState.address, goldCurrencyState.Serialize()) .SetState(_agentAddress, new AgentState(_agentAddress).Serialize()); @@ -591,7 +591,7 @@ public void Execute_With_Free_Crystal_Fee() "1,900002,0,100,0,1,1,40"; var goldCurrencyState = new GoldCurrencyState(_goldCurrency); - IAccountStateDelta state = new State() + IAccountStateDelta state = new StateDelta() .SetState(goldCurrencyState.address, goldCurrencyState.Serialize()) .SetState(_agentAddress, new AgentState(_agentAddress).Serialize()); diff --git a/.Lib9c.Tests/Action/Raid6Test.cs b/.Lib9c.Tests/Action/Raid6Test.cs index 336a867fb9..a98b69832f 100644 --- a/.Lib9c.Tests/Action/Raid6Test.cs +++ b/.Lib9c.Tests/Action/Raid6Test.cs @@ -137,7 +137,7 @@ int runeId2 var fee = _tableSheets.WorldBossListSheet[raidId].EntranceFee; var context = new ActionContext(); - IAccountStateDelta state = new State() + IAccountStateDelta state = new StateDelta() .SetState(goldCurrencyState.address, goldCurrencyState.Serialize()) .SetState(_agentAddress, new AgentState(_agentAddress).Serialize()); @@ -437,7 +437,7 @@ public void Execute_With_Reward() Address bossAddress = Addresses.GetWorldBossAddress(raidId); Address worldBossKillRewardRecordAddress = Addresses.GetWorldBossKillRewardRecordAddress(_avatarAddress, raidId); - IAccountStateDelta state = new State() + IAccountStateDelta state = new StateDelta() .SetState(goldCurrencyState.address, goldCurrencyState.Serialize()) .SetState(_agentAddress, new AgentState(_agentAddress).Serialize()); @@ -591,7 +591,7 @@ public void Execute_With_Free_Crystal_Fee() "1,900002,0,100,0,1,1,40"; var goldCurrencyState = new GoldCurrencyState(_goldCurrency); - IAccountStateDelta state = new State() + IAccountStateDelta state = new StateDelta() .SetState(goldCurrencyState.address, goldCurrencyState.Serialize()) .SetState(_agentAddress, new AgentState(_agentAddress).Serialize()); diff --git a/.Lib9c.Tests/Action/RankingBattle0Test.cs b/.Lib9c.Tests/Action/RankingBattle0Test.cs index 0bea0db5fd..01e7786e25 100644 --- a/.Lib9c.Tests/Action/RankingBattle0Test.cs +++ b/.Lib9c.Tests/Action/RankingBattle0Test.cs @@ -30,7 +30,7 @@ public class RankingBattle0Test public RankingBattle0Test() { - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) diff --git a/.Lib9c.Tests/Action/RankingBattle10Test.cs b/.Lib9c.Tests/Action/RankingBattle10Test.cs index f922416f46..ab916ad976 100644 --- a/.Lib9c.Tests/Action/RankingBattle10Test.cs +++ b/.Lib9c.Tests/Action/RankingBattle10Test.cs @@ -32,7 +32,7 @@ public class RankingBattle10Test public RankingBattle10Test(ITestOutputHelper outputHelper) { - _initialState = new State(); + _initialState = new StateDelta(); var keys = new List { @@ -478,7 +478,7 @@ public void Rehearsal() _avatar1Address.Derive(LegacyQuestListKey), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext { diff --git a/.Lib9c.Tests/Action/RankingBattle11Test.cs b/.Lib9c.Tests/Action/RankingBattle11Test.cs index 32b669f776..e97587bc42 100644 --- a/.Lib9c.Tests/Action/RankingBattle11Test.cs +++ b/.Lib9c.Tests/Action/RankingBattle11Test.cs @@ -35,7 +35,7 @@ public class RankingBattle11Test public RankingBattle11Test(ITestOutputHelper outputHelper) { - _initialState = new State(); + _initialState = new StateDelta(); var keys = new List { @@ -680,7 +680,7 @@ public void Rehearsal() _avatar1Address.Derive(LegacyQuestListKey), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext { diff --git a/.Lib9c.Tests/Action/RankingBattle2Test.cs b/.Lib9c.Tests/Action/RankingBattle2Test.cs index f600df95d2..f4530d9af1 100644 --- a/.Lib9c.Tests/Action/RankingBattle2Test.cs +++ b/.Lib9c.Tests/Action/RankingBattle2Test.cs @@ -30,7 +30,7 @@ public class RankingBattle2Test public RankingBattle2Test(ITestOutputHelper outputHelper) { - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) diff --git a/.Lib9c.Tests/Action/RankingBattle3Test.cs b/.Lib9c.Tests/Action/RankingBattle3Test.cs index cc7b77d60b..f426150e34 100644 --- a/.Lib9c.Tests/Action/RankingBattle3Test.cs +++ b/.Lib9c.Tests/Action/RankingBattle3Test.cs @@ -30,7 +30,7 @@ public class RankingBattle3Test public RankingBattle3Test(ITestOutputHelper outputHelper) { - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) diff --git a/.Lib9c.Tests/Action/RankingBattle4Test.cs b/.Lib9c.Tests/Action/RankingBattle4Test.cs index ea224b0570..d35c061b04 100644 --- a/.Lib9c.Tests/Action/RankingBattle4Test.cs +++ b/.Lib9c.Tests/Action/RankingBattle4Test.cs @@ -31,7 +31,7 @@ public class RankingBattle4Test public RankingBattle4Test(ITestOutputHelper outputHelper) { - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) diff --git a/.Lib9c.Tests/Action/RankingBattle5Test.cs b/.Lib9c.Tests/Action/RankingBattle5Test.cs index 3530ef0a3c..1fd6145a69 100644 --- a/.Lib9c.Tests/Action/RankingBattle5Test.cs +++ b/.Lib9c.Tests/Action/RankingBattle5Test.cs @@ -33,7 +33,7 @@ public class RankingBattle5Test public RankingBattle5Test(ITestOutputHelper outputHelper) { - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) @@ -443,7 +443,7 @@ public void Rehearsal() _avatar1Address.Derive(LegacyQuestListKey), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/RankingBattle6Test.cs b/.Lib9c.Tests/Action/RankingBattle6Test.cs index 3a6c937905..1d7cf8ae3a 100644 --- a/.Lib9c.Tests/Action/RankingBattle6Test.cs +++ b/.Lib9c.Tests/Action/RankingBattle6Test.cs @@ -33,7 +33,7 @@ public class RankingBattle6Test public RankingBattle6Test(ITestOutputHelper outputHelper) { - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) @@ -443,7 +443,7 @@ public void Rehearsal() _avatar1Address.Derive(LegacyQuestListKey), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/RankingBattle7Test.cs b/.Lib9c.Tests/Action/RankingBattle7Test.cs index 73e182eec4..b0d97fb1df 100644 --- a/.Lib9c.Tests/Action/RankingBattle7Test.cs +++ b/.Lib9c.Tests/Action/RankingBattle7Test.cs @@ -33,7 +33,7 @@ public class RankingBattle7Test public RankingBattle7Test(ITestOutputHelper outputHelper) { - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) @@ -443,7 +443,7 @@ public void Rehearsal() _avatar1Address.Derive(LegacyQuestListKey), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/RankingBattle8Test.cs b/.Lib9c.Tests/Action/RankingBattle8Test.cs index c6f3d988de..910f7f4dc8 100644 --- a/.Lib9c.Tests/Action/RankingBattle8Test.cs +++ b/.Lib9c.Tests/Action/RankingBattle8Test.cs @@ -34,7 +34,7 @@ public class RankingBattle8Test public RankingBattle8Test(ITestOutputHelper outputHelper) { - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) @@ -480,7 +480,7 @@ public void Rehearsal() _avatar1Address.Derive(LegacyQuestListKey), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/RankingBattle9Test.cs b/.Lib9c.Tests/Action/RankingBattle9Test.cs index 255cec7975..97b3c41dfa 100644 --- a/.Lib9c.Tests/Action/RankingBattle9Test.cs +++ b/.Lib9c.Tests/Action/RankingBattle9Test.cs @@ -34,7 +34,7 @@ public class RankingBattle9Test public RankingBattle9Test(ITestOutputHelper outputHelper) { - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) @@ -480,7 +480,7 @@ public void Rehearsal() _avatar1Address.Derive(LegacyQuestListKey), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/RankingBattleTest.cs b/.Lib9c.Tests/Action/RankingBattleTest.cs index ef4cb8b7f7..55dd65380c 100644 --- a/.Lib9c.Tests/Action/RankingBattleTest.cs +++ b/.Lib9c.Tests/Action/RankingBattleTest.cs @@ -30,7 +30,7 @@ public class RankingBattleTest public RankingBattleTest(ITestOutputHelper outputHelper) { - _initialState = new State(); + _initialState = new StateDelta(); var keys = new List { diff --git a/.Lib9c.Tests/Action/RapidCombination0Test.cs b/.Lib9c.Tests/Action/RapidCombination0Test.cs index dbb1b5ee88..956569955c 100644 --- a/.Lib9c.Tests/Action/RapidCombination0Test.cs +++ b/.Lib9c.Tests/Action/RapidCombination0Test.cs @@ -28,7 +28,7 @@ public class RapidCombination0Test public RapidCombination0Test() { - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) diff --git a/.Lib9c.Tests/Action/RapidCombination2Test.cs b/.Lib9c.Tests/Action/RapidCombination2Test.cs index 4f1d548c83..2d32bc9aba 100644 --- a/.Lib9c.Tests/Action/RapidCombination2Test.cs +++ b/.Lib9c.Tests/Action/RapidCombination2Test.cs @@ -28,7 +28,7 @@ public class RapidCombination2Test public RapidCombination2Test() { - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) diff --git a/.Lib9c.Tests/Action/RapidCombination3Test.cs b/.Lib9c.Tests/Action/RapidCombination3Test.cs index 9f92a515c5..50c3d06d16 100644 --- a/.Lib9c.Tests/Action/RapidCombination3Test.cs +++ b/.Lib9c.Tests/Action/RapidCombination3Test.cs @@ -28,7 +28,7 @@ public class RapidCombination3Test public RapidCombination3Test() { - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) diff --git a/.Lib9c.Tests/Action/RapidCombination4Test.cs b/.Lib9c.Tests/Action/RapidCombination4Test.cs index 2d53e27c31..242b97fdb2 100644 --- a/.Lib9c.Tests/Action/RapidCombination4Test.cs +++ b/.Lib9c.Tests/Action/RapidCombination4Test.cs @@ -30,7 +30,7 @@ public class RapidCombination4Test public RapidCombination4Test() { - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) @@ -383,7 +383,7 @@ public void Rehearsal() slotAddress, }; - var state = new State(); + var state = new StateDelta(); var action = new RapidCombination4 { diff --git a/.Lib9c.Tests/Action/RapidCombination5Test.cs b/.Lib9c.Tests/Action/RapidCombination5Test.cs index 3eca37dd0a..9ad29218ca 100644 --- a/.Lib9c.Tests/Action/RapidCombination5Test.cs +++ b/.Lib9c.Tests/Action/RapidCombination5Test.cs @@ -30,7 +30,7 @@ public class RapidCombination5Test public RapidCombination5Test() { - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) @@ -383,7 +383,7 @@ public void Rehearsal() slotAddress, }; - var state = new State(); + var state = new StateDelta(); var action = new RapidCombination5 { diff --git a/.Lib9c.Tests/Action/RapidCombination6Test.cs b/.Lib9c.Tests/Action/RapidCombination6Test.cs index 8c9cb18cca..5efc90bc48 100644 --- a/.Lib9c.Tests/Action/RapidCombination6Test.cs +++ b/.Lib9c.Tests/Action/RapidCombination6Test.cs @@ -32,7 +32,7 @@ public class RapidCombination6Test public RapidCombination6Test() { - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) @@ -385,7 +385,7 @@ public void Rehearsal() slotAddress, }; - var state = new State(); + var state = new StateDelta(); var action = new RapidCombination6 { diff --git a/.Lib9c.Tests/Action/RapidCombination8Test.cs b/.Lib9c.Tests/Action/RapidCombination8Test.cs index bab26f22e2..4fe12f93fc 100644 --- a/.Lib9c.Tests/Action/RapidCombination8Test.cs +++ b/.Lib9c.Tests/Action/RapidCombination8Test.cs @@ -32,7 +32,7 @@ public class RapidCombination8Test public RapidCombination8Test() { - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) @@ -385,7 +385,7 @@ public void Rehearsal() slotAddress, }; - var state = new State(); + var state = new StateDelta(); var action = new RapidCombination8 { diff --git a/.Lib9c.Tests/Action/RapidCombinationTest.cs b/.Lib9c.Tests/Action/RapidCombinationTest.cs index 08c8a22dcf..92a43dc942 100644 --- a/.Lib9c.Tests/Action/RapidCombinationTest.cs +++ b/.Lib9c.Tests/Action/RapidCombinationTest.cs @@ -32,7 +32,7 @@ public class RapidCombinationTest public RapidCombinationTest() { - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) @@ -385,7 +385,7 @@ public void Rehearsal() slotAddress, }; - var state = new State(); + var state = new StateDelta(); var action = new RapidCombination { diff --git a/.Lib9c.Tests/Action/RapidCombinationTest7.cs b/.Lib9c.Tests/Action/RapidCombinationTest7.cs index 1ba97cb9e5..e86fe2ca87 100644 --- a/.Lib9c.Tests/Action/RapidCombinationTest7.cs +++ b/.Lib9c.Tests/Action/RapidCombinationTest7.cs @@ -32,7 +32,7 @@ public class RapidCombinationTest7 public RapidCombinationTest7() { - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) @@ -385,7 +385,7 @@ public void Rehearsal() slotAddress, }; - var state = new State(); + var state = new StateDelta(); var action = new RapidCombination7 { diff --git a/.Lib9c.Tests/Action/ReRegisterProduct0Test.cs b/.Lib9c.Tests/Action/ReRegisterProduct0Test.cs index 0537ddc379..a070960c72 100644 --- a/.Lib9c.Tests/Action/ReRegisterProduct0Test.cs +++ b/.Lib9c.Tests/Action/ReRegisterProduct0Test.cs @@ -40,7 +40,7 @@ public ReRegisterProduct0Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { diff --git a/.Lib9c.Tests/Action/ReRegisterProductTest.cs b/.Lib9c.Tests/Action/ReRegisterProductTest.cs index 58af0d2eaa..3d7aa0636d 100644 --- a/.Lib9c.Tests/Action/ReRegisterProductTest.cs +++ b/.Lib9c.Tests/Action/ReRegisterProductTest.cs @@ -40,7 +40,7 @@ public ReRegisterProductTest(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { diff --git a/.Lib9c.Tests/Action/RedeemCode0Test.cs b/.Lib9c.Tests/Action/RedeemCode0Test.cs index 0d4fe78005..1c8af5f832 100644 --- a/.Lib9c.Tests/Action/RedeemCode0Test.cs +++ b/.Lib9c.Tests/Action/RedeemCode0Test.cs @@ -68,7 +68,7 @@ public void Execute() #pragma warning restore CS0618 var context = new ActionContext(); - var initialState = new State() + var initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, avatarState.Serialize()) .SetState(RedeemCodeState.Address, prevRedeemCodesState.Serialize()) @@ -125,7 +125,7 @@ public void Rehearsal() { BlockIndex = 1, Miner = default, - PreviousState = new State(), + PreviousState = new StateDelta(), Rehearsal = true, Signer = _agentAddress, }); diff --git a/.Lib9c.Tests/Action/RedeemCodeTest.cs b/.Lib9c.Tests/Action/RedeemCodeTest.cs index 23447b5fc8..5816fe195e 100644 --- a/.Lib9c.Tests/Action/RedeemCodeTest.cs +++ b/.Lib9c.Tests/Action/RedeemCodeTest.cs @@ -71,7 +71,7 @@ public void Execute(bool backward) #pragma warning restore CS0618 var context = new ActionContext(); - var initialState = new State() + var initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(RedeemCodeState.Address, prevRedeemCodesState.Serialize()) .SetState(GoldCurrencyState.Address, goldState.Serialize()) @@ -140,7 +140,7 @@ public void Rehearsal() { BlockIndex = 1, Miner = default, - PreviousState = new State(), + PreviousState = new StateDelta(), Rehearsal = true, Signer = _agentAddress, }); diff --git a/.Lib9c.Tests/Action/RegisterProduct0Test.cs b/.Lib9c.Tests/Action/RegisterProduct0Test.cs index 70c06ddc1e..c2d34e4ad0 100644 --- a/.Lib9c.Tests/Action/RegisterProduct0Test.cs +++ b/.Lib9c.Tests/Action/RegisterProduct0Test.cs @@ -55,7 +55,7 @@ public RegisterProduct0Test() }; agentState.avatarAddresses[0] = AvatarAddress; - _initialState = new State() + _initialState = new StateDelta() .SetState(GoldCurrencyState.Address, new GoldCurrencyState(Gold).Serialize()) .SetState(Addresses.GetSheetAddress(), _tableSheets.MaterialItemSheet.Serialize()) .SetState(Addresses.GameConfig, _gameConfigState.Serialize()) diff --git a/.Lib9c.Tests/Action/RegisterProductTest.cs b/.Lib9c.Tests/Action/RegisterProductTest.cs index 0116ac1052..8287acdf27 100644 --- a/.Lib9c.Tests/Action/RegisterProductTest.cs +++ b/.Lib9c.Tests/Action/RegisterProductTest.cs @@ -55,7 +55,7 @@ public RegisterProductTest() }; agentState.avatarAddresses[0] = AvatarAddress; - _initialState = new State() + _initialState = new StateDelta() .SetState(GoldCurrencyState.Address, new GoldCurrencyState(Gold).Serialize()) .SetState(Addresses.GetSheetAddress(), _tableSheets.MaterialItemSheet.Serialize()) .SetState(Addresses.GameConfig, _gameConfigState.Serialize()) diff --git a/.Lib9c.Tests/Action/RenewAdminStateTest.cs b/.Lib9c.Tests/Action/RenewAdminStateTest.cs index 2d5d861ad8..7af1f28b81 100644 --- a/.Lib9c.Tests/Action/RenewAdminStateTest.cs +++ b/.Lib9c.Tests/Action/RenewAdminStateTest.cs @@ -24,7 +24,7 @@ public RenewAdminStateTest() _validUntil = 1_500_000L; _adminState = new AdminState(_adminPrivateKey.ToAddress(), _validUntil); _stateDelta = - new State(ImmutableDictionary.Empty.Add( + new StateDelta(ImmutableDictionary.Empty.Add( Addresses.Admin, _adminState.Serialize())); } diff --git a/.Lib9c.Tests/Action/RequestPledgeTest.cs b/.Lib9c.Tests/Action/RequestPledgeTest.cs index 5fd8f3b027..7574b88c19 100644 --- a/.Lib9c.Tests/Action/RequestPledgeTest.cs +++ b/.Lib9c.Tests/Action/RequestPledgeTest.cs @@ -21,7 +21,7 @@ public void Execute(int contractedMead) Currency mead = Currencies.Mead; Address patron = new PrivateKey().ToAddress(); var context = new ActionContext(); - IAccountStateDelta states = new State().MintAsset(context, patron, 2 * mead); + IAccountStateDelta states = new StateDelta().MintAsset(context, patron, 2 * mead); var address = new PrivateKey().ToAddress(); var action = new RequestPledge { @@ -52,7 +52,7 @@ public void Execute_Throw_AlreadyContractedException() Address patron = new PrivateKey().ToAddress(); var address = new PrivateKey().ToAddress(); Address contractAddress = address.GetPledgeAddress(); - IAccountStateDelta states = new State().SetState(contractAddress, List.Empty); + IAccountStateDelta states = new StateDelta().SetState(contractAddress, List.Empty); var action = new RequestPledge { AgentAddress = address, diff --git a/.Lib9c.Tests/Action/RewardGoldTest.cs b/.Lib9c.Tests/Action/RewardGoldTest.cs index cf01f11de9..3b536009e0 100644 --- a/.Lib9c.Tests/Action/RewardGoldTest.cs +++ b/.Lib9c.Tests/Action/RewardGoldTest.cs @@ -37,7 +37,7 @@ public class RewardGoldTest { private readonly AvatarState _avatarState; private readonly AvatarState _avatarState2; - private readonly State _baseState; + private readonly StateDelta _baseState; private readonly TableSheets _tableSheets; public RewardGoldTest() @@ -77,7 +77,7 @@ public RewardGoldTest() var gold = new GoldCurrencyState(Currency.Legacy("NCG", 2, null)); #pragma warning restore CS0618 IActionContext context = new ActionContext(); - _baseState = (State)new State() + _baseState = (StateDelta)new StateDelta() .SetState(GoldCurrencyState.Address, gold.Serialize()) .SetState(Addresses.GoldDistribution, GoldDistributionTest.Fixture.Select(v => v.Serialize()).Serialize()) .MintAsset(context, GoldCurrencyState.Address, gold.Currency * 100000000000); @@ -573,7 +573,7 @@ public void TransferMead(int patronMead, int balance) var patronAddress = new PrivateKey().ToAddress(); var contractAddress = agentAddress.GetPledgeAddress(); IActionContext context = new ActionContext(); - IAccountStateDelta states = new State() + IAccountStateDelta states = new StateDelta() .MintAsset(context, patronAddress, patronMead * Currencies.Mead) .TransferAsset(context, patronAddress, agentAddress, 1 * Currencies.Mead) .SetState(contractAddress, List.Empty.Add(patronAddress.Serialize()).Add(true.Serialize()).Add(balance.Serialize())) diff --git a/.Lib9c.Tests/Action/RuneEnhancement0Test.cs b/.Lib9c.Tests/Action/RuneEnhancement0Test.cs index 5ba311a434..469505a8c0 100644 --- a/.Lib9c.Tests/Action/RuneEnhancement0Test.cs +++ b/.Lib9c.Tests/Action/RuneEnhancement0Test.cs @@ -40,7 +40,7 @@ public void Execute(int seed) var goldCurrencyState = new GoldCurrencyState(_goldCurrency); var context = new ActionContext(); - var state = new State() + var state = new StateDelta() .SetState(goldCurrencyState.address, goldCurrencyState.Serialize()) .SetState(agentAddress, new AgentState(agentAddress).Serialize()); @@ -170,7 +170,7 @@ public void Execute_RuneCostNotFoundException() .StartedBlockIndex; var goldCurrencyState = new GoldCurrencyState(_goldCurrency); - var state = new State() + var state = new StateDelta() .SetState(goldCurrencyState.address, goldCurrencyState.Serialize()) .SetState(agentAddress, new AgentState(agentAddress).Serialize()); @@ -223,7 +223,7 @@ public void Execute_RuneCostDataNotFoundException() .StartedBlockIndex; var goldCurrencyState = new GoldCurrencyState(_goldCurrency); - var state = new State() + var state = new StateDelta() .SetState(goldCurrencyState.address, goldCurrencyState.Serialize()) .SetState(agentAddress, new AgentState(agentAddress).Serialize()); @@ -292,7 +292,7 @@ public void Execute_NotEnoughFungibleAssetValueException(bool ncg, bool crystal, var goldCurrencyState = new GoldCurrencyState(_goldCurrency); var context = new ActionContext(); - var state = new State() + var state = new StateDelta() .SetState(goldCurrencyState.address, goldCurrencyState.Serialize()) .SetState(agentAddress, new AgentState(agentAddress).Serialize()); @@ -405,7 +405,7 @@ public void Execute_TryCountIsZeroException() .StartedBlockIndex; var goldCurrencyState = new GoldCurrencyState(_goldCurrency); - var state = new State() + var state = new StateDelta() .SetState(goldCurrencyState.address, goldCurrencyState.Serialize()) .SetState(agentAddress, new AgentState(agentAddress).Serialize()); diff --git a/.Lib9c.Tests/Action/RuneEnhancementTest.cs b/.Lib9c.Tests/Action/RuneEnhancementTest.cs index d1db93ea0c..0b74aea250 100644 --- a/.Lib9c.Tests/Action/RuneEnhancementTest.cs +++ b/.Lib9c.Tests/Action/RuneEnhancementTest.cs @@ -55,7 +55,7 @@ public void Execute(int seed) ); agentState.avatarAddresses.Add(0, avatarAddress); var context = new ActionContext(); - var state = new State() + var state = new StateDelta() .SetState(goldCurrencyState.address, goldCurrencyState.Serialize()) .SetState(agentAddress, agentState.SerializeV2()) .SetState(avatarAddress, avatarState.SerializeV2()) @@ -194,7 +194,7 @@ public void Execute_RuneCostNotFoundException() rankingMapAddress ); agentState.avatarAddresses.Add(0, avatarAddress); - var state = new State() + var state = new StateDelta() .SetState(goldCurrencyState.address, goldCurrencyState.Serialize()) .SetState(agentAddress, agentState.SerializeV2()) .SetState(avatarAddress, avatarState.SerializeV2()) @@ -256,7 +256,7 @@ public void Execute_RuneCostDataNotFoundException() rankingMapAddress ); agentState.avatarAddresses.Add(0, avatarAddress); - var state = new State() + var state = new StateDelta() .SetState(goldCurrencyState.address, goldCurrencyState.Serialize()) .SetState(agentAddress, agentState.SerializeV2()) .SetState(avatarAddress, avatarState.SerializeV2()) @@ -334,7 +334,7 @@ public void Execute_NotEnoughFungibleAssetValueException(bool ncg, bool crystal, ); agentState.avatarAddresses.Add(0, avatarAddress); var context = new ActionContext(); - var state = new State() + var state = new StateDelta() .SetState(goldCurrencyState.address, goldCurrencyState.Serialize()) .SetState(agentAddress, agentState.SerializeV2()) .SetState(avatarAddress, avatarState.SerializeV2()) @@ -456,7 +456,7 @@ public void Execute_TryCountIsZeroException() rankingMapAddress ); agentState.avatarAddresses.Add(0, avatarAddress); - var state = new State() + var state = new StateDelta() .SetState(goldCurrencyState.address, goldCurrencyState.Serialize()) .SetState(agentAddress, agentState.SerializeV2()) .SetState(avatarAddress, avatarState.SerializeV2()) @@ -505,7 +505,7 @@ public void Execute_FailedLoadStateException() .StartedBlockIndex; var goldCurrencyState = new GoldCurrencyState(_goldCurrency); - var state = new State() + var state = new StateDelta() .SetState(goldCurrencyState.address, goldCurrencyState.Serialize()) .SetState(agentAddress, new AgentState(agentAddress).Serialize()); diff --git a/.Lib9c.Tests/Action/Scenario/ArenaScenarioTest.cs b/.Lib9c.Tests/Action/Scenario/ArenaScenarioTest.cs index d6fd27d15e..e94af498aa 100644 --- a/.Lib9c.Tests/Action/Scenario/ArenaScenarioTest.cs +++ b/.Lib9c.Tests/Action/Scenario/ArenaScenarioTest.cs @@ -38,7 +38,7 @@ public ArenaScenarioTest(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _state = new Tests.Action.State(); + _state = new Tests.Action.StateDelta(); _sheets = TableSheetsImporter.ImportSheets(); var tableSheets = new TableSheets(_sheets); diff --git a/.Lib9c.Tests/Action/Scenario/CombinationAndRapidCombinationTest.cs b/.Lib9c.Tests/Action/Scenario/CombinationAndRapidCombinationTest.cs index 1b080d3348..38f5c5e850 100644 --- a/.Lib9c.Tests/Action/Scenario/CombinationAndRapidCombinationTest.cs +++ b/.Lib9c.Tests/Action/Scenario/CombinationAndRapidCombinationTest.cs @@ -80,7 +80,7 @@ public CombinationAndRapidCombinationTest(ITestOutputHelper outputHelper) _worldInformationAddress = _avatarAddress.Derive(LegacyWorldInformationKey); _questListAddress = _avatarAddress.Derive(LegacyQuestListKey); - _initialState = new Tests.Action.State() + _initialState = new Tests.Action.StateDelta() .SetState(GoldCurrencyState.Address, gold.Serialize()) .SetState(gameConfigState.address, gameConfigState.Serialize()) .SetState(_agentAddress, agentState.Serialize()) diff --git a/.Lib9c.Tests/Action/Scenario/MarketScenarioTest.cs b/.Lib9c.Tests/Action/Scenario/MarketScenarioTest.cs index e3bfeb56eb..03765a86c2 100644 --- a/.Lib9c.Tests/Action/Scenario/MarketScenarioTest.cs +++ b/.Lib9c.Tests/Action/Scenario/MarketScenarioTest.cs @@ -103,7 +103,7 @@ public MarketScenarioTest(ITestOutputHelper outputHelper) agentState3.avatarAddresses[0] = _buyerAvatarAddress; _currency = Currency.Legacy("NCG", 2, minters: null); - _initialState = new Tests.Action.State() + _initialState = new Tests.Action.StateDelta() .SetState(GoldCurrencyState.Address, new GoldCurrencyState(_currency).Serialize()) .SetState(Addresses.GameConfig, _gameConfigState.Serialize()) .SetState(Addresses.GetSheetAddress(), _tableSheets.MaterialItemSheet.Serialize()) diff --git a/.Lib9c.Tests/Action/Scenario/MeadScenarioTest.cs b/.Lib9c.Tests/Action/Scenario/MeadScenarioTest.cs index 04933ee60d..05ebbd4cf7 100644 --- a/.Lib9c.Tests/Action/Scenario/MeadScenarioTest.cs +++ b/.Lib9c.Tests/Action/Scenario/MeadScenarioTest.cs @@ -21,7 +21,7 @@ public void Contract() Currency mead = Currencies.Mead; var patron = new PrivateKey().ToAddress(); IActionContext context = new ActionContext(); - IAccountStateDelta states = new State().MintAsset(context, patron, 10 * mead); + IAccountStateDelta states = new StateDelta().MintAsset(context, patron, 10 * mead); var agentAddress = new PrivateKey().ToAddress(); var requestPledge = new RequestPledge @@ -86,7 +86,7 @@ bool IsTarget(Type type) var action = (IAction)Activator.CreateInstance(typeId)!; var actionContext = new ActionContext { - PreviousState = new State(), + PreviousState = new StateDelta(), }; try { diff --git a/.Lib9c.Tests/Action/Scenario/RuneScenarioTest.cs b/.Lib9c.Tests/Action/Scenario/RuneScenarioTest.cs index eaf8fe287a..dcab19e0b9 100644 --- a/.Lib9c.Tests/Action/Scenario/RuneScenarioTest.cs +++ b/.Lib9c.Tests/Action/Scenario/RuneScenarioTest.cs @@ -40,7 +40,7 @@ public void Craft_And_Equip() ); var context = new ActionContext(); - IAccountStateDelta initialState = new Tests.Action.State() + IAccountStateDelta initialState = new Tests.Action.StateDelta() .SetState(agentAddress, agentState.Serialize()) .SetState(avatarAddress, avatarState.SerializeV2()) .SetState( diff --git a/.Lib9c.Tests/Action/Scenario/SellAndCancellationAndSellTest.cs b/.Lib9c.Tests/Action/Scenario/SellAndCancellationAndSellTest.cs index 3c24132ba3..a0425a6592 100644 --- a/.Lib9c.Tests/Action/Scenario/SellAndCancellationAndSellTest.cs +++ b/.Lib9c.Tests/Action/Scenario/SellAndCancellationAndSellTest.cs @@ -60,7 +60,7 @@ public SellAndCancellationAndSellTest(ITestOutputHelper outputHelper) GameConfig.RequireClearedStageLevel.ActionsInShop), }; - _initialState = new Tests.Action.State() + _initialState = new Tests.Action.StateDelta() .SetState(GoldCurrencyState.Address, gold.Serialize()) .SetState(gameConfigState.address, gameConfigState.Serialize()) .SetState(_agentAddress, agentState.Serialize()) diff --git a/.Lib9c.Tests/Action/Scenario/StakeAndClaimStakeReward2ScenarioTest.cs b/.Lib9c.Tests/Action/Scenario/StakeAndClaimStakeReward2ScenarioTest.cs index 3c216744e0..043611837b 100644 --- a/.Lib9c.Tests/Action/Scenario/StakeAndClaimStakeReward2ScenarioTest.cs +++ b/.Lib9c.Tests/Action/Scenario/StakeAndClaimStakeReward2ScenarioTest.cs @@ -15,7 +15,7 @@ namespace Lib9c.Tests.Action.Scenario using Xunit; using Xunit.Abstractions; using static Lib9c.SerializeKeys; - using State = Lib9c.Tests.Action.State; + using State = Lib9c.Tests.Action.StateDelta; public class StakeAndClaimStakeReward2ScenarioTest { diff --git a/.Lib9c.Tests/Action/Scenario/WorldUnlockScenarioTest.cs b/.Lib9c.Tests/Action/Scenario/WorldUnlockScenarioTest.cs index 8a360f38a0..59ce549f7f 100644 --- a/.Lib9c.Tests/Action/Scenario/WorldUnlockScenarioTest.cs +++ b/.Lib9c.Tests/Action/Scenario/WorldUnlockScenarioTest.cs @@ -50,7 +50,7 @@ public WorldUnlockScenarioTest() _weeklyArenaState = new WeeklyArenaState(0); - _initialState = new Lib9c.Tests.Action.State() + _initialState = new Lib9c.Tests.Action.StateDelta() .SetState(_weeklyArenaState.address, _weeklyArenaState.Serialize()) .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, avatarState.Serialize()) diff --git a/.Lib9c.Tests/Action/SecureMiningRewardTest.cs b/.Lib9c.Tests/Action/SecureMiningRewardTest.cs index a4e9491292..8d1155d306 100644 --- a/.Lib9c.Tests/Action/SecureMiningRewardTest.cs +++ b/.Lib9c.Tests/Action/SecureMiningRewardTest.cs @@ -34,11 +34,11 @@ public class SecureMiningRewardTest new Address("636d187B4d434244A92B65B06B5e7da14b3810A9"), }.ToImmutableList(); - private static readonly State _previousState = new State( - state: ImmutableDictionary.Empty + private static readonly StateDelta _previousState = new StateDelta( + states: ImmutableDictionary.Empty .Add(AdminState.Address, new AdminState(_admin, 100).Serialize()) .Add(GoldCurrencyState.Address, new GoldCurrencyState(NCG).Serialize()), - balance: ImmutableDictionary<(Address, Currency), FungibleAssetValue>.Empty + balances: ImmutableDictionary<(Address, Currency), FungibleAssetValue>.Empty .Add((_authMiners[0], NCG), NCG * 1000) .Add((_authMiners[1], NCG), NCG * 2000) .Add((_authMiners[2], NCG), NCG * 3000) diff --git a/.Lib9c.Tests/Action/Sell0Test.cs b/.Lib9c.Tests/Action/Sell0Test.cs index 4599fd5457..ee4ef85749 100644 --- a/.Lib9c.Tests/Action/Sell0Test.cs +++ b/.Lib9c.Tests/Action/Sell0Test.cs @@ -31,7 +31,7 @@ public Sell0Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -155,7 +155,7 @@ public void ExecuteThrowFailedLoadStateException() Assert.Throws(() => action.Execute(new ActionContext { BlockIndex = 0, - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, })); } diff --git a/.Lib9c.Tests/Action/Sell10Test.cs b/.Lib9c.Tests/Action/Sell10Test.cs index e1ee81f5b0..e62bc85464 100644 --- a/.Lib9c.Tests/Action/Sell10Test.cs +++ b/.Lib9c.Tests/Action/Sell10Test.cs @@ -39,7 +39,7 @@ public Sell10Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -256,7 +256,7 @@ public void Execute_Throw_FailedLoadStateException() Assert.Throws(() => action.Execute(new ActionContext { BlockIndex = 0, - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, })); } @@ -443,7 +443,7 @@ public void Rehearsal() OrderDigestListState.DeriveAddress(_avatarAddress), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/Sell11Test.cs b/.Lib9c.Tests/Action/Sell11Test.cs index 48ea71557c..906fa1c4d4 100644 --- a/.Lib9c.Tests/Action/Sell11Test.cs +++ b/.Lib9c.Tests/Action/Sell11Test.cs @@ -39,7 +39,7 @@ public Sell11Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -304,7 +304,7 @@ public void Execute_Throw_InvalidOperationException_DueTo_EmptyState() Assert.Throws(() => action.Execute(new ActionContext { BlockIndex = 0, - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, })); } @@ -491,7 +491,7 @@ public void Rehearsal() OrderDigestListState.DeriveAddress(_avatarAddress), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/Sell2Test.cs b/.Lib9c.Tests/Action/Sell2Test.cs index 32d1cc3591..99646495ff 100644 --- a/.Lib9c.Tests/Action/Sell2Test.cs +++ b/.Lib9c.Tests/Action/Sell2Test.cs @@ -31,7 +31,7 @@ public Sell2Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -192,7 +192,7 @@ public void ExecuteThrowFailedLoadStateException() Assert.Throws(() => action.Execute(new ActionContext { BlockIndex = 0, - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, })); } diff --git a/.Lib9c.Tests/Action/Sell3Test.cs b/.Lib9c.Tests/Action/Sell3Test.cs index c19399622c..b5ef4cb125 100644 --- a/.Lib9c.Tests/Action/Sell3Test.cs +++ b/.Lib9c.Tests/Action/Sell3Test.cs @@ -33,7 +33,7 @@ public Sell3Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -193,7 +193,7 @@ public void ExecuteThrowFailedLoadStateException() Assert.Throws(() => action.Execute(new ActionContext { BlockIndex = 0, - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, })); } diff --git a/.Lib9c.Tests/Action/Sell4Test.cs b/.Lib9c.Tests/Action/Sell4Test.cs index e2fbe84d55..17d22f0e5a 100644 --- a/.Lib9c.Tests/Action/Sell4Test.cs +++ b/.Lib9c.Tests/Action/Sell4Test.cs @@ -36,7 +36,7 @@ public Sell4Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -224,7 +224,7 @@ public void Execute_Throw_FailedLoadStateException() Assert.Throws(() => action.Execute(new ActionContext { BlockIndex = 0, - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, })); } diff --git a/.Lib9c.Tests/Action/Sell5Test.cs b/.Lib9c.Tests/Action/Sell5Test.cs index 1c136070eb..6af6c0d775 100644 --- a/.Lib9c.Tests/Action/Sell5Test.cs +++ b/.Lib9c.Tests/Action/Sell5Test.cs @@ -35,7 +35,7 @@ public Sell5Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -300,7 +300,7 @@ public void Execute_Throw_FailedLoadStateException() Assert.Throws(() => action.Execute(new ActionContext { BlockIndex = 0, - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, })); } diff --git a/.Lib9c.Tests/Action/Sell6Test.cs b/.Lib9c.Tests/Action/Sell6Test.cs index 0d1674482a..96e93167d3 100644 --- a/.Lib9c.Tests/Action/Sell6Test.cs +++ b/.Lib9c.Tests/Action/Sell6Test.cs @@ -35,7 +35,7 @@ public Sell6Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -603,7 +603,7 @@ public void Execute_Throw_FailedLoadStateException() Assert.Throws(() => action.Execute(new ActionContext { BlockIndex = 0, - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, })); } diff --git a/.Lib9c.Tests/Action/Sell7Test.cs b/.Lib9c.Tests/Action/Sell7Test.cs index 6348104fce..9b25f4c1cf 100644 --- a/.Lib9c.Tests/Action/Sell7Test.cs +++ b/.Lib9c.Tests/Action/Sell7Test.cs @@ -39,7 +39,7 @@ public Sell7Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -297,7 +297,7 @@ public void Execute_Throw_FailedLoadStateException() Assert.Throws(() => action.Execute(new ActionContext { BlockIndex = 0, - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, })); } @@ -466,7 +466,7 @@ public void Rehearsal() OrderDigestListState.DeriveAddress(_avatarAddress), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/Sell8Test.cs b/.Lib9c.Tests/Action/Sell8Test.cs index 3df907d76f..82742ea96c 100644 --- a/.Lib9c.Tests/Action/Sell8Test.cs +++ b/.Lib9c.Tests/Action/Sell8Test.cs @@ -39,7 +39,7 @@ public Sell8Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -290,7 +290,7 @@ public void Execute_Throw_FailedLoadStateException() Assert.Throws(() => action.Execute(new ActionContext { BlockIndex = 0, - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, })); } @@ -459,7 +459,7 @@ public void Rehearsal() OrderDigestListState.DeriveAddress(_avatarAddress), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/Sell9Test.cs b/.Lib9c.Tests/Action/Sell9Test.cs index 055937acdf..9575468ca7 100644 --- a/.Lib9c.Tests/Action/Sell9Test.cs +++ b/.Lib9c.Tests/Action/Sell9Test.cs @@ -39,7 +39,7 @@ public Sell9Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -256,7 +256,7 @@ public void Execute_Throw_FailedLoadStateException() Assert.Throws(() => action.Execute(new ActionContext { BlockIndex = 0, - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, })); } @@ -443,7 +443,7 @@ public void Rehearsal() OrderDigestListState.DeriveAddress(_avatarAddress), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/SellCancellation0Test.cs b/.Lib9c.Tests/Action/SellCancellation0Test.cs index a94e708c58..7194b04666 100644 --- a/.Lib9c.Tests/Action/SellCancellation0Test.cs +++ b/.Lib9c.Tests/Action/SellCancellation0Test.cs @@ -28,7 +28,7 @@ public SellCancellation0Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { diff --git a/.Lib9c.Tests/Action/SellCancellation2Test.cs b/.Lib9c.Tests/Action/SellCancellation2Test.cs index 784d4f65a4..b555ea3913 100644 --- a/.Lib9c.Tests/Action/SellCancellation2Test.cs +++ b/.Lib9c.Tests/Action/SellCancellation2Test.cs @@ -30,7 +30,7 @@ public SellCancellation2Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { diff --git a/.Lib9c.Tests/Action/SellCancellation3Test.cs b/.Lib9c.Tests/Action/SellCancellation3Test.cs index 0685f25274..94399cbf59 100644 --- a/.Lib9c.Tests/Action/SellCancellation3Test.cs +++ b/.Lib9c.Tests/Action/SellCancellation3Test.cs @@ -28,7 +28,7 @@ public SellCancellation3Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { diff --git a/.Lib9c.Tests/Action/SellCancellation4Test.cs b/.Lib9c.Tests/Action/SellCancellation4Test.cs index 2421ecca8e..bcfca58184 100644 --- a/.Lib9c.Tests/Action/SellCancellation4Test.cs +++ b/.Lib9c.Tests/Action/SellCancellation4Test.cs @@ -28,7 +28,7 @@ public SellCancellation4Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { diff --git a/.Lib9c.Tests/Action/SellCancellation5Test.cs b/.Lib9c.Tests/Action/SellCancellation5Test.cs index 6f2592aee6..7e7a075ffe 100644 --- a/.Lib9c.Tests/Action/SellCancellation5Test.cs +++ b/.Lib9c.Tests/Action/SellCancellation5Test.cs @@ -32,7 +32,7 @@ public SellCancellation5Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { diff --git a/.Lib9c.Tests/Action/SellCancellation6Test.cs b/.Lib9c.Tests/Action/SellCancellation6Test.cs index 47dda389d6..8be829347a 100644 --- a/.Lib9c.Tests/Action/SellCancellation6Test.cs +++ b/.Lib9c.Tests/Action/SellCancellation6Test.cs @@ -34,7 +34,7 @@ public SellCancellation6Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { diff --git a/.Lib9c.Tests/Action/SellCancellation7Test.cs b/.Lib9c.Tests/Action/SellCancellation7Test.cs index 4a5bf18951..93aae93bd0 100644 --- a/.Lib9c.Tests/Action/SellCancellation7Test.cs +++ b/.Lib9c.Tests/Action/SellCancellation7Test.cs @@ -37,7 +37,7 @@ public SellCancellation7Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -475,7 +475,7 @@ public void Rehearsal() Addresses.GetItemAddress(default), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/SellCancellation8Test.cs b/.Lib9c.Tests/Action/SellCancellation8Test.cs index 9a043ebc28..31937aecc1 100644 --- a/.Lib9c.Tests/Action/SellCancellation8Test.cs +++ b/.Lib9c.Tests/Action/SellCancellation8Test.cs @@ -37,7 +37,7 @@ public SellCancellation8Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -496,7 +496,7 @@ public void Rehearsal() Addresses.GetItemAddress(default), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/SellCancellationTest.cs b/.Lib9c.Tests/Action/SellCancellationTest.cs index 3ab9c0a2c2..8bedcbc4fe 100644 --- a/.Lib9c.Tests/Action/SellCancellationTest.cs +++ b/.Lib9c.Tests/Action/SellCancellationTest.cs @@ -39,7 +39,7 @@ public SellCancellationTest(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -531,7 +531,7 @@ public void Rehearsal() Addresses.GetItemAddress(default), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/SellTest.cs b/.Lib9c.Tests/Action/SellTest.cs index 8d734ea0bd..19787922ac 100644 --- a/.Lib9c.Tests/Action/SellTest.cs +++ b/.Lib9c.Tests/Action/SellTest.cs @@ -38,7 +38,7 @@ public SellTest(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -303,7 +303,7 @@ public void Execute_Throw_InvalidOperationException_DueTo_EmptyState() Assert.Throws(() => action.Execute(new ActionContext { BlockIndex = 0, - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, })); } @@ -490,7 +490,7 @@ public void Rehearsal() OrderDigestListState.DeriveAddress(_avatarAddress), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/Snapshot/TransferAsset0SnapshotTest.cs b/.Lib9c.Tests/Action/Snapshot/TransferAsset0SnapshotTest.cs index a9b0ec1204..f78b95ff8d 100644 --- a/.Lib9c.Tests/Action/Snapshot/TransferAsset0SnapshotTest.cs +++ b/.Lib9c.Tests/Action/Snapshot/TransferAsset0SnapshotTest.cs @@ -49,7 +49,7 @@ public Task TransferCrystal() var recipientAddress = recipientPrivateKey.ToAddress(); var crystal = CrystalCalculator.CRYSTAL; var context = new ActionContext(); - IAccountStateDelta state = new State().MintAsset(context, senderAddress, crystal * 100); + IAccountStateDelta state = new StateDelta().MintAsset(context, senderAddress, crystal * 100); var actionContext = new ActionContext { Signer = senderAddress, @@ -88,7 +88,7 @@ public Task TransferWithMemo() var recipientAddress = recipientPrivateKey.ToAddress(); var crystal = CrystalCalculator.CRYSTAL; var context = new ActionContext(); - var state = new State().MintAsset(context, senderAddress, crystal * 100); + var state = new StateDelta().MintAsset(context, senderAddress, crystal * 100); var actionContext = new ActionContext { Signer = senderAddress, diff --git a/.Lib9c.Tests/Action/Stake0Test.cs b/.Lib9c.Tests/Action/Stake0Test.cs index 9a0d3b89e3..d491119442 100644 --- a/.Lib9c.Tests/Action/Stake0Test.cs +++ b/.Lib9c.Tests/Action/Stake0Test.cs @@ -29,7 +29,7 @@ public Stake0Test(ITestOutputHelper outputHelper) .CreateLogger(); var context = new ActionContext(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) diff --git a/.Lib9c.Tests/Action/StakeTest.cs b/.Lib9c.Tests/Action/StakeTest.cs index f8c42eae2b..f1704674c7 100644 --- a/.Lib9c.Tests/Action/StakeTest.cs +++ b/.Lib9c.Tests/Action/StakeTest.cs @@ -28,7 +28,7 @@ public StakeTest(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) diff --git a/.Lib9c.Tests/Action/State.cs b/.Lib9c.Tests/Action/StateDelta.cs similarity index 69% rename from .Lib9c.Tests/Action/State.cs rename to .Lib9c.Tests/Action/StateDelta.cs index d01d735cc0..fc9e64a751 100644 --- a/.Lib9c.Tests/Action/State.cs +++ b/.Lib9c.Tests/Action/StateDelta.cs @@ -12,15 +12,15 @@ namespace Lib9c.Tests.Action using Libplanet.Consensus; using Libplanet.State; - public class State : IAccountStateDelta + public class StateDelta : IAccountStateDelta { - private readonly IImmutableDictionary _state; - private readonly IImmutableDictionary<(Address, Currency), BigInteger> _balance; + private readonly IImmutableDictionary _states; + private readonly IImmutableDictionary<(Address, Currency), BigInteger> _fungibles; private readonly IImmutableDictionary _totalSupplies; private readonly ValidatorSet _validatorSet; private readonly IAccountDelta _delta; - public State() + public StateDelta() : this( ImmutableDictionary.Empty, ImmutableDictionary<(Address Address, Currency Currency), BigInteger>.Empty, @@ -32,14 +32,14 @@ public State() // Pretends all given arguments are part of the delta, i.e., have been modified // using appropriate methods such as Transfer/Mint/Burn to set the values. // Also convert to internal data types. - public State( - IImmutableDictionary state = null, - IImmutableDictionary<(Address Address, Currency Currency), FungibleAssetValue> balance = null, + public StateDelta( + IImmutableDictionary states = null, + IImmutableDictionary<(Address Address, Currency Currency), FungibleAssetValue> balances = null, IImmutableDictionary totalSupplies = null, ValidatorSet validatorSet = null) { - _state = state ?? ImmutableDictionary.Empty; - _balance = balance is { } b + _states = states ?? ImmutableDictionary.Empty; + _fungibles = balances is { } b ? b.ToImmutableDictionary(kv => kv.Key, kv => kv.Value.RawValue) : ImmutableDictionary<(Address, Currency), BigInteger>.Empty; _totalSupplies = totalSupplies is { } t @@ -48,22 +48,22 @@ public State( _validatorSet = validatorSet ?? new ValidatorSet(); - _delta = new Delta(_state, _balance, _totalSupplies, _validatorSet); + _delta = new Delta(_states, _fungibles, _totalSupplies, _validatorSet); } // For Transfer/Mint/Burn - private State( + private StateDelta( IImmutableDictionary state, IImmutableDictionary<(Address Address, Currency Currency), BigInteger> balance, IImmutableDictionary totalSupplies, ValidatorSet validatorSet) { - _state = state; - _balance = balance; + _states = state; + _fungibles = balance; _totalSupplies = totalSupplies; _validatorSet = validatorSet; - _delta = new Delta(_state, _balance, _totalSupplies, _validatorSet); + _delta = new Delta(_states, _fungibles, _totalSupplies, _validatorSet); } public IAccountDelta Delta => _delta; @@ -86,9 +86,9 @@ public IReadOnlyList GetStates(IReadOnlyList
addresses) => addresses.Select(GetState).ToArray(); public IAccountStateDelta SetState(Address address, IValue state) => - new State( - _state.SetItem(address, state), - _balance, + new StateDelta( + _states.SetItem(address, state), + _fungibles, _totalSupplies, _validatorSet); @@ -122,9 +122,9 @@ public IAccountStateDelta MintAsset(IActionContext context, Address recipient, F value.Currency, (GetTotalSupply(value.Currency) + value).RawValue) : _totalSupplies; - return new State( - _state, - _balance.SetItem( + return new StateDelta( + _states, + _fungibles.SetItem( (recipient, value.Currency), (GetBalance(recipient, value.Currency) + value).RawValue), totalSupplies, @@ -140,9 +140,9 @@ public IAccountStateDelta BurnAsset(IActionContext context, Address owner, Fungi value.Currency, (GetTotalSupply(value.Currency) - value).RawValue) : _totalSupplies; - return new State( - _state, - _balance.SetItem( + return new StateDelta( + _states, + _fungibles.SetItem( (owner, value.Currency), (GetBalance(owner, value.Currency) - value).RawValue), totalSupplies, @@ -177,72 +177,17 @@ public IAccountStateDelta TransferAsset( throw new InsufficientBalanceException(msg, sender, senderBalance); } - IImmutableDictionary<(Address, Currency), BigInteger> newBalance = _balance + IImmutableDictionary<(Address, Currency), BigInteger> newBalance = _fungibles .SetItem((sender, currency), (senderBalance - value).RawValue) .SetItem((recipient, currency), (recipientBalance + value).RawValue); - return new State(_state, newBalance, _totalSupplies, _validatorSet); + return new StateDelta(_states, newBalance, _totalSupplies, _validatorSet); } public IAccountStateDelta SetValidator(Validator validator) { - return new State(_state, _balance, _totalSupplies, GetValidatorSet().Update(validator)); + return new StateDelta(_states, _fungibles, _totalSupplies, GetValidatorSet().Update(validator)); } public ValidatorSet GetValidatorSet() => _validatorSet; } - -#pragma warning disable SA1402 - public class Delta : IAccountDelta - { - private readonly IImmutableDictionary _state; - private readonly IImmutableDictionary<(Address, Currency), BigInteger> _balance; - private readonly IImmutableDictionary _totalSupplies; - private readonly ValidatorSet _validatorSet; - - public Delta() - : this( - ImmutableDictionary.Empty, - ImmutableDictionary<(Address, Currency), BigInteger>.Empty, - ImmutableDictionary.Empty, - null) - { - } - - public Delta( - IImmutableDictionary state, - IImmutableDictionary<(Address Address, Currency Currency), BigInteger> balance, - IImmutableDictionary totalSupplies, - ValidatorSet validatorSet) - { - _state = state; - _balance = balance; - _totalSupplies = totalSupplies; - _validatorSet = validatorSet; - } - - public IImmutableSet
UpdatedAddresses => - StateUpdatedAddresses.Union(FungibleUpdatedAddresses); - - public IImmutableSet
StateUpdatedAddresses => _state.Keys.ToImmutableHashSet(); - - public IImmutableDictionary States => _state; - - public IImmutableSet
FungibleUpdatedAddresses => - UpdatedFungibleAssets.Select(pair => pair.Item1).ToImmutableHashSet(); - - public IImmutableSet<(Address, Currency)> UpdatedFungibleAssets => - Fungibles.Keys.ToImmutableHashSet(); - - public IImmutableDictionary<(Address, Currency), BigInteger> Fungibles => - _balance; - - public IImmutableSet UpdatedTotalSupplyCurrencies => - TotalSupplies.Keys.ToImmutableHashSet(); - - public IImmutableDictionary TotalSupplies => - _totalSupplies; - - public ValidatorSet ValidatorSet => _validatorSet; - } -#pragma warning restore SA1402 } diff --git a/.Lib9c.Tests/Action/TransferAsset2Test.cs b/.Lib9c.Tests/Action/TransferAsset2Test.cs index 06dd85f0cc..7b907906d6 100644 --- a/.Lib9c.Tests/Action/TransferAsset2Test.cs +++ b/.Lib9c.Tests/Action/TransferAsset2Test.cs @@ -53,9 +53,9 @@ public void Execute() .Add((_recipient, _currency), _currency * 10); var state = ImmutableDictionary.Empty .Add(_recipient.Derive(ActivationKey.DeriveKey), true.Serialize()); - var prevState = new State( - state: state, - balance: balance + var prevState = new StateDelta( + states: state, + balances: balance ); var action = new TransferAsset2( sender: _sender, @@ -80,8 +80,8 @@ public void ExecuteWithInvalidSigner() var balance = ImmutableDictionary<(Address, Currency), FungibleAssetValue>.Empty .Add((_sender, _currency), _currency * 1000) .Add((_recipient, _currency), _currency * 10); - var prevState = new State( - balance: balance + var prevState = new StateDelta( + balances: balance ); var action = new TransferAsset2( sender: _sender, @@ -111,8 +111,8 @@ public void ExecuteWithInvalidRecipient() { var balance = ImmutableDictionary<(Address, Currency), FungibleAssetValue>.Empty .Add((_sender, _currency), _currency * 1000); - var prevState = new State( - balance: balance + var prevState = new StateDelta( + balances: balance ); // Should not allow TransferAsset2 with same sender and recipient. var action = new TransferAsset2( @@ -151,8 +151,8 @@ public void ExecuteWithInsufficientBalance() var balance = ImmutableDictionary<(Address, Currency), FungibleAssetValue>.Empty .Add((_sender, _currency), _currency * 1000) .Add((_recipient, _currency), _currency * 10); - var prevState = new State( - balance: balance + var prevState = new StateDelta( + balances: balance ); var action = new TransferAsset2( sender: _sender, @@ -182,8 +182,8 @@ public void ExecuteWithMinterAsSender() var balance = ImmutableDictionary<(Address, Currency), FungibleAssetValue>.Empty .Add((_sender, currencyBySender), _currency * 1000) .Add((_recipient, currencyBySender), _currency * 10); - var prevState = new State( - balance: balance + var prevState = new StateDelta( + balances: balance ); var action = new TransferAsset2( sender: _sender, @@ -216,8 +216,8 @@ public void ExecuteWithMinterAsRecipient() var balance = ImmutableDictionary<(Address, Currency), FungibleAssetValue>.Empty .Add((_sender, currencyByRecipient), _currency * 1000) .Add((_recipient, currencyByRecipient), _currency * 10); - var prevState = new State( - balance: balance + var prevState = new StateDelta( + balances: balance ); var action = new TransferAsset2( sender: _sender, @@ -250,9 +250,9 @@ public void ExecuteWithUnactivatedRecipient() var state = ImmutableDictionary.Empty .Add(_sender.Derive(ActivationKey.DeriveKey), true.Serialize()) .Add(Addresses.ActivatedAccount, activatedAddress.Serialize()); - var prevState = new State( - state: state, - balance: balance + var prevState = new StateDelta( + states: state, + balances: balance ); var action = new TransferAsset2( sender: _sender, @@ -284,7 +284,7 @@ public void Rehearsal() IAccountStateDelta nextState = action.Execute(new ActionContext() { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = default, Rehearsal = true, BlockIndex = 1, @@ -394,7 +394,7 @@ public void CheckObsolete() { action.Execute(new ActionContext() { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _sender, Rehearsal = false, BlockIndex = TransferAsset3.CrystalTransferringRestrictionStartIndex, diff --git a/.Lib9c.Tests/Action/TransferAsset3Test.cs b/.Lib9c.Tests/Action/TransferAsset3Test.cs index a9d7111475..e0a4b3d592 100644 --- a/.Lib9c.Tests/Action/TransferAsset3Test.cs +++ b/.Lib9c.Tests/Action/TransferAsset3Test.cs @@ -78,9 +78,9 @@ public void Execute(bool activate, bool legacyActivate, bool stateExist) state = state.Add(_recipient, new AgentState(_recipient).Serialize()); } - var prevState = new State( - state: state, - balance: balance + var prevState = new StateDelta( + states: state, + balances: balance ); var action = new TransferAsset3( sender: _sender, @@ -105,8 +105,8 @@ public void ExecuteWithInvalidSigner() var balance = ImmutableDictionary<(Address, Currency), FungibleAssetValue>.Empty .Add((_sender, _currency), _currency * 1000) .Add((_recipient, _currency), _currency * 10); - var prevState = new State( - balance: balance + var prevState = new StateDelta( + balances: balance ); var action = new TransferAsset3( sender: _sender, @@ -136,8 +136,8 @@ public void ExecuteWithInvalidRecipient() { var balance = ImmutableDictionary<(Address, Currency), FungibleAssetValue>.Empty .Add((_sender, _currency), _currency * 1000); - var prevState = new State( - balance: balance + var prevState = new StateDelta( + balances: balance ); // Should not allow TransferAsset with same sender and recipient. var action = new TransferAsset3( @@ -167,8 +167,8 @@ public void ExecuteWithInsufficientBalance() var balance = ImmutableDictionary<(Address, Currency), FungibleAssetValue>.Empty .Add((_sender, _currency), _currency * 1000) .Add((_recipient, _currency), _currency * 10); - var prevState = new State( - balance: balance + var prevState = new StateDelta( + balances: balance ).SetState(_recipient, new AgentState(_recipient).Serialize()); var action = new TransferAsset3( sender: _sender, @@ -198,8 +198,8 @@ public void ExecuteWithMinterAsSender() var balance = ImmutableDictionary<(Address, Currency), FungibleAssetValue>.Empty .Add((_sender, currencyBySender), _currency * 1000) .Add((_recipient, currencyBySender), _currency * 10); - var prevState = new State( - balance: balance + var prevState = new StateDelta( + balances: balance ).SetState(_recipient, new AgentState(_recipient).Serialize()); var action = new TransferAsset3( sender: _sender, @@ -232,8 +232,8 @@ public void ExecuteWithMinterAsRecipient() var balance = ImmutableDictionary<(Address, Currency), FungibleAssetValue>.Empty .Add((_sender, currencyByRecipient), _currency * 1000) .Add((_recipient, currencyByRecipient), _currency * 10); - var prevState = new State( - balance: balance + var prevState = new StateDelta( + balances: balance ).SetState(_recipient, new AgentState(_recipient).Serialize()); var action = new TransferAsset3( sender: _sender, @@ -266,9 +266,9 @@ public void ExecuteWithUnactivatedRecipient() var state = ImmutableDictionary.Empty .Add(_sender.Derive(ActivationKey.DeriveKey), true.Serialize()) .Add(Addresses.ActivatedAccount, activatedAddress.Serialize()); - var prevState = new State( - state: state, - balance: balance + var prevState = new StateDelta( + states: state, + balances: balance ); var action = new TransferAsset3( sender: _sender, @@ -300,7 +300,7 @@ public void Rehearsal() IAccountStateDelta nextState = action.Execute(new ActionContext() { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = default, Rehearsal = true, BlockIndex = 1, @@ -374,9 +374,9 @@ public void Execute_Throw_InvalidTransferCurrencyException() var state = ImmutableDictionary.Empty .Add(_recipient.Derive(ActivationKey.DeriveKey), true.Serialize()); - var prevState = new State( - state: state, - balance: balance + var prevState = new StateDelta( + states: state, + balances: balance ); var action = new TransferAsset3( sender: _sender, diff --git a/.Lib9c.Tests/Action/TransferAssetTest.cs b/.Lib9c.Tests/Action/TransferAssetTest.cs index 9d58c01bd2..f32c58a23c 100644 --- a/.Lib9c.Tests/Action/TransferAssetTest.cs +++ b/.Lib9c.Tests/Action/TransferAssetTest.cs @@ -56,9 +56,9 @@ public void Execute() .Add((_recipient, _currency), _currency * 10); var state = ImmutableDictionary.Empty; - var prevState = new State( - state: state, - balance: balance + var prevState = new StateDelta( + states: state, + balances: balance ); var action = new TransferAsset( sender: _sender, @@ -84,8 +84,8 @@ public void Execute_Throw_InvalidTransferSignerException() .Add((_sender, _currency), _currency * 1000) .Add((_recipient, _currency), _currency * 10) .Add((_sender, Currencies.Mead), Currencies.Mead * 1); - var prevState = new State( - balance: balance + var prevState = new StateDelta( + balances: balance ); var action = new TransferAsset( sender: _sender, @@ -116,8 +116,8 @@ public void Execute_Throw_InvalidTransferRecipientException() var balance = ImmutableDictionary<(Address, Currency), FungibleAssetValue>.Empty .Add((_sender, _currency), _currency * 1000) .Add((_sender, Currencies.Mead), Currencies.Mead * 1); - var prevState = new State( - balance: balance + var prevState = new StateDelta( + balances: balance ); // Should not allow TransferAsset with same sender and recipient. var action = new TransferAsset( @@ -148,8 +148,8 @@ public void Execute_Throw_InsufficientBalanceException() .Add((_sender, _currency), _currency * 1000) .Add((_recipient, _currency), _currency * 10); - var prevState = new State( - balance: balance + var prevState = new StateDelta( + balances: balance ).SetState(_recipient, new AgentState(_recipient).Serialize()); var action = new TransferAsset( sender: _sender, @@ -186,8 +186,8 @@ public void Execute_Throw_InvalidTransferMinterException(bool minterAsSender) .Add((_sender, currencyBySender), _currency * 1000) .Add((_recipient, currencyBySender), _currency * 10) .Add((_sender, Currencies.Mead), Currencies.Mead * 1); - var prevState = new State( - balance: balance + var prevState = new StateDelta( + balances: balance ).SetState(_recipient, new AgentState(_recipient).Serialize()); var action = new TransferAsset( sender: _sender, @@ -222,7 +222,7 @@ public void Rehearsal() var context = new ActionContext(); IAccountStateDelta nextState = action.Execute(new ActionContext() { - PreviousState = new State().MintAsset(context, _sender, Currencies.Mead * 1), + PreviousState = new StateDelta().MintAsset(context, _sender, Currencies.Mead * 1), Signer = default, Rehearsal = true, BlockIndex = 1, @@ -297,9 +297,9 @@ public void Execute_Throw_InvalidTransferCurrencyException() var state = ImmutableDictionary.Empty .Add(_recipient.Derive(ActivationKey.DeriveKey), true.Serialize()); - var prevState = new State( - state: state, - balance: balance + var prevState = new StateDelta( + states: state, + balances: balance ); var action = new TransferAsset( sender: _sender, diff --git a/.Lib9c.Tests/Action/TransferAssetTest0.cs b/.Lib9c.Tests/Action/TransferAssetTest0.cs index 72044efcda..e8ec5723ee 100644 --- a/.Lib9c.Tests/Action/TransferAssetTest0.cs +++ b/.Lib9c.Tests/Action/TransferAssetTest0.cs @@ -49,8 +49,8 @@ public void Execute() var balance = ImmutableDictionary<(Address, Currency), FungibleAssetValue>.Empty .Add((_sender, _currency), _currency * 1000) .Add((_recipient, _currency), _currency * 10); - var prevState = new State( - balance: balance + var prevState = new StateDelta( + balances: balance ); var action = new TransferAsset0( sender: _sender, @@ -75,8 +75,8 @@ public void ExecuteWithInvalidSigner() var balance = ImmutableDictionary<(Address, Currency), FungibleAssetValue>.Empty .Add((_sender, _currency), _currency * 1000) .Add((_recipient, _currency), _currency * 10); - var prevState = new State( - balance: balance + var prevState = new StateDelta( + balances: balance ); var action = new TransferAsset0( sender: _sender, @@ -106,8 +106,8 @@ public void ExecuteWithInvalidRecipient() { var balance = ImmutableDictionary<(Address, Currency), FungibleAssetValue>.Empty .Add((_sender, _currency), _currency * 1000); - var prevState = new State( - balance: balance + var prevState = new StateDelta( + balances: balance ); // Should not allow TransferAsset with same sender and recipient. var action = new TransferAsset0( @@ -146,8 +146,8 @@ public void ExecuteWithInsufficientBalance() var balance = ImmutableDictionary<(Address, Currency), FungibleAssetValue>.Empty .Add((_sender, _currency), _currency * 1000) .Add((_recipient, _currency), _currency * 10); - var prevState = new State( - balance: balance + var prevState = new StateDelta( + balances: balance ); var action = new TransferAsset0( sender: _sender, @@ -177,8 +177,8 @@ public void ExecuteWithMinterAsSender() var balance = ImmutableDictionary<(Address, Currency), FungibleAssetValue>.Empty .Add((_sender, currencyBySender), _currency * 1000) .Add((_recipient, currencyBySender), _currency * 10); - var prevState = new State( - balance: balance + var prevState = new StateDelta( + balances: balance ); var action = new TransferAsset0( sender: _sender, @@ -211,8 +211,8 @@ public void ExecuteWithMinterAsRecipient() var balance = ImmutableDictionary<(Address, Currency), FungibleAssetValue>.Empty .Add((_sender, currencyByRecipient), _currency * 1000) .Add((_recipient, currencyByRecipient), _currency * 10); - var prevState = new State( - balance: balance + var prevState = new StateDelta( + balances: balance ); var action = new TransferAsset0( sender: _sender, @@ -246,7 +246,7 @@ public void Rehearsal() IAccountStateDelta nextState = action.Execute(new ActionContext() { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = default, Rehearsal = true, BlockIndex = 1, diff --git a/.Lib9c.Tests/Action/TransferAssets0Test.cs b/.Lib9c.Tests/Action/TransferAssets0Test.cs index ca6b6b556b..ebd0d14fdb 100644 --- a/.Lib9c.Tests/Action/TransferAssets0Test.cs +++ b/.Lib9c.Tests/Action/TransferAssets0Test.cs @@ -100,9 +100,9 @@ public void Execute(bool activate, bool legacyActivate, bool stateExist) .Add(_recipient2, new AgentState(_recipient2).Serialize()); } - var prevState = new State( - state: state, - balance: balance + var prevState = new StateDelta( + states: state, + balances: balance ); var action = new TransferAssets0( sender: _sender, @@ -131,8 +131,8 @@ public void ExecuteWithInvalidSigner() var balance = ImmutableDictionary<(Address, Currency), FungibleAssetValue>.Empty .Add((_sender, _currency), _currency * 1000) .Add((_recipient, _currency), _currency * 10); - var prevState = new State( - balance: balance + var prevState = new StateDelta( + balances: balance ); var action = new TransferAssets0( sender: _sender, @@ -164,8 +164,8 @@ public void ExecuteWithInvalidRecipient() { var balance = ImmutableDictionary<(Address, Currency), FungibleAssetValue>.Empty .Add((_sender, _currency), _currency * 1000); - var prevState = new State( - balance: balance + var prevState = new StateDelta( + balances: balance ); // Should not allow TransferAsset with same sender and recipient. var action = new TransferAssets0( @@ -197,8 +197,8 @@ public void ExecuteWithInsufficientBalance() var balance = ImmutableDictionary<(Address, Currency), FungibleAssetValue>.Empty .Add((_sender, _currency), _currency * 1000) .Add((_recipient, _currency), _currency * 10); - var prevState = new State( - balance: balance + var prevState = new StateDelta( + balances: balance ).SetState(_recipient, new AgentState(_recipient).Serialize()); var action = new TransferAssets0( sender: _sender, @@ -230,8 +230,8 @@ public void ExecuteWithMinterAsSender() var balance = ImmutableDictionary<(Address, Currency), FungibleAssetValue>.Empty .Add((_sender, currencyBySender), _currency * 1000) .Add((_recipient, currencyBySender), _currency * 10); - var prevState = new State( - balance: balance + var prevState = new StateDelta( + balances: balance ).SetState(_recipient, new AgentState(_recipient).Serialize()); var action = new TransferAssets0( sender: _sender, @@ -266,8 +266,8 @@ public void ExecuteWithMinterAsRecipient() var balance = ImmutableDictionary<(Address, Currency), FungibleAssetValue>.Empty .Add((_sender, currencyByRecipient), _currency * 1000) .Add((_recipient, currencyByRecipient), _currency * 10); - var prevState = new State( - balance: balance + var prevState = new StateDelta( + balances: balance ).SetState(_recipient, new AgentState(_recipient).Serialize()); var action = new TransferAssets0( sender: _sender, @@ -302,9 +302,9 @@ public void ExecuteWithUnactivatedRecipient() var state = ImmutableDictionary.Empty .Add(_sender.Derive(ActivationKey.DeriveKey), true.Serialize()) .Add(Addresses.ActivatedAccount, activatedAddress.Serialize()); - var prevState = new State( - state: state, - balance: balance + var prevState = new StateDelta( + states: state, + balances: balance ); var action = new TransferAssets0( sender: _sender, @@ -340,7 +340,7 @@ public void Rehearsal() IAccountStateDelta nextState = action.Execute(new ActionContext() { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = default, Rehearsal = true, BlockIndex = 1, @@ -472,7 +472,7 @@ public void Execute_Throw_ArgumentOutOfRangeException() { action.Execute(new ActionContext() { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _sender, Rehearsal = false, BlockIndex = 1, @@ -489,9 +489,9 @@ public void Execute_Throw_InvalidTransferCurrencyException() var state = ImmutableDictionary.Empty .Add(_recipient.Derive(ActivationKey.DeriveKey), true.Serialize()); - var prevState = new State( - state: state, - balance: balance + var prevState = new StateDelta( + states: state, + balances: balance ); var action = new TransferAssets0( sender: _sender, diff --git a/.Lib9c.Tests/Action/TransferAssetsTest.cs b/.Lib9c.Tests/Action/TransferAssetsTest.cs index 313bd83d64..23d5445bff 100644 --- a/.Lib9c.Tests/Action/TransferAssetsTest.cs +++ b/.Lib9c.Tests/Action/TransferAssetsTest.cs @@ -72,9 +72,9 @@ public void Execute() .Add((_recipient, _currency), _currency * 10); var state = ImmutableDictionary.Empty; - var prevState = new State( - state: state, - balance: balance + var prevState = new StateDelta( + states: state, + balances: balance ); var action = new TransferAssets( sender: _sender, @@ -105,8 +105,8 @@ public void Execute_Throw_InvalidTransferSignerException() var balance = ImmutableDictionary<(Address, Currency), FungibleAssetValue>.Empty .Add((_sender, _currency), _currency * 1000) .Add((_recipient, _currency), _currency * 10); - var prevState = new State( - balance: balance + var prevState = new StateDelta( + balances: balance ); var action = new TransferAssets( sender: _sender, @@ -138,8 +138,8 @@ public void Execute_Throw_InvalidTransferRecipientException() { var balance = ImmutableDictionary<(Address, Currency), FungibleAssetValue>.Empty .Add((_sender, _currency), _currency * 1000); - var prevState = new State( - balance: balance + var prevState = new StateDelta( + balances: balance ); // Should not allow TransferAsset with same sender and recipient. var action = new TransferAssets( @@ -172,8 +172,8 @@ public void Execute_Throw_InsufficientBalanceException() .Add((_sender, _currency), _currency * 1000) .Add((_recipient, _currency), _currency * 10); - var prevState = new State( - balance: balance + var prevState = new StateDelta( + balances: balance ).SetState(_recipient, new AgentState(_recipient).Serialize()); var action = new TransferAssets( sender: _sender, @@ -208,8 +208,8 @@ public void Execute_Throw_InvalidTransferMinterException() var balance = ImmutableDictionary<(Address, Currency), FungibleAssetValue>.Empty .Add((_sender, currencyBySender), _currency * 1000) .Add((_recipient, currencyBySender), _currency * 10); - var prevState = new State( - balance: balance + var prevState = new StateDelta( + balances: balance ).SetState(_recipient, new AgentState(_recipient).Serialize()); var action = new TransferAssets( sender: _sender, @@ -247,7 +247,7 @@ public void Rehearsal() IAccountStateDelta nextState = action.Execute(new ActionContext() { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = default, Rehearsal = true, BlockIndex = 1, @@ -379,7 +379,7 @@ public void Execute_Throw_ArgumentOutOfRangeException() { action.Execute(new ActionContext() { - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _sender, Rehearsal = false, BlockIndex = 1, @@ -396,9 +396,9 @@ public void Execute_Throw_InvalidTransferCurrencyException() var state = ImmutableDictionary.Empty .Add(_recipient.Derive(ActivationKey.DeriveKey), true.Serialize()); - var prevState = new State( - state: state, - balance: balance + var prevState = new StateDelta( + states: state, + balances: balance ); var action = new TransferAssets( sender: _sender, diff --git a/.Lib9c.Tests/Action/UnlockEquipmentRecipe1Test.cs b/.Lib9c.Tests/Action/UnlockEquipmentRecipe1Test.cs index 8a59f1e7db..3f7dd6def3 100644 --- a/.Lib9c.Tests/Action/UnlockEquipmentRecipe1Test.cs +++ b/.Lib9c.Tests/Action/UnlockEquipmentRecipe1Test.cs @@ -52,7 +52,7 @@ public UnlockEquipmentRecipe1Test() agentState.avatarAddresses.Add(0, _avatarAddress); - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(Addresses.GetSheetAddress(), _tableSheets.EquipmentItemSheet.Serialize()) .SetState(Addresses.GetSheetAddress(), _tableSheets.EquipmentItemRecipeSheet.Serialize()) diff --git a/.Lib9c.Tests/Action/UnlockEquipmentRecipeTest.cs b/.Lib9c.Tests/Action/UnlockEquipmentRecipeTest.cs index be1396455f..b05b9f0ba4 100644 --- a/.Lib9c.Tests/Action/UnlockEquipmentRecipeTest.cs +++ b/.Lib9c.Tests/Action/UnlockEquipmentRecipeTest.cs @@ -52,7 +52,7 @@ public UnlockEquipmentRecipeTest() agentState.avatarAddresses.Add(0, _avatarAddress); - _initialState = new State() + _initialState = new StateDelta() .SetState(_agentAddress, agentState.Serialize()) .SetState(Addresses.GetSheetAddress(), _tableSheets.EquipmentItemSheet.Serialize()) .SetState(Addresses.GetSheetAddress(), _tableSheets.EquipmentItemRecipeSheet.Serialize()) diff --git a/.Lib9c.Tests/Action/UnlockRuneSlotTest.cs b/.Lib9c.Tests/Action/UnlockRuneSlotTest.cs index 6902af9ffe..1664a75a11 100644 --- a/.Lib9c.Tests/Action/UnlockRuneSlotTest.cs +++ b/.Lib9c.Tests/Action/UnlockRuneSlotTest.cs @@ -35,7 +35,7 @@ public IAccountStateDelta Init(out Address agentAddress, out Address avatarAddre .StartedBlockIndex; var goldCurrencyState = new GoldCurrencyState(_goldCurrency); - var state = new State() + var state = new StateDelta() .SetState(goldCurrencyState.address, goldCurrencyState.Serialize()) .SetState(agentAddress, new AgentState(agentAddress).Serialize()); diff --git a/.Lib9c.Tests/Action/UnlockWorld1Test.cs b/.Lib9c.Tests/Action/UnlockWorld1Test.cs index a509e939cc..de0dbd0cfe 100644 --- a/.Lib9c.Tests/Action/UnlockWorld1Test.cs +++ b/.Lib9c.Tests/Action/UnlockWorld1Test.cs @@ -50,7 +50,7 @@ public UnlockWorld1Test() agentState.avatarAddresses.Add(0, _avatarAddress); - _initialState = new State() + _initialState = new StateDelta() .SetState(Addresses.GetSheetAddress(), _tableSheets.WorldUnlockSheet.Serialize()) .SetState(Addresses.GameConfig, gameConfigState.Serialize()); } diff --git a/.Lib9c.Tests/Action/UnlockWorldTest.cs b/.Lib9c.Tests/Action/UnlockWorldTest.cs index f5d62ae2ef..4168f20699 100644 --- a/.Lib9c.Tests/Action/UnlockWorldTest.cs +++ b/.Lib9c.Tests/Action/UnlockWorldTest.cs @@ -50,7 +50,7 @@ public UnlockWorldTest() agentState.avatarAddresses.Add(0, _avatarAddress); - _initialState = new State() + _initialState = new StateDelta() .SetState(Addresses.GetSheetAddress(), _tableSheets.WorldUnlockSheet.Serialize()) .SetState(Addresses.GameConfig, gameConfigState.Serialize()); } diff --git a/.Lib9c.Tests/Action/UpdateSell0Test.cs b/.Lib9c.Tests/Action/UpdateSell0Test.cs index ce45a4c9b3..ce154e28be 100644 --- a/.Lib9c.Tests/Action/UpdateSell0Test.cs +++ b/.Lib9c.Tests/Action/UpdateSell0Test.cs @@ -38,7 +38,7 @@ public UpdateSell0Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -276,7 +276,7 @@ public void Execute_Throw_FailedLoadStateException() Assert.Throws(() => action.Execute(new ActionContext { BlockIndex = 0, - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, })); } @@ -367,7 +367,7 @@ public void Rehearsal() OrderDigestListState.DeriveAddress(_avatarAddress), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/UpdateSell2Test.cs b/.Lib9c.Tests/Action/UpdateSell2Test.cs index 617f262a27..849b792321 100644 --- a/.Lib9c.Tests/Action/UpdateSell2Test.cs +++ b/.Lib9c.Tests/Action/UpdateSell2Test.cs @@ -38,7 +38,7 @@ public UpdateSell2Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -257,7 +257,7 @@ public void Execute_Throw_FailedLoadStateException() Assert.Throws(() => action.Execute(new ActionContext { BlockIndex = 0, - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, })); } @@ -348,7 +348,7 @@ public void Rehearsal() OrderDigestListState.DeriveAddress(_avatarAddress), }; - var state = new State(); + var state = new StateDelta(); var nextState = action.Execute(new ActionContext() { diff --git a/.Lib9c.Tests/Action/UpdateSell3Test.cs b/.Lib9c.Tests/Action/UpdateSell3Test.cs index aab0dd612d..5d7754582c 100644 --- a/.Lib9c.Tests/Action/UpdateSell3Test.cs +++ b/.Lib9c.Tests/Action/UpdateSell3Test.cs @@ -38,7 +38,7 @@ public UpdateSell3Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -258,7 +258,7 @@ public void Execute_Throw_ListEmptyException() Assert.Throws(() => action.Execute(new ActionContext { BlockIndex = 0, - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, })); } @@ -283,7 +283,7 @@ public void Execute_Throw_FailedLoadStateException() Assert.Throws(() => action.Execute(new ActionContext { BlockIndex = 0, - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, })); } diff --git a/.Lib9c.Tests/Action/UpdateSell4Test.cs b/.Lib9c.Tests/Action/UpdateSell4Test.cs index 8bc42dd880..6a3dff4839 100644 --- a/.Lib9c.Tests/Action/UpdateSell4Test.cs +++ b/.Lib9c.Tests/Action/UpdateSell4Test.cs @@ -38,7 +38,7 @@ public UpdateSell4Test(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -258,7 +258,7 @@ public void Execute_Throw_ListEmptyException() Assert.Throws(() => action.Execute(new ActionContext { BlockIndex = 0, - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, })); } @@ -283,7 +283,7 @@ public void Execute_Throw_FailedLoadStateException() Assert.Throws(() => action.Execute(new ActionContext { BlockIndex = 0, - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, })); } diff --git a/.Lib9c.Tests/Action/UpdateSellTest.cs b/.Lib9c.Tests/Action/UpdateSellTest.cs index b7477ca764..0b8b0ca475 100644 --- a/.Lib9c.Tests/Action/UpdateSellTest.cs +++ b/.Lib9c.Tests/Action/UpdateSellTest.cs @@ -38,7 +38,7 @@ public UpdateSellTest(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var (key, value) in sheets) { @@ -258,7 +258,7 @@ public void Execute_Throw_ListEmptyException() Assert.Throws(() => action.Execute(new ActionContext { BlockIndex = 0, - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, })); } @@ -283,7 +283,7 @@ public void Execute_Throw_FailedLoadStateException() Assert.Throws(() => action.Execute(new ActionContext { BlockIndex = 0, - PreviousState = new State(), + PreviousState = new StateDelta(), Signer = _agentAddress, })); } diff --git a/.Lib9c.Tests/Action/ValidatorSetOperateTest.cs b/.Lib9c.Tests/Action/ValidatorSetOperateTest.cs index 38d583d0d3..5b9958a98e 100644 --- a/.Lib9c.Tests/Action/ValidatorSetOperateTest.cs +++ b/.Lib9c.Tests/Action/ValidatorSetOperateTest.cs @@ -27,7 +27,7 @@ public ValidatorSetOperateTest(ITestOutputHelper outputHelper) .WriteTo.TestOutput(outputHelper) .CreateLogger(); - _initialState = new State(); + _initialState = new StateDelta(); _validator = new Validator(new PrivateKey().PublicKey, BigInteger.One); var sheets = TableSheetsImporter.ImportSheets(); @@ -47,7 +47,7 @@ public void CheckPermission() var initStates = ImmutableDictionary.Empty .Add(AdminState.Address, adminState.Serialize()); - var state = new State( + var state = new StateDelta( initStates, validatorSet: new ValidatorSet()); var action = ValidatorSetOperate.Append(_validator); @@ -71,7 +71,7 @@ public void CheckPermission_Throws_PermissionDenied() var initStates = ImmutableDictionary.Empty .Add(AdminState.Address, adminState.Serialize()); - var state = new State( + var state = new StateDelta( initStates, validatorSet: new ValidatorSet()); var action = ValidatorSetOperate.Append(_validator); @@ -107,7 +107,7 @@ public void Append_Throws_WhenAlreadyExistValidator() [Fact] public void Update_Throws_WhenDoNotExistValidator() { - var state = new State(); + var state = new StateDelta(); var action = ValidatorSetOperate.Update(_validator); InvalidOperationException exc = Assert.Throws(() => action.Execute(new ActionContext @@ -122,7 +122,7 @@ public void Update_Throws_WhenDoNotExistValidator() [Fact] public void Remove_Throws_WhenDoNotExistValidator() { - var state = new State(); + var state = new StateDelta(); var action = ValidatorSetOperate.Remove(_validator); InvalidOperationException exc = Assert.Throws(() => action.Execute(new ActionContext diff --git a/.Lib9c.Tests/Extensions/SheetsExtensionsTest.cs b/.Lib9c.Tests/Extensions/SheetsExtensionsTest.cs index 911ad0431b..f07b7c9228 100644 --- a/.Lib9c.Tests/Extensions/SheetsExtensionsTest.cs +++ b/.Lib9c.Tests/Extensions/SheetsExtensionsTest.cs @@ -24,7 +24,7 @@ public class SheetsExtensionsTest public SheetsExtensionsTest() { - _states = new Tests.Action.State(); + _states = new Tests.Action.StateDelta(); InitSheets( _states, out _sheetNameAndFiles, diff --git a/.Lib9c.Tests/TestHelper/BlockChainHelper.cs b/.Lib9c.Tests/TestHelper/BlockChainHelper.cs index eb7bd69be9..24a35efb89 100644 --- a/.Lib9c.Tests/TestHelper/BlockChainHelper.cs +++ b/.Lib9c.Tests/TestHelper/BlockChainHelper.cs @@ -99,7 +99,7 @@ public static MakeInitialStateResult MakeInitialState() var sheets = TableSheetsImporter.ImportSheets(); var weeklyArenaAddress = WeeklyArenaState.DeriveAddress(0); var context = new ActionContext(); - var initialState = new Tests.Action.State() + var initialState = new Tests.Action.StateDelta() .SetState(GoldCurrencyState.Address, goldCurrencyState.Serialize()) .SetState( Addresses.GoldDistribution, diff --git a/.Lib9c.Tests/Util/InitializeUtil.cs b/.Lib9c.Tests/Util/InitializeUtil.cs index 3337742b1c..501ddb5f1d 100644 --- a/.Lib9c.Tests/Util/InitializeUtil.cs +++ b/.Lib9c.Tests/Util/InitializeUtil.cs @@ -11,7 +11,7 @@ namespace Lib9c.Tests.Util using Nekoyume.Action; using Nekoyume.Model.State; using Nekoyume.TableData; - using State = Lib9c.Tests.Action.State; + using State = Lib9c.Tests.Action.StateDelta; using StateExtensions = Nekoyume.Model.State.StateExtensions; public static class InitializeUtil