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

New SDK Interfaces #26

Merged
merged 226 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
226 commits
Select commit Hold shift + click to select a range
ef55202
Combine Repos (#16)
barnjamin Aug 22, 2023
0958ac8
big overhaul and (only partial) cleanup of mapping and metaprogrammin…
nonergodic Aug 24, 2023
c19e5d9
Add Auto Token Transfer protocol (#30)
barnjamin Aug 24, 2023
362f2ba
prettier
barnjamin Aug 24, 2023
555d208
move protocols to their own directory
barnjamin Aug 24, 2023
903f738
Protocol Testing (#32)
barnjamin Aug 27, 2023
b4ddf91
starting e2e testing with circle bridges (#33)
barnjamin Aug 27, 2023
fa19bc9
starting rework of examples (#34)
barnjamin Aug 27, 2023
900e985
Cleanup Examples and refactor Connect protocols (#35)
barnjamin Aug 29, 2023
59b538b
Refactor contracts to their own files (#37)
barnjamin Aug 29, 2023
677c2af
Implement Solana platform (#38)
barnjamin Aug 31, 2023
b6502b7
Making rpc generic (#40)
barnjamin Sep 1, 2023
f296008
Tests (#41)
barnjamin Sep 5, 2023
e8cddf6
starting cleanup adding core protocol (#44)
barnjamin Sep 6, 2023
fac3bbe
rename module to protocol (#45)
barnjamin Sep 6, 2023
b875612
Cleanup for publishing (#46)
barnjamin Sep 6, 2023
dcb8c28
adding arbitrum and optimism cctp contracts, refactor circle contract…
barnjamin Sep 7, 2023
0616c2d
bumping versions, adding files to package.json for core modules (#48)
barnjamin Sep 7, 2023
894170a
bump versions (#49)
barnjamin Sep 7, 2023
a51f02b
Fix eth address encoding (#50)
barnjamin Sep 7, 2023
cca1139
update docs (#51)
barnjamin Sep 7, 2023
300ea53
convert to universal address prior to getting bytes for address (#52)
barnjamin Sep 11, 2023
d1497a2
bump version to fix sol/eth addresses (#53)
barnjamin Sep 12, 2023
38a54fb
remove noble secp256k1 as dep in signature type def (#54)
barnjamin Sep 19, 2023
fe3367c
Initial Cosmwasm
barnjamin Sep 20, 2023
e8f51a0
Make platforms modules (#58)
barnjamin Sep 21, 2023
2f40acf
Hardcode platform in ChainContext (#59)
barnjamin Sep 21, 2023
f5f3b6c
adding default network in connect package to provide a project wide d…
barnjamin Sep 22, 2023
1ddbb40
Add method to get network and chain from rpc on platform (#61)
barnjamin Sep 22, 2023
df4db94
Starting to make cosmwasm work (#57)
barnjamin Sep 22, 2023
b4c5ec3
Platform utils (#64)
anondev2323 Sep 28, 2023
5f8dd14
add: bam layout for serialization/deserialization
anondev2323 Oct 2, 2023
94e776f
fix: bam deserialization
anondev2323 Oct 2, 2023
0c6e5d7
add: serialization test
anondev2323 Oct 2, 2023
c43af3f
fix: copy/paste error
anondev2323 Oct 2, 2023
6d66705
update: readme
anondev2323 Oct 2, 2023
a146131
enhance BAM payload parsing
nonergodic Oct 2, 2023
58a605a
bump versions for beta release
barnjamin Oct 3, 2023
fb997bd
bump version with redeem bugfix on evm
barnjamin Oct 3, 2023
60bab20
Cosmwasm WIP (#62)
barnjamin Oct 3, 2023
bc7cbea
adding an absolutely ludicruous cast to fix governance vaa type infor…
nonergodic Oct 3, 2023
3fa65a8
fix missing nonce parameter in common payload (#69)
barnjamin Oct 4, 2023
4f0baa0
fix gnosis testnet chain id (#68)
barnjamin Oct 4, 2023
208870e
Cleaning up cosmos ibc query (#71)
barnjamin Oct 4, 2023
8504dd6
test, fix, and optimize layout discrimination
nonergodic Oct 6, 2023
5e4d621
idk (#73)
barnjamin Oct 9, 2023
9c80a21
Cosmos - e2e (#72)
barnjamin Oct 9, 2023
164f560
constMap bugfix
nonergodic Oct 10, 2023
88eec04
add payload discrimination for protocol payloads
nonergodic Oct 10, 2023
6542228
Core Linter (#70)
barnjamin Oct 10, 2023
1ea2781
use source files for testing (#75)
barnjamin Oct 10, 2023
52ea548
pretty up examples (#74)
barnjamin Oct 10, 2023
170bcf5
fix gateway channel
barnjamin Oct 10, 2023
81d9139
update docs (#76)
barnjamin Oct 10, 2023
5908250
bump version (#77)
barnjamin Oct 10, 2023
5c451ae
adding missing docs for unexported stuff (#78)
barnjamin Oct 10, 2023
0e30bbc
Refactor circle api client to account for other statuses (#79)
barnjamin Oct 10, 2023
2ad0d59
Release prep (#80)
barnjamin Oct 10, 2023
aef64cc
CCTP Refactor
barnjamin Oct 11, 2023
3dcbb54
adding logic to account for different channels producing different de…
barnjamin Oct 11, 2023
e89726c
move amount formatter to utils (#85)
barnjamin Oct 11, 2023
8e7cd82
use signed_vaa endpoint on getVaaBytes (#83)
mat1asm Oct 11, 2023
6dbb11c
fixing and adding payload discrimination for VAAs
nonergodic Oct 13, 2023
1b0c2e8
Fix sei receiving issue (#86)
barnjamin Oct 13, 2023
fbb26e5
combine circle decoders to a single payload (#88)
barnjamin Oct 13, 2023
cb6c92c
rebuild docs (#89)
barnjamin Oct 13, 2023
4b2cf3f
Token registry (#87)
anondev2323 Oct 13, 2023
fc02318
shuffle channel config and provide a method to accurately determine i…
barnjamin Oct 13, 2023
b0a0f5c
improve naming of types for external consumption in vaa.ts
nonergodic Oct 13, 2023
eeb03a8
chesterton put it there for a reason (#97)
barnjamin Oct 13, 2023
c7944dc
add: tests and fix typos from manual edits (#96)
anondev2323 Oct 15, 2023
ea823a9
try to check foreign asset cache concurrently (#99)
barnjamin Oct 16, 2023
258834d
add map of chains so we cache the initialized chain instead of recrea…
barnjamin Oct 16, 2023
b847ab3
so close (#98)
barnjamin Oct 16, 2023
4de21de
Refactor timeout and retry (#100)
barnjamin Oct 16, 2023
f90e004
remove unused imports
barnjamin Oct 16, 2023
0225346
fix address of xfer instruction, fix get decimals to return bigint (#…
barnjamin Oct 17, 2023
dce6f53
bump version for release
barnjamin Oct 17, 2023
e5a273e
fix reconfigured network
barnjamin Oct 17, 2023
6c4a4f6
break out testnet and devnet connect config
barnjamin Oct 17, 2023
9894186
remove redundant network setting (#105)
barnjamin Oct 17, 2023
0ee1959
add: optimized get token balances (#104)
anondev2323 Oct 18, 2023
2db4c82
Tilt Testing (#106)
barnjamin Oct 18, 2023
f53a2ef
finalize automatic payload discrimination and rework VAA handling (#109)
nonergodic Oct 19, 2023
91a55de
bump for release (#110)
barnjamin Oct 19, 2023
42f08aa
adding typeguard to addresses (#111)
barnjamin Oct 20, 2023
29ac7e1
fix issue with serializing signature (#112)
barnjamin Oct 20, 2023
4daae7d
no special serde ser (#113)
barnjamin Oct 21, 2023
57c6a7b
Tilt (#108)
barnjamin Oct 23, 2023
2323c26
TODOs from meeting (#115)
barnjamin Oct 24, 2023
5d28e8a
bump version, regen docs (#116)
barnjamin Oct 24, 2023
f3862ff
adding balance checks to tests (#117)
barnjamin Oct 24, 2023
c0c1dd9
move signer to its own file, update readme (#120)
barnjamin Oct 24, 2023
018d49b
cleanup readme for use in docs (#121)
barnjamin Oct 25, 2023
50ad2ce
add codecs for common encodings (#122)
barnjamin Oct 25, 2023
1782792
Tweaks to improve browser usage (#123)
barnjamin Oct 26, 2023
a952eac
fix circle hash format
barnjamin Oct 26, 2023
52889bb
bump version, regen docs (#124)
barnjamin Oct 26, 2023
cae121b
make parallelizable flag true (#125)
barnjamin Oct 26, 2023
68efb63
Providing a simple signer implementation in platforms (#129)
barnjamin Oct 27, 2023
b4390e3
fmt (#130)
barnjamin Oct 27, 2023
77873ed
fix sol b58 dep
barnjamin Oct 30, 2023
66b28bc
Switch layout (#135)
nonergodic Oct 31, 2023
04c8460
bump versions
barnjamin Oct 31, 2023
f86196b
implement signed integers and endian support for LayoutItems
nonergodic Oct 31, 2023
a1a15d7
add tests for signed ints and endianness and fix impl
nonergodic Nov 1, 2023
0c1eab3
unify circle layout specification and fix type information (#136)
nonergodic Nov 1, 2023
49dd3d9
Protocol packages (#131)
barnjamin Nov 1, 2023
290df16
move signers to testing package (#139)
barnjamin Nov 1, 2023
707e0a2
add size calculation functionality for fixed-sized layouts
nonergodic Nov 1, 2023
f2b5e65
make payload types (more) accessible
nonergodic Nov 1, 2023
3a10dcb
refactor and bugfix, add static size calc for layouts
nonergodic Nov 2, 2023
0985958
prettier
barnjamin Nov 2, 2023
b140bbb
tidy up encoding
nonergodic Nov 3, 2023
0dd7769
remove some ts-ignores (#140)
barnjamin Nov 3, 2023
a977c5d
compile with very strict ts config (#142)
barnjamin Nov 3, 2023
6ce7f77
support unnamed, standalone items as Layouts
nonergodic Nov 4, 2023
e3ea0e1
fix issues with governance payloads
nonergodic Nov 4, 2023
c09d22a
Config audit (#144)
barnjamin Nov 6, 2023
c344867
refactor config generation
barnjamin Nov 6, 2023
f1de73a
make config match mr
barnjamin Nov 6, 2023
515873d
all chain ids
barnjamin Nov 6, 2023
6901094
Fix constmap (#145)
nonergodic Nov 6, 2023
4da1910
adding typechecking tool (#143)
barnjamin Nov 6, 2023
1fd74f6
Start to add finality settings (#102)
barnjamin Nov 9, 2023
7ffcdd1
wip (#147)
nonergodic Nov 9, 2023
4af4ca9
convert Near named addresses to UniversalAddresses using sha256
nonergodic Nov 13, 2023
e71b8b2
bump for release
barnjamin Nov 12, 2023
da467aa
Refactor cleanup (#148)
barnjamin Nov 13, 2023
163336c
regen docs (#157)
barnjamin Nov 13, 2023
5c0ea03
round trip example
barnjamin Nov 14, 2023
8f8b035
reduce some boilerplate, make it easier to access a static reference …
barnjamin Nov 25, 2023
958ed66
bump deps
barnjamin Nov 25, 2023
d177b5e
fixup packages, fix solana wrapped meta, make token account less hacky
barnjamin Nov 25, 2023
b050cd9
add relayer fee method and relay status function
barnjamin Nov 25, 2023
e1618df
bump versions, remove some deps
barnjamin Nov 27, 2023
e5eff27
add script to sync version across workspaces
barnjamin Nov 27, 2023
218ffcd
fix any issues found by tsconfig changes
barnjamin Nov 27, 2023
492dd52
remove src from package files
barnjamin Nov 27, 2023
ed0cdac
allow platform to create a chain context obj with optional rpc connec…
barnjamin Nov 27, 2023
479aa9f
import dep protocols where required
barnjamin Nov 28, 2023
6ec142f
add optional rpc to wh getChain
barnjamin Nov 28, 2023
ed9525c
provide static methods for token transfer protocol so state need not …
barnjamin Nov 29, 2023
5cf30d0
add static method for getting a wormhole message given chain context
barnjamin Nov 29, 2023
c37f0a5
replace ethers provider init with json provider
barnjamin Nov 29, 2023
f7d6850
refactor retries, make get token account only require an address, add…
barnjamin Nov 30, 2023
1806eb2
bump version, add static methods for looking up dest token and check…
barnjamin Dec 5, 2023
d03aff1
updating core bridge helpers to correctly parse sequence data
barnjamin Dec 6, 2023
b6be55e
bump version
barnjamin Dec 6, 2023
f9b2d61
make solana parser work for both types of instructions
barnjamin Dec 6, 2023
86ed80f
bump version
barnjamin Dec 6, 2023
a566a09
rm console logs, bump version
barnjamin Dec 6, 2023
1abc878
add core messaging example
barnjamin Dec 6, 2023
08db30f
adding example for message gen/post
barnjamin Dec 6, 2023
f964f36
add back seq log parsing, bail in postVaa if its already posted
barnjamin Dec 6, 2023
ac8db38
update fixtures
barnjamin Dec 6, 2023
bb0228f
bump version
barnjamin Dec 7, 2023
77b2926
add verifyMessage to whcore
barnjamin Dec 7, 2023
b380750
fix post msg acct
barnjamin Dec 7, 2023
46715be
add unwrap native (#166)
barnjamin Dec 7, 2023
89f1f22
bump version, add utils, tweak examples
barnjamin Dec 7, 2023
32683d3
Tb auto relay (#167)
barnjamin Dec 8, 2023
66f073c
start to add quote details for a transfer
barnjamin Dec 10, 2023
548a53f
scale amounts to match
barnjamin Dec 10, 2023
8654113
fix more scaling, bump version
barnjamin Dec 11, 2023
acb2cc7
remove fee being added in the backend, bump version
barnjamin Dec 11, 2023
db6fd95
bump version
barnjamin Dec 13, 2023
91641c3
update gateway rpc and fix address parsing from payload (#170)
barnjamin Dec 14, 2023
6521f49
update version, revert where we apply overrides, add transfer states
barnjamin Dec 15, 2023
a3f975a
start to add to the token cache (#173)
barnjamin Dec 18, 2023
0f9d119
move token registry to root since it needs connect-sdk (#174)
barnjamin Dec 18, 2023
5f90654
bump version, add method to pull from static list of tokens that are …
barnjamin Dec 18, 2023
f19c2ac
return correct type from atb asset list, bump version
barnjamin Dec 18, 2023
4a9524b
bump version, add npm scripts for publishing
barnjamin Dec 19, 2023
c064ede
update docs
barnjamin Dec 19, 2023
cca9933
start to add solana cctp manual route (#175)
barnjamin Dec 19, 2023
dc52c05
bump version
barnjamin Dec 19, 2023
970625d
add TokenId creation example
barnjamin Dec 19, 2023
6553fd2
move anchor files to their own directory
barnjamin Dec 19, 2023
d9838fb
adding guardian keys (#176)
barnjamin Dec 20, 2023
139b8da
add transfer tracker function and receipt type (#177)
barnjamin Dec 20, 2023
c09e0e0
Improved Types, CCTP interface changes (#172)
barnjamin Dec 20, 2023
ef9bd13
bump version
barnjamin Dec 20, 2023
a7c24e2
fire task before waiting for interval
barnjamin Dec 21, 2023
d00fa07
bump version with fix for task firing
barnjamin Dec 21, 2023
961c63b
rename wormhole namespace
barnjamin Dec 21, 2023
d0384ef
fix quote to handle fewer than 8 decimals
barnjamin Dec 21, 2023
6175ca8
bump version with fix for decimal issue
barnjamin Dec 21, 2023
a5fa7f3
fix normalize amount issue with low decimals
barnjamin Dec 21, 2023
252b31a
bump version, fixed bug with normalize amount and low decimals
barnjamin Dec 21, 2023
81e4624
add comments for how fee is applied to cctp relay
barnjamin Dec 21, 2023
43be810
refactor addresses (#178)
barnjamin Dec 21, 2023
4cf7ae6
bump version
barnjamin Dec 21, 2023
fc31add
fix rescale fn in token transfer logic
barnjamin Dec 22, 2023
6be6e1a
refactor and add payloads for automatic bridges (#180)
barnjamin Dec 26, 2023
2a152cd
update tracker to use receipt
barnjamin Dec 26, 2023
25d633b
bump version
barnjamin Dec 26, 2023
02544b6
adding overrides for configs (#183)
barnjamin Dec 28, 2023
dc90598
bump version with config changes
barnjamin Dec 28, 2023
9e7435c
Tracker receipt (#184)
barnjamin Dec 29, 2023
1a9d8fb
Add Algorand platform (#160)
barnjamin Dec 29, 2023
abb89fd
bump version with algorand
barnjamin Dec 29, 2023
4e6312a
Fixed Algorand tokenBridge.redeem to check storage lsigs properly (#187)
SilentRhetoric Dec 30, 2023
a6bc068
bump version
barnjamin Dec 30, 2023
25334d5
Readme and comments tidying (#191)
SilentRhetoric Jan 1, 2024
c33fe76
add turbo to make building faster (#188)
barnjamin Jan 1, 2024
a2d38c9
fix cosmos query client issue
barnjamin Jan 2, 2024
033a815
slim down utils in core package
barnjamin Jan 2, 2024
8f7607b
shot at required fields based on transfer state (#190)
barnjamin Jan 2, 2024
46b01d5
change default for unwrap native to true
barnjamin Jan 2, 2024
bfb7a61
add sign and send signer for solana (#193)
barnjamin Jan 2, 2024
0744d50
allow opts to be passed to sendWait on solana platform
barnjamin Jan 2, 2024
33195de
bump version
barnjamin Jan 2, 2024
f383a43
Add fee method to core bridge (#196)
barnjamin Jan 3, 2024
75c7155
Solana: Provide ability to resign transactions with ephemeral keys (#…
barnjamin Jan 3, 2024
b607da9
bump version
barnjamin Jan 3, 2024
ed182b5
set stricter tsconfig, fix what broke
barnjamin Jan 4, 2024
8849160
Use union types for TransferReceipt (#197)
artursapek Jan 4, 2024
677939d
bump 0.3.0-beta.12
artursapek Jan 4, 2024
112d650
bump version
barnjamin Jan 4, 2024
2fc4e97
unglob the files config (#198)
artursapek Jan 4, 2024
0b0c2fe
rm npm from deps, fix src in package json for aptos
barnjamin Jan 4, 2024
197fd35
disallow same chain token transfers
barnjamin Jan 5, 2024
94c3a68
disallow same chain token transfers (#199)
barnjamin Jan 8, 2024
dfb32e3
add rpc for terra
barnjamin Jan 8, 2024
b77586a
add chain context to constructor args so we always use the same chain…
barnjamin Jan 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
15 changes: 15 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Node.js CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18.x'
- run: npm ci
- run: npm run build --if-present
- run: npm test
# - run: cd core/tokenRegistry && npx ts-node src/scripts/checkForeignAssetConfig.ts
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
.turbo/
build/
dist/
node_modules/
.env
.env
tsconfig-build.tsbuildinfo
tsconfig.tsbuildinfo
__tests__/staging
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"tabWidth": 2,
"printWidth": 100,
"singleQuote": false,
"trailingComma": "all",
"semi": true
}
205 changes: 205 additions & 0 deletions DESIGN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
Design Document for Wormhole SDK
---------------------------------

# Organization

Code is organized into workspaces so that each can be its own module.

```
core/
base/ -- Constants
definitions/ -- VAA structures and module definitions
connect/ -- Primary package and interface through Wormhole

platforms/ -- Platform specific logic
evm/
protocols/
tokenBridge.ts
cctp.ts
chain.ts
platform.ts
...
solana/
protocols/
tokenBridge.ts
chain.ts
platform.ts
...
...
```

# Concepts

The `Wormhole` class provides methods to interact with the Wormhole protocol by mapping chain parameters to the `Platform` and `Chain` specific implementations.

A `Platform` is a blockchain runtime, often shared across a number of chains (e.g. `Evm` platform for `Ethereum`, `Bsc`, `Polygon`, etc ...).

A `Chain` is a specific blockchain, potentially with overrides for slight differences in the platform implementation.

A `Protocol` (fka `Module`) is a specific application on a `Chain`, it provides a set of methods that can be called to accomplish some action (e.g. `TokenBridge` allows send/receive/lookup token, etc...)

A `Signer` is an interface that provides a callback to sign one or more transaction objects. These signed transactions are sent to the blockchain to invoke some action.

An `Attestation` is a signed guarantee that some _thing_ happened on a remote chain, sent to the target chain to complete a transfer.


# Details

## Wormhole

Registers Platforms

Allows overriding chain specific configs (rpc, contract addresses, ...)

Provides methods to get PlatformContext or ChainContext objects
```ts
wh.getPlatform("Evm")
wh.getChain("Ethereum")
```

Provides methods to create a `WormholeTransfer` for any `Protocol`
```ts
wh.tokenTransfer(...)
wh.nftTransfer(...)
wh.cctp(...)
//...
```

Provides methods to query an API for VAAs and token details
```ts
// grab a vaa with identifier
wh.getVaa(...)
// get the token details
wh.getOriginalToken(...)
wh.getWrappedToken(orig, chain)
```

## Platform

Base class, implements Platform specific logic

Parse Addresses

Parse Message out of Transaction

Sign/Send/Wait

## ChainContext

Defined in abstract ChainContext class

Note: Dispatches many calls to the Platform, filling in details like ChainName and RPC

The `getRpc` method is the only platform specific thing _required_ to implement.

Responsible for holding RPC connection, initialized from default or overrides
```ts
cc.getRPC() // for evm -> ethers.Provider, for sol -> web3.Connection
```

Holds references to Contract client


<!--
Not Implemented
Provides methods to lookup details for contract addresses, finality, address parsers/formatters

```ts
cc.getTokenBridgeAddress()
cc.estimateFinality(txid)
```
-->


## WormholeTransfer

Holds a reference to ChainContexts

Holds details about the transfer

Provides methods to step through the transfer process

## Glossary

- Network
Mainnet, Testnet, Devnet
- Platform
A chain or group of chains within the same ecosystem that share common logic (e.g. EVM, Cosmwasm, etc)
- Platform Context
A class which implements a standardized format and set of methods. It may include additional chain-specific methods and logic.
- Protocol
A cross-chain application built on top of Wormhole (the core contracts are also considered a module)
- Universal Address
A 32-byte address, used by the wormhole contracts
- Native Address (I think this should be called "Platform Address")
An address in the standard chain-specific format
- Native
The "home" chain (e.g. ETH is native to Ethereum)
Comment on lines +134 to +137
Copy link
Collaborator

Choose a reason for hiding this comment

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

good point/agree re Platform Address

I guess if we want to use the word "native", we should have some coherent idea what it should represent, because right now it's quite the confusing grab-bag of different concepts (e.g. calling the gas token of a chain the native token, calling the origin token of the token bridge the native / home chain etc.)

- Foreign
A non-native chain (e.g. ETH is foreign to Moonbeam)
- VAA (Verified Action Approval)
The core messaging primitive in Wormhole, it contains information about a message and a payload encoded as bytes. Once finality is achieved and it is observed by the majority of the guardians, it is signed and can then be used to complete a transfer on the destination chain
- Payload
Bytes that can be passed along with any wormhole message that contain application-specific data
- Finality/Finality Threshold
The required number of blocks to wait until a VAA is produced

# Discussion


## What's the purpose of the Wormhole class?

Wormhole class provides the main interface to do _everything_

- Registers Platforms to access later -- constructor
- Provides access to PlatformContexts -- getContext(ChainName)
- Provides "shortcuts" to start a WormholeTransfer -- tokenTransfer/nftTransfer/cctp/...
- Helpers for getting VAAs? or generally querying the API?
- Abstract away chain-specific logic for easy mode access to methods

## What do we want from a PlatformContext and how is that different from a provider / common utilities for a given platform?

Provides Platform specific logic for a set of things

- Register Modules (contract/app specific functionality)
- Translates Platform specific stuff to generic stuff (e.g. ethers.Provider => RPC connection)
- Deals with Platform specific interaction w/ chain (approve on eth, postvaa on sol, ...)
- Implements standardized method format

## What's the relationship between platforms/chains/providers?

- A Platform provides the logic for all chains that run on that platform
- A Chain provides consts (rpc/contract addresses/chain specific overrides)
- A Provider is just an RPC connection and is held by the Chain. Providers are an implementation detail.

## What's a signer vs. a wallet? Should signers have a provider (my answer: no)?

- A Signer is an interface to sign transactions
- It _may_ be backed by a wallet but not necessarily, as long as it fulfils the interface

## Can we provide some way to make other non-standard applications available to use through the WormholeTransfer?

Say I have an app that defines its own protocol, can I provide something that adheres to the WormholeTransfer interface so a dev can install it and call it like the TokenTransfer?
Comment on lines +180 to +182
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good point!

I already thought about this when specifying payload layouts, but until now I didn't realize that essentially layouts for an inheritance hierarchy of sorts... I'll have to think about this more 🤔



# Outstanding Questions:

What is the preferred terminology to refer to either end of a cross-chain message: from/to, source/target or origin/destination?
Copy link
Collaborator

Choose a reason for hiding this comment

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

I feel like we've (partially) had this discussion before, but I can't quite remember where/in what context. 🤔


What is the preferred terminology for the core Wormhole layer? (i.e. Core Contracts or Wormhole Contracts)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Currently the protocol name is CoreBridge and primarily refers to the contract and its associated payloads. Core layer in my mind should include the entire attestation mechanism (i.e. including off-chain components like guardians etc.).

Bridge is perhaps not the best name because in its raw form it really is just attestation which, if anything, is a broadcast.

I was reluctant to call it WormholeCore or anything else with Wormhole in the name because we're already in a Wormhole SDK and just "Core" seemed too generic.

Open to suggestions. Main primary concern is consistency.


Should we namespace export base/definitions?
Copy link
Collaborator

Choose a reason for hiding this comment

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

We shouldn't export the payloads by default because they only clutter up the namespace unnecessarily. E.g. users don't care about governance payloads and so they shouldn't be added to the payload factory by default.

Being a C++ dinosaur and fan-boy I think we should follow the same principles "you don't pay for things you don't use".


How should we think about xchain concepts without having xchain context?

e.g.
// need to implement universal univeral decoder?
given eth address, and without installing evm platform, how do i turn it into a solana wrapped token without knowing how to fmt the address?

// neet to tweak contracts on sol to support !ATA?
given an xfer from eth=>sol, and without installing sol platform, how do i determine the ATA?
Comment on lines +193 to +200
Copy link
Collaborator

Choose a reason for hiding this comment

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

yeah, that one is a tricky bitch. I realized that this would be an issue a while ago but haven't put a lot of thought into it myself yet.

My knee-jerk response is to split platforms into a thin layer that contains light-weight stuff (like address types) and a heavy weight part (if you actually want to do stuff on that chain). But I'm afraid that this is not an abstraction that will actually work/hold up. (If you have to do address translations via RPC lookups like on Sui, you're presumably fucked).



What is the benefit of costmap vs single fat object
Copy link
Collaborator

Choose a reason for hiding this comment

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

primarily: easily supporting multiple "views" (e.g. inverse mappings)
also: proper bigint key support (bigint is not a PropertyKey)


Why is network duped across platform/chaincontext/contracts?
Loading