Skip to content
This repository has been archived by the owner on Nov 29, 2024. It is now read-only.

feat: implement misbehaviour program #103

Merged
merged 23 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
16df45a
initial implementation of the misbehaviour program
gjermundgaraba Jul 28, 2024
0c329f8
Merge branch 'main' into gjermund/56-implement-misbehavior-program
gjermundgaraba Aug 19, 2024
269bb6a
misbehaviour program with operator integration with fixture output
gjermundgaraba Aug 21, 2024
4ac34e9
lint
gjermundgaraba Aug 21, 2024
849d020
output misbehaviour fixture from e2e test
gjermundgaraba Aug 26, 2024
dcb3e73
misbehaviour tests (unit and e2e)
gjermundgaraba Aug 28, 2024
91aee68
some code cleanup
gjermundgaraba Aug 28, 2024
bf39613
code cleanup
gjermundgaraba Aug 28, 2024
5f750fa
added clippy linting
gjermundgaraba Aug 28, 2024
c9cbfb3
Added misbehaviour program to ci build pipeline
gjermundgaraba Aug 28, 2024
4f3864e
fix cargo setups for misbehaviour
gjermundgaraba Aug 28, 2024
46dfe66
lint and add e2e test to ci
gjermundgaraba Aug 28, 2024
588f580
Update programs/misbehaviour/src/lib.rs
gjermundgaraba Aug 30, 2024
df06cd8
Update programs/misbehaviour/src/lib.rs
gjermundgaraba Aug 30, 2024
f36b596
Update programs/misbehaviour/src/lib.rs
gjermundgaraba Aug 30, 2024
f0d9b70
Update programs/misbehaviour/src/lib.rs
gjermundgaraba Aug 30, 2024
aff47cc
pr review fixes
gjermundgaraba Aug 30, 2024
b7b8d0e
Update operator/src/runners/fixtures/misbehaviour.rs
gjermundgaraba Sep 3, 2024
5676c8e
Update e2e/interchaintestv8/sp1_ics07_test.go
gjermundgaraba Sep 3, 2024
8947815
code review fixes
gjermundgaraba Sep 3, 2024
4b8e72b
added test for misbehaviour breaking time monotonicity
gjermundgaraba Sep 3, 2024
e6ae78f
added unit test for TrustingPeriodTooLong
gjermundgaraba Sep 3, 2024
0e641ce
rename validators correctly
gjermundgaraba Sep 4, 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
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# URL of the Tendermint RPC node
TENDERMINT_RPC_URL=https://rpc.celestia-mocha.com/
TENDERMINT_RPC_URL=http://public-celestia-mocha4-consensus.numia.xyz/
# URL of the Ethereum RPC node
# use https://ethereum-sepolia.publicnode.com/ for the Eth Sepolia testnet
RPC_URL=https://ethereum-holesky-rpc.publicnode.com
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v3.7.0
uses: golangci/golangci-lint-action@v6.1.0
with:
version: v1.59
version: v1.60
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed to use 1.60 because there is a memory bug in 1.59 that causes a lot of problems on my machine.

The version bumps in this file is just because I thought it was good to have latest version 🤷

args: --timeout 5m
working-directory: e2e/interchaintestv8
e2e:
Expand All @@ -41,13 +41,15 @@ jobs:
- TestWithSP1ICS07TendermintTestSuite/TestDeploy
- TestWithSP1ICS07TendermintTestSuite/TestUpdateClient
- TestWithSP1ICS07TendermintTestSuite/TestUpdateClientAndMembership
- TestWithSP1ICS07TendermintTestSuite/TestDoubleSignMisbehaviour
- TestWithSP1ICS07TendermintTestSuite/TestBreakingTimeMonotonicityMisbehaviour
name: ${{ matrix.test }}
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: "1.22"
check-latest: true
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/programs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
- programs/update-client
- programs/membership
- programs/uc-and-membership
- programs/misbehaviour
name: 'build: ${{ matrix.programs }}'
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,4 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: build
args: --workspace --exclude sp1-ics07-tendermint-update-client --exclude sp1-ics07-tendermint-membership --exclude sp1-ics07-tendermint-uc-and-membership --all-features --locked
args: --workspace --exclude sp1-ics07-tendermint-update-client --exclude sp1-ics07-tendermint-membership --exclude sp1-ics07-tendermint-uc-and-membership --exclude sp1-ics07-tendermint-misbehaviour --all-features --locked
19 changes: 19 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ sp1-zkvm = "1.1"
sp1-ics07-tendermint-solidity = { path = "./packages/solidity/" }
sp1-ics07-tendermint-update-client = { path = "./programs/update-client/" }
sp1-ics07-tendermint-membership = { path = "./programs/membership/" }
sp1-ics07-tendermint-uc-and-membership = { path = "./programs/uc-and-membership/" }
sp1-ics07-tendermint-misbehaviour = { path = "./programs/misbehaviour/" }

# ibc-proto
ibc-proto = { version = "0.47", default-features = false }
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,12 @@ After generating the verify the proof with the SP1 EVM verifier.
just test-foundry
```

The recipe also accepts a `testname` argument that will only run the test with the given name. For example:

```shell
just test-foundry test_success_sendTransfer
```

## End to End Testing

There are several end-to-end tests in the `e2e/interchaintestv8` directory. These tests are written in Go and use the [`interchaintest`](https://github.com/strangelove-ventures/interchaintest) library. It spins up a local Ethereum and a Tendermint network and runs the tests found in [`e2e/interchaintestv8/sp1_ics07_test.go`](e2e/interchaintestv8/sp1_ics07_test.go). Some of the tests use the prover network to generate the proofs, so you need to provide your SP1 network private key to `.env` for these tests to pass.
Expand Down
177 changes: 174 additions & 3 deletions contracts/abi/SP1ICS07Tendermint.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
"type": "bytes32",
"internalType": "bytes32"
},
{
"name": "misbehaviourProgramVkey",
"type": "bytes32",
"internalType": "bytes32"
},
{
"name": "verifier",
"type": "address",
Expand Down Expand Up @@ -61,6 +66,19 @@
],
"stateMutability": "view"
},
{
"type": "function",
"name": "MISBEHAVIOUR_PROGRAM_VKEY",
"inputs": [],
"outputs": [
{
"name": "",
"type": "bytes32",
"internalType": "bytes32"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "UPDATE_CLIENT_AND_MEMBERSHIP_PROGRAM_VKEY",
Expand Down Expand Up @@ -190,7 +208,7 @@
{
"name": "env",
"type": "tuple",
"internalType": "struct IUpdateClientMsgs.Env",
"internalType": "struct IICS07TendermintMsgs.Env",
"components": [
{
"name": "chainId",
Expand Down Expand Up @@ -406,6 +424,159 @@
]
}
]
},
{
"name": "o7",
"type": "tuple",
"internalType": "struct IMisbehaviourMsgs.MisbehaviourOutput",
"components": [
{
"name": "env",
"type": "tuple",
"internalType": "struct IICS07TendermintMsgs.Env",
"components": [
{
"name": "chainId",
"type": "string",
"internalType": "string"
},
{
"name": "trustThreshold",
"type": "tuple",
"internalType": "struct IICS07TendermintMsgs.TrustThreshold",
"components": [
{
"name": "numerator",
"type": "uint8",
"internalType": "uint8"
},
{
"name": "denominator",
"type": "uint8",
"internalType": "uint8"
}
]
},
{
"name": "trustingPeriod",
"type": "uint32",
"internalType": "uint32"
},
{
"name": "now",
"type": "uint64",
"internalType": "uint64"
}
]
},
{
"name": "trustedHeight1",
"type": "tuple",
"internalType": "struct IICS02ClientMsgs.Height",
"components": [
{
"name": "revisionNumber",
"type": "uint32",
"internalType": "uint32"
},
{
"name": "revisionHeight",
"type": "uint32",
"internalType": "uint32"
}
]
},
{
"name": "trustedHeight2",
"type": "tuple",
"internalType": "struct IICS02ClientMsgs.Height",
"components": [
{
"name": "revisionNumber",
"type": "uint32",
"internalType": "uint32"
},
{
"name": "revisionHeight",
"type": "uint32",
"internalType": "uint32"
}
]
},
{
"name": "trustedConsensusState1",
"type": "tuple",
"internalType": "struct IICS07TendermintMsgs.ConsensusState",
"components": [
{
"name": "timestamp",
"type": "uint64",
"internalType": "uint64"
},
{
"name": "root",
"type": "bytes32",
"internalType": "bytes32"
},
{
"name": "nextValidatorsHash",
"type": "bytes32",
"internalType": "bytes32"
}
]
},
{
"name": "trustedConsensusState2",
"type": "tuple",
"internalType": "struct IICS07TendermintMsgs.ConsensusState",
"components": [
{
"name": "timestamp",
"type": "uint64",
"internalType": "uint64"
},
{
"name": "root",
"type": "bytes32",
"internalType": "bytes32"
},
{
"name": "nextValidatorsHash",
"type": "bytes32",
"internalType": "bytes32"
}
]
}
]
},
{
"name": "o8",
"type": "tuple",
"internalType": "struct IMisbehaviourMsgs.MsgSubmitMisbehaviour",
"components": [
{
"name": "sp1Proof",
"type": "tuple",
"internalType": "struct ISP1Msgs.SP1Proof",
"components": [
{
"name": "vKey",
"type": "bytes32",
"internalType": "bytes32"
},
{
"name": "publicValues",
"type": "bytes",
"internalType": "bytes"
},
{
"name": "proof",
"type": "bytes",
"internalType": "bytes"
}
]
}
]
}
],
"outputs": [],
Expand Down Expand Up @@ -557,13 +728,13 @@
"name": "misbehaviour",
"inputs": [
{
"name": "",
"name": "misbehaviourMsg",
"type": "bytes",
"internalType": "bytes"
}
],
"outputs": [],
"stateMutability": "pure"
"stateMutability": "nonpayable"
},
{
"type": "function",
Expand Down
Loading
Loading