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

feat: introduce basic multisig message support #1025

Merged
merged 7 commits into from
Nov 9, 2023

Conversation

byte-bandit
Copy link
Contributor

@byte-bandit byte-bandit commented Nov 6, 2023

Related Github tickets

Background

This change introduces a couple of new concepts into the Paloma ecosystem:

  1. Message Metadata: every message that is to be included within a transaction now comes with a new, required field called metadata, which itself includes two different fields: signers and creator.
  2. Ante Handlers: Paloma's modules may now register their own ante handlers to perform transaction validation.

Using these new concepts, Paloma now considers the metadata field contents when verifying transaction signatures. It does so by confirming that the transaction contains signatures from:

a) all signers of every message within the transaction
b) ensuring that the message creator is among the set of signers, or at least one of the signers of a message has active feegrant from the message creator

This allows us to start using more than one key when signing transactions, as long as those keys are feegranted from our validator account. It also sets the stage for multisig transaction verifications on our end.

⚠️ This is a breaking change, and will require a new version of Pigeon to be deployed alongside.

Testing completed

  • test coverage exists or has been added/updated
  • tested in a private testnet

Breaking changes

  • I have checked my code for breaking changes
  • If there are breaking changes, there is a supporting migration.

@byte-bandit byte-bandit marked this pull request as draft November 6, 2023 10:43
x/paloma/ante.go Outdated Show resolved Hide resolved
@byte-bandit byte-bandit marked this pull request as ready for review November 9, 2023 12:30
@byte-bandit byte-bandit changed the title Clohr/op keys feat: introduce basic multisig message support Nov 9, 2023
@byte-bandit byte-bandit enabled auto-merge (squash) November 9, 2023 12:31
Copy link
Contributor

@taariq taariq left a comment

Choose a reason for hiding this comment

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

LGTM! Do we need README updates as well?

@taariq taariq disabled auto-merge November 9, 2023 17:58
@taariq taariq merged commit fcba987 into palomachain:master Nov 9, 2023
2 checks passed
@taariq taariq deleted the clohr/op-keys branch November 9, 2023 17:59
@byte-bandit
Copy link
Contributor Author

LGTM! Do we need README updates as well?

Not for this one, the Pigeon one will contain one though.

byte-bandit added a commit to palomachain/pigeon that referenced this pull request Nov 10, 2023
# Related Github tickets

- VolumeFi/paloma#857
- VolumeFi/paloma#934
- palomachain/paloma#1025

# Background

In order to support multiple signing keys for Pigeons, we recently released a change for Paloma that introduced message metadata fields for all Paloma messages, allowing Pigeons to define signers other than the creator address.

This change includes:

- Removing lens as a dependency, replacing it with a slimmed down in-house solution called `ion`
- Support to define multiple signature keys in the pigeon config, see below for additional details
- Automatic key rotation when sending messages to Paloma
- Automatic metadata injection into messages
- Introducing `validator-key` as a configuration field for the paloma chain inside Pigeon. This used to be the `signing-key` field, which remains to be supported for now

The new signing keys are completely optional. In case there's no change to the configuration, Pigeon will read the old existing `signature-key` field and use it for both the message creator and signer when injecting metadata. See below on how to enable support for multiple signing keys.

Going forward, we'll be referring to the old `signing-key` as `validator-key`.

#### Support for multiple signing keys

By default, Pigeon will use your validator key to sign any transactions sent to Paloma. In high throughput environments, this may lead to `account sequence mismatch` errors.
It's possible to define more than one signing key to be used in rotation to combat this issue. In order to do so, you will need to create a number of new keys and register them with Pigeon like this:

```bash
# First, create a number of new keys. You may create an arbitrary amount of keys.
palomad keys add pigeon-operator-alpha
palomad keys add pigeon-operator-bravo
palomad keys add pigeon-operator-charlie

# Second, your new addresses will need to receive an active feegrant from your validator address.
# This step is very important. It's not enough to simply fund those addresses manually.
# The active feegrant is considered a "permission" to send transactions from your validator address".
palomad tx feegrant grant $VALIDATOR_ADDRESS pigeon-operator-alpha --fees 500ugrain -y
palomad tx feegrant grant $VALIDATOR_ADDRESS pigeon-operator-bravo --fees 500ugrain -y
palomad tx feegrant grant $VALIDATOR_ADDRESS pigeon-operator-charlie --fees 500ugrain -y
```

After creating your signing keys, all you need to do is register them with Pigeon by adding the following to your pigeon config. Make sure to restart the service after making these changes.

```yaml
paloma:
  signing-keys:
    - pigeon-operator-alpha
    - pigeon-operator-bravo
    - pigeon-operator-charlie
```

# Testing completed

- [x] test coverage exists or has been added/updated
- [x] tested in a private testnet

# Breaking changes

- [x] I have checked my code for breaking changes

---

* feat: support multiple signing keys with rotation

* fix: use master address when sending messages

* fix: dead lock on mutex acquisition

* feat: add fee grant

* chore: add logging

* feat: inject message metadata

* fix: retrieve signer address for metadata

* fix: remove superfluous logging

* feat: remove locking from paloma calls

* fix: use paloma wrapper constructor

* chore: remove all lens dependencies

* fix: CI pipeline

* chore: move signature keys configuration to paloma only

* chore: update go.mod paloma reference

* doc: update README
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.

3 participants