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

Fix fee of CreateMultisigAccount #2712

Merged
merged 7 commits into from
May 5, 2022
Merged
Changes from 1 commit
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
7 changes: 4 additions & 3 deletions src/neo/SmartContract/ApplicationEngine.Contract.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ partial class ApplicationEngine
/// The <see cref="InteropDescriptor"/> of System.Contract.CreateStandardAccount.
/// Calculates corresponding account scripthash for the given public key.
/// </summary>
public static readonly InteropDescriptor System_Contract_CreateStandardAccount = Register("System.Contract.CreateStandardAccount", nameof(CreateStandardAccount), 1 << 8, CallFlags.None);
public static readonly InteropDescriptor System_Contract_CreateStandardAccount = Register("System.Contract.CreateStandardAccount", nameof(CreateStandardAccount), CheckSigPrice, CallFlags.None);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My gut feeling is that computationally it's more like CheckSigPrice/2, but that needs to be measured of course.


/// <summary>
/// The <see cref="InteropDescriptor"/> of System.Contract.CreateMultisigAccount.
/// Calculates corresponding multisig account scripthash for the given public keys.
/// </summary>
public static readonly InteropDescriptor System_Contract_CreateMultisigAccount = Register("System.Contract.CreateMultisigAccount", nameof(CreateMultisigAccount), 1 << 8, CallFlags.None);
public static readonly InteropDescriptor System_Contract_CreateMultisigAccount = Register("System.Contract.CreateMultisigAccount", nameof(CreateMultisigAccount), 0, CallFlags.None);

/// <summary>
/// The <see cref="InteropDescriptor"/> of System.Contract.NativeOnPersist.
Expand Down Expand Up @@ -132,8 +132,9 @@ internal protected static UInt160 CreateStandardAccount(ECPoint pubKey)
/// <param name="m">The minimum number of correct signatures that need to be provided in order for the verification to pass.</param>
/// <param name="pubKeys">The public keys of the account.</param>
/// <returns>The hash of the account.</returns>
internal protected static UInt160 CreateMultisigAccount(int m, ECPoint[] pubKeys)
internal protected UInt160 CreateMultisigAccount(int m, ECPoint[] pubKeys)
{
AddGas(CheckSigPrice * pubKeys.Length * ExecFeeFactor);
erikzhang marked this conversation as resolved.
Show resolved Hide resolved
return Contract.CreateMultiSigRedeemScript(m, pubKeys).ToScriptHash();
}

Expand Down