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

merge release/140 to main #2483

Merged
merged 43 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
ce975d6
Merge pull request #2466 from planetarium/release/132
U-lis May 2, 2024
304cf4f
update acs GetTxQuota Method to async
area363 Apr 25, 2024
8d0c100
bump lib9c
area363 May 2, 2024
99c03d8
Merge pull request #2457 from area363/update-access-control-service
area363 May 2, 2024
76793cb
Add Libplanet.Mocks project to solution
moreal May 3, 2024
333d6a2
Merge pull request #2469 from moreal/bugfix-2468
moreal May 3, 2024
a2c3811
add `--consensus-propose-second-base` cli parameter
eseiker May 3, 2024
e2cdc1c
Delete agent, avatar legacy account backward compatible code
ipdae May 10, 2024
e575125
Merge pull request #2471 from planetarium/20240510-bump-lib9c
ipdae May 10, 2024
14bb67e
Bump lib9c to 0ce58e61
greymistcube May 14, 2024
1144fc7
Build fix
greymistcube Apr 26, 2024
d7ce958
Merge pull request #2472 from greymistcube/bump/libplanet-to-4.4.2
greymistcube May 14, 2024
93a193e
Bump lib9c to 90f1b34f
greymistcube May 16, 2024
f453846
Merge pull request #2474 from greymistcube/bump/lib9c-to-90f1b34f
greymistcube May 16, 2024
538a76b
Bump lib9c to 07147619
greymistcube May 16, 2024
84b91fc
Merge pull request #2475 from greymistcube/bump/libplanet-to-4.5.0
greymistcube May 16, 2024
5a276fe
Provide `long`-typed `index` parameter for `stateQuery` field
moreal May 16, 2024
b2d3647
Provide `long`-typed `index` parameter for `state` field
moreal May 16, 2024
48e7550
Refactor
moreal May 16, 2024
9c08c57
Merge pull request #2477 from moreal/state-by-index
moreal May 17, 2024
6296642
Use `RemoteKeyValueStore`
moreal Apr 30, 2024
7089413
Introduce `AnonymousStore` to create temporary `IStore` implementation
moreal Mar 26, 2024
b2b664a
Replace RemoteKeyValueStates with RemoteKeyValueStore
moreal Mar 26, 2024
f413954
Force RemoteKeyValueService
moreal Mar 27, 2024
d0a4093
Add IKeyValueStore
moreal Mar 27, 2024
af86cb8
Add serilog dependency
moreal Mar 27, 2024
8f8249a
Correct replay command
moreal Mar 27, 2024
10c5eaa
Use cache for RemoteKeyValueStore
moreal Mar 27, 2024
5b9ea9f
fix: use wrong state root hash
riemannulus Mar 27, 2024
363d35e
Make RemoteKeyValueService optional
moreal May 16, 2024
e91cd5a
Remove unused features
moreal May 16, 2024
0b6bb13
Merge pull request #2476 from moreal/remote-kv-service
moreal May 17, 2024
9e481f9
Verify `dotnet format` before commit
moreal May 19, 2024
979f76d
Make hooks/pre-commit executable
moreal May 19, 2024
5710cf4
Correct typo
moreal May 19, 2024
a448c59
Merge pull request #2478 from moreal/correct-typo-hardrouter
moreal May 20, 2024
9b88a82
Implement diff query (#2479)
Atralupus May 23, 2024
f0c3ddf
Bump lib9c to 043e495e
greymistcube May 27, 2024
7fb122c
Bump libplanet to 4.5.1
greymistcube May 27, 2024
909939b
Merge pull request #2480 from greymistcube/bump/libplanet-to-4.5.1
greymistcube May 27, 2024
d5df6a0
Bump lib9c to release/1.12.0
U-lis May 28, 2024
2455520
Bump lib9c
U-lis Jun 3, 2024
4026561
Merge branch 'main' into release/140
ipdae Jun 7, 2024
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
19 changes: 19 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug NineChronicles.Headless",
"type": "coreclr",
"request": "launch",
"program": "${workspaceFolder}/NineChronicles.Headless.Executable/bin/Debug/net6/NineChronicles.Headless.Executable.dll",
"cwd": "${workspaceFolder}/NineChronicles.Headless.Executable",
"stopAtEntry": false,
"console": "integratedTerminal",
"preLaunchTask": "build",
"args": [
"--config",
"appsettings.local.json"
]
}
]
}
41 changes: 41 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/NineChronicles.Headless.Executable/NineChronicles.Headless.Executable.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/NineChronicles.Headless.Executable/NineChronicles.Headless.Executable.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/NineChronicles.Headless.Executable/NineChronicles.Headless.Executable.csproj"
],
"problemMatcher": "$msCompile"
}
]
}
2 changes: 1 addition & 1 deletion Lib9c
Submodule Lib9c updated 243 files
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private static void CheckCollision(
{
throw new ArgumentOutOfRangeException(
nameof(pairs),
"The pairs must cover all range over blockchain. Its last element's start index wasn't 0.");
$"The pairs must cover all range over blockchain. Its last element's end index wasn't long.MaxValue({long.MaxValue}).");
}

if (pairs.Length == 1)
Expand Down
5 changes: 5 additions & 0 deletions Libplanet.Headless/Hosting/LibplanetNodeService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public class LibplanetNodeService : BackgroundService, IDisposable

public readonly IStateStore StateStore;

public readonly IKeyValueStore StateKeyValueStore;

public readonly BlockChain BlockChain;

public readonly Swarm Swarm;
Expand Down Expand Up @@ -174,6 +176,8 @@ IActionEvaluator BuildActionEvaluator(IActionEvaluatorConfiguration actionEvalua
);
}

StateKeyValueStore = keyValueStore;

_obsoletedChainIds = chainIds.Where(chainId => chainId != BlockChain.Id).ToList();

_exceptionHandlerAction = exceptionHandlerAction;
Expand Down Expand Up @@ -235,6 +239,7 @@ IActionEvaluator BuildActionEvaluator(IActionEvaluatorConfiguration actionEvalua
ConsensusPrivateKey = Properties.ConsensusPrivateKey,
ConsensusWorkers = 500,
TargetBlockInterval = TimeSpan.FromMilliseconds(Properties.ConsensusTargetBlockIntervalMilliseconds ?? 7000),
ContextTimeoutOptions = Properties.ContextTimeoutOption,
};
}

Expand Down
3 changes: 3 additions & 0 deletions Libplanet.Headless/Hosting/LibplanetNodeServiceProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Libplanet.Types.Blocks;
using Libplanet.Crypto;
using Libplanet.Net;
using Libplanet.Net.Consensus;

namespace Libplanet.Headless.Hosting
{
Expand Down Expand Up @@ -67,6 +68,8 @@ public class LibplanetNodeServiceProperties

public TimeSpan TipTimeout { get; set; } = TimeSpan.FromSeconds(60);

public ContextTimeoutOption ContextTimeoutOption { get; set; }

public int DemandBuffer { get; set; } = 1150;

public ImmutableList<BoundPeer> ConsensusSeeds { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public AccessControlServiceController(IMutableAccessControlService accessControl
[HttpGet("entries/{address}")]
public ActionResult<int?> GetTxQuota(string address)
{
var result = _accessControlService.GetTxQuota(new Address(address));
var result = _accessControlService.GetTxQuotaAsync(new Address(address)).Result;

return result != null ? result : NotFound();
}
Expand Down
60 changes: 40 additions & 20 deletions NineChronicles.Headless.Executable.sln
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,16 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Libplanet.Crypto", "Lib9c\.
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Libplanet.Extensions.ActionEvaluatorCommonComponents", "Lib9c\.Libplanet.Extensions.ActionEvaluatorCommonComponents\Libplanet.Extensions.ActionEvaluatorCommonComponents.csproj", "{A6922395-36E5-4B0A-BEBD-9BCE34D08722}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Libplanet.Extensions.RemoteBlockChainStates", "Lib9c\.Libplanet.Extensions.RemoteBlockChainStates\Libplanet.Extensions.RemoteBlockChainStates.csproj", "{8F9E5505-C157-4DF3-A419-FF0108731397}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NineChronicles.Headless.AccessControlCenter", "NineChronicles.Headless.AccessControlCenter\NineChronicles.Headless.AccessControlCenter.csproj", "{162C0F4B-A1D9-4132-BC34-31F1247BC26B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Libplanet.Extensions.PluggedActionEvaluator", "Libplanet.Extensions.PluggedActionEvaluator\Libplanet.Extensions.PluggedActionEvaluator.csproj", "{DE91C36D-3999-47B6-A0BD-848C8EBA2A76}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lib9c.Plugin.Shared", "Lib9c\.Lib9c.Plugin.Shared\Lib9c.Plugin.Shared.csproj", "{3D32DA34-E619-429F-8421-848FF4F14417}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Libplanet.Mocks", "Lib9c\.Libplanet\Libplanet.Mocks\Libplanet.Mocks.csproj", "{F79B695B-6FCC-43F5-AEE4-88E484382B9B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Libplanet.Store.Remote", "Lib9c\.Libplanet\Libplanet.Store.Remote\Libplanet.Store.Remote.csproj", "{D1E15F81-8765-4DCA-9299-675415686C23}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -651,24 +653,6 @@ Global
{A6922395-36E5-4B0A-BEBD-9BCE34D08722}.Release|x64.Build.0 = Release|Any CPU
{A6922395-36E5-4B0A-BEBD-9BCE34D08722}.Release|x86.ActiveCfg = Release|Any CPU
{A6922395-36E5-4B0A-BEBD-9BCE34D08722}.Release|x86.Build.0 = Release|Any CPU
{8F9E5505-C157-4DF3-A419-FF0108731397}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8F9E5505-C157-4DF3-A419-FF0108731397}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8F9E5505-C157-4DF3-A419-FF0108731397}.Debug|x64.ActiveCfg = Debug|Any CPU
{8F9E5505-C157-4DF3-A419-FF0108731397}.Debug|x64.Build.0 = Debug|Any CPU
{8F9E5505-C157-4DF3-A419-FF0108731397}.Debug|x86.ActiveCfg = Debug|Any CPU
{8F9E5505-C157-4DF3-A419-FF0108731397}.Debug|x86.Build.0 = Debug|Any CPU
{8F9E5505-C157-4DF3-A419-FF0108731397}.DevEx|Any CPU.ActiveCfg = Debug|Any CPU
{8F9E5505-C157-4DF3-A419-FF0108731397}.DevEx|Any CPU.Build.0 = Debug|Any CPU
{8F9E5505-C157-4DF3-A419-FF0108731397}.DevEx|x64.ActiveCfg = Debug|Any CPU
{8F9E5505-C157-4DF3-A419-FF0108731397}.DevEx|x64.Build.0 = Debug|Any CPU
{8F9E5505-C157-4DF3-A419-FF0108731397}.DevEx|x86.ActiveCfg = Debug|Any CPU
{8F9E5505-C157-4DF3-A419-FF0108731397}.DevEx|x86.Build.0 = Debug|Any CPU
{8F9E5505-C157-4DF3-A419-FF0108731397}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8F9E5505-C157-4DF3-A419-FF0108731397}.Release|Any CPU.Build.0 = Release|Any CPU
{8F9E5505-C157-4DF3-A419-FF0108731397}.Release|x64.ActiveCfg = Release|Any CPU
{8F9E5505-C157-4DF3-A419-FF0108731397}.Release|x64.Build.0 = Release|Any CPU
{8F9E5505-C157-4DF3-A419-FF0108731397}.Release|x86.ActiveCfg = Release|Any CPU
{8F9E5505-C157-4DF3-A419-FF0108731397}.Release|x86.Build.0 = Release|Any CPU
{162C0F4B-A1D9-4132-BC34-31F1247BC26B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{162C0F4B-A1D9-4132-BC34-31F1247BC26B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{162C0F4B-A1D9-4132-BC34-31F1247BC26B}.Debug|x64.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -723,6 +707,42 @@ Global
{3D32DA34-E619-429F-8421-848FF4F14417}.Release|x64.Build.0 = Release|Any CPU
{3D32DA34-E619-429F-8421-848FF4F14417}.Release|x86.ActiveCfg = Release|Any CPU
{3D32DA34-E619-429F-8421-848FF4F14417}.Release|x86.Build.0 = Release|Any CPU
{F79B695B-6FCC-43F5-AEE4-88E484382B9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F79B695B-6FCC-43F5-AEE4-88E484382B9B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F79B695B-6FCC-43F5-AEE4-88E484382B9B}.Debug|x64.ActiveCfg = Debug|Any CPU
{F79B695B-6FCC-43F5-AEE4-88E484382B9B}.Debug|x64.Build.0 = Debug|Any CPU
{F79B695B-6FCC-43F5-AEE4-88E484382B9B}.Debug|x86.ActiveCfg = Debug|Any CPU
{F79B695B-6FCC-43F5-AEE4-88E484382B9B}.Debug|x86.Build.0 = Debug|Any CPU
{F79B695B-6FCC-43F5-AEE4-88E484382B9B}.DevEx|Any CPU.ActiveCfg = Debug|Any CPU
{F79B695B-6FCC-43F5-AEE4-88E484382B9B}.DevEx|Any CPU.Build.0 = Debug|Any CPU
{F79B695B-6FCC-43F5-AEE4-88E484382B9B}.DevEx|x64.ActiveCfg = Debug|Any CPU
{F79B695B-6FCC-43F5-AEE4-88E484382B9B}.DevEx|x64.Build.0 = Debug|Any CPU
{F79B695B-6FCC-43F5-AEE4-88E484382B9B}.DevEx|x86.ActiveCfg = Debug|Any CPU
{F79B695B-6FCC-43F5-AEE4-88E484382B9B}.DevEx|x86.Build.0 = Debug|Any CPU
{F79B695B-6FCC-43F5-AEE4-88E484382B9B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F79B695B-6FCC-43F5-AEE4-88E484382B9B}.Release|Any CPU.Build.0 = Release|Any CPU
{F79B695B-6FCC-43F5-AEE4-88E484382B9B}.Release|x64.ActiveCfg = Release|Any CPU
{F79B695B-6FCC-43F5-AEE4-88E484382B9B}.Release|x64.Build.0 = Release|Any CPU
{F79B695B-6FCC-43F5-AEE4-88E484382B9B}.Release|x86.ActiveCfg = Release|Any CPU
{F79B695B-6FCC-43F5-AEE4-88E484382B9B}.Release|x86.Build.0 = Release|Any CPU
{D1E15F81-8765-4DCA-9299-675415686C23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D1E15F81-8765-4DCA-9299-675415686C23}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D1E15F81-8765-4DCA-9299-675415686C23}.Debug|x64.ActiveCfg = Debug|Any CPU
{D1E15F81-8765-4DCA-9299-675415686C23}.Debug|x64.Build.0 = Debug|Any CPU
{D1E15F81-8765-4DCA-9299-675415686C23}.Debug|x86.ActiveCfg = Debug|Any CPU
{D1E15F81-8765-4DCA-9299-675415686C23}.Debug|x86.Build.0 = Debug|Any CPU
{D1E15F81-8765-4DCA-9299-675415686C23}.DevEx|Any CPU.ActiveCfg = Debug|Any CPU
{D1E15F81-8765-4DCA-9299-675415686C23}.DevEx|Any CPU.Build.0 = Debug|Any CPU
{D1E15F81-8765-4DCA-9299-675415686C23}.DevEx|x64.ActiveCfg = Debug|Any CPU
{D1E15F81-8765-4DCA-9299-675415686C23}.DevEx|x64.Build.0 = Debug|Any CPU
{D1E15F81-8765-4DCA-9299-675415686C23}.DevEx|x86.ActiveCfg = Debug|Any CPU
{D1E15F81-8765-4DCA-9299-675415686C23}.DevEx|x86.Build.0 = Debug|Any CPU
{D1E15F81-8765-4DCA-9299-675415686C23}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D1E15F81-8765-4DCA-9299-675415686C23}.Release|Any CPU.Build.0 = Release|Any CPU
{D1E15F81-8765-4DCA-9299-675415686C23}.Release|x64.ActiveCfg = Release|Any CPU
{D1E15F81-8765-4DCA-9299-675415686C23}.Release|x64.Build.0 = Release|Any CPU
{D1E15F81-8765-4DCA-9299-675415686C23}.Release|x86.ActiveCfg = Release|Any CPU
{D1E15F81-8765-4DCA-9299-675415686C23}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ query GetBlockData($hash: ID!)
preEvaluationHash
previousBlock {
hash
stateRootHash
}
stateRootHash
}
}}
}
Expand Down Expand Up @@ -87,6 +89,7 @@ private sealed class BlockType
public string? Miner { get; set; }
public string? PreEvaluationHash { get; set; }
public BlockType? PreviousBlock { get; set; }
public string? StateRootHash { get; set; }
}

private sealed class TransactionQueryType
Expand Down
42 changes: 34 additions & 8 deletions NineChronicles.Headless.Executable/Commands/ReplayCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,19 @@
using Cocona.Help;
using GraphQL.Client.Http;
using GraphQL.Client.Serializer.SystemTextJson;
using Grpc.Net.Client;
using Libplanet.Action;
using Libplanet.Action.Loader;
using Libplanet.Blockchain;
using Libplanet.Blockchain.Policies;
using Libplanet.Extensions.RemoteBlockChainStates;
using Libplanet.Types.Blocks;
using Libplanet.RocksDBStore;
using Libplanet.Action.State;
using Libplanet.Common;
using Libplanet.Crypto;
using Libplanet.Store;
using Libplanet.Store.Remote;
using Libplanet.Store.Remote.Client;
using Libplanet.Types.Tx;
using Nekoyume.Action;
using Nekoyume.Action.Loader;
Expand Down Expand Up @@ -353,8 +355,10 @@ public int Blocks(
public int RemoteTx(
[Option("tx", new[] { 't' }, Description = "The transaction id")]
string transactionId,
[Option("endpoint", new[] { 'e' }, Description = "GraphQL endpoint to get remote state")]
string endpoint)
[Option("endpoint", new[] { 'e' }, Description = "GraphQL endpoint to get block data.")]
string endpoint,
[Option("grpc-endpoint", new []{ 'g' }, Description = "gRPC endpoint to get remote states.")]
string grpcEndpoint)
{
var graphQlClient = new GraphQLHttpClient(new Uri(endpoint), new SystemTextJsonSerializer());
var transactionResponse = GetTransactionData(graphQlClient, transactionId);
Expand All @@ -378,19 +382,41 @@ public int RemoteTx(

var block = GetBlockData(graphQlClient, transactionResult.BlockHash)?.ChainQuery?.BlockQuery?.Block;
var previousBlockHashValue = block?.PreviousBlock?.Hash;
var previousBlockHashStateRootHash = block?.PreviousBlock?.StateRootHash;
var preEvaluationHashValue = block?.PreEvaluationHash;
var minerValue = block?.Miner;
if (previousBlockHashValue is null || preEvaluationHashValue is null || minerValue is null)
if (previousBlockHashValue is null || preEvaluationHashValue is null || minerValue is null || previousBlockHashStateRootHash is null)
{
throw new CommandExitedException("Failed to get block from query", -1);
}
var miner = new Address(minerValue);

var explorerEndpoint = $"{endpoint}/explorer";
var blockChainStates = new RemoteBlockChainStates(new Uri(explorerEndpoint));
var channel = GrpcChannel.ForAddress(grpcEndpoint);
var keyValueServiceClient = new KeyValueStore.KeyValueStoreClient(channel);
var cacheKeyValueStore =
new RocksDBKeyValueStore(Path.Combine(Path.GetTempPath(), "9c-headless-replay-remotetx"));
var keyValueStore = new ReplicableKeyValueStore(
new RemoteKeyValueStore(keyValueServiceClient),
cacheKeyValueStore);
var store = new AnonymousStore
{
GetBlockDigest = hash =>
{
var stateRootHash = HashDigest<SHA256>.FromString(block!.StateRootHash!);
var privateKey = new PrivateKey();
var blockMetadata = new BlockMetadata(
0, DateTimeOffset.Now, privateKey.PublicKey, null, null, null);
var blockContent = new BlockContent(blockMetadata);
var preEvaluationBlock = blockContent.Propose();
var b = preEvaluationBlock.Sign(privateKey, stateRootHash);
return new BlockDigest(b.Header, ImmutableArray<ImmutableArray<byte>>.Empty);
}
};

var previousStateRootHash = HashDigest<SHA256>.FromString(previousBlockHashStateRootHash);
var blockChainStates = new BlockChainStates(store, new TrieStateStore(keyValueStore));

var previousBlockHash = BlockHash.FromString(previousBlockHashValue);
var previousStates = new World(blockChainStates.GetWorldState(previousBlockHash));
var previousStates = new World(blockChainStates.GetWorldState(previousStateRootHash));

var actions = transaction.Actions
.Select(ToAction)
Expand Down
28 changes: 0 additions & 28 deletions NineChronicles.Headless.Executable/Commands/TxCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,34 +190,6 @@ public void MigrationActivatedAccountsState()
_console.Out.WriteLine(ByteUtil.Hex(raw));
}

[Command(Description = "Create MigrationAvatarState action and dump it.")]
public void MigrationAvatarState(
[Argument("directory-path", Description = "path of the directory contained hex-encoded avatar states.")]
string directoryPath,
[Argument("output-path", Description = "path of the output file dumped action.")]
string outputPath
)
{
var files = Directory.GetFiles(directoryPath, "*", SearchOption.AllDirectories);
var avatarStates = files.Select(a =>
{
var raw = File.ReadAllText(a);
return (Dictionary)_codec.Decode(ByteUtil.ParseHex(raw));
}).ToList();
var action = new MigrationAvatarState()
{
avatarStates = avatarStates
};

var encoded = new List(
(Text)nameof(Nekoyume.Action.MigrationAvatarState),
action.PlainValue
);

byte[] raw = _codec.Encode(encoded);
File.WriteAllText(outputPath, ByteUtil.Hex(raw));
}

[Command(Description = "Create AddRedeemCode action and dump it.")]
public void AddRedeemCode(
[Argument("TABLE-PATH", Description = "A table file path for RedeemCodeListSheet")]
Expand Down
Loading
Loading