Skip to content

Commit f6b078a

Browse files
committed
Add restored Odin RPC 1
1 parent 232ee7f commit f6b078a

File tree

6 files changed

+20
-34
lines changed

6 files changed

+20
-34
lines changed

.github/workflows/build.yaml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,6 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- uses: actions/checkout@main
16-
- if: github.ref_type == 'tag'
17-
run: |
18-
set -evx
19-
pushd /tmp
20-
wget $WEB_FLOW_KEY_URL
21-
popd
22-
gpg --import /tmp/web-flow.gpg
23-
if ! git verify-commit "$GITHUB_REF_NAME" && \
24-
[[ "$( git cat-file -p "$GITHUB_REF_NAME" \
25-
| grep -Ei '^parent\s+[0-9a-f]{40}$' | wc -l )" -lt 2 ]]; then
26-
echo "::error title=Invalid tag commit::Tags must refer to a merge" \
27-
"commit or a commit signed by GitHub @web-flow" \
28-
"($WEB_FLOW_KEY_URL). The tag $GITHUB_REF_NAME refers to " \
29-
"a commit $(git rev-parse $GITHUB_REF_NAME) which is neither" \
30-
"a merge commit nor signed by GitHub @web-flow."
31-
exit 1
32-
fi
33-
env:
34-
WEB_FLOW_KEY_URL: https://github.com/web-flow.gpg
3516
- uses: actions/setup-dotnet@v3
3617
with:
3718
dotnet-version: 6.0.x

src/Libplanet.Action/State/AccountState.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@ namespace Libplanet.Action.State
1515
/// </summary>
1616
public class AccountState : IAccountState
1717
{
18+
private static readonly ActivitySource ActivitySource =
19+
new ("Libplanet.Action.State");
20+
1821
private readonly ITrie _trie;
19-
private readonly ActivitySource _activitySource;
2022

2123
public AccountState(ITrie trie)
2224
{
2325
_trie = trie;
24-
_activitySource = new ActivitySource("Libplanet.Action.State");
2526
}
2627

2728
/// <inheritdoc cref="IAccountState.Trie"/>
@@ -30,7 +31,7 @@ public AccountState(ITrie trie)
3031
/// <inheritdoc cref="IAccountState.GetState"/>
3132
public IValue? GetState(Address address)
3233
{
33-
using Activity? a = _activitySource
34+
using Activity? a = ActivitySource
3435
.StartActivity(ActivityKind.Internal)?
3536
.AddTag("Address", address.ToString());
3637
return Trie.Get(ToStateKey(address));

src/Libplanet.Action/State/WorldBaseState.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ namespace Libplanet.Action.State
1717
/// </summary>
1818
public class WorldBaseState : IWorldState
1919
{
20+
private static readonly ActivitySource ActivitySource =
21+
new ("Libplanet.Action.WorldBaseState");
22+
2023
private readonly IStateStore _stateStore;
21-
private readonly ActivitySource _activitySource;
2224

2325
public WorldBaseState(ITrie trie, IStateStore stateStore)
2426
{
@@ -27,7 +29,6 @@ public WorldBaseState(ITrie trie, IStateStore stateStore)
2729
Version = trie.GetMetadata() is { } value
2830
? value.Version
2931
: 0;
30-
_activitySource = new ActivitySource("Libplanet.Action.WorldBaseState");
3132
}
3233

3334
/// <inheritdoc cref="IWorldState.Trie"/>
@@ -42,7 +43,7 @@ public WorldBaseState(ITrie trie, IStateStore stateStore)
4243
/// <inheritdoc cref="IWorldState.GetAccountState"/>
4344
public IAccountState GetAccountState(Address address)
4445
{
45-
using Activity? a = _activitySource
46+
using Activity? a = ActivitySource
4647
.StartActivity(ActivityKind.Internal)?
4748
.AddTag("Address", address.ToString());
4849
if (Legacy)

src/Libplanet.Net/Transports/NetMQTransport.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ namespace Libplanet.Net.Transports
2727
/// </summary>
2828
public class NetMQTransport : ITransport
2929
{
30+
private static readonly ActivitySource ActivitySource =
31+
new ("Libplanet.Net.Transports.NetMQTransport");
32+
3033
private readonly PrivateKey _privateKey;
3134
private readonly ILogger _logger;
3235
private readonly AppProtocolVersionOptions _appProtocolVersionOptions;
@@ -36,7 +39,6 @@ public class NetMQTransport : ITransport
3639
private readonly Channel<MessageRequest> _requests;
3740
private readonly Task _runtimeProcessor;
3841
private readonly AsyncManualResetEvent _runningEvent;
39-
private readonly ActivitySource _activitySource;
4042

4143
private NetMQQueue<(AsyncManualResetEvent, Message)>? _replyQueue;
4244

@@ -94,7 +96,6 @@ private NetMQTransport(
9496
_requests = Channel.CreateUnbounded<MessageRequest>();
9597
_runtimeCancellationTokenSource = new CancellationTokenSource();
9698
_turnCancellationTokenSource = new CancellationTokenSource();
97-
_activitySource = new ActivitySource("Libplanet.Net.Transports.NetMQTransport");
9899
_requestCount = 0;
99100
CancellationToken runtimeCt = _runtimeCancellationTokenSource.Token;
100101
_runtimeProcessor = Task.Factory.StartNew(
@@ -323,7 +324,7 @@ CancellationToken cancellationToken
323324
throw new ObjectDisposedException(nameof(NetMQTransport));
324325
}
325326

326-
using Activity? a = _activitySource
327+
using Activity? a = ActivitySource
327328
.StartActivity(ActivityKind.Producer)?
328329
.AddTag("Message", content.Type)
329330
.AddTag("Peer", peer.PeerString);
@@ -504,7 +505,7 @@ public void BroadcastMessage(IEnumerable<BoundPeer> peers, MessageContent conten
504505
Task.Run(
505506
async () =>
506507
{
507-
using Activity? a = _activitySource
508+
using Activity? a = ActivitySource
508509
.StartActivity(ActivityKind.Producer)?
509510
.AddTag("Message", content.Type)
510511
.AddTag("Peers", boundPeers.Select(x => x.PeerString));

src/Libplanet.Store/HashNodeCache.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@ namespace Libplanet.Store
1414
public class HashNodeCache
1515
{
1616
// FIXME: Tuned to 9c mainnet. Should be refactored to accept cache size as an argument.
17-
private const int _cacheSize = 524_288;
17+
private const int _cacheSize = 100_000;
1818

1919
private ICache<HashDigest<SHA256>, IValue> _cache;
2020

2121
internal HashNodeCache()
2222
{
2323
_cache = new ConcurrentLruBuilder<HashDigest<SHA256>, IValue>()
2424
.WithMetrics()
25+
.WithConcurrencyLevel(Environment.ProcessorCount)
2526
.WithExpireAfterAccess(TimeSpan.FromMinutes(10))
2627
.WithCapacity(_cacheSize)
2728
.Build();

src/Libplanet/Blockchain/BlockChainStates.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,22 @@ namespace Libplanet.Blockchain
1515
/// </summary>
1616
public class BlockChainStates : IBlockChainStates
1717
{
18+
private static readonly ActivitySource ActivitySource =
19+
new ("Libplanet.Blockchain.BlockChainStates");
20+
1821
private readonly IStore _store;
1922
private readonly IStateStore _stateStore;
20-
private readonly ActivitySource _activitySource;
2123

2224
public BlockChainStates(IStore store, IStateStore stateStore)
2325
{
2426
_store = store;
2527
_stateStore = stateStore;
26-
_activitySource = new ActivitySource("Libplanet.Blockchain.BlockChainStates");
2728
}
2829

2930
/// <inheritdoc cref="IBlockChainStates.GetWorldState(BlockHash)"/>
3031
public IWorldState GetWorldState(BlockHash offset)
3132
{
32-
using Activity? a = _activitySource
33+
using Activity? a = ActivitySource
3334
.StartActivity(ActivityKind.Internal)?
3435
.AddTag("BlockHash", offset.ToString());
3536
return new WorldBaseState(GetTrie(offset), _stateStore);
@@ -65,7 +66,7 @@ public IWorldState GetWorldState(HashDigest<SHA256>? stateRootHash)
6566
/// </remarks>
6667
private ITrie GetTrie(BlockHash offset)
6768
{
68-
using Activity? a = _activitySource
69+
using Activity? a = ActivitySource
6970
.StartActivity(ActivityKind.Internal)?
7071
.AddTag("BlockHash", offset.ToString());
7172
if (_store.GetStateRootHash(offset) is { } stateRootHash)

0 commit comments

Comments
 (0)