-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2744 from moreal/main-to-dev-1.16.0
Backmerge 1.16.0 release
- Loading branch information
Showing
61 changed files
with
1,789 additions
and
224 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
BenchmarkDotNet.Artifacts/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
using BenchmarkDotNet.Attributes; | ||
using Bencodex.Types; | ||
using Lib9c.Tests.Action; | ||
using Lib9c.Tests.Util; | ||
using Libplanet.Action.State; | ||
using Libplanet.Mocks; | ||
using Nekoyume; | ||
using Nekoyume.Action.Guild; | ||
using Nekoyume.Extensions; | ||
using Nekoyume.Module; | ||
using Nekoyume.Module.Guild; | ||
using Nekoyume.TypedAddress; | ||
|
||
namespace Lib9c.Benchmarks.Actions; | ||
|
||
public class AutoJoinGuild | ||
{ | ||
private AgentAddress signer = AddressUtil.CreateAgentAddress(); | ||
private IWorld worldEmpty; | ||
private IWorld worldWithPledge; | ||
private IWorld worldWithPledgeAndGuild; | ||
private IWorld worldAfterMigration; | ||
|
||
[GlobalSetup] | ||
public void Setup() | ||
{ | ||
worldEmpty = new World(MockUtil.MockModernWorldState); | ||
worldWithPledge = worldEmpty | ||
.SetLegacyState( | ||
signer.GetPledgeAddress(), | ||
new List(MeadConfig.PatronAddress.Bencoded, (Boolean)true, (Integer)4)); | ||
|
||
var guildMasterAddress = GuildConfig.PlanetariumGuildOwner; | ||
var guildAddress = AddressUtil.CreateGuildAddress(); | ||
worldWithPledgeAndGuild = worldWithPledge | ||
.MakeGuild(guildAddress, guildMasterAddress); | ||
worldAfterMigration = worldWithPledgeAndGuild | ||
.JoinGuild(guildAddress, signer); | ||
} | ||
|
||
[Benchmark] | ||
public void Execute_WithoutPledge() | ||
{ | ||
var action = new Nekoyume.PolicyAction.Tx.Begin.AutoJoinGuild(); | ||
action.Execute(new ActionContext | ||
{ | ||
IsPolicyAction = true, | ||
PreviousState = worldEmpty, | ||
Signer = signer, | ||
}); | ||
} | ||
|
||
[Benchmark] | ||
public void Execute_WithPledge_WithoutGuild() | ||
{ | ||
var action = new Nekoyume.PolicyAction.Tx.Begin.AutoJoinGuild(); | ||
action.Execute(new ActionContext | ||
{ | ||
IsPolicyAction = true, | ||
PreviousState = worldWithPledge, | ||
Signer = signer, | ||
}); | ||
} | ||
|
||
[Benchmark] | ||
public void Execute_WithPledge_WithGuild() | ||
{ | ||
var action = new Nekoyume.PolicyAction.Tx.Begin.AutoJoinGuild(); | ||
action.Execute(new ActionContext | ||
{ | ||
IsPolicyAction = true, | ||
PreviousState = worldWithPledgeAndGuild, | ||
Signer = signer, | ||
}); | ||
} | ||
|
||
[Benchmark] | ||
public void Execute_AfterMigration() | ||
{ | ||
var action = new Nekoyume.PolicyAction.Tx.Begin.AutoJoinGuild(); | ||
action.Execute(new ActionContext | ||
{ | ||
IsPolicyAction = true, | ||
PreviousState = worldAfterMigration, | ||
Signer = signer, | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
using BenchmarkDotNet.Attributes; | ||
using Bencodex.Types; | ||
using Lib9c.Tests.Action; | ||
using Lib9c.Tests.Util; | ||
using Libplanet.Action.State; | ||
using Libplanet.Mocks; | ||
using Nekoyume; | ||
using Nekoyume.Action.Guild; | ||
using Nekoyume.Extensions; | ||
using Nekoyume.Module; | ||
using Nekoyume.Module.Guild; | ||
using Nekoyume.TypedAddress; | ||
|
||
namespace Lib9c.Benchmarks.Actions; | ||
|
||
public class MigratePledgeToGuild | ||
{ | ||
private AgentAddress signer = AddressUtil.CreateAgentAddress(); | ||
private AgentAddress target = AddressUtil.CreateAgentAddress(); | ||
private IWorld worldEmpty; | ||
private IWorld worldWithPledge; | ||
private IWorld worldWithPledgeAndGuild; | ||
private IWorld worldAfterMigration; | ||
|
||
[GlobalSetup] | ||
public void Setup() | ||
{ | ||
worldEmpty = new World(MockUtil.MockModernWorldState); | ||
worldWithPledge = worldEmpty | ||
.SetLegacyState( | ||
target.GetPledgeAddress(), | ||
new List(MeadConfig.PatronAddress.Bencoded, (Boolean)true, (Integer)4)); | ||
|
||
var guildMasterAddress = GuildConfig.PlanetariumGuildOwner; | ||
var guildAddress = AddressUtil.CreateGuildAddress(); | ||
worldWithPledgeAndGuild = worldWithPledge | ||
.MakeGuild(guildAddress, guildMasterAddress); | ||
worldAfterMigration = worldWithPledgeAndGuild | ||
.JoinGuild(guildAddress, signer); | ||
} | ||
|
||
[Benchmark] | ||
public void Execute_WithoutPledge() | ||
{ | ||
var action = new Nekoyume.Action.Guild.Migration.MigratePledgeToGuild(target); | ||
try | ||
{ | ||
action.Execute(new ActionContext | ||
{ | ||
IsPolicyAction = false, | ||
PreviousState = worldEmpty, | ||
Signer = signer, | ||
}); | ||
} | ||
catch | ||
{ | ||
// Do nothing. | ||
} | ||
} | ||
|
||
[Benchmark] | ||
public void Execute_WithPledge_WithoutGuild() | ||
{ | ||
var action = new Nekoyume.Action.Guild.Migration.MigratePledgeToGuild(target); | ||
try | ||
{ | ||
action.Execute(new ActionContext | ||
{ | ||
IsPolicyAction = false, | ||
PreviousState = worldWithPledge, | ||
Signer = signer, | ||
}); | ||
} | ||
catch | ||
{ | ||
// Do nothing. | ||
} | ||
} | ||
|
||
[Benchmark] | ||
public void Execute_WithPledge_WithGuild() | ||
{ | ||
var action = new Nekoyume.Action.Guild.Migration.MigratePledgeToGuild(target); | ||
action.Execute(new ActionContext | ||
{ | ||
IsPolicyAction = false, | ||
PreviousState = worldWithPledgeAndGuild, | ||
Signer = signer, | ||
}); | ||
} | ||
|
||
[Benchmark] | ||
public void Execute_AfterMigration() | ||
{ | ||
var action = new Nekoyume.Action.Guild.Migration.MigratePledgeToGuild(target); | ||
try | ||
{ | ||
action.Execute(new ActionContext | ||
{ | ||
IsPolicyAction = false, | ||
PreviousState = worldAfterMigration, | ||
Signer = signer, | ||
}); | ||
} | ||
catch | ||
{ | ||
// Do nothing. | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using BenchmarkDotNet.Attributes; | ||
using Bencodex.Types; | ||
using Lib9c.Tests.Action; | ||
using Lib9c.Tests.Util; | ||
using Libplanet.Action.State; | ||
using Libplanet.Mocks; | ||
using Libplanet.Types.Assets; | ||
using Nekoyume; | ||
using Nekoyume.Action.Guild; | ||
using Nekoyume.Extensions; | ||
using Nekoyume.Module; | ||
using Nekoyume.Module.Guild; | ||
using Nekoyume.TypedAddress; | ||
|
||
namespace Lib9c.Benchmarks.Actions; | ||
|
||
public class TransferAsset | ||
{ | ||
private AgentAddress signer = AddressUtil.CreateAgentAddress(); | ||
private AgentAddress recipient = AddressUtil.CreateAgentAddress(); | ||
private Currency currency = Currency.Uncapped("NCG", 2, null); | ||
private IWorld world; | ||
|
||
[GlobalSetup] | ||
public void Setup() | ||
{ | ||
world = new World(MockUtil.MockModernWorldState) | ||
.MintAsset(new ActionContext(), signer, currency * 100); | ||
} | ||
|
||
[Benchmark] | ||
public void Execute() | ||
{ | ||
var action = new Nekoyume.Action.TransferAsset(signer, recipient, currency * 100); | ||
action.Execute(new ActionContext | ||
{ | ||
Signer = signer, | ||
PreviousState = world, | ||
IsPolicyAction = false, | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.