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

Acp 77 updates #585

Merged
merged 64 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
6121347
cleanup message spec
cam-schultz Oct 1, 2024
6e8fa6b
use correct type ids
cam-schultz Oct 1, 2024
f1a5147
code block formatting
cam-schultz Oct 1, 2024
b412e48
update to latest spec
cam-schultz Oct 1, 2024
9515841
pack lengths as uint32
cam-schultz Oct 2, 2024
3b06b23
scope local vars to bypass stack limit
cam-schultz Oct 2, 2024
80902f0
fix init vdr validationID
cam-schultz Oct 2, 2024
b015856
reorder fields
cam-schultz Oct 2, 2024
54e0c76
unit tests working
cam-schultz Oct 2, 2024
e6ffd3b
update bindings
cam-schultz Oct 2, 2024
90967aa
remove unused file
cam-schultz Oct 2, 2024
907e41d
use updated bindings
cam-schultz Oct 3, 2024
506c603
bump avago
cam-schultz Oct 3, 2024
29214d2
version extracts rc tags
cam-schultz Oct 3, 2024
85daef0
increase timeout to 120s
cam-schultz Oct 3, 2024
5f26868
Merge branch 'validator-manager' into acp-77-updates
cam-schultz Oct 3, 2024
3f0b287
wip: convertsubnet working
cam-schultz Oct 4, 2024
f74c575
wip: flaky p-chain warp verification
cam-schultz Oct 5, 2024
0ca3a53
wip
cam-schultz Oct 7, 2024
2207e65
use tagged subnet-evm
cam-schultz Oct 8, 2024
b553d96
lengthen timeout
cam-schultz Oct 8, 2024
f90c70d
new justification format
cam-schultz Oct 8, 2024
f4bb683
bump avago
cam-schultz Oct 9, 2024
f281179
add delegation to erc20 staking flow
cam-schultz Oct 9, 2024
06a244e
resolve todos
cam-schultz Oct 9, 2024
d6e0632
separate init vdr helpers
cam-schultz Oct 9, 2024
ead93bc
reduce to 67 quorum
cam-schultz Oct 9, 2024
7c1e007
separate e2e suites
cam-schultz Oct 9, 2024
72ea62d
init chainid before tests
cam-schultz Oct 9, 2024
63bad1a
init chainid before tests
cam-schultz Oct 9, 2024
406caf7
simplify local network
cam-schultz Oct 9, 2024
2d5bbb3
cleanup
cam-schultz Oct 9, 2024
3b62b9b
build fix
cam-schultz Oct 9, 2024
c8ebfd2
add back in teleporter setup
cam-schultz Oct 9, 2024
5a76c07
recover subnet helper
cam-schultz Oct 9, 2024
0fa2ae8
native staking e2e
cam-schultz Oct 10, 2024
c3a0640
remove delegation flows
cam-schultz Oct 10, 2024
70b85e9
tear down network between validator manager tests
cam-schultz Oct 10, 2024
b4710e5
create new default registerer at runtime
cam-schultz Oct 10, 2024
c9320a9
bump awm-relayer
cam-schultz Oct 10, 2024
7136669
poa->pos migration e2e
cam-schultz Oct 10, 2024
3ecdb46
remove debug logs
cam-schultz Oct 10, 2024
2f3390a
add todo
cam-schultz Oct 10, 2024
e033da0
component-wise e2e test jobs
cam-schultz Oct 10, 2024
e0e108b
update job names
cam-schultz Oct 10, 2024
f57c860
remove upload artifact
cam-schultz Oct 10, 2024
11e8a39
lint fixes
cam-schultz Oct 10, 2024
0cb408f
Merge branch 'acp-77-e2e' into e2e-refactor-separate-suites
cam-schultz Oct 10, 2024
380fc9a
resolve todos
cam-schultz Oct 10, 2024
a3b77b0
fix typo
cam-schultz Oct 10, 2024
9123f15
remove unneeded input validation
cam-schultz Oct 10, 2024
ec11cd1
update bindings
cam-schultz Oct 10, 2024
9a962ed
clarify stack too deep workaround
cam-schultz Oct 10, 2024
f49fe5f
clarify stack too deep workaround - round 2
cam-schultz Oct 10, 2024
6ec27cc
lint
cam-schultz Oct 10, 2024
02ce9d0
Merge branch 'validator-manager' into acp-77-updates
cam-schultz Oct 14, 2024
43c2279
Merge branch 'acp-77-updates' into acp-77-e2e
cam-schultz Oct 14, 2024
391b03c
Merge branch 'acp-77-e2e' into e2e-refactor-separate-suites
cam-schultz Oct 14, 2024
cbe7a7e
validate p chain owner
cam-schultz Oct 14, 2024
4bd2158
simplify component check
cam-schultz Oct 14, 2024
098442e
remove ref to unused var
cam-schultz Oct 15, 2024
646e4dd
test all suites by default
cam-schultz Oct 15, 2024
4cbde54
correct arg
cam-schultz Oct 15, 2024
dac3220
Merge pull request #592 from ava-labs/e2e-refactor-separate-suites
cam-schultz Oct 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@ server.log

# Forge documentation
docs/
coverage/

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

164 changes: 111 additions & 53 deletions contracts/validator-manager/MessageSpec.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,115 @@
## Warp Message Format Reference

### `SubnetConversionMessage`

- Description: Confirms conversion to a Permissionless Subnet on the P-Chain

- Signed by: P-Chain

- Consumed by: Validator Manager contract

Specification:

```
SubnetConversionMessage
Copy link
Collaborator

Choose a reason for hiding this comment

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

Doesn't matter at all for this PR, but worth noting that markdown supports tables that provide auto-formatting in the future. It makes it easy to modify in the future without having to manually correct all of the spacing.

+--------------------+----------+----------+
| codecID : uint16 | 2 bytes |
+--------------------+----------+----------+
| typeID : uint32 | 4 bytes |
+--------------------+----------+----------+
| subnetConversionID : [32]byte | 32 bytes |
+--------------------+----------+----------+
| 38 bytes |
+----------+
```

where `subnetConversionID` is defined as the `sha256` hash of the serialization of the `SubnetConversionData`, defined as follows:

```
ValidatorData
+--------------+----------+------------------------+
| nodeID : []byte | 4 + len(nodeID) bytes |
+--------------+----------+------------------------+
| blsPublicKey : [48]byte | 48 bytes |
+--------------+----------+------------------------+
| weight : uint64 | 8 bytes |
+--------------+----------+------------------------+
| 60 + len(nodeID) bytes |
+------------------------+

SubnetConversionData
+----------------+-----------------+--------------------------------------------------------+
| codecID : uint16 | 2 bytes |
+----------------+-----------------+--------------------------------------------------------+
| subnetID : [32]byte | 32 bytes |
+----------------+-----------------+--------------------------------------------------------+
| managerChainID : [32]byte | 32 bytes |
+----------------+-----------------+--------------------------------------------------------+
| managerAddress : []byte | 4 + len(managerAddress) bytes |
+----------------+-----------------+--------------------------------------------------------+
| validators : []ValidatorData | 4 + sum(validatorLengths) bytes |
+----------------+-----------------+--------------------------------------------------------+
| 74 + len(managerAddress) + len(validatorLengths) bytes |
+--------------------------------------------------------+
```

### `RegisterSubnetValidatorMessage`

Description: Register a Subnet Validator on the P-Chain
- Description: Registers a Subnet Validator on the P-Chain

Signed by: Subnet
Consumed by: P-Chain
- Signed by: Subnet

- Consumed by: P-Chain

Specification:

```
+--------------+----------+-----------+
| codecID : uint16 | 2 bytes |
+--------------+----------+-----------+
| typeID : uint32 | 4 bytes |
+--------------+----------+-----------+
| subnetID : [32]byte | 32 bytes |
+--------------+----------+-----------+
| nodeID : [32]byte | 32 bytes |
+--------------+----------+-----------+
| weight : uint64 | 8 bytes |
+--------------+----------+-----------+
| blsPublicKey : [48]byte | 48 bytes |
+--------------+----------+-----------+
| expiry : uint64 | 8 bytes |
+--------------+----------+-----------+
| 134 bytes |
+-----------+
PChainOwner
+-----------+------------+-------------------------------+
| threshold : uint32 | 4 bytes |
+-----------+------------+-------------------------------+
| addresses : [][20]byte | 4 + len(addresses) * 20 bytes |
+-----------+------------+-------------------------------+
| 8 + len(addresses) * 20 bytes |
+-------------------------------+

RegisterSubnetValidatorMessage
+-----------------------+-------------+--------------------------------------------------------------------+
| codecID : uint16 | 2 bytes |
+-----------------------+-------------+--------------------------------------------------------------------+
| typeID : uint32 | 4 bytes |
+-----------------------+-------------+-------------------------------------------------------------------+
| subnetID : [32]byte | 32 bytes |
+-----------------------+-------------+--------------------------------------------------------------------+
| nodeID : []byte | 4 + len(nodeID) bytes |
+-----------------------+-------------+--------------------------------------------------------------------+
| blsPublicKey : [48]byte | 48 bytes |
+-----------------------+-------------+--------------------------------------------------------------------+
| expiry : uint64 | 8 bytes |
+-----------------------+-------------+--------------------------------------------------------------------+
| remainingBalanceOwner : PChainOwner | 4 + len(addresses) * 20 bytes |
+-----------------------+-------------+--------------------------------------------------------------------+
| disableOwner : PChainOwner | 4 + len(addresses) * 20 bytes |
+-----------------------+-------------+--------------------------------------------------------------------+
| weight : uint64 | 8 bytes |
+-----------------------+-------------+--------------------------------------------------------------------+
| 114 + len(nodeID) + (len(addresses1) + len(addresses2)) * 20 bytes |
+--------------------------------------------------------------------+

```

### `SubnetValidatorRegistrationMessage`

Description: Confirms a Subnet Validator's registration validity on the P-Chain
- Description: Confirms a Subnet Validator's registration validity on the P-Chain

- Signed by: P-Chain

Signed by: P-Chain
Consumed by: Validator Manager contract
- Consumed by: Validator Manager contract

Specification:

```
SubnetValidatorRegistrationMessage
+--------------+----------+----------+
| codecID : uint16 | 2 bytes |
+--------------+----------+----------+
Expand All @@ -53,39 +123,27 @@ Specification:
+----------+
```

### `ValidationUptimeMessage`
### `SubnetValidatorWeightMessage`

Description: Provides a Validator's uptime for calculating staking rewards
- Description: Used to set and acknowledge a Validator's stake weight on another chain

Signed by: Subnet
Consumed by: Validator Manager contract
- To effect a weight change:

Specification:
- Signed by: Subnet

```
+--------------+----------+----------+
| codecID : uint16 | 2 bytes |
+--------------+----------+----------+
| typeID : uint32 | 4 bytes |
+--------------+----------+----------+
| validationID : [32]byte | 32 bytes |
+--------------+----------+----------+
| uptime : uint64 | 8 bytes |
+--------------+----------+----------+
| 46 bytes |
+----------+
```
- Consumed by: P-Chain

### `SetSubnetValidatorWeightMessage`
- To acknowledge the weight change:

Description: Used to set a Validator's stake weight on another chain
- Signed by P-Chain

Signed by: Subnet
Consumed by: P-Chain

- Consumed by Subnet

Specification:

```
SubnetValidatorWeightMessage
+--------------+----------+----------+
| codecID : uint16 | 2 bytes |
+--------------+----------+----------+
Expand All @@ -101,27 +159,27 @@ Specification:
+----------+
```

### `SubnetValidatorWeightUpdateMessage`
### `ValidationUptimeMessage`

- Description: Provides a Validator's uptime for calculating staking rewards

Description: Acknowledges a Validator weight update
- Signed by: Subnet
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not for this PR, but just a heads up that we'll be updating the terminology from subnet -> L1 soon, including for these message names and transaction types.

Subnets will refer to pre-Etna Subnets, where their validator set must also validate the primary network, making it a subset of the primary network validators.

L1s will refer to post-Etna sovereign networks, whose validators sets can be completely independent of the primary network.


Signed by: P-Chain
Consumed by: Validator Manager contract
- Consumed by: Validator Manager contract

Specification:

```
ValidationUptimeMessage
+--------------+----------+----------+
| codecID : uint16 | 2 bytes |
+--------------+----------+----------+
| typeID : uint32 | 4 bytes |
+--------------+----------+----------+
| validationID : [32]byte | 32 bytes |
+--------------+----------+----------+
| nonce : uint64 | 8 bytes |
+--------------+----------+----------+
| weight : uint64 | 8 bytes |
| uptime : uint64 | 8 bytes |
+--------------+----------+----------+
| 54 bytes |
| 46 bytes |
+----------+
```
6 changes: 3 additions & 3 deletions contracts/validator-manager/PoSValidatorManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ abstract contract PoSValidatorManager is

// Unpack the Warp message
(bytes32 messageValidationID, uint64 nonce,) = ValidatorMessages
.unpackSubnetValidatorWeightUpdateMessage(_getPChainWarpMessage(messageIndex).payload);
.unpackSubnetValidatorWeightMessage(_getPChainWarpMessage(messageIndex).payload);

if (validationID != messageValidationID) {
revert InvalidValidationID(delegator.validationID);
Expand Down Expand Up @@ -589,7 +589,7 @@ abstract contract PoSValidatorManager is

// Submit the message to the Warp precompile.
WARP_MESSENGER.sendWarpMessage(
ValidatorMessages.packSetSubnetValidatorWeightMessage(
ValidatorMessages.packSubnetValidatorWeightMessage(
delegator.validationID, validator.messageNonce, validator.weight
)
);
Expand All @@ -613,7 +613,7 @@ abstract contract PoSValidatorManager is
// Unpack the Warp message
WarpMessage memory warpMessage = _getPChainWarpMessage(messageIndex);
(bytes32 validationID, uint64 nonce,) =
ValidatorMessages.unpackSubnetValidatorWeightUpdateMessage(warpMessage.payload);
ValidatorMessages.unpackSubnetValidatorWeightMessage(warpMessage.payload);

if (delegator.validationID != validationID) {
revert InvalidValidationID(validationID);
Expand Down
Loading
Loading