-
Notifications
You must be signed in to change notification settings - Fork 2
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
Update 0030-ETHM-multisig_control_spec.md #1497
base: cosmicelevator
Are you sure you want to change the base?
Conversation
|
||
A signature bundle is a hex string of appended 65 byte ECDSA signatures where each signer signed the same message hash usually containing the parameters of the function being called, the current epoch data consisting of a list of signers and their corresponding weights, and a nonce that is used to prevent replay attacks. | ||
|
||
## Epoch Data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we want to insist on per-epoch updates.
The validators will have protocol-level incentives to update the multisig weights if they weights or the signer set changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll change the wording of it and call it something else
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been updated in the spec and the code
## Signer Set Data | ||
Signer Set Data is the set of signer addresses and their associated weight. Once hashed, the signer set data hash must match the current signer set data hash stored on the smart contract. This hash can be updated by calling `update_signers` (see below). The entire set of addresses and weights needs to be sent with every verified transaction and will be invalid once the signer set (or weights) change. | ||
|
||
## Verify Signatures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should consider the signature format a bit more, both taking into context what Clef supports and also additional safe-guards.
I propose the following format:
concat(
bytes2("\x19\x00"), bytes20(address(this)), // [1]
u256(block.chainid), // [2]
bytes32(current_signer_set_hash), // [3]
bytes20(calling_contract), // [4]
u256(nonce), // [5]
bytes(function_payload) // [6]
)
- This prefix is to accommodate Clef's
text/validator
mime-type. See their source - This prevents replay across chains for whatever reason. It's unlikely that the same signer set and multisig address will be present across chains, but this rules out that completely
- This is the signer set discussed in the PR. I would also be beneficial if the signer set had a total-order such that when verifying signatures, the verification algorithm can be O(n) in the signers and not have to keep a set of seen signers like the current implementation. The order has to be easy to compute on the Vega side, so a simple lexicographic sort of the validator keys would be very easy. Or it could sort by weight in descending order. This discussion is a bit orthogonal as it touches in the verification of multiple signatures rather than the integrity of a particular signature.
- Making the
calling_contract
explicit. In the current format we have the concept ofsubmitter
which has a dual-use; when the multisig contact is called by another contract, this becomes the address of the calling contact, however when it is the multisig contract verifying a call to itself, it becomes the address of whoever invokes the contact. In this case we should injectaddress(this)
from the multisig contract itself and keepmsg.sender
for external contracts. Again, this discussion is more in the realm of the mechanics of how the multisig is used rather than the signature itself. The multisig contract doesn't have a concept of other contracts, but can simply look at the current signer set and whether a quorum of those signed identical payloads. - The nonce is a common-denominator control to prevent replay attacks since we cannot guarantee the order in which transactions to the multisig contract are done. This might as well be a part of the
function_payload
, however I do think it makes sense to keep a explicit nonce rather than a dummy signer as proposed below such that we do not need any special case logic around verifying signatures against the signer set, eg. stop the verification one short of the signer set, since the last signer is a dummy and someone might just be able to produce a signature with a key that hashes to an address that overlaps with the dummy. - The function name and parameters as describe in the PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[1] why do we care about clef? Is it giving us anything useful for the extra gas?
[2] might consider doing this as it would allow validators to reuse addresses across multiple chains if we get there... A) they probably shouldn't do that and B) need to investigate the extra gas
[3] that hash is entirely derived from the passed in signer set rather than storing signers, this also includes the weights (good call and already implemented, will update the spec to make that clear)
[4] at the moment I have an internal validation function and an external one (see source) Does this work?
[5] how common/feasable is sig recovery overlap for ETH addresses? (looking it up right after I post this)
[6] cool
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- So in Vega you can either import an ethereum key or use a running clef service. Currently we have a fork of clef to support the current signature format: https://docs.vega.xyz/testnet/node-operators/how-to/rotate-ethereum-keys
- Cost here is low.
CHAINID
is 2 gas, memory expansion and hashing additional bytes is 6 and 3 gas respectively. - Correct, my point was to define a total order, but as mentioned, it's something that should be defined elsewhere in the spec
- Main point here is today, if you submit anything to the multisig contract itself, you need to use a fixed external account, while other contracts such as the bridge, can be submitted by anyone, since the "point of view" of who the submitter is changes. What I'm suggesting is that we make this the same so when transactions to the multisig contract itself are validated, we use the multisig address as the "submitter"
- I don't remember what the point was here
- 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I'll need to investigate clef more
- seems reasonable, added to the spec on the end of the "final hash"
- this was added to the spec as one of the assumptions
- submitter is now always the contract calling the verification and never a user. even if it's on the multisig itself, this allows anyone to submit any of the multisig orders and removes that complication
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adding the clef prefix after a chat with @jeremyletang
I had an informal chat with Jeremy and then David on Friday because we were all in the same place, and the following points came up:
|
I had similar feelings about this. I wrote a little script that looked at the changes in stake scores of each validator on mainnet over each epoch, and there are some big movements, but mostly there there are just tiny changes and I don't know what security benefit we get from updating to weights are that practically equal to some small tolerance. We also currently have this mechanism in core where we penalise a validator if they aren't on the contract but should be, and penalise all validators if someone is on who shouldn't be, and maybe that doesn't really fit anymore with the weights changes. Also on this: It makes me wonder what the course of action for the protocol is if the set_hash emitted from ethereum is different that one Vega expects it to be (i.e it has been changed externally for some reason, maybe intentionally by manually gather validator signatures for some good reason). Vega-core won't be able to know anything about whats happened from just the hash. |
|
added clef, removed incentive
removed reward diversion incentive
removed reward diversion incentive
updated spec for consistency with v2 demo code as well as internal updates
No description provided.