Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⬆️ Bump 9c-headless #515

Merged
merged 5 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace NineChronicles.DataProvider.Executable.Commands
using Cocona;
using Libplanet;
using Libplanet.Action;
using Libplanet.Action.State;
using Libplanet.Blockchain;
using Libplanet.Blockchain.Policies;
using Libplanet.Crypto;
Expand Down Expand Up @@ -116,7 +117,7 @@ public void Migration(
var blockChainStates = new BlockChainStates(_baseStore, baseStateStore);
var actionEvaluator = new ActionEvaluator(
_ => blockPolicy.BlockAction,
blockChainStates,
baseStateStore,
new NCActionLoader());
_baseChain = new BlockChain(blockPolicy, stagePolicy, _baseStore, baseStateStore, genesis, blockChainStates, actionEvaluator);

Expand Down Expand Up @@ -161,6 +162,8 @@ public void Migration(
var tip = _baseStore.GetBlock((BlockHash)tipHash!);
var blockEvaluation = _baseChain.EvaluateBlock(tip);
var evaluation = blockEvaluation.Last();
var outputState = new Account(_baseChain.GetAccountState(evaluation.OutputState));

var avatarCount = 0;
AvatarState avatarState;
bool checkBattleArenaRankingTable = false;
Expand All @@ -174,17 +177,17 @@ public void Migration(
var avatarAddress = new Address(avatar);
try
{
avatarState = evaluation.OutputState.GetAvatarStateV2(avatarAddress);
avatarState = outputState.GetAvatarStateV2(avatarAddress);
}
catch (Exception)
{
avatarState = evaluation.OutputState.GetAvatarState(avatarAddress);
avatarState = outputState.GetAvatarState(avatarAddress);
}

if (avatarState != null)
{
var avatarLevel = avatarState.level;
var arenaSheet = evaluation.OutputState.GetSheet<ArenaSheet>();
var arenaSheet = outputState.GetSheet<ArenaSheet>();
var arenaData = arenaSheet.GetRoundByBlockIndex(tip.Index);

if (!checkBattleArenaRankingTable)
Expand Down Expand Up @@ -229,8 +232,8 @@ public void Migration(
ArenaScore.DeriveAddress(avatarAddress, arenaData.ChampionshipId, arenaData.Round);
var arenaInformationAdr =
ArenaInformation.DeriveAddress(avatarAddress, arenaData.ChampionshipId, arenaData.Round);
evaluation.OutputState.TryGetArenaInformation(arenaInformationAdr, out var currentArenaInformation);
evaluation.OutputState.TryGetArenaScore(arenaScoreAdr, out var outputArenaScore);
outputState.TryGetArenaInformation(arenaInformationAdr, out var currentArenaInformation);
outputState.TryGetArenaScore(arenaScoreAdr, out var outputArenaScore);
if (currentArenaInformation != null && outputArenaScore != null)
{
_barBulkFile.WriteLine(
Expand Down
Loading