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

Add relay service listeners and handlers #56

Merged
merged 2 commits into from
Oct 29, 2020
Merged

Add relay service listeners and handlers #56

merged 2 commits into from
Oct 29, 2020

Conversation

mwaa
Copy link
Contributor

@mwaa mwaa commented Oct 23, 2020

How to test

  1. Start ethermint
  2. Start Redis on port 6379
  3. In the relayer folder add childchain bridge address.
  4. If not deployed you can run ts-node deploy.ts. Copy value of address from address.json to key address in config.json
  5. Run ts-node start.ts.
  6. Test Unlock by running ts-node /src/utils/transaction.ts. Will create 3 separate burn events that should be captured and recorded

Closes #26 Closes #40


### Redis

We use redis two track two things
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
We use redis two track two things
We use redis to track two things

contractInstance: any;
validatorAddress: string;
bridgeAddress: string = Config.address;
bridgeHash: string = Config.brigdgeHash;
Copy link
Member

Choose a reason for hiding this comment

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

spelling error in bridgeHash


const startQueue = async () => {
const qname = Config.address;
console.log("This is the quee", qname);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
console.log("This is the quee", qname);
console.log("This is the queue", qname);

Functionality to listen for events and relay them across chains

### Redis

Copy link
Member

@Clearwood Clearwood Oct 26, 2020

Choose a reason for hiding this comment

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

Please add instructions on Redis version to use, as well as configuration like the port here.
Add instructions on what version of TS node to use.

A longer description of the Relayer service is missing here, all instructions on how to run the service should be able to be found in this file.
Provide clear instructions on how to provide the Bridge Address.

@Clearwood
Copy link
Member

image
I am getting errors on connecting to Redis even though my instance is started on port 6379

@mwaa
Copy link
Contributor Author

mwaa commented Oct 27, 2020

Does not use current childchain start script

  1. Clone latest ethermint git clone [email protected]:ChainSafe/ethermint.git
  2. Run /.init.sh
  3. On new console listen on web socket port. ethermintcli rest-server --laddr "tcp://localhost:8545" --wsport 8546 --unlock-key mykey --chain-id ethermint-1 --trace
  4. On relayer folder install packages using yarn
  5. Deploy contract using npm run deploy. Copy address to config file
  6. Use npm run start to start the service
  7. Add console.log on _collectUnLock on the evm.ts file to confirm receipt object is received
  8. Use npm run dummy:unlock to trigger 3 dummy burn events
  9. Confirm receipt objects are logged on console

@johannbarbie
Copy link
Member

i've executed all steps as described above. I see the script producing transactions:

johba$ npx ts-node src/utils/transaction.ts 
We have transaction 0xe7476ce751935ebabddd9f73b2ae99033c781b34730820adfeb88b8c67bd6401
We have transaction 0x3ed39d55eae12d118878f1e9f2197f72a08a95d87c57026ffbbd5a255c4d6176
We have transaction 0xc46b1f9ee904314fab02def7f19b12c2ba7a1075e22eb92a7ab768779b87267d

but console.log is never triggered:

$ npx ts-node start.ts
DB has been connected...
No matching redis queue found. Creating a new one.
Queue successfully created...
Listening on childchain...
Blocks to process are 27
Listening on childchain...
Blocks to process are 10
Listening on childchain...

@johannbarbie
Copy link
Member

getting negative block numbers suddenly. stopped everything and did a redeployment, still same.

a1708-4:relayer johba$ yarn start
yarn run v1.22.10
warning package.json: No license field
$ npx ts-node start.ts
DB has been connected...
Listening on childchain...
Blocks to process are -92
Listening on childchain...
Blocks to process are -84
Listening on childchain...
Blocks to process are -76
Listening on childchain...
Blocks to process are -68
Listening on childchain...
Blocks to process are -60
Listening on childchain...
Blocks to process are -52

@mwaa
Copy link
Contributor Author

mwaa commented Oct 29, 2020

Negative block numbers is because we don't reset the redis db when service stops
So if it recorded up to height 400 and you start a new network blocks to process will be negative

Forked out the bug since its taking long #59

Copy link
Member

@johannbarbie johannbarbie left a comment

Choose a reason for hiding this comment

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

code looks good. events forked out and need to be solved.

@mwaa mwaa merged commit 2c005ac into master Oct 29, 2020
@mwaa mwaa deleted the feat/relay-service branch October 31, 2020 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CKB relayer service Childchain relayer service
3 participants