-
Closes AC-1572. `go build ./tools/cmd/debug` and then: - Marshal a transaction: `debug encode transaction '{...}'` (argument must be a transaction) - Hash a transaction: `debug encode transaction --hash '{...}'` (argument must be a transaction) - Marshal a header: `debug encode transaction header '{...}'` (argument must be a transaction header) - Hash a header: `debug encode transaction header --hash '{...}'` (argument must be a transaction header) - Marshal a body: `debug encode transaction body '{...}'` (argument must be a transaction body) - Hash a body: `debug encode transaction body --hash '{...}'` (argument must be a transaction body) - Marshal a signature: `debug encode signature '{...}'` (argument must be a signature) - Hash a signature: `debug encode signature --hash '{...}'` (argument must be a signature) - Finalize a signature: `debug sign '{...}' <private key>` (first argument must be a signature) When finalizing a signature, the first argument _must_ include the following fields: - `type` - the signature type as a string, e.g. `"ed25519"` - `signer` - the URL of the signer as a string, e.g. `"acc://ethan"` - `signerVersion` - the version of the key page, or 1 for lite token accounts - `transactionHash` - the hash of the transaction being signed When initiating a transaction, the signature _must_ include the timestamp field. To initiate a transaction: - Calculate the signature metadata hash with `debug encode signature --hash <signature metadata>`. The signature metadata is **all** of the signature fields except for `signature` and `transactionHash`. - Use that as the `initiator` field of the transaction header. - Calculate the transaction hash with `debug encode transaction --hash <transaction>`. - Add that as the `transactionHash` field of the signature. - Finalize the signature with `debug sign <incomplete signature> <private key>` You may be able to omit fields without `debug` raising an error, but that will almost certainly produce an invalid signature and/or transaction. **Note:** PowerShell is dumb and forces you to escape all of the quotes even within quotes. For example, `{"type": "foo"}` has to be passed as `'{\"type\": \"foo\"}'`. ## Review Checklist **If any item is not complete, the merge request is not ready to be reviewed and must be marked `Draft:`.** - [x] The merge request title is in the format `<change type>(<change scope>): <short description> [<task id>]` - For example, `feat(cli): add QR code generation [AC-123]` - For details, see [CONTRIBUTING.md](/CONTRIBUTING.md) - [x] The description includes `Closes <jira task ID>` (or rarely `Updates <jira task ID>`) - [~] The change is fully validated by tests that are run during CI - In most cases this means a test in "validate.sh" - In some cases, a Go test may be acceptable - Validation is not applicable to things like documentation updates - Purely UI/UX changes can be manually validated, such as changes to human-readable output - For all other changes, automated validation tests are an absolute requirement unless a maintainer specifically explains why they are not in a comment on this merge request - [x] The change is marked with one of the validation labels - ~"validation::ci/cd" for changes validated by CI tests - ~"validation::manual" for changes validated by hand - ~"validation::deferred" for changes validated by a follow up merge request - ~"validation::not applicable" for changes where validation is not applicable ## Merge Checklist - [ ] CI is passing - [ ] Merge conflicts are resolved - [ ] All discussions are resolved Related to AC-1572
10b6d44e