Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional IGP cmds, move Zebec ownership #2778

Open
wants to merge 81 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
791302f
Add helloworld program
tkporter Aug 8, 2023
7568cbb
Start ripping out common router types
tkporter Aug 8, 2023
8cfc568
Still quite a mess but helloworld.rs uses the router deploy tooling
tkporter Aug 9, 2023
5aa718d
Helloworld deploy tooling
tkporter Aug 9, 2023
7aea99a
Merge branch 'main' of github.com:abacus-network/abacus-monorepo into…
tkporter Aug 9, 2023
f508e2d
Better file structure for hellworld program
tkporter Aug 9, 2023
eb119f9
Add ability to pay for gas in helloworld program
tkporter Aug 9, 2023
3a32a17
Deployed to rc woo
tkporter Aug 10, 2023
96eb859
ugly wip
tkporter Aug 10, 2023
515b2ca
works
tkporter Aug 10, 2023
dd7ff72
Update comment
tkporter Aug 10, 2023
e30fb4a
Playing around with things to try to get SDK/infra tooling to work we…
tkporter Aug 11, 2023
76cea2d
Merge branch 'main' of github.com:abacus-network/abacus-monorepo into…
tkporter Aug 16, 2023
49988bb
Merge branch 'main' of github.com:abacus-network/abacus-monorepo into…
tkporter Sep 5, 2023
673e1f3
wip
tkporter Sep 5, 2023
422f475
Checker working & sealevel cli compiling
tkporter Sep 6, 2023
ca7ccab
Move helloworld checking into check-deploy.ts, able to set routers an…
tkporter Sep 7, 2023
1025f1f
wip...
tkporter Sep 12, 2023
9adcc8e
Plan to deploy rc relayer
tkporter Sep 12, 2023
5a04e9d
Merge branch 'main' of github.com:abacus-network/abacus-monorepo into…
tkporter Sep 12, 2023
42d0b03
Now trying to set ism correctly
tkporter Sep 12, 2023
9185791
Some deployments
tkporter Sep 13, 2023
c3eac80
Move serde stuff
tkporter Sep 13, 2023
22786aa
Attempting to clean up artifacts
tkporter Sep 13, 2023
6cc4952
Move more into multisig_ism.rs
tkporter Sep 13, 2023
e25a57f
Add get_storage in helloworld
tkporter Sep 13, 2023
82252df
Deploy new nautilus multisig ism
tkporter Sep 13, 2023
f6d61ea
mid cleanup
tkporter Sep 13, 2023
0fd7294
Merge branch 'main' of github.com:abacus-network/abacus-monorepo into…
tkporter Sep 14, 2023
8515436
Cleaning up warp_route.rs
tkporter Sep 14, 2023
49ea3e9
Cleaning up warp_route.rs
tkporter Sep 14, 2023
4e68445
Cleaning up
tkporter Sep 14, 2023
5cdde39
Add gas amount stuff back
tkporter Sep 14, 2023
9175247
mintor refactor
tkporter Sep 14, 2023
13d0d62
rm devnet environment
tkporter Sep 14, 2023
dc52b7a
rm local-e2e/helloworld
tkporter Sep 14, 2023
63abd62
Configuration for new default ISM config
tkporter Sep 15, 2023
489b84c
Progress towards getting mainnet all working
tkporter Sep 18, 2023
a34b56c
IGP checker works
tkporter Sep 18, 2023
09b0680
try to get around the celo bs
tkporter Sep 18, 2023
adc63a0
Use Celo safe tx service URL that works
tkporter Sep 19, 2023
79d8d99
rm a console.log
tkporter Sep 19, 2023
fb48f68
Merge branch 'main' of github.com:abacus-network/abacus-monorepo into…
tkporter Sep 19, 2023
4f22170
Nits
tkporter Sep 19, 2023
39c0fb6
Some cleanup, set the new testnet3 default ISM in program_ids.json
tkporter Sep 19, 2023
79ce38a
Cleanup innit
tkporter Sep 19, 2023
23dc5a5
Cleanup
tkporter Sep 19, 2023
6aa48e6
Clean upppp
tkporter Sep 19, 2023
d930ba0
Owner deploy tooling, make it truly idempotent regardless of the pres…
tkporter Sep 19, 2023
e682c8a
Move to routing ISM at root
tkporter Sep 19, 2023
0836656
Deployed new default ISM on mainnet
tkporter Sep 20, 2023
29be997
Created some multisig txs
tkporter Sep 20, 2023
812e395
nits
tkporter Sep 20, 2023
05dd8ea
Merge branch 'main' of github.com:abacus-network/abacus-monorepo into…
tkporter Sep 20, 2023
7d4ce34
Removing deposit-only
tkporter Sep 26, 2023
039fc89
rm duped mainnetHyperlaneDefaultIsmCache
tkporter Sep 26, 2023
5d41e82
mild cleanup - also set new ISMs as helloworld ISMs
tkporter Sep 26, 2023
5ad3176
Add new POSE router
tkporter Sep 27, 2023
35a1065
Merge branch 'main' of github.com:abacus-network/abacus-monorepo into…
tkporter Sep 27, 2023
da008a3
New POSE token
tkporter Sep 27, 2023
23d7ccb
Enroll new solana routers on mainnet helloworlds
tkporter Sep 28, 2023
f315685
Add DomainRoutingIsm to verification.json
tkporter Sep 28, 2023
4dd8eb1
Merge branch 'main' of github.com:abacus-network/abacus-monorepo into…
tkporter Sep 28, 2023
7e4b1ab
Don't charge gas for solana helloworld either
tkporter Sep 28, 2023
92ad7f9
Address todo
tkporter Sep 28, 2023
269abfc
short circuit in routingIsm
tkporter Sep 28, 2023
2f18ef9
Rip out igp cmd processor
tkporter Sep 28, 2023
46ebb95
wip
tkporter Sep 28, 2023
966b8a0
Wip
tkporter Sep 29, 2023
4fb5786
Change program-ids
tkporter Sep 29, 2023
9945dab
Merge branch 'main' of github.com:abacus-network/abacus-monorepo into…
tkporter Oct 3, 2023
fa45809
Move overflow-checks to the root Cargo.toml
tkporter Oct 3, 2023
c4387cf
Merge branch 'main' of github.com:abacus-network/abacus-monorepo into…
tkporter Oct 5, 2023
c0de676
Merge branch 'main' of github.com:abacus-network/abacus-monorepo into…
tkporter Oct 11, 2023
f994c69
make clippy happy
tkporter Oct 13, 2023
51e2711
Merge branch 'main' of github.com:abacus-network/abacus-monorepo into…
tkporter Oct 23, 2023
d7e84ea
Add EnvironmentArgs
tkporter Oct 23, 2023
fd63f97
Change IGP consts elsewhere
tkporter Oct 23, 2023
3b2f23c
Add cmd to set beneficiary
tkporter Oct 23, 2023
9eaa616
Move to ZBC warp route to nautilus IGP
tkporter Oct 23, 2023
30af050
make new_beneficiary a positional arg
tkporter Oct 23, 2023
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
Prev Previous commit
Next Next commit
Better file structure for hellworld program
tkporter committed Aug 9, 2023
commit f508e2d69ff74e1e1ad8692ea7a0eb5aafd08626
13 changes: 5 additions & 8 deletions rust/sealevel/client/src/helloworld.rs
Original file line number Diff line number Diff line change
@@ -3,7 +3,9 @@ use std::collections::HashMap;
use hyperlane_core::H256;
use hyperlane_sealevel_connection_client::router::RemoteRouterConfig;
use hyperlane_sealevel_hello_world::{
program::HelloWorldStorageAccount, program_storage_pda_seeds,
accounts::HelloWorldStorageAccount,
instruction::{enroll_remote_routers_instruction, init_instruction},
program_storage_pda_seeds,
};
use serde::{Deserialize, Serialize};
use solana_sdk::{instruction::Instruction, pubkey::Pubkey, signature::Signer};
@@ -47,12 +49,7 @@ impl Deployable<HelloWorldConfig> for HelloWorldDeployer {
payer: Pubkey,
router_configs: Vec<RemoteRouterConfig>,
) -> Instruction {
hyperlane_sealevel_hello_world::program::enroll_remote_routers_instruction(
program_id,
payer,
router_configs,
)
.unwrap()
enroll_remote_routers_instruction(program_id, payer, router_configs).unwrap()
}

fn get_routers(&self, client: &RpcClient, program_id: &Pubkey) -> HashMap<u32, H256> {
@@ -105,7 +102,7 @@ impl Deployable<HelloWorldConfig> for HelloWorldDeployer {

ctx.new_txn()
.add(
hyperlane_sealevel_hello_world::program::init_instruction(
init_instruction(
program_id,
ctx.payer.pubkey(),
domain_id,
Original file line number Diff line number Diff line change
@@ -661,6 +661,7 @@ where
token_account,
&Rent::get()?,
owner_account,
system_program,
)?;

Ok(())
@@ -709,6 +710,7 @@ where
token_account,
&Rent::get()?,
owner_account,
system_program,
)?;

Ok(())
@@ -849,6 +851,7 @@ where
token_account,
&Rent::get()?,
owner_account,
system_program,
)?;

Ok(())
104 changes: 104 additions & 0 deletions rust/sealevel/programs/helloworld/src/accounts.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
//! HelloWorld accounts.
use std::collections::HashMap;

use access_control::AccessControl;
use account_utils::{AccountData, SizedData};
use borsh::{BorshDeserialize, BorshSerialize};
use hyperlane_core::H256;
use hyperlane_sealevel_connection_client::{
router::{HyperlaneRouter, RemoteRouterConfig},
HyperlaneConnectionClient,
};
use hyperlane_sealevel_igp::accounts::InterchainGasPaymasterType;

use solana_program::{program_error::ProgramError, pubkey::Pubkey};

/// The storage account.
pub type HelloWorldStorageAccount = AccountData<HelloWorldStorage>;

/// The storage account's data.
#[derive(BorshSerialize, BorshDeserialize, Debug, Default)]
pub struct HelloWorldStorage {
/// The local domain.
pub local_domain: u32,
/// The mailbox.
pub mailbox: Pubkey,
/// The ISM.
pub ism: Option<Pubkey>,
/// The IGP.
// pub igp: Option<(Pubkey, InterchainGasPaymasterType)>,
/// The owner.
pub owner: Option<Pubkey>,
/// A counter of how many messages have been sent from this contract.
pub sent: u64,
/// A counter of how many messages have been received by this contract.
pub received: u64,
/// Keyed by domain, a counter of how many messages that have been sent
/// from this contract to the domain.
pub sent_to: HashMap<u32, u64>,
/// Keyed by domain, a counter of how many messages that have been received
/// by this contract from the domain.
pub received_from: HashMap<u32, u64>,
/// Keyed by domain, the router for the remote domain.
pub routers: HashMap<u32, H256>,
}

impl SizedData for HelloWorldStorage {
fn size(&self) -> usize {
// local domain
std::mem::size_of::<u32>() +
// mailbox
32 +
// ism
1 + 32 +
// igp
1 + 32 + 1 + 32 +
// owner
1 + 32 +
// sent
std::mem::size_of::<u64>() +
// received
std::mem::size_of::<u64>() +
// sent_to
(self.sent_to.len() * (std::mem::size_of::<u32>() + std::mem::size_of::<u64>())) +
// received_from
(self.received_from.len() * (std::mem::size_of::<u32>() + std::mem::size_of::<u64>())) +
// routers
(self.routers.len() * (std::mem::size_of::<u32>() + 32))
}
}

impl AccessControl for HelloWorldStorage {
fn owner(&self) -> Option<&Pubkey> {
self.owner.as_ref()
}

fn set_owner(&mut self, new_owner: Option<Pubkey>) -> Result<(), ProgramError> {
self.owner = new_owner;
Ok(())
}
}

impl HyperlaneRouter for HelloWorldStorage {
fn router(&self, origin: u32) -> Option<&H256> {
self.routers.get(&origin)
}

fn enroll_remote_router(&mut self, config: RemoteRouterConfig) {
self.routers.insert(config.domain, config.router.unwrap());
}
}

impl HyperlaneConnectionClient for HelloWorldStorage {
fn mailbox(&self) -> &Pubkey {
&self.mailbox
}

fn interchain_gas_paymaster(&self) -> Option<&(Pubkey, InterchainGasPaymasterType)> {
None
}

fn interchain_security_module(&self) -> Option<&Pubkey> {
self.ism.as_ref()
}
}
119 changes: 119 additions & 0 deletions rust/sealevel/programs/helloworld/src/instruction.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
//! HelloWorld instructions.

use borsh::{BorshDeserialize, BorshSerialize};
// use hyperlane_sealevel_igp::accounts::InterchainGasPaymasterType;
use hyperlane_sealevel_connection_client::router::RemoteRouterConfig;
use solana_program::{
instruction::{AccountMeta, Instruction},
program_error::ProgramError,
pubkey::Pubkey,
};

use crate::program_storage_pda_seeds;

/// Init instruction data.
#[derive(BorshSerialize, BorshDeserialize, Debug)]
pub struct Init {
/// The local domain.
pub local_domain: u32,
/// The mailbox.
pub mailbox: Pubkey,
/// The ISM.
pub ism: Option<Pubkey>,
/// The IGP.
// pub igp: Option<(Pubkey, InterchainGasPaymasterType)>,
/// The owner.
pub owner: Option<Pubkey>,
}

/// A HelloWorld message.
#[derive(BorshSerialize, BorshDeserialize, Debug)]
pub struct HelloWorldMessage {
/// The destination domain.
pub destination: u32,
/// The message.
pub message: String,
}

/// Instructions for the program.
#[derive(BorshSerialize, BorshDeserialize, Debug)]
pub enum HelloWorldInstruction {
/// Initializes the program.
Init(Init),
/// Dispatches a message using the dispatch authority.
SendHelloWorld(HelloWorldMessage),
/// Sets the ISM.
SetInterchainSecurityModule(Option<Pubkey>),
/// Enrolls remote routers
EnrollRemoteRouters(Vec<RemoteRouterConfig>),
}

/// Gets an instruction to initialize the program.
pub fn init_instruction(
program_id: Pubkey,
payer: Pubkey,
local_domain: u32,
mailbox: Pubkey,
ism: Option<Pubkey>,
// igp: Option<(Pubkey, InterchainGasPaymasterType)>,
owner: Option<Pubkey>,
) -> Result<Instruction, ProgramError> {
let (program_storage_account, _program_storage_bump) =
Pubkey::try_find_program_address(program_storage_pda_seeds!(), &program_id)
.ok_or(ProgramError::InvalidSeeds)?;

let init = Init {
local_domain,
mailbox,
ism,
// igp,
owner,
};

// Accounts:
// 0. [executable] System program.
// 1. [signer] Payer.
// 2. [writeable] Storage PDA.
let accounts = vec![
AccountMeta::new_readonly(solana_program::system_program::id(), false),
AccountMeta::new_readonly(payer, true),
AccountMeta::new(program_storage_account, false),
];

let instruction = Instruction {
program_id,
data: HelloWorldInstruction::Init(init).try_to_vec()?,
accounts,
};

Ok(instruction)
}

/// Gets an instruction to enroll remote routers.
pub fn enroll_remote_routers_instruction(
program_id: Pubkey,
owner: Pubkey,
configs: Vec<RemoteRouterConfig>,
) -> Result<Instruction, ProgramError> {
let (program_storage_account, _program_storage_bump) =
Pubkey::try_find_program_address(program_storage_pda_seeds!(), &program_id)
.ok_or(ProgramError::InvalidSeeds)?;

// Accounts:
// 0. [executable] System program.
// 1. [signer] Payer.
// 2. [writeable] Storage PDA.
let accounts = vec![
AccountMeta::new_readonly(solana_program::system_program::id(), false),
AccountMeta::new(program_storage_account, false),
AccountMeta::new(owner, true),
];

let instruction = Instruction {
program_id,
data: HelloWorldInstruction::EnrollRemoteRouters(configs).try_to_vec()?,
accounts,
};

Ok(instruction)
}
4 changes: 3 additions & 1 deletion rust/sealevel/programs/helloworld/src/lib.rs
Original file line number Diff line number Diff line change
@@ -4,4 +4,6 @@
#![deny(missing_docs)]
#![deny(unsafe_code)]

pub mod program;
pub mod accounts;
pub mod instruction;
pub mod processor;
Loading