Skip to content

Commit

Permalink
Merge branch 'main' into Missing_Functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
dangell7 committed May 10, 2024
2 parents 4ac79a1 + 27659c0 commit 66099fb
Show file tree
Hide file tree
Showing 18 changed files with 380 additions and 132 deletions.
172 changes: 172 additions & 0 deletions .ci-config/rippled.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
[server]
port_rpc_admin_local
port_ws_public
port_ws_admin_local

# port_peer
# port_ws_admin_local
# ssl_key = /etc/ssl/private/server.key
# ssl_cert = /etc/ssl/certs/server.crt

# IPs must be 0.0.0.0 instead of 127.0.0.1 to be accessed outside the docker container

[port_rpc_admin_local]
port = 5005
ip = 0.0.0.0
admin = 0.0.0.0
protocol = http

[port_ws_public]
port = 80
ip = 0.0.0.0
protocol = ws

# [port_peer]
# port = 51235
# ip = 0.0.0.0
# protocol = peer

[port_ws_admin_local]
port = 6006
ip = 0.0.0.0
admin = 0.0.0.0
protocol = ws

[node_size]
small

# tiny
# small
# medium
# large
# huge

[node_db]
type=NuDB
path=/var/lib/rippled/db/nudb
advisory_delete=0

# How many ledgers do we want to keep (history)?
# Integer value that defines the number of ledgers
# between online deletion events
online_delete=256

[ledger_history]
# How many ledgers do we want to keep (history)?
# Integer value (ledger count)
# or (if you have lots of TB SSD storage): 'full'
256

[database_path]
/var/lib/rippled/db

[debug_logfile]
/var/log/rippled/debug.log

[sntp_servers]
time.windows.com
time.apple.com
time.nist.gov
pool.ntp.org

[ips]
r.ripple.com 51235

[validators_file]
validators.txt

[rpc_startup]
{ "command": "log_level", "severity": "info" }

# severity (order: lots of information .. only errors)
# debug
# info
# warn
# error
# fatal

[ssl_verify]
1

# The [features] stanza does not currently work for standalone mode: https://github.com/XRPLF/xrpl-dev-portal/issues/1762#issuecomment-1441252450


# In order to enable an amendment which by default would vote "No", you must include its amendment id and name here.
# To add amendments specifically from the latest releases of rippled:
# 1. Go to https://xrpl.org/known-amendments.html
# 2. Find the first amendment in the latest releases of rippled which are not already in the list below
# 3. Click on each amendment to get their Amendment ID and name to add to this list manually.
# You will likely update the list with all amendments from a new release of rippled all at once.

# To get the list of amendments on a network (e.g. devnet) follow the steps in xrpl.js's CONTRIBUTING.md for "Updating the Docker container".
# https://github.com/XRPLF/xrpl.js/blob/main/CONTRIBUTING.md
# (Running the script `getNewAmendments.js` should help you identify any new amendments that should be added.)
#
# Note: The version of rippled you use this config with must have an implementation for the amendments you attempt to enable or it will crash.
# If you need the version of rippled to be more up to date, you may need to make a comment on this repo: https://github.com/WietseWind/docker-rippled

[features]
# Devnet amendments as of June 28th, 2023
NegativeUNL
fixRemoveNFTokenAutoTrustLine
NonFungibleTokensV1
CheckCashMakesTrustLine
fixRmSmallIncreasedQOffers
fixSTAmountCanonicalize
FlowSortStrands
TicketBatch
fix1201
fixQualityUpperBound
FlowCross
EnforceInvariants
fix1523
HardenedValidations
DepositPreauth
MultiSignReserve
fix1623
FeeEscalation
PayChan
fix1513
RequireFullyCanonicalSig
fix1543
TickSize
fix1781
fixCheckThreading
fix1515
CryptoConditions
fix1528
fixPayChanRecipientOwnerDir
SortedDirectories
fix1578
fix1571
fixAmendmentMajorityCalc
fixTakerDryOfferRemoval
fixMasterKeyAsRegularKey
Flow
Escrow
TrustSetAuth
DeletableAccounts
DepositAuth
fix1368
fix1512
fix1373
MultiSign
Checks
NonFungibleTokensV1_1
# 1.10.0 Amendments
DisallowIncoming
fixNonFungibleTokensV1_2
fixTrustLinesToSelf
fixUniversalNumber
ImmediateOfferKilled
XRPFees
# 1.11.0 Amendments
ExpandedSignerList
# 1.12.0 Amendments
AMM
Clawback
fixReducedOffersV1
fixNFTokenRemint
# 2.0.0 Amendments
XChainBridge
DID
26 changes: 15 additions & 11 deletions .github/workflows/dotnet.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

name: .NET CI

env:
RIPPLED_DOCKER_IMAGE: rippleci/rippled:2.0.0-b4

on:
push:
branches: [ main ]
Expand Down Expand Up @@ -44,17 +47,14 @@ jobs:

integration:
runs-on: ubuntu-latest

services:
rippled:
image: natenichols/rippled-standalone:latest
ports:
- 6006:6006
options:
--health-cmd="wget localhost:6006 || exit 1" --health-interval=5s --health-retries=10 --health-timeout=2s


steps:
- uses: actions/checkout@v3

- name: Run docker in background
run: |
docker run --detach --rm --name rippled-service -p 6006:6006 --volume "${{ github.workspace }}/.ci-config/":"/opt/ripple/etc/" --health-cmd="wget localhost:6006 || exit 1" --health-interval=5s --health-retries=10 --health-timeout=2s --env GITHUB_ACTIONS=true --env CI=true ${{ env.RIPPLED_DOCKER_IMAGE }} /opt/ripple/bin/rippled -a --conf /opt/ripple/etc/rippled.cfg
- name: Use .NET "${{ matrix.dotnet }}"
uses: actions/setup-dotnet@v3
with:
Expand All @@ -63,8 +63,12 @@ jobs:
run: dotnet restore
- name: Build
run: dotnet build
- name: Test Unit
- name: Test Integration
run: dotnet test --verbosity normal --filter "TestI"
env:
HOST: localhost
PORT: ${{ job.services.rippled.ports['6006'] }}
PORT: ${{ job.services.rippled.ports['6006'] }}

- name: Stop docker container
if: always()
run: docker stop rippled-service
1 change: 0 additions & 1 deletion Base/Xrpl.BinaryCodec/Binary/BytesList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public byte[] ToBytes()
AddBytes(bytes, 0);
return bytes;
}

/// <summary> Hex Lookup </summary>
public static string[] HexLookup = new string[256];
static BytesList()
Expand Down
File renamed without changes.
11 changes: 4 additions & 7 deletions Base/Xrpl.BinaryCodec/Enums/Field.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using Xrpl.BinaryCodec.Types;

namespace Xrpl.BinaryCodec.Enums
{
Expand Down Expand Up @@ -141,7 +142,6 @@ private bool IsVlEncodedType()
public static readonly Uint32Field BurnedTokens = new Uint32Field(nameof(BurnedTokens), 44);
public static readonly Uint32Field HookStateCount = new Uint32Field(nameof(HookStateCount), 45);
public static readonly Uint32Field EmitGeneration = new Uint32Field(nameof(EmitGeneration), 46);

public static readonly Uint32Field VoteWeight = new Uint32Field(nameof(VoteWeight), 47);
public static readonly Uint32Field DiscountedFee = new Uint32Field(nameof(DiscountedFee), 48);

Expand Down Expand Up @@ -227,8 +227,6 @@ private bool IsVlEncodedType()
public static readonly AmountField Price = new AmountField(nameof(Price), 23);
public static readonly AmountField LPTokenBalance = new AmountField(nameof(LPTokenBalance), 24);

public static readonly AmountField HookCallbackFee = new AmountField(nameof(HookCallbackFee), 20);

public static readonly BlobField PublicKey = new BlobField(nameof(PublicKey), 1);
public static readonly BlobField MessageKey = new BlobField(nameof(MessageKey), 2);
public static readonly BlobField SigningPubKey = new BlobField(nameof(SigningPubKey), 3);
Expand Down Expand Up @@ -263,7 +261,7 @@ private bool IsVlEncodedType()
public static readonly AccountIdField RegularKey = new AccountIdField(nameof(RegularKey), 8);
public static readonly AccountIdField NFTokenMinter = new AccountIdField(nameof(NFTokenMinter), 9);
public static readonly AccountIdField EmitCallback = new AccountIdField(nameof(EmitCallback), 10);
public static readonly AccountIdField AMMAccount = new AccountIdField(nameof(AMMAccount), 11);
public static readonly AccountIdField AMMAccount = new AccountIdField(nameof(AMMAccount), 11);
public static readonly AccountIdField HookAccount = new AccountIdField(nameof(HookAccount), 16);

public static readonly Vector256Field Indexes = new Vector256Field(nameof(Indexes), 1);
Expand Down Expand Up @@ -301,8 +299,7 @@ private bool IsVlEncodedType()
public static readonly StObjectField VoteEntry = new StObjectField(nameof(VoteEntry), 25);
public static readonly StObjectField AuctionSlot = new StObjectField(nameof(AuctionSlot), 27);
public static readonly StObjectField AuthAccount = new StObjectField(nameof(AuthAccount), 28);

public static readonly StArrayField Signers = new StArrayField(nameof(Signers), 3, isSigningField: false);
public static readonly StArrayField Signers = new StArrayField(nameof(Signers), 3, isSigningField:false);
public static readonly StArrayField SignerEntries = new StArrayField(nameof(SignerEntries), 4);
public static readonly StArrayField Template = new StArrayField(nameof(Template), 5);
public static readonly StArrayField Necessary = new StArrayField(nameof(Necessary), 6);
Expand All @@ -311,7 +308,7 @@ private bool IsVlEncodedType()
public static readonly StArrayField Memos = new StArrayField(nameof(Memos), 9);
public static readonly StArrayField NFTokens = new StArrayField(nameof(NFTokens), 10);
public static readonly StArrayField Hooks = new StArrayField(nameof(Hooks), 11);
public static readonly StArrayField VoteSlots = new StArrayField(nameof(VoteSlots), 14);
public static readonly StArrayField VoteSlots = new StArrayField(nameof(VoteSlots), 14);
public static readonly StArrayField Majorities = new StArrayField(nameof(Majorities), 16);
public static readonly StArrayField DisabledValidators = new StArrayField(nameof(DisabledValidators), 17);
public static readonly StArrayField HookExecutions = new StArrayField(nameof(HookExecutions), 18);
Expand Down
6 changes: 4 additions & 2 deletions Base/Xrpl.BinaryCodec/Enums/FieldType.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace Xrpl.BinaryCodec.Enums
using Xrpl.BinaryCodec.Types;

namespace Xrpl.BinaryCodec.Enums
{
public class FieldType : EnumItem
{
Expand All @@ -24,7 +26,7 @@ public FieldType(string name, int ordinal) : base(name, ordinal)
public static readonly FieldType Hash160 = new FieldType(nameof(Hash160), 17);
public static readonly FieldType PathSet = new FieldType(nameof(PathSet), 18);
public static readonly FieldType Vector256 = new FieldType(nameof(Vector256), 19);
public static readonly FieldType Issue = new FieldType(nameof(Issue), 24);
public static readonly FieldType Issue = new FieldType(nameof(Issue), 24);
public static readonly FieldType Transaction = new FieldType(nameof(Transaction), 10001);
public static readonly FieldType LedgerEntry = new FieldType(nameof(LedgerEntry), 10002);
public static readonly FieldType Validation = new FieldType(nameof(Validation), 10003);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Xrpl.BinaryCodec.Enums;

namespace Xrpl.BinaryCodec.Types
namespace Xrpl.BinaryCodec.Enums
{
public class TransactionType : SerializedEnumItem<ushort>
{
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ dotnet test --verbosity normal --filter "TestU"
### Integration Tests

## Running Tests
For integration tests, we use a `rippled` node in standalone mode to test XRPLSwift code against. To set this up, you can either run `rippled` locally, or set up the Docker container `natenichols/rippled-standalone:latest` for this purpose. The latter will require you to [install Docker](https://docs.docker.com/get-docker/).
For integration tests, we use a `rippled` node in standalone mode to test XRPLSwift code against. To set this up, you can either run `rippled` locally, or set up the Docker container `xrpllabsofficial/xrpld:1.12.0` for this purpose. The latter will require you to [install Docker](https://docs.docker.com/get-docker/).

```bash
# sets up the rippled standalone Docker container - you can skip this step if you already have it set up
docker run -p 6006:6006 -it natenichols/rippled-standalone:latest
docker run -p 6006:6006 --interactive -t --volume $PWD/.ci-config:/config/ xrpllabsofficial/xrpld:1.12.0 -a --start
dotnet build
dotnet test--verbosity normal --filter "TestI"
```
Expand Down
8 changes: 0 additions & 8 deletions Tests/Xrpl.Tests/Models/TestAMMBid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,6 @@ public async Task TestVerifyValid()
//verifies valid AMMBid
await Validation.Validate(bid);









//throws w/ missing field Asset
bid.Remove("Asset");
await Assert.ThrowsExceptionAsync<ValidationException>(() => Validation.Validate(bid), "AMMBid: missing field Asset");
Expand Down
3 changes: 2 additions & 1 deletion Tests/Xrpl.Tests/Models/TestAccountSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
// https://github.com/XRPLF/xrpl.js/blob/main/packages/xrpl/test/models/accountSet.ts

using Microsoft.VisualStudio.TestTools.UnitTesting;

using System.Collections.Generic;
using System.Threading.Tasks;

using Xrpl.Client.Exceptions;
using Xrpl.Models.Transaction;
using Xrpl.Models.Transactions;

namespace XrplTests.Xrpl.Models
Expand Down
Loading

0 comments on commit 66099fb

Please sign in to comment.