Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
e5d080e
Combined contracts, updated governance model
JoshuaAverett Jan 31, 2025
003c13e
Updates for the new spec
JoshuaAverett Feb 14, 2025
01a12c1
Remove old tests and add common interface for verification errors
JoshuaAverett Feb 14, 2025
32d8de3
First round of updates
JoshuaAverett Mar 8, 2025
ae0b6bc
Add encode/decode functions
JoshuaAverett Mar 11, 2025
8102478
Another round of corrections.
JoshuaAverett Mar 20, 2025
a51c8f8
Make contract compile using the latest wormhole solidity sdk
noitatum Apr 1, 2025
5efbb40
Move EVM code to its own folder and add checks for governance emitter
JoshuaAverett Apr 12, 2025
ddeb014
First pass of the solana code
JoshuaAverett Apr 12, 2025
348fa72
Merge branch 'combined-contract' of github.com:XLabs/core-bridge into…
JoshuaAverett Apr 12, 2025
a5fcd5f
Clean up account verification and a few other updates
JoshuaAverett Apr 17, 2025
35e9c34
Add Guardian TLS Registration to the contract
noitatum Apr 19, 2025
187054f
Minor changes and cargo update. Currently solana does not build.
JoshuaAverett Apr 22, 2025
60ee633
Merge branch 'combined-contract' of github.com:XLabs/core-bridge into…
JoshuaAverett Apr 22, 2025
530cbeb
solana: derives serialization traits for `VAA`
scnale Apr 22, 2025
81c9409
solana: points at modified wormhole anchor bindings
scnale Apr 22, 2025
e6f5f85
basic TS setup
scnale Apr 23, 2025
44ca5a6
solana: fix import in test
scnale Apr 23, 2025
52088f9
solana: sets up mocha
scnale Apr 23, 2025
35826a5
Updates to solidity based on code review
JoshuaAverett Apr 24, 2025
2f2b4c3
Fix for missing pullGuardianSets
JoshuaAverett Apr 24, 2025
a9d5a94
Second round of code review
JoshuaAverett Apr 24, 2025
680e9e0
Update Wormhole Solidity SDK dependency
noitatum Apr 25, 2025
7495c9b
Initial tests for solana
JoshuaAverett Apr 28, 2025
eeeb593
Merge branch 'combined-contract' of github.com:XLabs/core-bridge into…
JoshuaAverett Apr 28, 2025
3ed4a2d
Tests run again!
JoshuaAverett Apr 30, 2025
466e11c
Move TLS data to shards and add EIP712 encoding support
noitatum May 5, 2025
27045fb
Changed names according to the spec
noitatum May 6, 2025
b9f7847
Try to send a TSS update VAA for testing
JoshuaAverett May 6, 2025
f741f35
Merge branch 'combined-contract' of github.com:XLabs/core-bridge into…
JoshuaAverett May 6, 2025
bb49a58
Use Schnorr signatures
JoshuaAverett May 12, 2025
7f79de3
Updated to use Chainlink signature scheme
JoshuaAverett May 15, 2025
aa11772
Big refactor and switch to schnorr
JoshuaAverett May 20, 2025
2619a38
Handle initialization a bit more carefully. Still needs some more tho…
JoshuaAverett May 22, 2025
d3ffd46
Bug fix and minor formatting updates
JoshuaAverett May 29, 2025
bc38300
Check to ensure we don't have TSS sets not matching guardian sets
JoshuaAverett May 29, 2025
3a170a8
Fix typo
JoshuaAverett May 29, 2025
90dc2a6
evm: fixes some typos
scnale May 29, 2025
9e49bd7
evm: decouples logic from data structure implementation
scnale May 29, 2025
6cb90de
solana: reworks tests to use the latest wormhole sdk
scnale May 29, 2025
082a748
evm: updates makefile and foundry config
scnale Jun 2, 2025
d87f8b8
evm: fixes syntax error
scnale Jun 2, 2025
e867c2f
evm: some minor improvements and removing obsolete comments
scnale Jun 2, 2025
e8ed134
evm: pulls only guardian sets starting from a specific index
scnale Jun 2, 2025
bed8014
evm: cleans up imports
scnale Jun 2, 2025
c6c794a
evm: renames a few classes and functions
scnale Jun 2, 2025
4b518fa
evm: comments on register guardian verification
scnale Jun 2, 2025
5f3ab80
evm: makes the expiration time set only for past guardians
scnale Jun 2, 2025
56db3eb
evm: removes redundant code
scnale Jun 2, 2025
240bfda
Refactor and cleanup
JoshuaAverett Jun 3, 2025
5984ff1
Merge branch 'combined-contract' of github.com:XLabs/core-bridge into…
JoshuaAverett Jun 3, 2025
fb64344
evm: removes unused code
scnale Jun 3, 2025
5fa5594
misc: removes trailing whitespace
scnale Jun 3, 2025
b787770
misc: adds solana recipes to makefile
scnale Jun 3, 2025
88c7ac0
Minor improvement in V2 verification path
JoshuaAverett Jun 3, 2025
d9db1c4
Merge branch 'combined-contract' of github.com:XLabs/core-bridge into…
JoshuaAverett Jun 3, 2025
a0ddf13
Domain info and a bit more cleaning
JoshuaAverett Jun 4, 2025
c855cd1
Add tests for everything besides V2 signatures
JoshuaAverett Jun 5, 2025
670ed8a
Added V2 tests
JoshuaAverett Jun 5, 2025
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ out
out.log
broadcast
dist
ts-types
ts-types
ts-build
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "lib/wormhole-solidity-sdk"]
path = lib/wormhole-solidity-sdk
url = https://github.com/wormhole-foundation/wormhole-solidity-sdk.git
branch = sr-refactor
47 changes: 33 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,31 +1,50 @@
TEST_RPC = https://rpc.ankr.com/eth
TEST_RPC = https://ethereum-rpc.publicnode.com

tolib = $(addprefix lib/,$(firstword $(subst @, ,$(notdir $(1)))))

define install_lib
dependencies: $(call tolib,$(1))
define install_lib_evm
dependencies-evm: $(call tolib,$(1))

$(call tolib,$(1)):
forge install $(1) --no-git --no-commit
forge install $(1) --no-git
endef

.DEFAULT_GOAL = build
.PHONY: build test clean dependencies
.PHONY: build* test* clean* dependencies*

build: dependencies
forge build
build: build-evm build-solana build-solana-ts

test: dependencies
forge test --fork-url $(TEST_RPC) -vvvv
#--match-test InitiateFullFuzz
test: test-evm test-solana

clean: clean-evm clean-solana

LIB_DEPS = foundry-rs/forge-std
LIB_DEPS += openzeppelin/openzeppelin-contracts@0457042d93d9dfd760dbaa06a4d2f1216fdbe297 #for gscd's optimizations
LIB_DEPS += wormhole-foundation/wormhole-solidity-sdk@67ca81c
LIB_DEPS += wormhole-foundation/wormhole-solidity-sdk@a7c8786

# dynamically generate install rule for each lib dependency and add to depdenencies
$(foreach dep,$(LIB_DEPS), $(eval $(call install_lib,$(dep))))
$(foreach dep,$(LIB_DEPS), $(eval $(call install_lib_evm,$(dep))))

clean:

build-evm: dependencies-evm
forge build

test-evm: dependencies-evm
forge test --fork-url $(TEST_RPC) -vvvv
#--match-test InitiateFullFuzz

clean-evm:
forge clean
rm -rf lib


build-solana:
cd src/solana; anchor build

build-solana-ts:
npm run build --prefix src/solana

test-solana:
cd src/solana; anchor test

clean-solana:
cd src/solana; anchor clean
3 changes: 1 addition & 2 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ solc_version = "0.8.28"
evm_version = "paris" # prevent use of PUSH0 opcode until it is widely supported
optimizer = true
via_ir = true
extra_output = ["asm"]
extra_output = ["asm", "metadata", "storageLayout", "evm.deployedBytecode.immutableReferences"]

libs = [
"lib",
]

remappings = [
"forge-std/=lib/forge-std/src/",
"@openzeppelin/=lib/openzeppelin-contracts/",
"wormhole-sdk/=lib/wormhole-solidity-sdk/src/",
"core-bridge/=src/",
]
6 changes: 6 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
67 changes: 0 additions & 67 deletions src/BackwardsOptimized/BackwardsOptimized.sol

This file was deleted.

50 changes: 0 additions & 50 deletions src/ThresholdSigOptimized.sol

This file was deleted.

90 changes: 90 additions & 0 deletions src/evm/EIP712Encoding.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
// SPDX-License-Identifier: Apache 2

pragma solidity ^0.8.0;

import {eagerOr} from "wormhole-sdk/Utils.sol";
import {BytesParsing} from "wormhole-sdk/libraries/BytesParsing.sol";
import {VaaLib} from "wormhole-sdk/libraries/VaaLib.sol";

bytes32 constant REGISTER_TYPE_HASH = keccak256(
"GuardianRegister(uint32 guardianSet,uint32 expirationTime,bytes32 id)"
);

interface IERC5267 {
function eip712Domain() external view returns (
bytes1 fields,
string memory name,
string memory version,
uint256 chainId,
address verifyingContract,
bytes32 salt,
uint256[] memory extensions
);
}

contract EIP712Encoding is IERC5267 {
bytes32 constant EIP712_DOMAIN_TYPE_HASH = keccak256(
"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
);

string constant EIP712_NAME = "Wormhole VerificationV2";
string constant EIP712_VERSION = "1";

bytes32 constant EIP712_NAME_HASH = keccak256(bytes(EIP712_NAME));
bytes32 constant EIP712_VERSION_HASH = keccak256(bytes(EIP712_VERSION));

bytes32 private immutable _domainSeparator;

constructor () {
_domainSeparator = getDomainSeparator(block.chainid, address(this));
}

function eip712Domain() external view returns (
bytes1 fields,
string memory name,
string memory version,
uint256 chainId,
address verifyingContract,
bytes32 salt,
uint256[] memory extensions
) {
return (
bytes1(0x0F),
EIP712_NAME,
EIP712_VERSION,
block.chainid,
address(this),
bytes32(0),
new uint256[](0)
);
}

function DOMAIN_SEPARATOR() external view returns (bytes32) {
return _domainSeparator;
}

function getDomainSeparator(
uint256 eth_chain_id, address verifyingContract
) internal pure returns (bytes32) {
return keccak256(abi.encode(
EIP712_DOMAIN_TYPE_HASH,
EIP712_NAME_HASH,
EIP712_VERSION_HASH,
eth_chain_id,
verifyingContract
));
}

function getRegisterGuardianDigest(
uint32 thresholdKeyIndex, uint32 expirationTime, bytes32 guardianId
) public view returns (bytes32) {
bytes32 idHash = keccak256(abi.encode(
REGISTER_TYPE_HASH,
thresholdKeyIndex,
expirationTime,
guardianId
));

return keccak256(abi.encodePacked("\x19\x01", _domainSeparator, idHash));
}
}
File renamed without changes.
Loading