Peggy Dev Update #2
End to end validator set updates + even more efficiency
In our first Althea Peggy dev update we highlighted the dramatic simplicity and efficiency of our Ethereum contract.
Think of the contract like a highly tuned engine. It does exactly what it needs to do without a single ounce of wasted metal. But without a car built around it our highly tuned engine is going nowhere extremely fast.
For this update we have our first end-to-end working bridge flow. Validator set updates are generated, signed, packaged, and submitted to the Althea Peggy Ethereum contract.
But don't take our word for it, you can automatically build a full Peggy dev environment and run it for yourself, you just need docker and about 15 minutes.
#!/bin/bash
git clone https://github.com/althea-net/peggy
cd peggy
bash tests/all-up-test.sh
That's it! We use this same code to run an all up micro-testnet on every commit to the Peggy repo.
This command will
- build from scratch all the Go, Solidity, and Rust code.
- Deploy a Cosmos blockchain with the Peggy module installed
- Deploy an Ethereum blockchain, build and deploy the Peggy contract to that Ethereum blockchain
- Run the Peggy test Orchestrator
- The Orchestrator then bootstraps the Peggy module and the Peggy Ethereum contract by constructing and ferrying the first validator set update between the two chains!
I know this already sounds complicated, but the devil is the details. Specifically the details of signatures. Since the contract doesn't wasate a single extra cycle processing, sorting, or ordering it's inputs the Orchestrator has to make sure that everything is in perfect order.
This process is particularly finicky because it also involves the Peggy Cosmos module, which also has to store and verify signatures.
For a complete end to end validator set update you to synchronize signature generation and verification in the Cosmos module, Peggy Orchestrator, and of course the contract itself.
This includes every little detail from the ordering of the validators list down to even the smallest detail of parsing out the signature components and presenting them to the contract independently rather than in the compact form.
I'm very proud to say this all works now. It's a very important achievement, one of the hardest parts of getting a cross chain bridge working is getting everything talking to each other.
While validator set updates are the first thing to work end to end we're making rapid progress at building out the Peggy Cosmos module. Here's a short list of things that are ready in the Cosmos module and waiting on end to end integration.
- More complete (but still not final) bootstrapping process
- Various oracle operations (these will mostly be final)
- Transaction batch generation (early version with minimum edge case handling)
In order to meet our early October brokennet target these existing patches just need to be refined and integrated end-to-end.
You'll be sending transactions back and forth before Halloween.
I almost forgot to mention, Peggy Ethereum contract gas costs are down 25% since our last update.
This is due to two optimizations a community submitted optimization on fee transfer, and a more complex change that allows for updating the validator set and submitted a transaction batch at the same time.
By allowing validator set updates and batch submission to operate independently transaction batch fees can pay to keep the validator set updated on active bridges. Even better the total cost is lower since the combined method can share the same signature verifications.
Crossing the Peggy bridge now costs less than $1 in gas per transaction using a 100 transaction batch @300gwei. Or just 15 cents in gas @50gwei.
If you want to keep up with Althea's Peggy development be sure to join our next standup and keep track of our past standups on Youtube.
We keep an up to date playlist with recordings of every bi-weekly Peggy update. In general this is the most up to date source of info about development and what's going on.