Skip to content

Update rippled.cfg file #824

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
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
76 changes: 13 additions & 63 deletions .ci-config/rippled.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@ 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
Expand All @@ -21,11 +14,6 @@ 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
Expand All @@ -35,26 +23,13 @@ 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)?
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are all the comments removed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've explained in point-2 under "Context of Change": #824 (comment)

Copy link
Collaborator

Choose a reason for hiding this comment

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

The comments are for us, not for rippled - they're supposed to be ignored by rippled

# Integer value that defines the number of ledgers
# between online deletion events
online_delete=256
type = NuDB
path = /var/lib/rippled/db/nudb
advisory_delete = 0
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]
Expand All @@ -76,41 +51,15 @@ r.ripple.com 51235
validators.txt

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

# severity (order: lots of information .. only errors)
# debug
# info
# warn
# error
# fatal
{ "command" = "log_level", "severity": "info" }

[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

# network_id is required otherwise it's read as None
[network_id]
63456

[features]
# Devnet amendments as of June 28th, 2023
NegativeUNL
fixRemoveNFTokenAutoTrustLine
NonFungibleTokensV1
Expand Down Expand Up @@ -157,32 +106,26 @@ 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-b4 Amendments
XChainBridge
DID
# 2.2.0-b3 Amendments
fixNFTokenReserve
fixInnerObjTemplate
fixAMMOverflowOffer
PriceOracle
fixEmptyDID
fixXChainRewardRounding
fixPreviousTxnID
# 2.3.0 Amendments
fixAMMv1_1
fixAMMv1_2
AMMClawback
Expand All @@ -196,9 +139,16 @@ fixEnforceNFTokenTrustline
fixReducedOffersV2
DeepFreeze
PermissionedDomains
DynamicNFT
fixInvalidTxFlags
fixFrozenLPTokenTransfer
fixFillOrKill
fixDisallowIncomingV1
fixNFTokenNegOffer
fixNFTokenDirV1

# This section can be used to simulate various FeeSettings scenarios for rippled node in standalone mode
[voting]
reference_fee = 200 # 200 drops
account_reserve = 20000000 # 20 XRP
owner_reserve = 5000000 # 5 XRP

27 changes: 23 additions & 4 deletions .github/workflows/integration_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}

- name: Load cached .local
id: cache-poetry
Expand All @@ -30,10 +33,6 @@ jobs:
path: /home/runner/.local
key: dotlocal-${{ env.POETRY_VERSION }}

- name: Run docker in background
run: |
docker run --detach --rm -p 5005:5005 -p 6006:6006 --volume "${{ github.workspace }}/.ci-config/":"/etc/opt/ripple/" --name rippled-service --health-cmd="rippled server_info || exit 1" --health-interval=5s --health-retries=10 --health-timeout=2s --env GITHUB_ACTIONS=true --env CI=true --entrypoint bash ${{ env.RIPPLED_DOCKER_IMAGE }} -c "rippled -a"

- name: Install poetry
if: steps.cache-poetry.outputs.cache-hit != 'true'
run: |
Expand All @@ -53,6 +52,26 @@ jobs:
- name: Install poetry dependencies
run: poetry install

- name: Fetch latest rippled amendments
if: ${{ github.event_name == 'pull_request' }}
run: |
poetry run python tools/fetch_rippled_amendments.py

- name: Add and commit rippled.cfg
Copy link
Collaborator

@mvadari mvadari Apr 8, 2025

Choose a reason for hiding this comment

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

Why run this as a part of integration tests rather than have a separate PR open on a cron job to update it? Feels potentially confusing to anyone submitting a PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Integration tests make use of a docker container. The rippled.cfg file is used to kick-start the rippled server with custom amendments. The results of the integration tests differ based on which amendments have been enabled in the standalone mode.

separate PR open on a cron job to update it

Are you suggesting Github Actions cron jobs (or) running a cron-job from my personal machine to periodically fetch rippled PRs ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

A GitHub Action cron job.

if: ${{ github.event_name == 'pull_request' }}
uses: EndBug/add-and-commit@v9
with:
message: 'Update rippled.cfg with latest amendments'
author_name: GitHub Actions
author_email: [email protected]
committer_name: GitHub Actions
committer_email: [email protected]
add: .ci-config/rippled.cfg

- name: Run docker in background
run: |
docker run --detach --rm -p 5005:5005 -p 6006:6006 --volume "${{ github.workspace }}/.ci-config/":"/etc/opt/ripple/" --name rippled-service --health-cmd="rippled server_info || exit 1" --health-interval=5s --health-retries=10 --health-timeout=2s --env GITHUB_ACTIONS=true --env CI=true --entrypoint bash ${{ env.RIPPLED_DOCKER_IMAGE }} -c "rippled -a"

- name: Integration test
run: |
poetry run poe test_integration
Expand Down
75 changes: 75 additions & 0 deletions tools/fetch_rippled_amendments.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
"""
This script fetches the latest amendments from (the `develop` branch of) rippled and
adds them to the `rippled.cfg` file.
"""

import configparser
import os
import re
import sys

import requests

CONFIG_FILE = os.path.join(os.getcwd(), ".ci-config", "rippled.cfg")
Copy link
Collaborator

Choose a reason for hiding this comment

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

It would be much more efficient to use the feature RPC on Devnet

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There are cases where new rippled amendments have been merged into the cpp code, but haven't been deployed into a devnet yet. I suspect this happens frequently for new amendments. Parsing the develop branch of the rippled repository covers this case.

I'm not strongly opposed to using the feature command on the devnet.

FEATURES_SECTION = "features"
RIPPLED_FEATURES_FILE = "https://raw.githubusercontent.com/XRPLF/rippled/develop/include/xrpl/protocol/detail/features.macro"

config = configparser.ConfigParser(
allow_no_value=True,
)
config.optionxform = str # type: ignore
config.read(CONFIG_FILE)


def fetch_rippled_amendments():
response = requests.get(RIPPLED_FEATURES_FILE, timeout=30)
if response.status_code == 200:
features_contents = response.text
feature_hits = re.findall(
r"^ *XRPL_FEATURE *\(([a-zA-Z0-9_]+), * Supported::yes, VoteBehavior::Default(?:Yes|No)",
features_contents,
re.MULTILINE,
)

fix_hits = re.findall(
r"^ *XRPL_FIX *\(([a-zA-Z0-9_]+), * Supported::yes, VoteBehavior::Default(?:Yes|No)",
features_contents,
re.MULTILINE,
)

print(fix_hits)

all_supported_amendments = feature_hits + ["fix" + f for f in fix_hits if f]
return all_supported_amendments
else:
print(f"Failed to fetch file. Status code: {response.status_code}")


if __name__ == "__main__":
if FEATURES_SECTION in config:
amendments_to_add = []
existing_amendments = [v for v in config[FEATURES_SECTION] if v]
new_rippled_amendments = fetch_rippled_amendments()
if new_rippled_amendments is None:
print("ERROR: Failed to fetch rippled amendments.")
sys.exit(1)

for v in new_rippled_amendments:
if v not in existing_amendments:
amendments_to_add.append(v)

if len(amendments_to_add) > 0:
print(
"INFO: The following amendments need to be inserted into the config file: "
+ ", ".join(amendments_to_add)
)

for v in amendments_to_add:
config.set(FEATURES_SECTION, v, value=None)

with open(CONFIG_FILE, "w", encoding="utf-8") as rippled_cfg_file:
config.write(rippled_cfg_file)
else:
print(f"INFO: No new amendments to add into the {CONFIG_FILE} file.")
else:
print(f"ERROR: No features section found in the {CONFIG_FILE} file.")