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

STAGING -> MASTER #5531

Merged
merged 74 commits into from
Oct 9, 2024
Merged

STAGING -> MASTER #5531

merged 74 commits into from
Oct 9, 2024

Conversation

NullSoldier
Copy link
Contributor

No description provided.

patnir and others added 30 commits September 27, 2024 21:07
Previously, we showed this fee as the token being sent to the target network. This was an incorrect assumption on our part.

The fee is actually taken in IRON. The chainport fee is the one that is always either in the target token or portx token.
* Fixes fetching assets for display in wallet:transactions:info

* Use Iron Fish API for bridge info

* Enable network icon

* Remove commented fields

* Change "bridge transaction fees" to "bridge transaction details"

Co-authored-by: Rahul Patni <[email protected]>

---------

Co-authored-by: Rahul Patni <[email protected]>
With some recent changes to our jest types, vscode no longer resolved
`describe`, `expect`, etc.

I believe the issue is that vscode's typescript extension relies on
`tsconfig.json`, without giving users the ability to change that. Our default
tsconfig.json excluded our test files, which is what was causing the issue. I
do not know why this wasn't an issue when we used `@types/jest`, but there
seems to be a lot of special-casing around `@types`, so maybe it was a defualt
tsconfig option somewhere that I wasn't able to figure out.

In the mean time, if we flip our usage of tsconfig - make tsconfig.json the one
that includes all tests files, and tsconfig.build.json the one we use for
building the actual deliverable code, we allow vscode to do what it wants to
do, while hopefully still only building the files we want
* Store backup of ledger account on disk

* Simplify code

---------

Co-authored-by: Jason Spafford <[email protected]>
This fixes a bug where you only re-ask for a name if it's duplicated
once.
* adds multisig server to broker dkg messages

copies stratum module from sdk into cli to serve as foundation for multisig
network module

replaces stratum mining messages with dkg messages:
- 'dkg.status': returns the dkg status of the session including minSigners,
  identities, and all public packages
- 'dkg.get_status': requests the status of the dkg session from the server
- 'dkg.identity': sends an identity over the socket
- 'dkg.round1': sends a round1 public package over the socket
- 'dkg.round2': sends a round2 public package over the socket

reuses single message for submitting an identity to the server and broadcasting
it from the server. likewise for round1 public packages and round2 public
packages

adds a cli command, 'wallet:multisig:server', to start a server for a dkg
session. requires maxSigners and minSigners on start to set the parameters for
DKG

updates 'wallet:multisig:dkg:create' with a '--server' flag to connect to a
server. at each step, submits the participant's information to the server and
then waits for server to broadcast packages from other participants. uses
'dkg.get_status' to get the status at the beginning of each step to account for
the possibility of having missed broadcasts

* adds sessions to multisig server (#5462)

supports using a single server for multiple runs of dkg and/or signing

updates 'wallet:multisig:dkg:create' to join an existing session with the
'sessionId' flag or create a new session if none is specified
* Upgrades Zondax JS to 5.1.0

We previously had to have two versions of this SDK available because the newer one did not work with single signer.

Zondax fixed the bugs and now we don't need to manage two separate dependencies now.

Created a base ledger class for the common functionality.

* changing ledger class name to LedgerSingleSigner

* adding new line back to package json'
zondax/ledger-js is a subdependency of @zondax/ledger-ironfish. We rely on the ResponseError type from ledger-js which should ideally be exported from zondax/ledger-ironfish. This way we don't have to explicitly include this subdependency in our package.json.

A todo has been added to remove this dependency when the ResponseError type is exported from ledger-ironfish.
* multisig server signing

defines common interface for storing dkg sessions and signing sessions in server
memory

adds network messages for signing flow: starting a signing session, signing
commitments, signature shares, and retrieving the status of a signing session

updates server and client implementations for new message types

updates 'sign' command:
- adds '--server' flag
- adds '--sessionId' flag
- prompts user to enter a session id or start a new session if server is set,
  but not session id
- connects to server, starts or joins a session, and uses messages to/from
  server to complete signing

* Update ironfish-cli/src/commands/wallet/multisig/sign.ts

Co-authored-by: mat-if <[email protected]>

* clears correct event listeners in sign command

---------

Co-authored-by: mat-if <[email protected]>
uses TlsUtils from ironfish sdk to create TLS key and cert files on server start

adds '--tls' flag to server, dkg:create, multisig:sign commands

enables TLS by default

extracts repeated client creation logic into MultisigServerUtils.createClient
util function

Closes IFL-3011
Closes IFL-3012
uses xchacha20poly1305 to encrypt all string fields in messages sent to multisig
server

client decrypts string fields in messages received from multisig server

derives the client key from a passphrase and the session ID (uses the bytes of
the session ID, which is a UUID, for the salt and nonce). ensures that any
client in the session can derive the key if they have the passphrase.

adds passphrase flags and prompts to dkg:create and multisig:sign

NOTE: numeric fields, like minSigners, are not currently encrypted

Closes IFL-3013
updates 'dkg:create' and 'multisig:sign' not to set the '--tls' flag by default.
since this flag depends on the '--server' flag this means that the '--server'
flag must also be provided by default
- changes log messages to debug for packages that don't need to be sent to other
  participants: signing package, encrypted secret packages
- does not log identities, packages, commitments, shares when using multisig broker

- logs session ID on separate line when starting session

Closes IFL-3014
Closes IFL-3015
Closes IFL-3019
Cleanup sessions on Multisig Broker Server
* Adds unsignedTransaction flag to chainport send

Allows for signing this transaction with a ledger device or other another signing method.

* adds ledger flag to chainport send command

You can now bridge with a ledger device in the CLI
adds a server 'ack' message that the server sends to the client upon receiving
and successfully parsing the client message. each 'ack' contains the client's
message id

client sets an interval to retry sending each message. when it receives the
'ack' for its message it clears the interval for that message id
uses maxSigners for dkg and numSigners for signing to broadcast the session
status once the required number of  participants have submitted data of a
particular type

removes broadcasts of individual identities, packages, etc.

removes client handlers for messages containing individual identities, packages,
etc.

simplifies client logic for waiting on data from server: only uses status
messages instead of listening for individual identities etc AND polling status

distinguishes message methods for dkg identities and signing identities. the
message bodies are the same, but it allows the server to distinguish how to
handle the session
* Cleanup DKG identity creation

* Remove unused functions
if a client submits data to the broker server encrypted with the wrong
passphrase and key then all other clients will now skip that data

adds a 'challenge' to the session which is a string encrypted with the session
passphrase and key

if a client fails to decrypt the challenge then the client throws an error

decrypts message data only when necessary
* Add ability for sessions to track specific clients

* Remove extra client ids so the data becomes correct
* updates ux status messages waiting for multisig broker

displays the number of identities, packages, commitments, etc. that the client
has received from the server and how many are expected

Closes IFL-3016

* prevents status from showing '0/n'

initializes lists with user's own packages so that status reflects that user has
submitted data
hughy and others added 26 commits October 8, 2024 00:24
the Ledger class and subclasses do not log messages themselves. clients that
want log output must log themselves
This allows round3 and backup to fail independently and we can retry them separately.
This fix ensures that the timeout threshold to check the user should
approve the action is more than the connect timeout.
* Update bridge transaction summary

* More updates to chainport transaction summary

* Remove 30m warning log

---------

Co-authored-by: Derek Guenther <[email protected]>
This adds new documentation about what and which errors are thrown. It
also removes appInfo() and getVersion() during tryInstruction because it
duplicates the error cdoes you get from just running any app commands.
This also transforms ledger app errors from TransportStatusError into
ResponseError so we can handle all the error codes in a single way.
* always reviews tx in same connection as commit or sign

clear signing in the Ironfish DKG Ledger App requires that the client review the
transaction with 'reviewTransaction' before generating signing commitments with
'dkgGetCommitments' or creating a signature share with 'dkgSign'

an approved 'reviewTransaction' instruction stores the transaction hash of the
approved transaction in the device memory. however, storage of that hash does
not persist between transport connections. so, if a connection is lost due to an
error, or if a new connection is created for each instruction, then the hash
cannot be accessed to allow generation of commitments or signature shares

modifies 'dkgGetCommitments' and 'dkgSign' in 'LedgerMultiSigner' to take an
unsigned transaction and always call the 'reviewTransaction' instruction in the
same connection as 'dkgGetCommitments' and 'dkgSign'

* reviews tx on InvalidTxHash error

updates dkgGetCommitments and dkgSign to catch Ledger error caused by unreviewed
transaction (InvalidTxHash), call reviewTransaction, and finally recursively
call themselves

adds error type for LedgerInvalidTxHash
This happens during operations occasionally when the transport fails.
assets stored in the blockchain database include both 'creator' and 'owner', but
the RpcMint type only includes 'creator'

our api expects to receive mint data that includes 'owner'

updates RpcMint to include owner

NOTE: this field is immediately deprecated alongside 'creator' and other fields
that can be read from asset RPCs. fully deprecating these fields for endpoints
like 'followChainStream' and 'getTransactionStream' that expect streams of chain
data could make the process of fetching asset data with separate requests
between streaming responses difficult
Because zondax removed the ability to discern between a locked app and a
locked device.
Found these in the hw-transport library from ledgerhq.
* adds default multisig broker server

changes '--server' to boolean flag in 'wallet:multisig:sign' and
'wallet:multisig:dkg:create'

adds '--hostname' and '--port' flags in place of previous '--server' flag to
supply server hostname and port

defaults 'hostname' to 'multisig.ironfish.network' and 'port' to 9035

adds support for connection strings with '--connection' flag

adds util function to parse all connection options from flags

prints connection string to console after starting session

* allows sessionId and passphrase flags without server flag

if a users sets the sessionId or passphrase flag in 'multisig:sign' or
'dkg:create', the commands will now interpret these flags as intent to use a
broker server
@NullSoldier NullSoldier requested a review from a team as a code owner October 9, 2024 22:49
@NullSoldier NullSoldier merged commit 700c521 into master Oct 9, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants