-
Notifications
You must be signed in to change notification settings - Fork 5
feat: add correct records functionality #288
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
37abfa9
feat: add correction functionality to audit trail records
itsyaasir 79e0d72
feat: add example for correcting records in audit trail
itsyaasir 068328a
Merge branch 'main' into feat/correct-record
itsyaasir a97dc90
feat: refactor record handling and improve timestamp retrieval
itsyaasir 45a5944
feat: update record correction API to use RecordInput struct for impr…
itsyaasir 7972197
feat: streamline capability lookup by removing redundant function and…
itsyaasir 97c779a
feat: add correction record functionality and enhance related documen…
itsyaasir 3b1b260
feat: update linked table node fetching to use new fetch_node functio…
itsyaasir 308aedb
feat: simplify PhantomData usage in TrailRecords struct
itsyaasir 1ab34c7
feat: refactor transaction apply methods to utilize new apply_with_ev…
itsyaasir e454d41
feat: add upgrade script for IOTA Audit Trails package management
itsyaasir 5678a1d
feat: remove localnet specific export for IOTA_TF_COMPONENTS_PKG_ID i…
itsyaasir File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,78 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Copyright 2020-2026 IOTA Stiftung | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| script_dir=$(cd "$(dirname "$0")" && pwd) | ||
| package_dir="$script_dir/.." | ||
|
|
||
| active_env=$(iota client active-env --json | jq -r '.') | ||
| chain_id=$(iota client chain-identifier) | ||
|
|
||
| current_pkg_id=$( | ||
| toml get "$package_dir/Move.lock" env \ | ||
| | jq -r --arg chain_id "$chain_id" ' | ||
| map(values | select(."chain-id" == $chain_id) ."latest-published-id") | ||
| | first | ||
| ' | ||
| ) | ||
|
|
||
| if [[ -z "$current_pkg_id" || "$current_pkg_id" == "null" ]]; then | ||
| echo "failed to find current Audit Trails package ID for chain $chain_id in Move.lock" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| upgrade_cap_id=$( | ||
| iota client objects --json \ | ||
| | jq -r --arg current_pkg_id "$current_pkg_id" ' | ||
| map( | ||
| select( | ||
| .data.type == "0x2::package::UpgradeCap" | ||
| and .data.content.fields.package == $current_pkg_id | ||
| ) | ||
| ) | ||
| | first | ||
| | .data.objectId | ||
| ' | ||
| ) | ||
|
|
||
| if [[ -z "$upgrade_cap_id" || "$upgrade_cap_id" == "null" ]]; then | ||
| echo "failed to find UpgradeCap for Audit Trails package $current_pkg_id" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| upgrade_args=( | ||
| iota client upgrade | ||
| --upgrade-capability "$upgrade_cap_id" | ||
| --verify-compatibility | ||
| --silence-warnings | ||
| --json | ||
| --gas-budget 500000000 | ||
| ) | ||
|
|
||
| if [[ "$active_env" == "localnet" ]]; then | ||
| upgrade_args+=(--with-unpublished-dependencies) | ||
| fi | ||
|
|
||
| echo "upgrading Audit Trails package $current_pkg_id using UpgradeCap $upgrade_cap_id" >&2 | ||
|
|
||
| response=$("${upgrade_args[@]}" "$package_dir") | ||
|
|
||
| audit_trail_package_id=$( | ||
| echo "$response" | jq -r ' | ||
| .objectChanges[] | ||
| | select(.type == "published") | ||
| | .packageId | ||
| ' | ||
| ) | ||
|
|
||
| if [[ -z "$audit_trail_package_id" || "$audit_trail_package_id" == "null" ]]; then | ||
| echo "$response" >&2 | ||
| echo "failed to extract upgraded Audit Trails package ID from upgrade response" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| export IOTA_AUDIT_TRAIL_PKG_ID="$audit_trail_package_id" | ||
| printf 'export IOTA_AUDIT_TRAIL_PKG_ID=%s\n' "$IOTA_AUDIT_TRAIL_PKG_ID" |
This file contains hidden or 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
This file contains hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.