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

Release 1.20.0 #3049

Merged
merged 196 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
196 commits
Select commit Hold shift + click to select a range
869cd8f
change AuraSummon.SummonLimit to 100
sonohoshi Oct 14, 2024
2e41aa2
change RuneSummon.SummonLimit to 100
sonohoshi Oct 14, 2024
ec40d66
remove unused canceled argument at AvatarState.UpdateFromAddCostume
sonohoshi Oct 16, 2024
2f71758
add CostumeSummon action
sonohoshi Oct 16, 2024
03deea4
change SummonLimit spec to array and...
sonohoshi Oct 17, 2024
009970d
fix CostumeSummonTest about changed InvalidSummonCountException
sonohoshi Oct 17, 2024
f02b391
change SummonLimit to static readonly array
sonohoshi Oct 17, 2024
27db483
fix plainValue serialzing of CostumeSummon
sonohoshi Oct 17, 2024
c2a600a
move CumulativeRatio test to SummonSheetTest
sonohoshi Oct 17, 2024
444e628
introduce SummonHelper
sonohoshi Oct 17, 2024
28230d5
change duplicated code to use SummonHelper
sonohoshi Oct 17, 2024
b326b5c
Merge branch 'development' into feature/summon-100
sonohoshi Oct 18, 2024
7a0d4ab
fix RuneSummon count bug
sonohoshi Oct 18, 2024
d098f34
Merge pull request #2904 from planetarium/feature/summon-100
sonohoshi Oct 18, 2024
221f6c5
apply code style rule to test code
eugene-doobu Oct 18, 2024
687028e
Merge branch 'development' into feature/apply-rule-test
eugene-doobu Oct 21, 2024
3ac2f12
code sweep create avatar action
eugene-doobu Oct 21, 2024
bbf4ec8
apply code sweep
eugene-doobu Oct 22, 2024
e12badf
sorting namespace order
eugene-doobu Oct 22, 2024
795fcc9
Add thor planet
ipdae Oct 22, 2024
231d8d1
Merge remote-tracking branch 'origin/development' into prepare/200250
sonohoshi Oct 22, 2024
097a13b
Merge branch 'development' into feature/apply-rule-test
eugene-doobu Oct 22, 2024
8bea553
Merge pull request #2914 from eugene-doobu/feature/apply-rule-test
eugene-doobu Oct 22, 2024
5721271
split ***SummonSheet by result type
sonohoshi Oct 23, 2024
eef3d8f
change usage of SummonSheet to specific sheets
sonohoshi Oct 23, 2024
06e758b
fix test about split sheets
sonohoshi Oct 23, 2024
27fe66b
remove test
sonohoshi Oct 23, 2024
ff58260
Merge pull request #2927 from planetarium/improve/summon-sheet
sonohoshi Oct 24, 2024
202cdd7
optimize wanted action
eugene-doobu Oct 24, 2024
5e6c9ad
optimize SweepAdventureBoss action
eugene-doobu Oct 24, 2024
681af88
Merge branch 'development' into feature/code-sweep-create-avatar
eugene-doobu Oct 25, 2024
5c9c1e1
Merge pull request #2919 from eugene-doobu/feature/code-sweep-create-…
eugene-doobu Oct 25, 2024
ab0d965
fix: Prevent to add item with 0 quantity
HwiYul-G Oct 25, 2024
091b561
[feat] add action (charge_action_point)
kanade012 Oct 25, 2024
17753fc
stye: 코드 컨벤션
HwiYul-G Oct 25, 2024
8ccba81
test: test add zero
HwiYul-G Oct 25, 2024
601bc17
[fix] fix formatting error
kanade012 Oct 25, 2024
b282556
undo package.json
kanade012 Oct 25, 2024
ef7a9ff
Merge pull request #2941 from kanade012/makeaction
Atralupus Oct 25, 2024
51c6162
modify COTRIBUTING.md
kanade012 Oct 25, 2024
39e8f48
Merge pull request #2942 from kanade012/rewritemd
Atralupus Oct 25, 2024
c5e5238
[feat] add new action (JoinArena)
kanade012 Oct 26, 2024
a171e22
fix formatting error
kanade012 Oct 26, 2024
a3243e2
[refactor] refactor RuneSlotInfo
kanade012 Oct 26, 2024
b3d76b3
[fix] 잘못된 호출 경로 수정
kanade012 Oct 26, 2024
6c96413
[fix] fix formatting error
kanade012 Oct 26, 2024
d9616ac
Merge pull request #2946 from kanade012/development
moreal Oct 26, 2024
9e3196e
[refactor] @planetarium 경로 수정 및 publish.yml 수정
kanade012 Oct 26, 2024
bf9e2c4
main.yml 파일 수정
kanade012 Oct 26, 2024
f21370f
main.yml 파일 수정
kanade012 Oct 26, 2024
15ad9fb
common.ts 수정
kanade012 Oct 26, 2024
3780cd7
Merge pull request #2948 from kanade012/move
moreal Oct 26, 2024
110b391
fix: Modify test code as prevent to add item zero
HwiYul-G Oct 27, 2024
a4486ba
Merge pull request #2939 from HwiYul-G/development
sonohoshi Oct 27, 2024
8fa1eb9
add grinding.ts
originchoi Oct 27, 2024
f9206ff
fixed filename typos
originchoi Oct 27, 2024
62eee51
Merge branch 'development' into grinding
Atralupus Oct 27, 2024
c3bff25
Merge pull request #2949 from originchoi/grinding
Atralupus Oct 27, 2024
f117ae6
chore: setup lib9c.py project
forwardyoung Oct 28, 2024
508295b
optimize UnlockFloor action
eugene-doobu Oct 28, 2024
83966c1
optimize CreateAvatar action
eugene-doobu Oct 28, 2024
66f56a7
Merge remote-tracking branch 'origin/development' into feature/optimi…
eugene-doobu Oct 28, 2024
6496a6b
add thorScheduleSheet
eugene-doobu Oct 29, 2024
4b02577
Merge pull request #2952 from planetarium/release/1.19.0
U-lis Oct 29, 2024
6e6a910
Update v200240 Data
NineSyu Oct 29, 2024
c53349a
improve exception messages
boscohyun Oct 29, 2024
19cdb86
fix exception formatter
eugene-doobu Oct 29, 2024
5444de9
Add test code
eugene-doobu Oct 29, 2024
c68fb01
change comment
eugene-doobu Oct 29, 2024
600ca14
fix unity build error
eugene-doobu Oct 29, 2024
afc9b19
fix ci for unity build
eugene-doobu Oct 31, 2024
a4f8c59
change net version to 4.8
eugene-doobu Oct 31, 2024
a626cb4
change tracing package import condition
eugene-doobu Oct 31, 2024
b59f5a2
remove fixme comment
eugene-doobu Oct 31, 2024
448d741
Merge pull request #2963 from eugene-doobu/feature/fix-msgpack-except…
eugene-doobu Nov 1, 2024
4d67bbc
sweep code rules
eugene-doobu Nov 1, 2024
b18a4ec
Merge branch 'development' into feature/optimization-get-avatar-state
eugene-doobu Nov 1, 2024
efe0efc
add comment for duplicate avatar address check
eugene-doobu Nov 1, 2024
966b645
Merge remote-tracking branch 'doobu/development' into feature/thor-data
eugene-doobu Nov 1, 2024
b8b8a4d
Merge pull request #2953 from eugene-doobu/feature/optimization-get-a…
eugene-doobu Nov 1, 2024
e6f8f81
Merge branch 'development' into feature/sweep-code-rules
eugene-doobu Nov 1, 2024
e96c173
Merge pull request #2970 from eugene-doobu/feature/sweep-code-rules
eugene-doobu Nov 1, 2024
e3ca247
Merge remote-tracking branch 'origin/development' into feature/thor-data
eugene-doobu Nov 4, 2024
c4394f6
remove thor scheduleSheet
eugene-doobu Nov 4, 2024
222c235
add currency formatter
eugene-doobu Nov 4, 2024
7e2664e
fix InvalidSignatureException
eugene-doobu Nov 4, 2024
df53f8d
Merge remote-tracking branch 'origin/development' into feature/fix-se…
eugene-doobu Nov 4, 2024
64248f2
remove redundant line
eugene-doobu Nov 5, 2024
f808495
Merge branch 'development' into prepare/200250
sonohoshi Nov 5, 2024
c3b4d2a
fix test
sonohoshi Nov 5, 2024
9ab288c
Merge pull request #2973 from eugene-doobu/feature/thor-data
eugene-doobu Nov 5, 2024
0e4a873
Merge branch 'development' into prepare/200250
sonohoshi Nov 5, 2024
3d4905b
Merge pull request #2978 from planetarium/prepare/200250
sonohoshi Nov 5, 2024
fed7c9b
Merge branch 'development' into feature/fix-serialize-exception
eugene-doobu Nov 5, 2024
c14e0f4
Merge pull request #2975 from eugene-doobu/feature/fix-serialize-exce…
eugene-doobu Nov 5, 2024
15b3b0e
add unity meta files for 240
eugene-doobu Nov 6, 2024
6bfebe0
remove sample sheet
eugene-doobu Nov 6, 2024
c29bc3c
Change event dungeon fee address
ipdae Nov 6, 2024
ce2ebb4
ci: run gh-actions validation every pushing and cron
moreal Nov 6, 2024
167efd2
ci: skip action deprecation check in pull_request
moreal Nov 7, 2024
020a494
Merge pull request #2990 from moreal/fix-workflows
moreal Nov 7, 2024
5b80e30
Remove libplanet submodule
moreal Nov 6, 2024
2a28ed3
Update items related with Libplanet submodule
moreal Nov 6, 2024
bcdf76a
Make easy to bump Libplanet
moreal Nov 6, 2024
43e01f9
Make easy to test with local Libplanet
moreal Nov 6, 2024
e446ebe
Check LibplanetDirectory is empty
moreal Nov 6, 2024
7e3d37a
Fix build-for-unity GitHub Actions job
moreal Nov 6, 2024
9487a69
Disallow submodules anymore
moreal Nov 7, 2024
e51e19f
Fix several bugs
moreal Nov 7, 2024
9b29c18
Merge pull request #2988 from moreal/remove-libplanet-submodule
moreal Nov 7, 2024
7970b49
Merge branch 'development' into improve/issue-2931
ipdae Nov 7, 2024
0a46c89
Make ncg initialSupply configurable
ipdae Nov 7, 2024
f58347f
Merge pull request #2993 from planetarium/improve/configure-ncg-supply
ipdae Nov 8, 2024
04b0e42
Merge branch 'development' into improve/issue-2931
ipdae Nov 8, 2024
ca1154e
Merge pull request #2986 from planetarium/improve/issue-2931
ipdae Nov 8, 2024
cce4730
Merge branch 'development' into feature/add-240-sheet-unity-meta
eugene-doobu Nov 8, 2024
673bd7f
Merge pull request #2985 from eugene-doobu/feature/add-240-sheet-unit…
eugene-doobu Nov 8, 2024
7552f48
Merge remote-tracking branch 'upstream/development' into feature/upgr…
eugene-doobu Nov 8, 2024
5489c42
change include pyroscope condition
eugene-doobu Nov 8, 2024
fcfc416
test - apply nullable
eugene-doobu Nov 8, 2024
fef05c5
Revert "test - apply nullable"
eugene-doobu Nov 8, 2024
6b723c2
disable nullable
eugene-doobu Nov 8, 2024
ed839c8
test - apply langVersion 9
eugene-doobu Nov 8, 2024
9ec84a8
Revert "disable nullable"
eugene-doobu Nov 8, 2024
7227d80
set to net 5.0
eugene-doobu Nov 8, 2024
e926001
remove maybe null when line
eugene-doobu Nov 8, 2024
8904f56
Merge branch 'development' of github.com:planetarium/lib9c into v2002…
ipdae Nov 12, 2024
4f90c1a
Merge pull request #2968 from eugene-doobu/feature/upgrade-build-for-…
eugene-doobu Nov 12, 2024
fa763ce
create ClaimOneTimeGift(action), OneTimeGiftSheet(sheet)
tyrosine1153 Oct 30, 2024
5abb70f
craete GiftModule
tyrosine1153 Oct 30, 2024
53766de
move ClaimGiftsSheet
tyrosine1153 Nov 8, 2024
2635d7f
create ClaimableGiftsSheetTest
tyrosine1153 Nov 8, 2024
53544d3
create ClaimGiftsTest
tyrosine1153 Nov 8, 2024
2af6ba7
refactor to replace avatarState -> Inventory
tyrosine1153 Nov 8, 2024
b6d63ea
refactor claimedGiftIds serialize
tyrosine1153 Nov 8, 2024
fb30233
add xml comment
tyrosine1153 Nov 8, 2024
ddf552b
fix item tradable
tyrosine1153 Nov 8, 2024
0d3b171
add CheckAvatarAddrIsContainedInAgent
tyrosine1153 Nov 11, 2024
ea9329e
edit field to property
tyrosine1153 Nov 11, 2024
03380eb
refactor to replace SetAccount -> MutateAccount
tyrosine1153 Nov 11, 2024
d54a4c8
fix exception name
tyrosine1153 Nov 11, 2024
49680cb
add column items tradable in ClaimableGiftsSheet
tyrosine1153 Nov 12, 2024
0adc4ea
Merge pull request #2982 from planetarium/feature/claim-one-time-gift
tyrosine1153 Nov 12, 2024
3ab07f6
Fix rune id
ipdae Nov 12, 2024
6fb0c60
Merge branch 'development' into v200240-data
ipdae Nov 12, 2024
f341a7c
Merge pull request #2960 from planetarium/v200240-data
ipdae Nov 12, 2024
607266d
chore: use common rulesets
moreal Nov 12, 2024
8bcf1e7
ci: treat errors related with docs as warnings
moreal Nov 12, 2024
a550baf
ci: prevent to add items without docs
moreal Nov 12, 2024
e8917e2
Merge pull request #2997 from moreal/ci/gh-actions/force-items-with-docs
moreal Nov 12, 2024
bf57f41
Fix missing guild migration in CreatePledge
ipdae Nov 13, 2024
88397f3
Merge pull request #2998 from planetarium/bugfix/create-pledge-guild-…
ipdae Nov 13, 2024
225d936
Extend Thor Tx. size to 1MiB
U-lis Nov 14, 2024
216d85b
Merge pull request #3000 from planetarium/feature/extend-thor-tx-size
U-lis Nov 14, 2024
c0b1e05
Allow buff limit in stat calculate
ipdae Nov 14, 2024
8f704af
Rename DebuffLimitSheet to BuffLimitSheet
ipdae Nov 14, 2024
428ae64
Avoid NRE in deprecated actions
ipdae Nov 14, 2024
17162a3
Merge pull request #3004 from planetarium/hotfix/issue-3002
ipdae Nov 14, 2024
e078e8e
Merge branch 'main' into backmerge-1.19.2
U-lis Nov 15, 2024
9cdc33c
Fix broken tests
U-lis Nov 15, 2024
4304f97
Delete migrate_pledge_to_guild
ipdae Nov 15, 2024
52a7a6c
Merge pull request #3009 from planetarium/backmerge-1.19.2
ipdae Nov 15, 2024
1547450
add metafile
jonny-jeahyunchoi Nov 15, 2024
f3f4040
Merge pull request #3010 from planetarium/fix/release-1.20.0-addmetafile
jonny-jeahyunchoi Nov 18, 2024
e726d20
Update github actions to latest major version
U-lis Nov 18, 2024
5dff77d
Merge pull request #3016 from planetarium/update-github-actions
U-lis Nov 18, 2024
879c1f8
Merge pull request #3015 from planetarium/release/1.19.2
U-lis Nov 18, 2024
9b7dfb0
WIP
ipdae Nov 19, 2024
21a5cec
fix test
eugene-doobu Nov 20, 2024
ffea5e0
add buff limit add value
eugene-doobu Nov 20, 2024
a0dd247
fix comment
eugene-doobu Nov 20, 2024
a8b6a66
change drr limit value 5000 -> 8100
eugene-doobu Nov 20, 2024
25bdd3b
fix unit test
eugene-doobu Nov 20, 2024
89c61f0
Merge pull request #3022 from planetarium/improve/issue-3020
ipdae Nov 20, 2024
9757492
Merge pull request #3028 from planetarium/release/1.19.3
OnedgeLee Nov 20, 2024
86056a0
configure project versions to 1.20.0
boscohyun Nov 21, 2024
8714ad4
Merge pull request #3031 from planetarium/chore/configure-project-ver…
boscohyun Nov 21, 2024
03dfa89
Add release publish trigger
Atralupus Nov 21, 2024
57ec735
Merge pull request #3034 from Atralupus/action/add-release-trigger
Atralupus Nov 21, 2024
682e96b
fix: Fix debug-related features
OnedgeLee Nov 22, 2024
c73a7fc
fix: Fix slashing, activate
OnedgeLee Nov 22, 2024
657fe1e
fix floor error
jonny-jeahyunchoi Nov 22, 2024
7db9074
disable battle log
jonny-jeahyunchoi Nov 22, 2024
5836a23
Update Libplanet 5.4.1
OnedgeLee Nov 22, 2024
5946f1f
Merge pull request #3038 from planetarium/fix/adventureboss-bug
jonny-jeahyunchoi Nov 25, 2024
385d7ff
chore: Fix typo
OnedgeLee Nov 25, 2024
da6a534
test: Fix lacked test cases
OnedgeLee Nov 25, 2024
0444528
fix: Fix MigrateDelegation action
OnedgeLee Nov 25, 2024
df449d9
chore: Change MigrateDelegationHeight as admin action
OnedgeLee Nov 25, 2024
53b3165
Merge pull request #3039 from planetarium/fix/pos
OnedgeLee Nov 26, 2024
31c7167
Fix: Collection was modified issue when slash executes
s2quake Nov 21, 2024
8650fc7
chore: Minor fixes and add docstrings for new actions
OnedgeLee Nov 26, 2024
f2c372e
Merge pull request #3044 from planetarium/chore/minor-fixes
OnedgeLee Nov 26, 2024
f900e40
fix duplicate guid NonFungibleItem in Claimitems
tyrosine1153 Nov 26, 2024
ea61bd0
Merge pull request #3046 from planetarium/bugfix/claim-items
tyrosine1153 Nov 26, 2024
64e8cdd
Merge branch 'main' into release/1.20.0
U-lis Nov 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
18 changes: 14 additions & 4 deletions .Lib9c.Benchmarks/Lib9c.Benchmarks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,24 @@
<PackageReference Include="BenchmarkDotNet" Version="0.12.1" />
</ItemGroup>

<ItemGroup Condition="!'$(UseLocalLibplanet)'">
<PackageReference Include="Libplanet" Version="$(LibplanetVersion)" />
<PackageReference Include="Libplanet.RocksDBStore" Version="$(LibplanetVersion)" />
<PackageReference Include="Libplanet.Crypto.Secp256k1" Version="$(LibplanetVersion)" />
<PackageReference Include="Libplanet.Mocks" Version="$(LibplanetVersion)" />
</ItemGroup>

<ItemGroup Condition="'$(UseLocalLibplanet)'">
<ProjectReference Include="$(LibplanetDirectory)\src\Libplanet\Libplanet.csproj" />
<ProjectReference Include="$(LibplanetDirectory)\src\Libplanet.RocksDBStore\Libplanet.RocksDBStore.csproj" />
<ProjectReference Include="$(LibplanetDirectory)\src\Libplanet.Crypto.Secp256k1\Libplanet.Crypto.Secp256k1.csproj" />
<ProjectReference Include="$(LibplanetDirectory)\test\Libplanet.Mocks\Libplanet.Mocks.csproj" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\.Lib9c.Tests\Lib9c.Tests.csproj" />
<ProjectReference Include="..\.Libplanet\src\Libplanet.RocksDBStore\Libplanet.RocksDBStore.csproj" />
<ProjectReference Include="..\.Libplanet\src\Libplanet\Libplanet.csproj" />
<ProjectReference Include="..\Lib9c\Lib9c.csproj" />
<ProjectReference Include="..\Lib9c.Policy\Lib9c.Policy.csproj" />
<ProjectReference Include="..\Libplanet.Crypto.Secp256k1\Libplanet.Crypto.Secp256k1.csproj" />
<ProjectReference Include="..\.Libplanet\test\Libplanet.Mocks\Libplanet.Mocks.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions .Lib9c.Miner.Tests/Lib9c.Proposer.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Lib9c.Policy\Lib9c.Policy.csproj" />
<ProjectReference Include="..\Lib9c.Proposer\Lib9c.Proposer.csproj" />
</ItemGroup>

Expand Down
145 changes: 145 additions & 0 deletions .Lib9c.Miner.Tests/ProposerTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
using System.Collections.Immutable;
using Lib9c.Renderers;
using Libplanet.Action;
using Libplanet.Blockchain.Policies;
using Libplanet.Blockchain;
using Libplanet.Crypto;
using Libplanet.Store;
using Libplanet.Store.Trie;
using Libplanet.Types.Assets;
using Libplanet.Types.Blocks;
using Libplanet.Types.Consensus;
using Libplanet.Types.Tx;
using Nekoyume.Action;
using Nekoyume.Action.Loader;
using Nekoyume.Blockchain.Policy;
using Nekoyume.Model.State;
using System.Numerics;

namespace Lib9c.Proposer.Tests
{
public class ProposerTest
{
private readonly PrivateKey _admin;
private readonly PrivateKey _proposer;
private readonly BlockChain _blockChain;

public ProposerTest()
{
_admin = new PrivateKey();
_proposer = new PrivateKey();
var ncg = Currency.Uncapped("ncg", 2, null);
var policy = new DebugPolicy();
var actionTypeLoader = new NCActionLoader();
IStagePolicy stagePolicy = new VolatileStagePolicy();
var mint = new PrepareRewardAssets
{
RewardPoolAddress = _proposer.Address,
Assets = new List<FungibleAssetValue>
{
1 * Currencies.Mead,
},
};

var validatorSet = new ValidatorSet(
new List<Validator> { new(_proposer.PublicKey, 10_000_000_000_000_000_000) });

var initializeStates = new InitializeStates(
validatorSet,
new RankingState0(),
new ShopState(),
new Dictionary<string, string>(),
new GameConfigState(),
new RedeemCodeState(new Dictionary<PublicKey, RedeemCodeState.Reward>()),
new ActivatedAccountsState(),
new GoldCurrencyState(ncg),
new GoldDistribution[] { },
new PendingActivationState[] { });

List <ActionBase> actions = new List<ActionBase>
{
initializeStates,
};

var genesis = BlockChain.ProposeGenesisBlock(
privateKey: _proposer,
transactions: ImmutableList<Transaction>.Empty
.Add(Transaction.Create(
0, _proposer, null, actions.ToPlainValues())),
timestamp: DateTimeOffset.MinValue);

var store = new MemoryStore();
var stateStore = new TrieStateStore(new MemoryKeyValueStore());

_blockChain = BlockChain.Create(
policy,
stagePolicy,
store,
stateStore,
genesis,
new ActionEvaluator(
policy.PolicyActionsRegistry,
stateStore,
new NCActionLoader()
),
new[] { new BlockRenderer(), }
);
}

[Fact]
public void ProposeBlock()
{
Block block = _blockChain.ProposeBlock(_proposer);
_blockChain.Append(
block,
GenerateBlockCommit(
block,
_proposer,
10_000_000_000_000_000_000));
}

[Fact]
public void AssertInvalidProposer()
{
Block block = _blockChain.ProposeBlock(_proposer);
Assert.Throws<InvalidBlockCommitException>(() => _blockChain.Append(
block,
GenerateBlockCommit(
block,
new PrivateKey(),
10_000_000_000_000_000_000)));
}

[Fact]
public void AssertInvalidPower()
{
Block block = _blockChain.ProposeBlock(_proposer);
Assert.Throws<InvalidBlockCommitException>(() => _blockChain.Append(
block,
GenerateBlockCommit(
block,
_proposer,
10_000_000_000_000_000)));
}

private BlockCommit? GenerateBlockCommit(
Block block, PrivateKey privateKey, BigInteger power)
{
return block.Index != 0
? new BlockCommit(
block.Index,
0,
block.Hash,
ImmutableArray.Create(
new VoteMetadata(
block.Index,
0,
block.Hash,
DateTimeOffset.UtcNow,
privateKey.PublicKey,
power,
VoteFlag.PreCommit).Sign(privateKey)))
: null;
}
}
}
12 changes: 7 additions & 5 deletions .Lib9c.Tests/Action/AccountStateDeltaExtensionsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void SetWorldBossKillReward(int level, int expectedRune, int expectedCrys
IWorld states = new World(MockUtil.MockModernWorldState);
var rewardInfoAddress = new PrivateKey().Address;
var rewardRecord = new WorldBossKillRewardRecord();
for (int i = 0; i < level; i++)
for (var i = 0; i < level; i++)
{
rewardRecord[i] = false;
}
Expand All @@ -67,11 +67,13 @@ public void SetWorldBossKillReward(int level, int expectedRune, int expectedCrys
);
var bossId = bossState.Id;
var runeWeightSheet = new RuneWeightSheet();
runeWeightSheet.Set($@"id,boss_id,rank,rune_id,weight
runeWeightSheet.Set(
$@"id,boss_id,rank,rune_id,weight
1,{bossId},0,10001,100
");
var killRewardSheet = new WorldBossKillRewardSheet();
killRewardSheet.Set($@"id,boss_id,rank,rune_min,rune_max,crystal,circle
killRewardSheet.Set(
$@"id,boss_id,rank,rune_min,rune_max,crystal,circle
1,{bossId},0,1,1,100,0
");

Expand Down Expand Up @@ -176,8 +178,8 @@ public void Mead(int agentBalance)
var agentContractAddress = _agentAddress.GetPledgeAddress();
var mead = Currencies.Mead;
var price = RequestPledge.DefaultRefillMead * mead;
ActionContext context = new ActionContext();
IWorld states = new World(MockUtil.MockModernWorldState)
var context = new ActionContext();
var states = new World(MockUtil.MockModernWorldState)
.SetLegacyState(
agentContractAddress,
List.Empty.Add(patron.Serialize()).Add(true.Serialize()))
Expand Down
32 changes: 16 additions & 16 deletions .Lib9c.Tests/Action/AccountStateViewExtensionsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ public void TryGetAvatarStateKeyNotFoundException()
{
var states = new World(MockUtil.MockModernWorldState)
.SetLegacyState(
default,
Dictionary.Empty
.Add("agentAddress", default(Address).Serialize())
);
default,
Dictionary.Empty
.Add("agentAddress", default(Address).Serialize())
);

Assert.False(states.TryGetAvatarState(default, default, out _));
}
Expand Down Expand Up @@ -110,7 +110,7 @@ public void GetAvatarStateV2()
[InlineData("questList")]
public void GetAvatarStateV2_Throw_FailedLoadStateException(string account)
{
Address accountAddress = account switch
var accountAddress = account switch
{
"inventory" => Addresses.Inventory,
"worldInformation" => Addresses.WorldInformation,
Expand All @@ -131,7 +131,7 @@ public void GetAvatarStateV2_Throw_FailedLoadStateException(string account)
[Fact]
public void TryGetAvatarState()
{
IWorld states = new World(MockUtil.MockModernWorldState).SetAvatarState(_avatarAddress, _avatarState);
var states = new World(MockUtil.MockModernWorldState).SetAvatarState(_avatarAddress, _avatarState);
Assert.True(states.TryGetAvatarState(_agentAddress, _avatarAddress, out _));
}

Expand Down Expand Up @@ -193,8 +193,8 @@ public void GetSheets()
public void GetCrystalCostState(bool exist)
{
IWorld states = new World(MockUtil.MockModernWorldState);
int expectedCount = exist ? 1 : 0;
FungibleAssetValue expectedCrystal = exist
var expectedCount = exist ? 1 : 0;
var expectedCrystal = exist
? 100 * CrystalCalculator.CRYSTAL
: 0 * CrystalCalculator.CRYSTAL;
Address address = default;
Expand All @@ -205,7 +205,7 @@ public void GetCrystalCostState(bool exist)
states = states.SetLegacyState(address, crystalCostState.Serialize());
}

CrystalCostState actual = states.GetCrystalCostState(address);
var actual = states.GetCrystalCostState(address);
Assert.Equal(expectedCount, actual.Count);
Assert.Equal(expectedCrystal, actual.CRYSTAL);
}
Expand All @@ -217,15 +217,15 @@ public void GetCrystalCostState(bool exist)
[InlineData(151_200L, true)]
public void GetCrystalCostStates(long blockIndex, bool previousWeeklyExist)
{
long interval = _tableSheets.CrystalFluctuationSheet.Values.First(r => r.Type == CrystalFluctuationSheet.ServiceType.Combination).BlockInterval;
var interval = _tableSheets.CrystalFluctuationSheet.Values.First(r => r.Type == CrystalFluctuationSheet.ServiceType.Combination).BlockInterval;
var weeklyIndex = (int)(blockIndex / interval);
Address dailyCostAddress =
var dailyCostAddress =
Addresses.GetDailyCrystalCostAddress((int)(blockIndex / CrystalCostState.DailyIntervalIndex));
Address weeklyCostAddress = Addresses.GetWeeklyCrystalCostAddress(weeklyIndex);
Address previousCostAddress = Addresses.GetWeeklyCrystalCostAddress(weeklyIndex - 1);
Address beforePreviousCostAddress = Addresses.GetWeeklyCrystalCostAddress(weeklyIndex - 2);
var weeklyCostAddress = Addresses.GetWeeklyCrystalCostAddress(weeklyIndex);
var previousCostAddress = Addresses.GetWeeklyCrystalCostAddress(weeklyIndex - 1);
var beforePreviousCostAddress = Addresses.GetWeeklyCrystalCostAddress(weeklyIndex - 2);
var crystalCostState = new CrystalCostState(default, 100 * CrystalCalculator.CRYSTAL);
IWorld state = new World(MockUtil.MockModernWorldState)
var state = new World(MockUtil.MockModernWorldState)
.SetLegacyState(dailyCostAddress, crystalCostState.Serialize())
.SetLegacyState(weeklyCostAddress, crystalCostState.Serialize())
.SetLegacyState(previousCostAddress, crystalCostState.Serialize())
Expand Down Expand Up @@ -311,7 +311,7 @@ public void GetCouponWallet()

states = states.SetLegacyState(
agentAddress1.Derive(CouponWalletKey),
(Bencodex.Types.Binary)new byte[] { 0x00 });
(Bencodex.Types.Binary)new byte[] { 0x00, });

Assert.Throws<InvalidCastException>(() => states.GetCouponWallet(agentAddress1));
Assert.Throws<InvalidCastException>(() => states.GetCouponWallet(agentAddress2));
Expand Down
33 changes: 18 additions & 15 deletions .Lib9c.Tests/Action/ActionContextExtensionsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public static IEnumerable<object[]> IsMainNetTestcases()
Currency.Legacy("BTC", 2, new Address("47d082a115c63e7b58b1532d20e631538eafadde"))),
false,
};
#pragma warning restore CS0618
#pragma warning restore CS0618
}

public static IEnumerable<object[]> IsPreviewNetTestcases()
Expand Down Expand Up @@ -156,20 +156,23 @@ public void IsMainNet(GoldCurrencyState goldCurrencyState, bool expected)
[Fact]
public void Since()
{
Assert.True(new ActionContext
{
BlockIndex = 1001,
}.Since(1000));

Assert.True(new ActionContext
{
BlockIndex = 0,
}.Since(0));

Assert.False(new ActionContext
{
BlockIndex = 0,
}.Since(1));
Assert.True(
new ActionContext
{
BlockIndex = 1001,
}.Since(1000));

Assert.True(
new ActionContext
{
BlockIndex = 0,
}.Since(0));

Assert.False(
new ActionContext
{
BlockIndex = 0,
}.Since(1));
}
}
}
18 changes: 10 additions & 8 deletions .Lib9c.Tests/Action/ActionEvaluationTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ private ActionBase GetAction(Type type)
new PrivateKey().Address,
ItemSubType.Armor,
#pragma warning disable CS0618
// Use of obsolete method Currency.Legacy(): https://github.com/planetarium/lib9c/discussions/1319
// Use of obsolete method Currency.Legacy(): https://github.com/planetarium/lib9c/discussions/1319
Currency.Legacy("NCG", 2, null) * 10
#pragma warning restore CS0618
),
Expand All @@ -181,7 +181,7 @@ private ActionBase GetAction(Type type)
CombinationConsumable _ => new CombinationConsumable(),
CombinationEquipment _ => new CombinationEquipment(),
CreatePendingActivation _ => new CreatePendingActivation(
new PendingActivationState(new byte[] { 0x0 }, new PrivateKey().PublicKey)
new PendingActivationState(new byte[] { 0x0, }, new PrivateKey().PublicKey)
),
DailyReward _ => new DailyReward(),
InitializeStates _ => new InitializeStates
Expand Down Expand Up @@ -437,13 +437,15 @@ private ActionBase GetAction(Type type)
CreatePledge _ => new CreatePledge
{
PatronAddress = new PrivateKey().Address,
AgentAddresses = new[] { (new PrivateKey().Address, new PrivateKey().Address) },
AgentAddresses = new[] { (new PrivateKey().Address, new PrivateKey().Address), },
Mead = 4,
},
TransferAssets _ => new TransferAssets(_sender, new List<(Address, FungibleAssetValue)>
{
(_signer, 1 * _currency),
}),
TransferAssets _ => new TransferAssets(
_sender,
new List<(Address, FungibleAssetValue)>
{
(_signer, 1 * _currency),
}),
RuneSummon _ => new RuneSummon
{
AvatarAddress = _sender,
Expand Down Expand Up @@ -476,7 +478,7 @@ private ActionBase GetAction(Type type)
),
},
},
RetrieveAvatarAssets _ => new RetrieveAvatarAssets(avatarAddress: new PrivateKey().Address),
RetrieveAvatarAssets _ => new RetrieveAvatarAssets(new PrivateKey().Address),
MigrateFee _ => new MigrateFee
{
TransferData = new List<(Address sender, Address recipient, BigInteger amount)>
Expand Down
Loading
Loading