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

e2e_tests:
name: e2e_tests
teleporter_e2e:
name: teleporter-e2e-tests
runs-on: ubuntu-22.04
steps:
- name: Checkout repositories and submodules
Expand All @@ -67,15 +67,52 @@ jobs:
run: |
export PATH=$PATH:$HOME/.foundry/bin
export PATH="$PATH:$GOPATH/bin"
./scripts/local/e2e_test.sh
./scripts/local/e2e_test.sh --components teleporter

- name: Upload tmpnet network dir
uses: actions/upload-artifact@v4
if: always()
governance_e2e:
name: governance-e2e-tests
runs-on: ubuntu-22.04
steps:
- name: Checkout repositories and submodules
uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'

- name: Install Foundry
run: ./scripts/install_foundry.sh

- name: Run E2E Tests
# Forge installs to BASE_DIR, but updates the PATH definition in $HOME/.bashrc
run: |
export PATH=$PATH:$HOME/.foundry/bin
export PATH="$PATH:$GOPATH/bin"
./scripts/local/e2e_test.sh --components governance

validator_manager_e2e:
name: validator-manager-e2e-tests
runs-on: ubuntu-22.04
steps:
- name: Checkout repositories and submodules
uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup Go
uses: actions/setup-go@v5
with:
name: e2e-tmpnet-data
path: |
~/.tmpnet/networks
~/.tmpnet/prometheus/prometheus.log
~/.tmpnet/promtail/promtail.log
if-no-files-found: error
go-version-file: 'go.mod'

- name: Install Foundry
run: ./scripts/install_foundry.sh

- name: Run E2E Tests
# Forge installs to BASE_DIR, but updates the PATH definition in $HOME/.bashrc
run: |
export PATH=$PATH:$HOME/.foundry/bin
export PATH="$PATH:$GOPATH/bin"
./scripts/local/e2e_test.sh --components validator-manager
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