Conversation
- Adds basic CLI and main package - Adds PR template file
- Adds Connection, Listener, and Pusher interfaces and started Ethereum & Centrifuge implementations - Adds general Chain type and Core to handle the orchestration of them
* implement ethereum connection using ethclient and rpcclient * implement SendTx (currently fails cause no signing :( ) * implement event subscriptions * added event types (just strings for now, we will need to determine what events we actually want)
- Adds api object to centrifuge connection.
- Fixes linting issues - Skip tests
* makefile, test script & github CI configured * Updates golangci config * changed lint timeout * removed verbosity; formatted project; fixed lint error
- Introduces `ChainConfig` - Able to load config from toml - Enable config and verbosity flags, adds keystore path flag
* fix go.mod
* add keypair to eth connection * implement signing of tx in SubmitTx for ethereum * to sign a tx, the function takes a Signer which is created from a geth ChainConfig. we need to add which eth chain config to use to the config, see todo in chains/ethereum/ethereum.go
* adds account subcommand with generate, list, and import functionality. saves keys by default in ./keys/keystore. currently, only creates secp256k1 keys and saves them in an encrypted file.
- basic router to forward messages to destination writer - adds router to startup - moves interfaces to `chain`
- Adds ability to subscribe to ethereum events - Events provided by config - Adds `Start`, `Stop` to listener and writer - Moves event types to `ethereum`
* add contracts * cleanup code * remove multisig code * remove admin * add validator * remove null from vote * add prefix Deposit to vote and proposals * address changes * fix final change * rename contacts dir * truffle * remove embark * add vlaidator count * test work * add validator proposal tests * add node workflow * clean up node yaml ; * cd to correct dir * rename to receiver * minor changes * add basic deposit tests * remove pacakge * seperate tests * stuff * add more tests * rename contrat tests * refactor * add theshold tests * add edge case * refactor tests to individual files * update Makefile * address comments * add coments * fix test
* add contracts * cleanup code * remove multisig code * remove admin * add validator * remove null from vote * add prefix Deposit to vote and proposals * address changes * fix final change * rename contacts dir * truffle * remove embark * add vlaidator count * test work * add validator proposal tests * add node workflow * clean up node yaml ; * cd to correct dir * rename to receiver * minor changes * add basic deposit tests * remove pacakge * seperate tests * stuff * add more tests * rename contrat tests * refactor * add theshold tests * add edge case * refactor tests to individual files * update Makefile * address comments * add coments * fix test * add startup scripts for ethereum * add additional cli args * add cli * fix truffle test * remove log * fix scripts
added centrifuge's asset contract and test that calls their store function. update ResolveMessage in eth package and message type. also added some helper functions for getting account nonce and function IDs.
Renames Home/Away to Receiver/Emitter
- Changes command `account` to `accounts` (sorry, nit picky) - Uses full provided path to keystore (doesn't append `/keys`) - Removes global flags from sub-command - Uses `Global*` for looking up global flags - Remove logs for errors that are also returned
- Remove usage of `sh` - Fixes `make run` - Adds `make install` - Adds readme instructions (WIP) - Change binary to `chainbridge` - Keep bridge alive until killed (ctrl-c) - Properly pass router to listener
- Reduces functionality of keystore to bare necessities
- No need for in memory KS, just needs to load specified keypairs
- Adds mock keystore for testing
- Use `NewTestKeystore()`
- Address "ethereum" returns default ethereum keypair, can be extended to others
- Use table of chains in toml config
- Gives us an array instead of map, easier to generalize
- Introduces `RawChainConfig` to provide an interface for `.toml` config
- Introduces `ethereum.Config` to hold the params for all the ethereum components
- Updates readme
- Basic connection using GSRPC lib - Listener with naive logic for handling NFT events - Scripts for testing - `make start_cent` which fetches, builds, and runs centrifuge-chain - `make cent_asset_tx` which submits a random hash that is emitted as the NFT hash
- Adds ed25519 and sr25519 keys - Enables `account` flags and handlers
* add md for centrifuge start * move into chain doc * add link to readme
* stuff * mods * changs * further changes * organise * update erc20 resolver * broke things * whitespace * fix tests * fix tests * rename contracts * address comments * address commnets * updated comments * update fn name
- Cleanup listener - Adds hash transfer test - Switch CI to chainbridge-substrate-chain - Clean up a bit in preparation for deployment
* Importing Geth Keys
* refctor deploy command * lint * add writer tests * update hash * fix method test * more proposal testing and voting * debuggin execute deposit * vote yes * fix linter * convert to helper function * test helper * refactor * update per comments * refactor based on suggestions * fix test * finally fixed the nonce bug * add mock * cleaned up * add basic listener test * lint and cleanup * add license * move to test * change address * fix
* Adding Logging
* fixing up * traced back to callopts nil pointer dereference * now it's message mismatches * off by one, thanks david * fixed event topic index for nonce in depositerc20 * remove adding one to the nonce in createDepositProposal * commented out writer vote and deposit proposal tests as they're to be changed shortly * cleaned up, tests passing * update to latest master commit from chainbridge-solidity * fixed merge issues * commented out unusused function + removed nonce workaround
- Adds go bindings, removes need for everyone to run `make setup-contracts` - Updates readme
Checking for Unrecognized Opts
- Updates message format to match discussions - Updates to latest contracts - Eth writer now watches for ProposalFinazlied event - Removes eth usage of messaging for internal purposes (signalling events to writer)
* removes outdated commands
- Updates bindings to latest - Uses new token id format
* Checking chainId on startup
- Update to latest contracts (hashing of data, data formatting) - Fixes generic handler support - Adds `startBlock` opt for listener
- Adds susbtrate hash -> eth test - Adds er20 -> susbtrate test - Adds CI e2e build
- Rebuilt bindings - Remove bytecode comparison - Add checks for other contracts
- Extends existing E2E to perfor multiple txs (starts ChainSafe#304) - Updates to the latest contract event - Implements susbtrate->eth test, skipped until ChainSafe/chainbridge-substrate#28 is closed
* Moving CLI elements
* Adding CodeUpdated Event
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
There was a problem hiding this comment.
Why don't we initialize the generic contract?
There was a problem hiding this comment.
Updated in ChainSafe#320 (ChainSafe#323)
| } | ||
|
|
||
| func NewConnection(cfg *Config, kp *secp256k1.Keypair, log log15.Logger) *Connection { | ||
| signer := ethtypes.HomesteadSigner{} |
There was a problem hiding this comment.
This will need to be configurable.
|
|
||
| // SubmitTx submits a transaction to the chain | ||
| // It assumes the input data is an ethtypes.Transaction, marshalled as JSON | ||
| func (c *Connection) SubmitTx(data []byte) error { |
There was a problem hiding this comment.
I was thinking, could we capture the Nonce at this stage?
Furthermore, we might benefit from a queue, where we assign the Nonce as we fire them off.
There was a problem hiding this comment.
To be removed, we don't ever use SubmitTx ChainSafe#323
| return nil, err | ||
| } | ||
|
|
||
| deployedContracts := DeployedContracts{bridgeAddr, relayerAddr, erc20HandlerAddr, erc721HandlerAddr, centrifugeHandlerAddr} |
There was a problem hiding this comment.
NIT: No need to assign you can just return
| // RegisterEventHandler creates a subscription for the provided event on the bridge bridgeContract. | ||
| // Handler will be called for every instance of event. | ||
| func (l *Listener) RegisterEventHandler(subscription EventSig, handler evtHandlerFn) error { | ||
| evt := subscription |
There was a problem hiding this comment.
This seems unnecessary
| case msg.NonFungibleTransfer: | ||
| panic("not yet implemented") | ||
| case msg.GenericTransfer: | ||
| return w.createGenericDepositProposal(m) |
There was a problem hiding this comment.
I dont see the contract being set, I'm confused at the pattern being followed for handling generic transfers?
There was a problem hiding this comment.
All writes are to the bridge contract, updated in ChainSafe#320
| func hash(data []byte) [32]byte { | ||
| return crypto.Keccak256Hash(data) | ||
| } | ||
|
|
||
| func u32toBigInt(n uint32) *big.Int { | ||
| return big.NewInt(int64(n)) | ||
| } | ||
|
|
||
| func byteSliceTo32Bytes(in []byte) [32]byte { //nolint:deadcode,unused | ||
| out := [32]byte{} | ||
| // Note: this is safe as copy uses the min length of the two slices | ||
| copy(out[:], in) | ||
| return out | ||
| } |
There was a problem hiding this comment.
It might make sense to push these out to a helper file
| const ExecuteDepositMethod = "executeDepositProposal" | ||
|
|
||
| func constructErc20ProposalData(amount, tokenId, recipient []byte) []byte { | ||
| var data []byte |
There was a problem hiding this comment.
Link to the solidity code where this is defined might be helpfull
Changes
Closes: #?