Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…leware into add-certora-rules
  • Loading branch information
ChaoticWalrus committed Oct 23, 2023
2 parents eb1136d + 088fb11 commit e6703d2
Show file tree
Hide file tree
Showing 26 changed files with 957 additions and 575 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "lib/eigenlayer-contracts"]
path = lib/eigenlayer-contracts
url = https://github.com/Layr-labs/eigenlayer-contracts
[submodule "lib/ds-test"]
path = lib/ds-test
url = https://github.com/dapphub/ds-test
17 changes: 13 additions & 4 deletions docs/middleware/IndexRegistry.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,27 @@ This contract assigns each operator an index (0 indexed) within each of its quor
The RegistryCoordinator for the AVS makes call to the IndexRegistry to register an operator for a certain set of quorums. The IndexRegistry will assign the next index in each of the quorums the operator is registering for to the operator storing the following struct:
```solidity
// struct used to give definitive ordering to operators at each blockNumber.
// NOTE: this struct is slightly abused for also storing the total number of operators for each quorum over time
struct OperatorIndexUpdate {
// blockNumber number from which `index` was the operators index
// the operator's index or the total number of operators at a `blockNumber` is the first entry such that `blockNumber >= entry.fromBlockNumber`
// the operator's index is the first entry such that `blockNumber >= entry.fromBlockNumber`
uint32 fromBlockNumber;
// index of the operator in array of operators, or the total number of operators if in the 'totalOperatorsHistory'
// index of the operator in array of operators
// index = type(uint32).max = OPERATOR_DEREGISTERED_INDEX implies the operator was deregistered
uint32 index;
}
```

The IndexRegistry also adds the operator's id to the append only list of operators that have registered for the middleware and it stores the total number of operators after the registering operator has registered for each of the quorums the operator is registering for by pushing the above struct to a growing array.
The IndexRegistry also adds the operator's id to the append only list of operators that have registered for the middleware and it stores the total number of operators after the registering operator has registered for each of the quorums the operator is registering for by pushing the below struct to a growing array.

```solidity
// struct used to denote the number of operators in a quorum at a given blockNumber
struct QuorumUpdate {
// The total number of operators at a `blockNumber` is the first entry such that `blockNumber >= entry.fromBlockNumber`
uint32 fromBlockNumber;
// The number of operators at `fromBlockNumber`
uint32 numOperators;
}
```

### deregisterOperator

Expand Down
2 changes: 2 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ out = "out"
libs = ["lib"]
fs_permissions = [{ access = "read-write", path = "./" }]

ffi = true

# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options
12 changes: 12 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module github.com/Layr-Labs/ffi

go 1.20

require (
github.com/bits-and-blooms/bitset v1.5.0 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.11.1 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
golang.org/x/sys v0.2.0 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
)
14 changes: 14 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
github.com/bits-and-blooms/bitset v1.5.0 h1:NpE8frKRLGHIcEzkR+gZhiioW1+WbYV6fKwD6ZIpQT8=
github.com/bits-and-blooms/bitset v1.5.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA=
github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ=
github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI=
github.com/consensys/gnark-crypto v0.11.1 h1:pt2nLbntYZA5IXnSw21vcQgoUCRPn6J/xylWQpK8gtM=
github.com/consensys/gnark-crypto v0.11.1/go.mod h1:Iq/P3HHl0ElSjsg2E1gsMwhAyxnxoKK5nVyZKd+/KhU=
github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk=
github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY=
github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU=
github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU=
golang.org/x/sys v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A=
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU=
rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA=
1 change: 1 addition & 0 deletions lib/ds-test
Submodule ds-test added at e28215
7 changes: 7 additions & 0 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@openzeppelin-upgrades/=lib/eigenlayer-contracts/lib/openzeppelin-contracts-upgradeable/
@openzeppelin/=lib/eigenlayer-contracts/lib/openzeppelin-contracts/
ds-test/=lib/ds-test/src/
eigenlayer-contracts/=lib/eigenlayer-contracts/
forge-std/=lib/forge-std/src/
openzeppelin-contracts-upgradeable/=lib/eigenlayer-contracts/lib/openzeppelin-contracts-upgradeable/
openzeppelin-contracts/=lib/eigenlayer-contracts/lib/openzeppelin-contracts/
Loading

0 comments on commit e6703d2

Please sign in to comment.