Skip to content

Commit

Permalink
feat(target_chains/fuel): add governance contract (#1518)
Browse files Browse the repository at this point in the history
* add governance contract

* add fuel ci

* add rust-toolchain

* add executes_governance_instruction test

* add test for SetValidPeriod

* add test for AuthorizeGovernanceDataSourceTransfer

* remove SetWormholeAddress

* add test for SetDataSources

* remove WormholeAddressSetEvent

* remove SetWormholeAddress

* remove SetWormholeAddressPayload

* remove SetWormholeAddressPayload and SetWormholeAddress imports

* remove GovernanceAction::SetWormholeAddress

* address comments

* refactor test

* add comments
  • Loading branch information
cctdaniel authored May 9, 2024
1 parent 6e0bd05 commit cf7987f
Show file tree
Hide file tree
Showing 42 changed files with 1,803 additions and 214 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/ci-fuel-contract.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Test Fuel Contract

on:
pull_request:
paths:
- target_chains/fuel/**
push:
branches:
- main
paths:
- target_chains/fuel/**

env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: target_chains/fuel/contracts/
steps:
- uses: actions/checkout@v2
- name: Install Fuel toolchain
run: |
curl https://install.fuel.network | sh
echo "$HOME/.fuelup/bin" >> $GITHUB_PATH
- name: Build with Forc
run: forc build --verbose
- name: Run tests with Forc
run: forc test --verbose
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
21 changes: 19 additions & 2 deletions pythnet/pythnet_sdk/src/test_utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ use {
merkle::MerkleTree,
Accumulator,
},
hashers::keccak256_160::Keccak160,
hashers::{
keccak256::Keccak256,
keccak256_160::Keccak160,
Hasher,
},
messages::{
FeedId,
Message,
Expand All @@ -27,6 +31,7 @@ use {
byteorder::BigEndian,
libsecp256k1::{
Message as libsecp256k1Message,
PublicKey,
RecoveryId,
SecretKey,
Signature,
Expand Down Expand Up @@ -96,6 +101,19 @@ pub fn dummy_guardians() -> Vec<SecretKey> {
result
}

pub fn dummy_guardians_addresses() -> Vec<[u8; 20]> {
let guardians = dummy_guardians();
guardians
.iter()
.map(|x| {
let mut result: [u8; 20] = [0u8; 20];
let pubkey = &PublicKey::from_secret_key(x).serialize()[1..];
result.copy_from_slice(&Keccak256::hashv(&[&pubkey])[12..]);
result
})
.collect()
}

pub fn create_dummy_feed_id(value: i64) -> FeedId {
let mut dummy_id = [0; 32];
dummy_id[0] = value as u8;
Expand Down Expand Up @@ -271,7 +289,6 @@ pub fn create_vaa_from_payload(
..Default::default()
};


(header, body).into()
}

Expand Down
Loading

0 comments on commit cf7987f

Please sign in to comment.