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 build warnings #101

Merged
merged 3 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 6 additions & 5 deletions .github/workflows/build-test-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

env:
RUST_FMT: nightly-2023-04-01-x86_64-unknown-linux-gnu
RUST_CLIPPY: 1.68
RUST_CLIPPY: 1.73

jobs:
rustfmt:
Expand Down Expand Up @@ -48,7 +48,7 @@ jobs:
run: cargo build --manifest-path=./rust-bindings/Cargo.toml --release

- name: Test Rust Project
run: cargo test --manifest-path=./rust-bindings/Cargo.toml --release
run: cargo test --manifest-path=./rust-bindings/Cargo.toml --release

- name: Setup .NET
uses: actions/setup-dotnet@v3
Expand All @@ -58,11 +58,12 @@ jobs:
- name: Restore dependencies
run: dotnet restore

- name: Check formatting
run: dotnet format --verify-no-changes

- name: Build
run: dotnet build --no-restore
run: dotnet build --no-restore -warnaserror

- name: Test
run: dotnet test --filter FullyQualifiedName!~IntegrationTests --no-build --verbosity normal

- name: Check formatting
run: dotnet format --verify-no-changes
2 changes: 1 addition & 1 deletion concordium-base
Submodule concordium-base updated 140 files
4 changes: 2 additions & 2 deletions examples/DeployModule/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ private static async Task Run(DeployModuleOptions o)

// Prepare the transaction for signing.
var sender = account.AccountAddress;
var sequenceNumber = client.GetNextAccountSequenceNumber(sender).Item1;
var (sequenceNumber, _) = await client.GetNextAccountSequenceNumberAsync(sender);
var expiry = Expiry.AtMinutesFromNow(30);
var preparedTransfer = transferPayload.Prepare(sender, sequenceNumber, expiry);

// Sign the transaction using the account keys.
var signedTransfer = preparedTransfer.Sign(account);

// Submit the transaction.
var txHash = client.SendAccountTransaction(signedTransfer);
var txHash = await client.SendAccountTransactionAsync(signedTransfer);

// Print the transaction hash.
Console.WriteLine($"Successfully submitted transfer transaction with hash {txHash}");
Expand Down
4 changes: 2 additions & 2 deletions examples/InitContract/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ private static async Task Run(InitContractOptions o)

// Prepare the transaction for signing.
var sender = account.AccountAddress;
var sequenceNumber = client.GetNextAccountSequenceNumber(sender).Item1;
var (sequenceNumber, _) = await client.GetNextAccountSequenceNumberAsync(sender);
var expiry = Expiry.AtMinutesFromNow(30);
var preparedPayload = payload.Prepare(sender, sequenceNumber, expiry, maxEnergy);

// Sign the transaction using the account keys.
var signedTrx = preparedPayload.Sign(account);

// Submit the transaction.
var txHash = client.SendAccountTransaction(signedTrx);
var txHash = await client.SendAccountTransactionAsync(signedTrx);

// Print the transaction hash.
Console.WriteLine($"Successfully submitted init-contract transaction with hash {txHash}");
Expand Down
90 changes: 77 additions & 13 deletions rust-bindings/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/Client/ConcordiumClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -812,5 +812,8 @@ public Task<QueryResponse<IAsyncEnumerable<BlockItem>>> GetBlockItems(IBlockHash
return QueryResponse<IAsyncEnumerable<BlockItem>>.From(response, BlockItem.From, token);
}

/// <summary>
/// Dispose the client
/// </summary>
public void Dispose() => this.Raw.Dispose();
}
3 changes: 3 additions & 0 deletions src/Client/RawClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -714,5 +714,8 @@ private static GrpcChannelOptions SetSchemeIfNotSet(GrpcChannelOptions? channelO
return channelOptions;
}

/// <summary>
/// Dispose the RawClient.
/// </summary>
public void Dispose() => this._grpcChannel.Dispose();
}
2 changes: 2 additions & 0 deletions src/Crypto/Ed25519SignKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public byte[] Sign(byte[] bytes)
return algorithm.Sign(key, bytes);
}

/// <summary> Determines whether one Ed25519SignKey is equal to a second Ed25519SignKey. </summary>
public bool Equals(Ed25519SignKey? other)
{
if (other is null)
Expand All @@ -98,5 +99,6 @@ public bool Equals(Ed25519SignKey? other)
return this._value.SequenceEqual(other._value);
}

/// <summary> Get hash code for the Ed25519SignKey. </summary>
public override int GetHashCode() => Helpers.HashCode.GetHashCodeByteArray(this._value);
}
1 change: 1 addition & 0 deletions src/Crypto/ISigner.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace Concordium.Sdk.Crypto;

/// <summary> Implementers of this interface hold keys for signing data. </summary>
public interface ISigner
{
/// <summary>
Expand Down
4 changes: 4 additions & 0 deletions src/Helpers/HashCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ namespace Concordium.Sdk.Helpers;
/// </summary>
public static class HashCode
{

/// <summary>
/// Helper for getting a hash code for a byte array.
/// </summary>
public static int GetHashCodeByteArray(byte[] array)
{
unchecked
Expand Down
2 changes: 1 addition & 1 deletion src/Transactions/ITransactionSigner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public interface ITransactionSigner
/// <summary>
/// Sign a transaction hash.
/// </summary>
/// <param name="bytes">A byte array representing the transaction hash to sign.</param>
/// <param name="data">A byte array representing the transaction hash to sign.</param>
/// <returns>A <see cref="AccountTransactionSignature"/> representing the transaction signature.</returns>
/// <exception cref="ArgumentException">Unexpected length of a signature returned by the signing.</exception>
public AccountTransactionSignature Sign(byte[] data);
Expand Down
3 changes: 3 additions & 0 deletions src/Transactions/RawPayload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@ public sealed record RawPayload(byte[] Bytes) : AccountTransactionPayload
/// </summary>
internal override PayloadSize Size() => new((uint)this.Bytes.Length);

/// <summary>
/// Get the array of bytes representing this payload.
/// </summary>
public override byte[] ToBytes() => this.Bytes;
}
2 changes: 2 additions & 0 deletions src/Transactions/TransactionSigner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ public sealed class TransactionSigner : ITransactionSigner
public TransactionSigner() =>
this._signers = new Dictionary<AccountCredentialIndex, Dictionary<AccountKeyIndex, ISigner>>();

/// <summary> Get the number of signatures this signer can produce.</summary>
public byte GetSignatureCount()
=> (byte)this._signers.Values.SelectMany(x => x.Values).Count();

/// <summary> Get credential-key-map of the signer.</summary>
public ImmutableDictionary<AccountCredentialIndex, ImmutableDictionary<AccountKeyIndex, ISigner>>
GetSignerEntries() => this._signers
.Select(
Expand Down
3 changes: 3 additions & 0 deletions src/Types/AccountAddress.cs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,10 @@ public static bool TryDeserial(ReadOnlySpan<byte> bytes, out (AccountAddress? Ac
return true;
}

/// <summary> Determines whether one AccountAddress is equal to a second AccountAddress. </summary>
/// <remarks> This does not consider two distinct aliases to the same account as equal. </remarks>
public bool Equals(AccountAddress? other) => other is not null && this._value.SequenceEqual(other._value);

/// <summary> Get hash code for the AccountAddress. </summary>
public override int GetHashCode() => Helpers.HashCode.GetHashCodeByteArray(this._value);
}
3 changes: 3 additions & 0 deletions src/Types/AccountSequenceNumber.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ namespace Concordium.Sdk.Types;
/// </summary>
public readonly record struct AccountSequenceNumber
{
/// <summary>
/// The number of bytes used to represent this type when serialized.
/// </summary>
public const uint BytesLength = sizeof(ulong);

/// <summary>
Expand Down
3 changes: 3 additions & 0 deletions src/Types/AccountStakingInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace Concordium.Sdk.Types;

/// <summary>
/// Information related to staking for a specific account.
/// </summary>
public interface IAccountStakingInfo { }

internal static class AccountStakingInfo
Expand Down
1 change: 1 addition & 0 deletions src/Types/AccountTransactionEffects.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ internal IEnumerable<AccountAddress> GetAffectedAccountAddresses()
/// </summary>
/// <param name="To">Receiver account.</param>
/// <param name="Amount">The list of releases. Ordered by increasing timestamp.</param>
/// <param name="Memo">Additional data attached to the transaction.</param>
public sealed record TransferredWithSchedule
(AccountAddress To, IList<(DateTimeOffset, CcdAmount)> Amount, OnChainData? Memo) : IAccountTransactionEffects
{
Expand Down
1 change: 1 addition & 0 deletions src/Types/BakerEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ internal static IBakerEvent From(BakerEvent bakerEvent) =>
),
BakerEvent.EventOneofCase.None =>
throw new MissingEnumException<BakerEvent.EventOneofCase>(bakerEvent.EventCase),
BakerEvent.EventOneofCase.DelegationRemoved => throw new NotImplementedException(),
limemloh marked this conversation as resolved.
Show resolved Hide resolved
_ => throw new MissingEnumException<BakerEvent.EventOneofCase>(bakerEvent.EventCase)
};
}
Expand Down
3 changes: 3 additions & 0 deletions src/Types/BakerPoolOpenStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace Concordium.Sdk.Types;

/// <summary>
/// The status of the baker pool in regards to delegations.
/// </summary>
public enum BakerPoolOpenStatus
{
/// <summary>
Expand Down
Loading
Loading